generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: afwilcox <[email protected]>
- Loading branch information
1 parent
e8e9dd7
commit 3ddcbc2
Showing
13 changed files
with
5,120 additions
and
1,863 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
backend/src/schedule_sector_xref/entities/schedule_sector_xref.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export class ScheduleSectorXref { | ||
sectorCode: string; | ||
scheduleCode: string; | ||
shortDescription: string; | ||
longDescription: string; | ||
activeIndicator: boolean; | ||
} |
12 changes: 12 additions & 0 deletions
12
backend/src/schedule_sector_xref/schedule_sector_xref.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
type ScheduleSectorXref { | ||
sectorCode: String | ||
scheduleCode: String | ||
shortDescription: String | ||
longDescription: String | ||
displayOrder: Int | ||
activeIndicator: Boolean | ||
} | ||
|
||
type Query { | ||
scheduleSectorXrefs: [ScheduleSectorXref]! | ||
} |
10 changes: 10 additions & 0 deletions
10
backend/src/schedule_sector_xref/schedule_sector_xref.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { PrismaModule } from "nestjs-prisma"; | ||
import { ScheduleSectorXrefService } from "./schedule_sector_xref.service"; | ||
import { ScheduleSectorXrefResolver } from "./schedule_sector_xref.resolver"; | ||
|
||
@Module({ | ||
imports: [PrismaModule], | ||
providers: [ScheduleSectorXrefResolver, ScheduleSectorXrefService], | ||
}) | ||
export class ScheduleSectorXrefModule {} |
19 changes: 19 additions & 0 deletions
19
backend/src/schedule_sector_xref/schedule_sector_xref.resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Resolver, Query, Args } from "@nestjs/graphql"; | ||
import { UseGuards } from "@nestjs/common"; | ||
import { JwtRoleGuard } from "src/auth/jwtrole.guard"; | ||
import { Roles } from "src/auth/decorators/roles.decorator"; | ||
import { Role } from "src/enum/role.enum"; | ||
import { ScheduleSectorXrefService } from "./schedule_sector_xref.service"; | ||
import { JwtAuthGuard } from "src/auth/jwtauth.guard"; | ||
|
||
@UseGuards(JwtAuthGuard, JwtRoleGuard) | ||
@Resolver("ScheduleSectorXref") | ||
export class ScheduleSectorXrefResolver { | ||
constructor(private readonly service: ScheduleSectorXrefService) {} | ||
|
||
@Query("scheduleSectorXrefs") | ||
@Roles(Role.CEEB, Role.COS_OFFICER) | ||
findAll() { | ||
return this.service.findAll(); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
backend/src/schedule_sector_xref/schedule_sector_xref.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Injectable } from "@nestjs/common"; | ||
import { PrismaService } from "nestjs-prisma"; | ||
import { ScheduleSectorXref } from "./entities/schedule_sector_xref.entity"; | ||
|
||
@Injectable() | ||
export class ScheduleSectorXrefService { | ||
constructor(private prisma: PrismaService) {} | ||
|
||
findAll = async (): Promise<Array<ScheduleSectorXref>> => { | ||
const codes = await this.prisma.schedule_sector_xref.findMany({ | ||
select: { | ||
sector_code: true, | ||
schedule_code: true, | ||
sector_code_schedule_sector_xref_sector_codeTosector_code: { | ||
select: { | ||
long_description: true, | ||
short_description: true, | ||
}, | ||
}, | ||
active_ind: true, | ||
}, | ||
orderBy: [ | ||
{ | ||
sector_code_schedule_sector_xref_sector_codeTosector_code: { | ||
display_order: "asc", | ||
}, | ||
}, | ||
], | ||
}); | ||
|
||
return codes.map( | ||
({ | ||
sector_code, | ||
schedule_code, | ||
sector_code_schedule_sector_xref_sector_codeTosector_code: { long_description, short_description }, | ||
active_ind, | ||
}) => ({ | ||
sectorCode: sector_code, | ||
scheduleCode: schedule_code, | ||
longDescription: long_description, | ||
shortDescription: short_description, | ||
activeIndicator: active_ind, | ||
}), | ||
); | ||
}; | ||
} |
Oops, something went wrong.