Skip to content

Commit

Permalink
Merge branch 'release/1.0.1' into CE-1335-last-update-date
Browse files Browse the repository at this point in the history
  • Loading branch information
afwilcox authored Jan 16, 2025
2 parents c4dd056 + d6edf2d commit 595623a
Show file tree
Hide file tree
Showing 22 changed files with 87 additions and 87 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ jobs:
--set nats.config.cluster.enabled=true
--set backup.enabled=true
--set backup.persistence.size=256Mi
# --set global.useCrunchy=true
# --set global.crunchyClusterEnvironment=prod
--set global.useCrunchy=true
--set global.crunchyClusterEnvironment=prod

healthcheck:
name: Healthcheck Prod Deployment
Expand Down
2 changes: 1 addition & 1 deletion backend/src/auth/decorators/roles.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Role } from "../../enum/role.enum";

/**
* Roles decorator for roles based access to API. The roles defined in role.enum are used as part of the Roles decorator.
* For example @Roles(Role.COS_OFFICER) will allow users that have the COS_OFFICER role on the JWT claim.
* For example @Roles(Role.COS) will allow users that have the COS role on the JWT claim.
*/
export const ROLES_KEY = "roles";
export const Roles = (...roles: Role[]) => SetMetadata(ROLES_KEY, roles);
2 changes: 1 addition & 1 deletion backend/src/enum/role.enum.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum Role {
COS_OFFICER = "COS Officer",
COS = "COS",
COS_ADMINISTRATOR = "COS Administrator",
CEEB = "CEEB",
CEEB_COMPLIANCE_COORDINATOR = "CEEB Compliance Coordinator",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class BcGeoCoderController {
constructor(private readonly bcGeoCoderService: BcGeoCoderService) {}

@Get("/address")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
findAll(@Query("localityName") localityName?: string, @Query("addressString") addressString?: string) {
return this.bcGeoCoderService.findAll(localityName, addressString);
}
Expand Down
32 changes: 16 additions & 16 deletions backend/src/v1/case_file/case_file.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ export class CaseFileController {
private readonly logger = new Logger(CaseFileController.name);

@Post("/equipment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async createEquipment(@Token() token, @Body() model: CaseFileDto): Promise<CaseFileDto> {
return await this.service.createEquipment(token, model);
}

@Patch("/equipment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async updateEquipment(@Token() token, @Body() model: CaseFileDto): Promise<CaseFileDto> {
return await this.service.updateEquipment(token, model);
}

@Delete("/equipment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async deleteEquipment(
@Token() token,
@Query("id") id: string,
Expand All @@ -72,61 +72,61 @@ export class CaseFileController {
}

@Post("/createAssessment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async createAssessment(@Token() token, @Body() model: CaseFileDto): Promise<CaseFileDto> {
return await this.service.createAssessment(token, model);
}

@Patch("/updateAssessment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async updateAssessment(@Token() token, @Body() model: CaseFileDto): Promise<CaseFileDto> {
return await this.service.updateAssessment(token, model);
}

@Post("/createPrevention")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async createPrevention(@Token() token, @Body() model: CaseFileDto): Promise<CaseFileDto> {
return await this.service.createPrevention(token, model);
}

@Patch("/updatePrevention")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async updatePrevention(@Token() token, @Body() model: CaseFileDto): Promise<CaseFileDto> {
return await this.service.updatePrevention(token, model);
}

@Post("/review")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async createReview(@Token() token, @Body() model: CaseFileDto): Promise<CaseFileDto> {
return await this.service.createReview(token, model);
}

@Patch("/review")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async updateReview(@Token() token, @Body() model: FileReviewInput): Promise<CaseFileDto> {
return await this.service.updateReview(token, model);
}

@Get("/:complaint_id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
find(@Param("complaint_id") complaint_id: string, @Token() token) {
return this.service.find(complaint_id, token);
}

@Post("/note")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async createNote(@Token() token, @Body() model: CreateSupplementalNotesInput): Promise<CaseFileDto> {
return await this.service.createNote(token, model);
}

@Patch("/note")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async UpdateNote(@Token() token, @Body() model: UpdateSupplementalNotesInput): Promise<CaseFileDto> {
return await this.service.updateNote(token, model);
}

@Delete("/note")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async deleteNote(
@Token() token,
@Query("caseIdentifier") caseIdentifier: string,
Expand All @@ -145,19 +145,19 @@ export class CaseFileController {
}

@Post("/wildlife")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async createWildlife(@Token() token, @Body() model: CreateWildlifeInput): Promise<CaseFileDto> {
return await this.service.createWildlife(token, model);
}

@Patch("/wildlife")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async updateWildlife(@Token() token, @Body() model: UpdateWildlifeInput): Promise<CaseFileDto> {
return await this.service.updateWildlife(token, model);
}

@Delete("/wildlife")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async deleteWildlife(
@Token() token,
@Query("caseIdentifier") caseIdentifier: string,
Expand Down
14 changes: 7 additions & 7 deletions backend/src/v1/code-table/code-table.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class CodeTableController {
constructor(private readonly service: CodeTableService) {}

@Get(":table")
@Roles(Role.COS_OFFICER, Role.CEEB, Role.TEMPORARY_TEST_ADMIN)
@Roles(Role.COS, Role.CEEB, Role.TEMPORARY_TEST_ADMIN)
async getCodeTableByName(@Param("table") table: string, @Token() token): Promise<BaseCodeTable[]> {
if (!AvailableCodeTables.includes(table)) {
throw new NotFoundException();
Expand All @@ -33,14 +33,14 @@ export class CodeTableController {
}

@Get("/complaint-method-received-by-agency/:agency")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async getComplaintMethodReceived(@Param("agency") agency: string): Promise<ComplaintMethodReceivedType[]> {
const result = await this.service.getComplaintMethodReceived(agency);
return result;
}

@Get("/organization-by-agency/:agency")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async getOrganizationsByAgency(@Param("agency") agency: string): Promise<OrganizationCodeTable[]> {
if (!AvailableAgencies.includes(agency)) {
throw new NotFoundException();
Expand All @@ -51,7 +51,7 @@ export class CodeTableController {
}

@Get("/regions-by-agency/:agency")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async getRegionsByAgency(@Param("agency") agency: string): Promise<Sector[]> {
if (!AvailableAgencies.includes(agency)) {
throw new NotFoundException();
Expand All @@ -62,7 +62,7 @@ export class CodeTableController {
}

@Get("/zones-by-agency/:agency")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async getZonesByAgency(@Param("agency") agency: string): Promise<Sector[]> {
if (!AvailableAgencies.includes(agency)) {
throw new NotFoundException();
Expand All @@ -73,7 +73,7 @@ export class CodeTableController {
}

@Get("/communities-by-agency/:agency")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async getCommunitiesByAgency(@Param("agency") agency: string): Promise<Sector[]> {
if (!AvailableAgencies.includes(agency)) {
throw new NotFoundException();
Expand All @@ -92,7 +92,7 @@ export class CaseManagementCodeTableController {
private readonly logger = new Logger(CaseManagementCodeTableController.name);

@Get(":table")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async getCodeTableByName(@Param("table") table: string, @Token() token): Promise<BaseCodeTable[]> {
this.logger.debug("in case management: " + JSON.stringify(table));
if (!AvailableCodeTables.includes(table)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class CompMthdRecvCdAgcyCdXrefController {
}

@Get("/by-agency/:agencyCode")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findByAgency(@Param("agencyCode") agencyCode: string) {
return this.compMthdRecvCdAgcyCdXrefService.findBy(agencyCode);
}
Expand Down
22 changes: 11 additions & 11 deletions backend/src/v1/complaint/complaint.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ export class ComplaintController {
private readonly logger = new Logger(ComplaintController.name);

@Get(":complaintType")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async findAllByType(
@Param("complaintType") complaintType: COMPLAINT_TYPE,
): Promise<Array<WildlifeComplaintDto | AllegationComplaintDto>> {
return await this.service.findAllByType(complaintType);
}

/* @Get("/map/search/:complaintType")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
mapSearch(
@Param("complaintType") complaintType: COMPLAINT_TYPE,
@Query() model: ComplaintSearchParameters,
Expand All @@ -62,7 +62,7 @@ export class ComplaintController {
} */

@Get("/map/search/clustered/:complaintType")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
mapSearchClustered(
@Param("complaintType") complaintType: COMPLAINT_TYPE,
@Query() model: ComplaintMapSearchClusteredParameters,
Expand All @@ -75,7 +75,7 @@ export class ComplaintController {
}

@Get("/search/:complaintType")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async search(
@Param("complaintType") complaintType: COMPLAINT_TYPE,
@Query() model: ComplaintSearchParameters,
Expand All @@ -88,7 +88,7 @@ export class ComplaintController {
}

@Patch("/update-status-by-id/:id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async updateComplaintStatusById(@Param("id") id: string, @Body() model: any): Promise<ComplaintDto> {
const { status } = model;
try {
Expand All @@ -99,7 +99,7 @@ export class ComplaintController {
}

@Patch("/update-by-id/:complaintType/:id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async updateComplaintById(
@Param("complaintType") complaintType: COMPLAINT_TYPE,
@Param("id") id: string,
Expand All @@ -109,7 +109,7 @@ export class ComplaintController {
}

@Get("/by-complaint-identifier/:complaintType/:id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async findComplaintById(
@Param("complaintType") complaintType: COMPLAINT_TYPE,
@Param("id") id: string,
Expand All @@ -120,13 +120,13 @@ export class ComplaintController {
| GeneralIncidentComplaintDto;
}
@Get("/related-data/:id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async findRelatedDataById(@Param("id") id: string): Promise<RelatedDataDto> {
return await this.service.findRelatedDataById(id);
}

@Post("/create/:complaintType")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async create(
@Param("complaintType") complaintType: COMPLAINT_TYPE,
@Body() model: WildlifeComplaintDto | AllegationComplaintDto,
Expand All @@ -135,7 +135,7 @@ export class ComplaintController {
}

@Get("/stats/:complaintType/by-zone/:zone")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
statsByZone(
@Param("complaintType") complaintType: COMPLAINT_TYPE,
@Param("zone") zone: string,
Expand All @@ -144,7 +144,7 @@ export class ComplaintController {
}

@Get("/linked-complaints/:complaint_id")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
async findLinkedComplaintsById(@Param("complaint_id") complaintId: string) {
const childComplaints = await this.linkedComplaintXrefService.findChildComplaints(complaintId);
if (childComplaints.length > 0) return childComplaints;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ export class ComplaintUpdatesController {
private readonly logger = new Logger(ComplaintUpdatesController.name);

@Get("/:id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findByComplaintId(@Param("id") id: string) {
return this.configurationService.findByComplaintId(id);
}
@Get("/related/:id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findRelatedDataById(@Param("id") id: string) {
return this.configurationService.findRelatedDataById(id);
}
@Get("/actions/:id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findActionsById(@Param("id") id: string) {
return this.configurationService.findActionsByComplaintId(id);
}
@Get("/count/:id")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
getComplaintChangeCount(@Param("id") id: string) {
return this.configurationService.getComplaintChangeCount(id);
}
Expand Down
6 changes: 3 additions & 3 deletions backend/src/v1/configuration/configuration.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export class ConfigurationController {
private readonly logger = new Logger(ConfigurationController.name);

@Get()
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.configurationService.findAll();
}

@Get(":configurationCode")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async findOne(@Param("configurationCode") configurationCode: string, @Token() token) {
try {
const result = await this.configurationService.findOne(configurationCode);
Expand Down Expand Up @@ -62,7 +62,7 @@ export class ConfigurationController {
}

@Patch(":id")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
update(@Param("id") id: string, @Body() updateConfigurationDto: UpdateConfigurationDto) {
return this.configurationService.update(+id, updateConfigurationDto);
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/v1/document/document.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class DocumentController {
constructor(private readonly service: DocumentService) {}

@Post("/export-complaint")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
async exportComplaint(@Body() model: ExportComplaintParameters, @Token() token, @Res() res: Response): Promise<void> {
const id: string = model?.id ?? "unknown";

Expand Down
2 changes: 1 addition & 1 deletion backend/src/v1/feature_flag/feature_flag.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class FeatureFlagController {
}

@Get("features-by-agency/:agencyCode")
@Roles(Role.TEMPORARY_TEST_ADMIN, Role.CEEB, Role.COS_OFFICER)
@Roles(Role.TEMPORARY_TEST_ADMIN, Role.CEEB, Role.COS)
async findByAgency(@Param("agencyCode") agencyCode: string) {
return await this.featureFlagService.findByAgency(agencyCode);
}
Expand Down
Loading

0 comments on commit 595623a

Please sign in to comment.