@@ -90,8 +90,8 @@ export class AdminService {
9090 if ( updateSubmissionDto . approvedHours !== undefined ) {
9191 updateData . approvedHours = updateSubmissionDto . approvedHours ;
9292 }
93- if ( updateSubmissionDto . hoursJustification !== undefined ) {
94- updateData . hoursJustification = updateSubmissionDto . hoursJustification ;
93+ if ( updateSubmissionDto . userFeedback !== undefined ) {
94+ updateData . hoursJustification = updateSubmissionDto . userFeedback ;
9595 }
9696 if ( updateSubmissionDto . approvalStatus !== undefined ) {
9797 updateData . approvalStatus = updateSubmissionDto . approvalStatus ;
@@ -123,6 +123,11 @@ export class AdminService {
123123 if ( updateSubmissionDto . approvedHours !== undefined ) {
124124 projectUpdateData . approvedHours = updateSubmissionDto . approvedHours ;
125125 }
126+ // hoursJustification is now admin-only for the project (stored in the updateSubmissionDto but used for airtable)
127+ // We store it in the project table for admin reference and Airtable sync only
128+ if ( updateSubmissionDto . hoursJustification !== undefined ) {
129+ projectUpdateData . hoursJustification = updateSubmissionDto . hoursJustification ;
130+ }
126131 if ( updateSubmissionDto . approvalStatus === 'approved' ) {
127132 // When approving, update project with submission data
128133 projectUpdateData . playableUrl = submission . playableUrl ;
@@ -145,6 +150,11 @@ export class AdminService {
145150 if ( ! isResubmission ) {
146151 // First submission - create Airtable record
147152 try {
153+ // Get the project record to access the admin's hoursJustification
154+ const projectRecord = await this . prisma . project . findUnique ( {
155+ where : { projectId : submission . projectId } ,
156+ } ) ;
157+
148158 const approvedProjectData = {
149159 user : {
150160 firstName : submission . project . user . firstName ,
@@ -163,7 +173,7 @@ export class AdminService {
163173 repoUrl : submission . repoUrl || submission . project . repoUrl || '' ,
164174 screenshotUrl : submission . screenshotUrl || submission . project . screenshotUrl || '' ,
165175 approvedHours : updateSubmissionDto . approvedHours || 0 ,
166- hoursJustification : updateSubmissionDto . hoursJustification || '' ,
176+ hoursJustification : projectRecord ?. hoursJustification || updateSubmissionDto . hoursJustification || '' ,
167177 description : submission . description || submission . project . description || undefined ,
168178 } ,
169179 } ;
@@ -189,13 +199,17 @@ export class AdminService {
189199 } else {
190200 // Resubmission - update existing Airtable record
191201 try {
202+ const projectRecord = await this . prisma . project . findUnique ( {
203+ where : { projectId : submission . projectId } ,
204+ } ) ;
205+
192206 await this . airtableService . updateApprovedProject ( submission . project . airtableRecId , {
193207 playableUrl : submission . playableUrl || undefined ,
194208 repoUrl : submission . repoUrl || undefined ,
195209 screenshotUrl : submission . screenshotUrl || undefined ,
196210 description : submission . description || undefined ,
197211 approvedHours : updateSubmissionDto . approvedHours ,
198- hoursJustification : updateSubmissionDto . hoursJustification ,
212+ hoursJustification : projectRecord ?. hoursJustification || updateSubmissionDto . hoursJustification ,
199213 } ) ;
200214 } catch ( error ) {
201215 console . error ( 'Error updating Approved Projects record in Airtable:' , error ) ;
@@ -225,7 +239,7 @@ export class AdminService {
225239 projectId : updatedSubmission . project . projectId ,
226240 approved : updateSubmissionDto . approvalStatus === 'approved' ,
227241 approvedHours : updateSubmissionDto . approvedHours ,
228- feedback : updateSubmissionDto . hoursJustification ,
242+ feedback : updatedSubmission . hoursJustification ,
229243 } ,
230244 ) ;
231245 console . log ( `Email sent for submission ${ submissionId } because sendEmail was explicitly true` ) ;
@@ -296,7 +310,7 @@ export class AdminService {
296310 return updatedSubmission ;
297311 }
298312
299- async quickApproveSubmission ( submissionId : number , adminUserId : number , providedJustification ?: string ) {
313+ async quickApproveSubmission ( submissionId : number , adminUserId : number , providedJustification ?: string , userFeedback ?: string ) {
300314 const submission = await this . prisma . submission . findUnique ( {
301315 where : { submissionId } ,
302316 include : {
@@ -314,12 +328,12 @@ export class AdminService {
314328
315329 const hackatimeHours = submission . project . nowHackatimeHours || 0 ;
316330 const autoJustification = `Quick approved with ${ hackatimeHours . toFixed ( 1 ) } Hackatime hours tracked on Midnight project.` ;
317- const hoursJustification = providedJustification || submission . hoursJustification || autoJustification ;
331+ const adminHoursJustification = providedJustification || autoJustification ;
318332
319333 const updateData : any = {
320334 approvalStatus : 'approved' ,
321335 approvedHours : hackatimeHours ,
322- hoursJustification : hoursJustification ,
336+ hoursJustification : userFeedback || '' ,
323337 reviewedBy : adminUserId . toString ( ) ,
324338 reviewedAt : new Date ( ) ,
325339 } ;
@@ -343,20 +357,18 @@ export class AdminService {
343357 } ,
344358 } ) ;
345359
346- // Update project with new data from submission
347360 await this . prisma . project . update ( {
348361 where : { projectId : submission . projectId } ,
349362 data : {
350363 approvedHours : hackatimeHours ,
351- hoursJustification : hoursJustification ,
364+ hoursJustification : adminHoursJustification ,
352365 playableUrl : submission . playableUrl ,
353366 repoUrl : submission . repoUrl ,
354367 screenshotUrl : submission . screenshotUrl ,
355368 description : submission . description ,
356369 } ,
357370 } ) ;
358371
359- // Check if this is a resubmission (project already has Airtable record)
360372 const isResubmission = ! ! submission . project . airtableRecId ;
361373
362374 if ( ! isResubmission ) {
@@ -388,7 +400,7 @@ export class AdminService {
388400 repoUrl : repoUrl ,
389401 screenshotUrl : submission . screenshotUrl || submission . project . screenshotUrl || '' ,
390402 approvedHours : hackatimeHours ,
391- hoursJustification : hoursJustification ,
403+ hoursJustification : adminHoursJustification ,
392404 description : submission . description || submission . project . description || undefined ,
393405 } ,
394406 } ;
@@ -420,17 +432,13 @@ export class AdminService {
420432 screenshotUrl : submission . screenshotUrl || undefined ,
421433 description : submission . description || undefined ,
422434 approvedHours : hackatimeHours ,
423- hoursJustification : hoursJustification ,
435+ hoursJustification : adminHoursJustification ,
424436 } ) ;
425437 } catch ( error ) {
426438 console . error ( 'Error updating Approved Projects record in Airtable:' , error ) ;
427439 }
428440 }
429441
430- // Note: quickApproveSubmission doesn't send email by default
431- // Email should be sent via the regular updateSubmission endpoint with sendEmail flag
432-
433- // Auto-approve pending edit requests when submission is approved
434442 try {
435443 const pendingEditRequests = await this . prisma . editRequest . findMany ( {
436444 where : {
0 commit comments