Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Change primary COS role from COS Officer to COS #117

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/src/age_code/age_code.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class AgeCodeResolver {
constructor(private readonly ageCodeService: AgeCodeService) {}

@Query("ageCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.ageCodeService.findAll();
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/agency_code/agency_code.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class AgencyCodeResolver {
constructor(private readonly agencyCodeService: AgencyCodeService) {}

@Query("agencyCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.agencyCodeService.findAll();
}
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);
36 changes: 18 additions & 18 deletions backend/src/case_file/case_file.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,109 +26,109 @@ export class CaseFileResolver {
constructor(private readonly caseFileService: CaseFileService) {}

@Mutation("createAssessment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
createAssessment(@Args("createAssessmentInput") createAssessmentInput: CreateAssessmentInput) {
return this.caseFileService.createAssessment(createAssessmentInput);
}

@Mutation("createPrevention")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
createPrevention(@Args("createPreventionInput") createPreventionInput: CreatePreventionInput) {
return this.caseFileService.createPrevention(createPreventionInput);
}

@Mutation("createReview")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
createReview(@Args("reviewInput") reviewInput: ReviewInput) {
return this.caseFileService.createReview(reviewInput);
}

@Query("getCaseFile")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findOne(@Args("caseIdentifier") caseIdentifier: string) {
return this.caseFileService.findOne(caseIdentifier);
}

@Query("getCaseFileByLeadId")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findOneByLeadId(@Args("leadIdentifier") leadIdentifier: string) {
return this.caseFileService.findOneByLeadId(leadIdentifier);
}

@Query("getCasesFilesBySearchString")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findManyBySearchString(@Args("searchString") searchString: string) {
return this.caseFileService.findManyBySearchString(searchString);
}

@Mutation("updateAssessment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
updateAssessment(@Args("updateAssessmentInput") updateAssessmentInput: UpdateAssessmentInput) {
return this.caseFileService.updateAssessment(updateAssessmentInput.caseIdentifier, updateAssessmentInput);
}

@Mutation("updatePrevention")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
updatePrevention(@Args("updatePreventionInput") updatePreventionInput: UpdatePreventionInput) {
return this.caseFileService.updatePrevention(updatePreventionInput.caseIdentifier, updatePreventionInput);
}

@Mutation("createEquipment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
createEquipment(@Args("createEquipmentInput") createEquipmentInput: CreateEquipmentInput) {
return this.caseFileService.createEquipment(createEquipmentInput);
}

@Mutation("updateEquipment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
updateEquipment(@Args("updateEquipmentInput") updateEquipmentInput: UpdateEquipmentInput) {
return this.caseFileService.updateEquipment(updateEquipmentInput);
}

@Mutation("deleteEquipment")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
deleteEquipment(@Args("deleteEquipmentInput") deleteEquipmentInput: DeleteEquipmentInput) {
return this.caseFileService.deleteEquipment(deleteEquipmentInput);
}

@Mutation("updateReview")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
updateReview(@Args("reviewInput") reviewInput: ReviewInput) {
return this.caseFileService.updateReview(reviewInput);
}

@Mutation("createNote")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
createNote(@Args("input") input: CreateSupplementalNoteInput) {
return this.caseFileService.createNote(input);
}

@Mutation("updateNote")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
updateNote(@Args("input") input: UpdateSupplementalNoteInput) {
return this.caseFileService.updateNote(input);
}

@Mutation("deleteNote")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
deleteNote(@Args("input") input: DeleteSupplementalNoteInput) {
return this.caseFileService.deleteNote(input);
}

@Mutation("createWildlife")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
createWildlife(@Args("input") input: CreateWildlifeInput) {
return this.caseFileService.createWildlife(input);
}

@Mutation("updateWildlife")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
updateWildlife(@Args("input") input: UpdateWildlifeInput) {
return this.caseFileService.updateWildlife(input);
}

@Mutation("deleteWildlife")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
deleteWildlife(@Args("input") input: DeleteWildlifeInput) {
return this.caseFileService.deleteWildlife(input);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class CEEBDecisionActionResolver {
constructor(private readonly actionCodeService: ActionCodeService) {}

@Query("CEEBDecisionActions")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
find() {
return this.actionCodeService.findAllCodesByType(ACTION_TYPE_CODES.CEEBACTION);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class CaseLocationCodeResolver {
constructor(private readonly service: CaseLocationCodeService) {}

@Query("caseLocationCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.service.findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DischargeCodeResolver {
constructor(private readonly service: DischargeCodeService) {}

@Query("dischargeCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.service.findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class NonComplianceCodeResolver {
constructor(private readonly service: NonComplianceCodeService) {}

@Query("nonComplianceCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.service.findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ScheduleCodeResolver {
constructor(private readonly service: ScheduleCodeService) {}

@Query("scheduleCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.service.findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class SectorCodeResolver {
constructor(private readonly service: SectorCodeService) {}

@Query("sectorCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.service.findAll();
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/configuration/configuration.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ConfigurationResolver {
constructor(private readonly configurationService: ConfigurationService) {}

@Query("configurationCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findOne(@Args("configurationCode") configurationCode?: string) {
return this.configurationService.find(configurationCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ConflictHistoryCodeResolver {
constructor(private readonly conflictHistoryCodeService: ConflictHistoryCodeService) {}

@Query("conflictHistoryCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.conflictHistoryCodeService.findAll();
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/drug_code/drug_code.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DrugCodeResolver {
constructor(private readonly drugCodeService: DrugCodeService) {}

@Query("drugCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.drugCodeService.findAll();
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/drug_method_code/drug_method_code.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DrugMethodCodeResolver {
constructor(private readonly drugMethodCodeService: DrugMethodCodeService) {}

@Query("drugMethodCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.drugMethodCodeService.findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DrugRemainingOutcomeCodeResolver {
constructor(private readonly drugRemainingOutcomeCodeService: DrugRemainingOutcomeCodeService) {}

@Query("drugRemainingOutcomeCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.drugRemainingOutcomeCodeService.findAll();
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/ear_code/ear_code.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class EarCodeResolver {
constructor(private readonly earCodeService: EarCodeService) {}

@Query("earCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.earCodeService.findAll();
}
Expand Down
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_ADMIN = "COS Admin",
CEEB = "CEEB",
READ_ONLY = "READ ONLY",
Expand Down
2 changes: 1 addition & 1 deletion backend/src/equipment_code/equipment_code.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class EquipmentCodeResolver {
constructor(private readonly equipmentCodeService: EquipmentCodeService) {}

@Query("equipmentCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.equipmentCodeService.findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export class HWCRAssessmentActionResolver {
constructor(private readonly actionCodeService: ActionCodeService) {}

@Query("HWCRAssessmentActions")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
find() {
return this.actionCodeService.findAllCodesByType(ACTION_TYPE_CODES.COMPASSESS);
}

@Query("HWCRAssessmentCat1Actions")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findCat1Actions() {
return this.actionCodeService.findAllCodesByType(ACTION_TYPE_CODES.CAT1ASSESS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class HwcrOutcomeCodeResolver {
constructor(private readonly hwcrOutcomeCodeService: HwcrOutcomeCodeService) {}

@Query("hwcrOutcomeCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.hwcrOutcomeCodeService.findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class HWCRPreventionActionResolver {
constructor(private readonly actionCodeService: ActionCodeService) {}

@Query("HWCRPreventionActions")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
find() {
return this.actionCodeService.findAllCodesByType(ACTION_TYPE_CODES.COSPRVANDEDU);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class InactionJustificationTypeResolver {
constructor(private readonly inactionJustificationTypeService: InactionJustificationTypeService) {}

@Query("inactionJustificationCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
find(@Args("agencyCode") agencyCode?: string) {
return this.inactionJustificationTypeService.find(agencyCode);
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/lead/lead.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class LeadResolver {
}

@Query("getLeadsByOutcomeAnimal")
@Roles(Role.COS_OFFICER)
@Roles(Role.COS)
findLeadsByOutcomeAnimal(
@Args("outcomeAnimalCode") outcomeAnimalCode: string,
@Args("startDate") startDate: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ScheduleSectorXrefResolver {
constructor(private readonly service: ScheduleSectorXrefService) {}

@Query("scheduleSectorXrefs")
@Roles(Role.CEEB, Role.COS_OFFICER)
@Roles(Role.CEEB, Role.COS)
findAll() {
return this.service.findAll();
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/sex_code/sex_code.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class SexCodeResolver {
constructor(private readonly sexCodeService: SexCodeService) {}

@Query("sexCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.sexCodeService.findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ThreatLevelCodeResolver {
constructor(private readonly threatLevelCodeService: ThreatLevelCodeService) {}

@Query("threatLevelCodes")
@Roles(Role.COS_OFFICER, Role.CEEB)
@Roles(Role.COS, Role.CEEB)
findAll() {
return this.threatLevelCodeService.findAll();
}
Expand Down