|
3 | 3 | DescriptionBulletPreview, |
4 | 4 | isAdmin, |
5 | 5 | isGuest, |
6 | | - isProject, |
| 6 | + isProjectWbs, |
7 | 7 | LinkCreateArgs, |
8 | 8 | LinkType, |
9 | 9 | Project, |
@@ -40,18 +40,18 @@ export default class ProjectsService { |
40 | 40 | * @param includeDeleted whether or not to include deleted projects |
41 | 41 | * @returns all the projects |
42 | 42 | */ |
43 | | - static async getAllProjects(organization: Organization, includeDeleted: boolean): Promise<Project[]> { |
| 43 | + static async getAllProjects(organization: Organization, includeDeleted: boolean): Promise<ProjectPreview[]> { |
44 | 44 | const projects = includeDeleted |
45 | 45 | ? await prisma.project.findMany({ |
46 | 46 | where: { wbsElement: { organizationId: organization.organizationId } }, |
47 | | - ...getProjectQueryArgs(organization.organizationId) |
| 47 | + ...getProjectManyQueryArgs(organization.organizationId) |
48 | 48 | }) |
49 | 49 | : await prisma.project.findMany({ |
50 | 50 | where: { wbsElement: { dateDeleted: null, organizationId: organization.organizationId } }, |
51 | | - ...getProjectQueryArgs(organization.organizationId) |
| 51 | + ...getProjectManyQueryArgs(organization.organizationId) |
52 | 52 | }); |
53 | 53 |
|
54 | | - return projects.map(projectTransformer); |
| 54 | + return projects.map(projectPreviewTransformer); |
55 | 55 | } |
56 | 56 |
|
57 | 57 | static async getUsersLeadingProjects(user: User, organization: Organization): Promise<ProjectPreview[]> { |
@@ -116,7 +116,7 @@ export default class ProjectsService { |
116 | 116 | } |
117 | 117 |
|
118 | 118 | static async getSingleProjectWithQueryArgs(wbsNumber: WbsNumber, organization: Organization) { |
119 | | - if (!isProject(wbsNumber)) throw new HttpException(400, `${wbsPipe(wbsNumber)} is not a valid project WBS #!`); |
| 119 | + if (!isProjectWbs(wbsNumber)) throw new HttpException(400, `${wbsPipe(wbsNumber)} is not a valid project WBS #!`); |
120 | 120 |
|
121 | 121 | const { carNumber, projectNumber, workPackageNumber } = wbsNumber; |
122 | 122 |
|
@@ -346,7 +346,7 @@ export default class ProjectsService { |
346 | 346 | * @throws if the project isn't found, the team isn't found, or the user doesn't have access |
347 | 347 | */ |
348 | 348 | static async setProjectTeam(user: User, wbsNumber: WbsNumber, teamId: string, organization: Organization): Promise<void> { |
349 | | - if (!isProject(wbsNumber)) throw new HttpException(400, `${wbsPipe(wbsNumber)} is not a valid project WBS #!`); |
| 349 | + if (!isProjectWbs(wbsNumber)) throw new HttpException(400, `${wbsPipe(wbsNumber)} is not a valid project WBS #!`); |
350 | 350 |
|
351 | 351 | // find the associated project |
352 | 352 | const project = await ProjectsService.getSingleProjectWithQueryArgs(wbsNumber, organization); |
|
0 commit comments