@@ -29,7 +29,7 @@ export class AssignmentController implements IAssignmentController {
2929 const status = req . query . status as string ;
3030
3131 if ( ! userId ) {
32- throw new AppError ( ErrorMessages . UNAUTHORIZED , HttpStatusCode . UNAUTH0RIZED ) ;
32+ throw new AppError ( ErrorMessages . UNAUTHORIZED , HttpStatusCode . UNAUTHORIZED ) ;
3333 }
3434
3535 const provider = await this . _serviceProviderService . getProviderByUserId ( userId ) ;
@@ -55,7 +55,7 @@ export class AssignmentController implements IAssignmentController {
5555 const freelancerId = assignment ?. freelancerId ?. _id ? assignment . freelancerId . _id . toString ( ) : assignment ?. freelancerId ?. toString ( ) ;
5656
5757 if ( ! assignment || ! provider || freelancerId !== provider . _id . toString ( ) ) {
58- throw new AppError ( ErrorMessages . ASSIGNMENT_NOT_FOUND , HttpStatusCode . UNAUTH0RIZED ) ;
58+ throw new AppError ( ErrorMessages . ASSIGNMENT_NOT_FOUND , HttpStatusCode . UNAUTHORIZED ) ;
5959 }
6060
6161 const jobId = assignment . jobId ?. _id ? assignment . jobId . _id . toString ( ) : assignment . jobId . toString ( ) ;
@@ -141,7 +141,7 @@ export class AssignmentController implements IAssignmentController {
141141
142142 const updated = await this . _assignmentService . cancelByProvider ( id , provider . _id . toString ( ) , notes ) ;
143143
144- ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , 'Assignment cancelled successfully by provider' ) ;
144+ ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , SuccessMessages . ASSIGNMENT_CANCELLED_PROVIDER ) ;
145145 } catch ( error ) {
146146 next ( error ) ;
147147 }
@@ -155,7 +155,7 @@ export class AssignmentController implements IAssignmentController {
155155
156156 const updated = await this . _assignmentService . cancelByClient ( id , userId as string , notes ) ;
157157
158- ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , 'Assignment cancelled successfully by client' ) ;
158+ ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , SuccessMessages . ASSIGNMENT_CANCELLED_CLIENT ) ;
159159 } catch ( error ) {
160160 next ( error ) ;
161161 }
@@ -168,7 +168,7 @@ export class AssignmentController implements IAssignmentController {
168168 const { notes, evidence } = req . body ;
169169 const updated = await this . _assignmentService . reportAbsence ( id , userId as string , notes , evidence ) ;
170170
171- ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , 'Absence reported successfully' ) ;
171+ ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , SuccessMessages . ABSENCE_REPORTED ) ;
172172 } catch ( error ) {
173173 next ( error ) ;
174174 }
@@ -179,7 +179,7 @@ export class AssignmentController implements IAssignmentController {
179179 const userId = req . user ?. userId ;
180180 const id = req . params . id as string ;
181181 const updated = await this . _assignmentService . markAsPaidByCash ( id , userId as string ) ;
182- ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , 'Payment marked as paid by cash' ) ;
182+ ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , SuccessMessages . PAYMENT_MARKED_CASH ) ;
183183 } catch ( error ) {
184184 next ( error ) ;
185185 }
@@ -193,7 +193,7 @@ export class AssignmentController implements IAssignmentController {
193193 if ( ! provider ) throw new AppError ( 'Provider not found' , HttpStatusCode . NOT_FOUND ) ;
194194
195195 const updated = await this . _assignmentService . confirmPayment ( id , provider . _id . toString ( ) ) ;
196- ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , 'Payment confirmed' ) ;
196+ ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , SuccessMessages . PAYMENT_CONFIRMED ) ;
197197 } catch ( error ) {
198198 next ( error ) ;
199199 }
@@ -208,7 +208,7 @@ export class AssignmentController implements IAssignmentController {
208208 if ( ! provider ) throw new AppError ( 'Provider not found' , HttpStatusCode . NOT_FOUND ) ;
209209
210210 const updated = await this . _assignmentService . providerMarkAsPaid ( id , provider . _id . toString ( ) ) ;
211- ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , 'Payment marked as received by hand' ) ;
211+ ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , SuccessMessages . PAYMENT_MARKED_RECEIVED_HAND ) ;
212212 } catch ( error ) {
213213 next ( error ) ;
214214 }
@@ -222,7 +222,7 @@ export class AssignmentController implements IAssignmentController {
222222 if ( ! provider ) throw new AppError ( 'Provider not found' , HttpStatusCode . NOT_FOUND ) ;
223223
224224 const updated = await this . _assignmentService . rejectPayment ( id , provider . _id . toString ( ) ) ;
225- ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , 'Payment confirmation rejected' ) ;
225+ ApiResponse . sendSuccess ( res , await mapAssignmentToResponseDTO ( updated ) , SuccessMessages . PAYMENT_CONFIRMATION_REJECTED ) ;
226226 } catch ( error ) {
227227 next ( error ) ;
228228 }
0 commit comments