user.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. const { User } = require('../models/user.model');
  2. const express = require('express');
  3. const router = express.Router();
  4. const authorize = require('../middleware/authorize');
  5. const Role = require('../lib/role')
  6. const UserController = require('../controllers/user');
  7. const GainController = require('../controllers/gain');
  8. const { LimitRequests } = require ('../middleware/limit-requests')
  9. //get all users
  10. router.get("/", authorize([Role.Employee,Role.Admin]), UserController.getAllUsers);
  11. //get user by id
  12. //router.get('/:id', UserController.getUserById);
  13. router.get('/:id', authorize([Role.Client,Role.Employee,Role.Admin]), UserController.getUserById);
  14. //delete user by id
  15. router.delete('/:id', authorize([Role.Employee,Role.Admin]) ,UserController.deleteUserById);
  16. //patch by id
  17. //router.patch('/:id', UserController.patchUserById)
  18. router.patch('/:id', authorize([Role.Client,Role.Employee,Role.Admin]), UserController.patchUserById)
  19. //post code gain
  20. router.post('/gain', authorize(Role.Client), GainController.gain);
  21. //router.post('/gain', GainController.gain);
  22. module.exports = router;
  23. // <div class="container navtop">
  24. // <h2 class="text-center titre font-weight-bold"><b> Tour du véhicule</b></h2>
  25. // <div class=" row justify-content-center mt-3 ">
  26. // <div class="col-10 col-md-6">
  27. // <img [src]="img" class="img-fluid" alt="clem">
  28. // </div>
  29. // </div>
  30. // <div class=" row justify-content-center mt-3 ">
  31. // <h3 class="col-7 col-md-4 text-center txt font-weight-bold" style="color: red;">
  32. // Veuillez sélectionner les éléments accidentés :</h3>
  33. // </div>
  34. // <!-- zone 1 -->
  35. // <ul>
  36. // <h3 class="titre font-weight-bold zone"><b>ZONE 1</b></h3>
  37. // <li *ngFor="let item of zone1">
  38. // <mat-checkbox [(ngModel)]="item.checked">
  39. // {{item.name}}
  40. // </mat-checkbox>
  41. // </li>
  42. // </ul>
  43. // <!-- zone 2 -->
  44. // <ul>
  45. // <h3 class="titre font-weight-bold zone"><b>ZONE 2</b></h3>
  46. // <li *ngFor="let item of zone2">
  47. // <mat-checkbox [(ngModel)]="item.checked">
  48. // {{item.name}}
  49. // </mat-checkbox>
  50. // </li>
  51. // </ul>
  52. // <!-- zone 3 -->
  53. // <ul>
  54. // <h3 class="titre font-weight-bold zone"><b>ZONE 3</b></h3>
  55. // <li *ngFor="let item of zone3">
  56. // <mat-checkbox [(ngModel)]="item.checked">
  57. // {{item.name}}
  58. // </mat-checkbox>
  59. // </li>
  60. // </ul>
  61. // <!-- zone 4 -->
  62. // <ul>
  63. // <h3 class="titre font-weight-bold zone"><b>ZONE 4</b></h3>
  64. // <li *ngFor="let item of zone4">
  65. // <mat-checkbox [(ngModel)]="item.checked">
  66. // {{item.name}}
  67. // </mat-checkbox>
  68. // </li>
  69. // </ul>
  70. // <!-- zone 5 -->
  71. // <ul>
  72. // <h3 class="titre font-weight-bold zone"><b>ZONE 5</b></h3>
  73. // <li *ngFor="let item of zone5">
  74. // <mat-checkbox [(ngModel)]="item.checked">
  75. // {{item.name}}
  76. // </mat-checkbox>
  77. // </li>
  78. // </ul>
  79. // <!-- zone 6 -->
  80. // <ul>
  81. // <h3 class="titre font-weight-bold zone"><b>ZONE 6</b></h3>
  82. // <li *ngFor="let item of zone6">
  83. // <mat-checkbox [(ngModel)]="item.checked">
  84. // {{item.name}}
  85. // </mat-checkbox>
  86. // </li>
  87. // </ul>
  88. // <!-- zone 7 -->
  89. // <ul>
  90. // <h3 class="titre font-weight-bold zone"><b>ZONE 7</b></h3>
  91. // <li *ngFor="let item of zone7">
  92. // <mat-checkbox [(ngModel)]="item.checked">
  93. // {{item.name}}
  94. // </mat-checkbox>
  95. // </li>
  96. // </ul>
  97. // <!-- zone 8 -->
  98. // <ul>
  99. // <h3 class="titre font-weight-bold zone"><b>ZONE 8</b></h3>
  100. // <li *ngFor="let item of zone8">
  101. // <mat-checkbox [(ngModel)]="item.checked">
  102. // {{item.name}}
  103. // </mat-checkbox>
  104. // </li>
  105. // </ul>
  106. // <div class=" row justify-content-center mt-3 mb-5">
  107. // <button class="col-8 col-md-4" mat-raised-button color="primary" (click)="sendCheck()">
  108. // <b> Valider</b></button>
  109. // </div>
  110. // </div>