feat: routes for auth, rent and catalog

#10
This commit is contained in:
Mathis H (Avnyr) 2024-04-23 11:17:38 +02:00
parent 7fb8c37cea
commit df9efc759c
Signed by: Mathis
GPG Key ID: DD9E0666A747D126
4 changed files with 100 additions and 0 deletions

31
src/routes/auth/router.ts Normal file
View File

@ -0,0 +1,31 @@
import express, {type Router} from "express";
import JwtGuard from "@validators/JwtGuard";
const router: Router = express.Router();
router.route('/login')
router.route('/register')
// PATCH
router.route('/me').patch(JwtGuard)
// GET
router.route('/me').get(JwtGuard)
// DELETE
router.route('/me').delete(JwtGuard)
// GET
router.route('/all').get(JwtGuard)
// GET
router.route('/user/:targetId').get(JwtGuard)
// PATCH
router.route('/user/:targetId').patch(JwtGuard)
export default router

View File

@ -0,0 +1,37 @@
import express, {type Router} from "express";
const router: Router = express.Router();
//-- MODELS >>
router.route('/model/new').get()
router.route('/model/all').get()
router.route('/model/:modelSlug')
.get()
.patch()
.delete()
//-- CATEGORY >>
router.route('/category/new').get()
router.route('/category/all').get()
router.route('/category/:categorySlug')
.get()
.patch()
.delete()
//-- BRAND >>
router.route('/brand/new').post()
router.route('/brand/all').get()
router.route('/brand/:brandSlug')
.get()
.patch()
.delete()

3
src/routes/index.ts Normal file
View File

@ -0,0 +1,3 @@
export * from './auth/router'
export * from './catalog/router'
export * from './rent'

29
src/routes/rent/router.ts Normal file
View File

@ -0,0 +1,29 @@
import express, {type Router} from "express";
import JwtGuard from "@validators/JwtGuard";
const router: Router = express.Router();
// Get rent affected to the user
router.route('/affected').get(JwtGuard)
// Get all vehicle in rent (admin only)
router.route('/affected/all').get(JwtGuard)
// Add a new vehicle (admin only)
router.route('/veh/new').post(JwtGuard)
// Get all vehicles
router.route('/veh/all').get()
// Rent a specific vehicle
router.route('/veh/rent/:vehicleId').post(JwtGuard)
// Endpoint to get the data of a vehicle, data change if source is an admin
router.route('/veh/:vehicleId').get(JwtGuard)
// Endpoint to edit the data of a vehicle if source is an admin
router.route('/veh/:vehicleId').patch(JwtGuard)
// Endpoint to delete a vehicle if source is an admin
router.route('/veh/:vehicleId').delete(JwtGuard)