@@ -11,9 +11,9 @@ import {
1111 wbsPipe ,
1212 WorkPackage ,
1313 WorkPackagePreview ,
14- WorkPackageSelection ,
1514 WorkPackageStage ,
16- User
15+ User ,
16+ WorkPackageSelection
1717} from 'shared' ;
1818import prisma from '../prisma/prisma' ;
1919import {
@@ -37,6 +37,7 @@ import {
3737import { getBlockingWorkPackages , validateBlockedBys } from '../utils/work-packages.utils' ;
3838import { getDescriptionBulletQueryArgs } from '../prisma-query-args/description-bullets.query-args' ;
3939import { userHasPermission } from '../utils/users.utils' ;
40+ import { getUserPreviewQueryArgs } from '../prisma-query-args/user.query-args' ;
4041
4142/** Service layer containing logic for work package controller functions. */
4243export default class WorkPackagesService {
@@ -583,9 +584,9 @@ export default class WorkPackagesService {
583584 selection : WorkPackageSelection
584585 ) : Promise < WorkPackagePreview [ ] > {
585586 const selectionArgs =
586- selection === 'allOverdue'
587+ selection === WorkPackageSelection . ALL_OVERDUE
587588 ? { }
588- : selection === 'leading'
589+ : selection === WorkPackageSelection . LEADING
589590 ? {
590591 workPackage : {
591592 project : {
@@ -630,8 +631,8 @@ export default class WorkPackagesService {
630631 workPackageNumber : true ,
631632 dateDeleted : true ,
632633 wbsElementId : true ,
633- lead : { select : { firstName : true , lastName : true , userId : true } } ,
634- manager : { select : { firstName : true , lastName : true , userId : true } }
634+ lead : getUserPreviewQueryArgs ( ) ,
635+ manager : getUserPreviewQueryArgs ( )
635636 }
636637 } ,
637638 blockedBy : true ,
@@ -642,7 +643,7 @@ export default class WorkPackagesService {
642643 }
643644 } ) ;
644645
645- if ( selection === 'allOverdue' ) {
646+ if ( selection === WorkPackageSelection . ALL_OVERDUE ) {
646647 workPackages = workPackages . filter ( ( wp ) => {
647648 const endDate = new Date ( wp . startDate ) ;
648649 endDate . setDate ( endDate . getDate ( ) + wp . duration * 7 ) ; // Add weeks as days
0 commit comments