@@ -18,7 +18,7 @@ export class InteractionController implements InteractionControllerType {
1818 ) { }
1919
2020 async getInteractions ( req : Request , res : Response , next : NextFunction ) : Promise < void > {
21- const trainee = await this . traineesRepository . getTrainee ( req . params . id ) ;
21+ const trainee = await this . traineesRepository . getTrainee ( String ( req . params . id ) ) ;
2222 if ( ! trainee ) {
2323 res . status ( 404 ) . send ( new ResponseError ( 'Trainee not found' ) ) ;
2424 return ;
@@ -33,7 +33,7 @@ export class InteractionController implements InteractionControllerType {
3333 }
3434
3535 async addInteraction ( req : Request , res : Response , next : NextFunction ) : Promise < void > {
36- const trainee = await this . traineesRepository . getTrainee ( req . params . id ) ;
36+ const trainee = await this . traineesRepository . getTrainee ( String ( req . params . id ) ) ;
3737 if ( ! trainee ) {
3838 res . status ( 404 ) . send ( new ResponseError ( 'Trainee not found' ) ) ;
3939 return ;
@@ -57,7 +57,7 @@ export class InteractionController implements InteractionControllerType {
5757 }
5858
5959 try {
60- const interaction = await this . traineesRepository . addInteraction ( req . params . id , newInteraction ) ;
60+ const interaction = await this . traineesRepository . addInteraction ( String ( req . params . id ) , newInteraction ) ;
6161 res . status ( 201 ) . json ( interaction ) ;
6262 this . notificationService . interactionCreated ( trainee , interaction ) ;
6363 } catch ( error : any ) {
@@ -66,21 +66,21 @@ export class InteractionController implements InteractionControllerType {
6666 }
6767
6868 async updateInteraction ( req : Request , res : Response , next : NextFunction ) : Promise < void > {
69- const trainee = await this . traineesRepository . getTrainee ( req . params . id ) ;
69+ const trainee = await this . traineesRepository . getTrainee ( String ( req . params . id ) ) ;
7070 if ( ! trainee ) {
7171 res . status ( 404 ) . send ( new ResponseError ( 'Trainee not found' ) ) ;
7272 return ;
7373 }
7474
75- const interaction = trainee . interactions . find ( ( interaction ) => interaction . id === req . params . interactionID ) ;
75+ const interaction = trainee . interactions . find ( ( interaction ) => interaction . id === String ( req . params . interactionID ) ) ;
7676 if ( ! interaction ) {
7777 res . status ( 404 ) . send ( new ResponseError ( 'Interaction not found' ) ) ;
7878 return ;
7979 }
8080
8181 const user = res . locals . user as AuthenticatedUser ;
8282 const interactionToUpdate : InteractionWithReporterID = {
83- id : req . params . interactionID ,
83+ id : String ( req . params . interactionID ) ,
8484 date : req . body . date ,
8585 type : req . body . type ,
8686 title : req . body . title ,
@@ -97,7 +97,10 @@ export class InteractionController implements InteractionControllerType {
9797 }
9898
9999 try {
100- const updatedInteraction = await this . traineesRepository . updateInteraction ( req . params . id , interactionToUpdate ) ;
100+ const updatedInteraction = await this . traineesRepository . updateInteraction (
101+ String ( req . params . id ) ,
102+ interactionToUpdate
103+ ) ;
101104 res . status ( 200 ) . json ( updatedInteraction ) ;
102105 } catch ( error : any ) {
103106 console . error ( error ) ;
@@ -107,19 +110,19 @@ export class InteractionController implements InteractionControllerType {
107110 }
108111
109112 async deleteInteraction ( req : Request , res : Response , next : NextFunction ) : Promise < void > {
110- const trainee = await this . traineesRepository . getTrainee ( req . params . id ) ;
113+ const trainee = await this . traineesRepository . getTrainee ( String ( req . params . id ) ) ;
111114 if ( ! trainee ) {
112115 res . status ( 404 ) . send ( new ResponseError ( 'Trainee not found' ) ) ;
113116 return ;
114117 }
115118
116- if ( ! trainee . interactions . find ( ( interaction ) => interaction . id === req . params . interactionID ) ) {
119+ if ( ! trainee . interactions . find ( ( interaction ) => interaction . id === String ( req . params . interactionID ) ) ) {
117120 res . status ( 404 ) . send ( new ResponseError ( 'Interaction not found' ) ) ;
118121 return ;
119122 }
120123
121124 try {
122- await this . traineesRepository . deleteInteraction ( req . params . id , req . params . interactionID ) ;
125+ await this . traineesRepository . deleteInteraction ( String ( req . params . id ) , String ( req . params . interactionID ) ) ;
123126 res . status ( 204 ) . end ( ) ;
124127 } catch ( error : any ) {
125128 next ( error ) ;
0 commit comments