File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,12 +161,19 @@ export class LabService {
161161 throw new Error ( "Invalid lab ID" ) ;
162162 if ( ! projectId || isNaN ( Number ( projectId ) ) || Number ( projectId ) <= 0 )
163163 throw new Error ( "Invalid project ID" ) ;
164- // You may want to validate implementationData here
164+
165+ // Convert date-only string (YYYY-MM-DD) to a Date object for Prisma DateTime fields
166+ const sanitizedData = { ...implementationData } ;
167+ if ( sanitizedData . start_at && typeof sanitizedData . start_at === "string" ) {
168+ const parsed = new Date ( sanitizedData . start_at ) ;
169+ if ( isNaN ( parsed . getTime ( ) ) ) throw new Error ( "Invalid start_at date" ) ;
170+ sanitizedData . start_at = parsed ;
171+ }
165172
166173 return await this . labRepository . upsertProjectImplementation (
167174 labId ,
168175 projectId ,
169- implementationData
176+ sanitizedData
170177 ) ;
171178 } catch ( error ) {
172179 console . error ( "Error in upsertLabProjectImplementation service:" , error ) ;
You can’t perform that action at this time.
0 commit comments