file_name
stringlengths
5
37
file_path
stringlengths
39
125
language
stringclasses
7 values
code
stringlengths
23
474k
email.js
VehicleExchange (vahan_trade)\pages\api\verify\email.js
javascript
import { sendWelcomeEmail } from "@/utils/send_welcome_email"; import { sendVerifyEmail } from "@/utils/verify_email_send"; import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); export default async function handler(req, res) { const { method, query, body } = req; if (method === 'PO...
index.js
VehicleExchange (vahan_trade)\pages\api\verify-purchase\index.js
javascript
const Razorpay = require("razorpay"); const crypto = require("crypto"); import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); const razorpay = new Razorpay({ key_id: process.env.RAZORPAY_KEY, key_secret: process.env.RAZORPAY_SECRET, }); async function verifyPayment(req, res) { if (req...
index.js
VehicleExchange (vahan_trade)\pages\api\verify-purchase-addon\index.js
javascript
const Razorpay = require("razorpay"); const crypto = require("crypto"); import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); const razorpay = new Razorpay({ key_id: process.env.RAZORPAY_KEY, key_secret: process.env.RAZORPAY_SECRET, }); async function verifyPayment(req, res) { if (r...
index.js
VehicleExchange (vahan_trade)\pages\api\videoListing\index.js
javascript
import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); export default async function handler(req, res) { try { switch (req.method) { case "GET": if (req.query.id) { return await getVideoById(req, res); } else if (req.query.userId && req.query.planId) { ...
approvedlistings.jsx
VehicleExchange (vahan_trade)\pages\backoffice\approvedlistings.jsx
jsx
import React, { useEffect, useState } from "react"; import Sidebar from "@/components/admin/Sidebar"; import {default as BackSidebar} from "@/components/backoffice/Sidebar" import { getRequest, postRequest } from "@/utils/api_call"; import { ToastContainer, toast } from "react-toastify"; import { useRouter } from "next...
deletedlistings.jsx
VehicleExchange (vahan_trade)\pages\backoffice\deletedlistings.jsx
jsx
import React, { useEffect, useState } from "react"; import Sidebar from "@/components/admin/Sidebar"; import { default as BackSidebar } from "@/components/backoffice/Sidebar"; import { getRequest, postRequest } from "@/utils/api_call"; import { ToastContainer, toast } from "react-toastify"; import { useRouter } from "n...
unapprovedlistings.jsx
VehicleExchange (vahan_trade)\pages\backoffice\unapprovedlistings.jsx
jsx
import React, { useEffect, useState } from "react"; import Sidebar from "@/components/admin/Sidebar"; import {default as BackSidebar} from "@/components/backoffice/Sidebar" import { getRequest, postRequest } from "@/utils/api_call"; import { ToastContainer, toast } from "react-toastify"; import { useRouter } from "next...
index.jsx
VehicleExchange (vahan_trade)\pages\choosevahantrade\index.jsx
jsx
import React from 'react' import BuyVehicleInSteps from '../../components/home/BuyVehicleInSteps' import Testimonials from '../../components/home/Testimonials' import WeBelieveInNumber from '../../components/home/WeBelieveInNumber' function Page() { return ( <> <BuyVehicleInSteps /> <Testimonials /> ...
[id].jsx
VehicleExchange (vahan_trade)\pages\edit-listing\[id].jsx
jsx
import Footer from "@/components/Footer"; import Navbar from "@/components/Navbar/Navbar"; import { getRequest, postRequest } from "@/utils/api_call"; import { Select } from "@mui/material"; import { Field, Form, Formik } from "formik"; import { useParams } from "next/navigation"; import { useRouter } from "next/router...
[id].jsx
VehicleExchange (vahan_trade)\pages\edit-listing\images\[id].jsx
jsx
import { uploadIcon } from "@/assets/icons"; import Footer from "@/components/Footer"; import Navbar from "@/components/Navbar/Navbar"; import { getRequest, postRequest } from "@/utils/api_call"; import { uploadToS3 } from "@/utils/uploadToS3"; import { Backdrop, CircularProgress } from "@mui/material"; import Image fr...
index.jsx
VehicleExchange (vahan_trade)\pages\filter\index.jsx
jsx
/* eslint-disable @next/next/no-img-element */ import React, { useEffect, useRef } from "react"; import Navbar from "@/components/Navbar/Navbar"; import { arrowDownBoldIcon, arrowDownIcon, locationIcon, meterIcon, searchIcon, } from "@/assets/icons"; import Image from "next/image"; import { useState } from "r...
[id].jsx
VehicleExchange (vahan_trade)\pages\listing-details\[id].jsx
jsx
"use client"; import { useEffect, useMemo, useState } from "react"; import Navbar from "@/components/Navbar/Navbar"; import { useParams } from "next/navigation"; import { getRequest, postRequest } from "@/utils/api_call"; import { FaAngleLeft, FaAngleRight, FaRegCircleCheck, FaLocationDot, } from "react-icons/f...
index.jsx
VehicleExchange (vahan_trade)\pages\messenger\index.jsx
jsx
import React, { useEffect, useMemo, useState } from "react"; import Navbar from "@/components/Navbar/Navbar"; import SideBar from "@/components/SideBar"; import { getRequest, postRequest } from "@/utils/api_call"; import { handleElipseText } from "@/utils/handleElipseText"; import DetailsWithChatBox from "@/components/...
[id].jsx
VehicleExchange (vahan_trade)\pages\seller-listing\[id].jsx
jsx
import { locationIcon, meterIcon } from "@/assets/icons"; import { myListingImage } from "@/assets/images/mylisting"; import { successfullImage } from "@/assets/images/successfullposting"; import Footer from "@/components/Footer"; import Navbar from "@/components/Navbar/Navbar"; import SideBar from "@/components/SideBa...
index.jsx
VehicleExchange (vahan_trade)\pages\subscription\index.jsx
jsx
import React, { useState, useEffect } from "react"; import Navbar from "@/components/Navbar/Navbar"; import Footer from "@/components/Footer"; import MakePaymentComponent from "@/components/Subscription/MakePaymentComponent"; import SideBar from "@/components/SideBar"; import { getRequest } from "@/utils/api_call"; imp...
index.jsx
VehicleExchange (vahan_trade)\pages\testimonial\index.jsx
jsx
import React from "react"; export default function index() { // Function to generate star ratings const generateStars = () => { const stars = []; for (let i = 0; i < 5; i++) { stars.push( <span key={i} className="text-yellow-500"> &#9733; </span> ); } return s...
migration.sql
VehicleExchange (vahan_trade)\prisma\migrations\20240226131613_first_migration\migration.sql
sql
-- CreateTable CREATE TABLE `User` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `full_name` VARCHAR(191) NULL, `email` VARCHAR(191) NOT NULL, `phone_number` VARCHAR(191) NOT NULL, `password` VARCHAR(191) NOT NULL, `email_otp` VARCHAR(191) NULL, `email_verified` BOOLEAN NOT NULL DEFAULT false, ...
migration.sql
VehicleExchange (vahan_trade)\prisma\migrations\20240227072338_user_plan_change\migration.sql
sql
/* Warnings: - The values [basic,pro,premium] on the enum `Subscription_type` will be removed. If these variants are still used in the database, this will fail. - The values [basic,pro,premium] on the enum `Subscription_type` will be removed. If these variants are still used in the database, this will fail. */ ...
migration.sql
VehicleExchange (vahan_trade)\prisma\migrations\20240227073353_validity_text_change\migration.sql
sql
/* Warnings: - The values [three_month] on the enum `Subscription_validity` will be removed. If these variants are still used in the database, this will fail. */ -- DropIndex DROP INDEX `ChatMessage_listingId_fkey` ON `chatmessage`; -- DropIndex DROP INDEX `ChatMessage_receiverId_fkey` ON `chatmessage`; -- Drop...
firebase-messaging-sw.js
VehicleExchange (vahan_trade)\public\firebase-messaging-sw.js
javascript
importScripts('https://www.gstatic.com/firebasejs/10.5.2/firebase-app-compat.js') importScripts('https://www.gstatic.com/firebasejs/10.5.2/firebase-messaging-compat.js') const firebaseConfig = { apiKey: "AIzaSyCgMBOg_QRBBHyBvjYK80L8SdjKhQD-nt8", authDomain: "vahantrade-f70c1.firebaseapp.com", projectId: "vahan...
assetlinks.json
VehicleExchange (vahan_trade)\public\.well-known\assetlinks.json
json
[{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "com.vahantrade_app", "sha256_cert_fingerprints": [ "A5:96:AB:33:54:F8:5B:C4:F4:B6:2E:C9:6B:1A:AC:88:87:C2:32:78:FE:6C:A2:F6:0E:B0:0E:18:D6:CA:0A:F2" ] } }...
globals.css
VehicleExchange (vahan_trade)\styles\globals.css
css
/* @import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap'); */ @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap'); @tailwind base; @tailwind components; @tailwind utilities; ...
api_call.js
VehicleExchange (vahan_trade)\utils\api_call.js
javascript
import { API_URL } from "@/constants/constant"; // export const getRequest = async (url) => { // try { // console.log(`${API_URL}${url}`); // const response = await fetch(`${API_URL}${url}`, { // headers: { // 'content-type': 'application/json', // }, // }).catch((err) ...
firebase.js
VehicleExchange (vahan_trade)\utils\firebase.js
javascript
import * as admin from 'firebase-admin'; import { readFileSync } from 'fs'; const serviceAccount = JSON.parse(readFileSync('./vahantrade-app_serviceAccountKey.json')); if (!admin.apps.length) { admin.initializeApp({ credential: admin.credential.cert(serviceAccount), }); } const messaging = admin....
firebaseWeb.js
VehicleExchange (vahan_trade)\utils\firebaseWeb.js
javascript
// firebase.js import { initializeApp } from "firebase/app"; import { getMessaging, getToken, onMessage } from "firebase/messaging"; const firebaseConfig = { apiKey: "AIzaSyCgMBOg_QRBBHyBvjYK80L8SdjKhQD-nt8", authDomain: "vahantrade-f70c1.firebaseapp.com", projectId: "vahantrade-f70c1", storageBucket:...
forgot_email_send.js
VehicleExchange (vahan_trade)\utils\forgot_email_send.js
javascript
import axios from "axios"; function generateOTP() { return Math.floor(1000 + Math.random() * 9000).toString(); } async function sendForgotPassEmail(email) { const apiKey = process.env.SMTP_KEY; // Replace 'YOUR_API_KEY' with your actual API key console.log("🚀 ~ sendWelcomeEmail ~ apiKey:", apiKey); const url...
getListings.js
VehicleExchange (vahan_trade)\utils\getListings.js
javascript
const { getRequest } = require("./api_call"); async function getVehicles() { console.log("🚀 ~ getListingsData") try { const res = await getRequest(`/api/listing?action=getAllListings&status=all`, false); console.log(res) if (!res) { throw new Error(`API call failed with...
getUserData.js
VehicleExchange (vahan_trade)\utils\getUserData.js
javascript
export function getUserData() { const user = JSON.parse(localStorage.getItem('userData')); if (user) { return user; } else { return '' } }
handleElipseText.js
VehicleExchange (vahan_trade)\utils\handleElipseText.js
javascript
export const handleElipseText = (text, length) => { try { if(text){ if (text.length > length) { return text.substr(0, length) + ' ...' } else { return text } } } catch (err) { console.log('handleElipseText_err-----------', err); } ...
jwt.js
VehicleExchange (vahan_trade)\utils\jwt.js
javascript
const jwt = require('jsonwebtoken'); const secretKey = process.env.JWT_SECRET; // You should store this in an environment variable console.log("secretKey=================",secretKey); function generateToken(user) { // return jwt.sign({ userId: user.id, email: user.email }, secretKey, { expiresIn: '1h' }); retu...
middleware.js
VehicleExchange (vahan_trade)\utils\middleware.js
javascript
import jwt from 'jsonwebtoken'; const authenticateToken = (req, res, next) => { const authHeader = req.headers['authorization']; const token = authHeader && authHeader.split(' ')[1]; // console.log("token2-------------",token); // console.log("token2-------------",process.env.JWT_SECRET); if (!token) { ...
sendPushNotification.js
VehicleExchange (vahan_trade)\utils\sendPushNotification.js
javascript
import { messaging } from "./firebase"; export async function sendPushNotification(notificationData) { console.log("sendPushNotificationnnnnnnn----------------",notificationData); // Build the message const message = { notification: { title: notificationData.title, body: n...
send_welcome_email.js
VehicleExchange (vahan_trade)\utils\send_welcome_email.js
javascript
import axios from 'axios'; function generateOTP() { // Generate a random 4-digit OTP return Math.floor(1000 + Math.random() * 9000).toString(); } async function sendWelcomeEmail(email) { const apiKey = process.env.SMTP_KEY; // Replace 'YOUR_API_KEY' with your actual API key console.log("🚀 ~ sendWelc...
socket.js
VehicleExchange (vahan_trade)\utils\socket.js
javascript
import { io } from "socket.io-client"; let socket; export const getSocket = () => { if (!socket) { socket = io("https://orca-app-4wcpj.ondigitalocean.app", { transports: ["websocket", 'polling'] }); } return socket; };
uploadToS3.js
VehicleExchange (vahan_trade)\utils\uploadToS3.js
javascript
import { SPACES_ACCESS_KEY, SPACES_SECRET_KEY } from '@/constants/constant'; import { S3 } from 'aws-sdk'; // import fs from "fs"; import imageCompression from 'browser-image-compression'; const spacesEndpoint = new S3({ endpoint: 'blr1.digitaloceanspaces.com', region: 'blr1', credentials: { acce...
verify_email_send.js
VehicleExchange (vahan_trade)\utils\verify_email_send.js
javascript
import nodemailer from 'nodemailer' const transporter = nodemailer.createTransport({ service: 'Gmail', auth: { user: 'fellon0312@gmail.com', pass: 'iphe klru otor hqaq' }, }); function generateOTP() { // Generate a random 4-digit OTP return Math.floor(1000 + Math.random() * 9000)....
withMiddleware.js
VehicleExchange (vahan_trade)\utils\withMiddleware.js
javascript
import authenticateToken from './middleware'; const withMiddleware = (handler) => { return async (req, res) => { if (req.method === 'POST' || req.method === 'PUT') { await new Promise((resolve, reject) => { authenticateToken(req, res, (result) => { if (result instanceof Error) { ...