@@ -16,7 +16,16 @@ export default class ChangeRequestsController {
1616
1717 static async getAllChangeRequests ( req : Request , res : Response , next : NextFunction ) {
1818 try {
19- const changeRequests = await ChangeRequestsService . getAllChangeRequests ( req . organization ) ;
19+ const changeRequests = await ChangeRequestsService . getAllChangeRequests ( req . organization , req . currentCar ?. carId ) ;
20+ res . status ( 200 ) . json ( changeRequests ) ;
21+ } catch ( error : unknown ) {
22+ next ( error ) ;
23+ }
24+ }
25+
26+ static async getAllGuestChangeRequests ( req : Request , res : Response , next : NextFunction ) {
27+ try {
28+ const changeRequests = await ChangeRequestsService . getAllGuestChangeRequests ( req . organization ) ;
2029 res . status ( 200 ) . json ( changeRequests ) ;
2130 } catch ( error : unknown ) {
2231 next ( error ) ;
@@ -25,7 +34,11 @@ export default class ChangeRequestsController {
2534
2635 static async getToReviewChangeRequests ( req : Request , res : Response , next : NextFunction ) {
2736 try {
28- const changeRequests = await ChangeRequestsService . getToReviewChangeRequests ( req . currentUser , req . organization ) ;
37+ const changeRequests = await ChangeRequestsService . getToReviewChangeRequests (
38+ req . currentUser ,
39+ req . organization ,
40+ req . currentCar ?. carId
41+ ) ;
2942 res . status ( 200 ) . json ( changeRequests ) ;
3043 } catch ( error : unknown ) {
3144 next ( error ) ;
@@ -41,7 +54,8 @@ export default class ChangeRequestsController {
4154 const changeRequests = await ChangeRequestsService . getUnreviewedChangeRequests (
4255 req . currentUser ,
4356 validatedWbs ,
44- req . organization
57+ req . organization ,
58+ req . currentCar ?. carId
4559 ) ;
4660 res . status ( 200 ) . json ( changeRequests ) ;
4761 } catch ( error : unknown ) {
@@ -58,7 +72,8 @@ export default class ChangeRequestsController {
5872 const changeRequests = await ChangeRequestsService . getApprovedChangeRequests (
5973 req . currentUser ,
6074 validatedWbs ,
61- req . organization
75+ req . organization ,
76+ req . currentCar ?. carId
6277 ) ;
6378 res . status ( 200 ) . json ( changeRequests ) ;
6479 } catch ( error : unknown ) {
0 commit comments