parent
7fb8c37cea
commit
df9efc759c
31
src/routes/auth/router.ts
Normal file
31
src/routes/auth/router.ts
Normal 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
|
37
src/routes/catalog/router.ts
Normal file
37
src/routes/catalog/router.ts
Normal 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
3
src/routes/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './auth/router'
|
||||
export * from './catalog/router'
|
||||
export * from './rent'
|
29
src/routes/rent/router.ts
Normal file
29
src/routes/rent/router.ts
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user