remove second middle ware
This commit is contained in:
parent
574905f9f8
commit
62fbfb97b2
11 changed files with 12 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
|||
import { Request, Response } from 'express';
|
||||
import { Cart, ICart } from '../models/cartModel';
|
||||
import { Product } from '../models/productModel';
|
||||
import { Order } from '../models/orderModel';
|
||||
import { Cart, ICart } from '../schemas/cartModel';
|
||||
import { Product } from '../schemas/productModel';
|
||||
import { Order } from '../schemas/orderModel';
|
||||
import { sendEmailasync } from '../services/sendGrid';
|
||||
import { config } from 'dotenv';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Request, Response } from 'express';
|
||||
import { Product, IProduct } from '../models/productModel';
|
||||
import { Product, IProduct } from '../schemas/productModel';
|
||||
|
||||
export async function createProduct(req: Request, res: Response) {
|
||||
try {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Request, Response } from 'express';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { User, IUser } from '../models/userModel';
|
||||
import { User, IUser } from '../schemas/userModel';
|
||||
import { clearJwtCookie, setJwtCookie } from '../middlewares/checkAuth';
|
||||
import validate from 'deep-email-validator';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import cookieParser from 'cookie-parser';
|
|||
|
||||
import userRouter from './routes/userRouter';
|
||||
import productRouter from './routes/productRouter';
|
||||
import cartRouter from './routes/cartRoute';
|
||||
import cartRouter from './routes/cartRouter';
|
||||
|
||||
const env = require('dotenv').config().parsed;
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import { checkUuid } from '../middlewares/checkUuid';
|
|||
|
||||
const cartRouter = express.Router();
|
||||
|
||||
cartRouter.post('/', [authenticateToken, checkUuid], addToCart);
|
||||
cartRouter.get('/', [authenticateToken, checkUuid], listCart);
|
||||
cartRouter.post('/', [authenticateToken], addToCart);
|
||||
cartRouter.get('/', [authenticateToken], listCart);
|
||||
|
||||
cartRouter.post('/checkout', authenticateToken, checkout);
|
||||
cartRouter.delete('/', authenticateToken, clearCart)
|
||||
|
|
|
@ -4,9 +4,9 @@ import { createUser, login, logout, getAllUsers, deleteUser } from '../controlle
|
|||
const userRouter = express.Router();
|
||||
|
||||
userRouter.post('/', createUser);
|
||||
userRouter.get('/', getAllUsers);
|
||||
userRouter.post('/login', login);
|
||||
userRouter.post('/logout', logout);
|
||||
userRouter.get('/all', getAllUsers);
|
||||
userRouter.delete('/:id', deleteUser)
|
||||
|
||||
export default userRouter;
|
|
@ -1,5 +1,3 @@
|
|||
// src/models/userModel.ts
|
||||
|
||||
import mongoose, { Schema, Document } from 'mongoose';
|
||||
|
||||
interface IUser extends Document {
|
|
@ -1,6 +1,6 @@
|
|||
import { config } from "dotenv";
|
||||
import { Order } from "../models/orderModel";
|
||||
import { User } from "../models/userModel";
|
||||
import { Order } from "../schemas/orderModel";
|
||||
import { User } from "../schemas/userModel";
|
||||
import client from '@sendgrid/mail';
|
||||
config();
|
||||
|
||||
|
|
Loading…
Reference in a new issue