Skip to content

Commit

Permalink
feat: citizen records payments (Optional Feature)
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Oct 7, 2023
1 parent 4ff2c7d commit f257193
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "Feature" ADD VALUE 'CITIZEN_RECORD_PAYMENTS';
1 change: 1 addition & 0 deletions apps/api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,7 @@ enum Feature {
LEO_EDITABLE_CITIZEN_PROFILE // see #1698
ALLOW_MULTIPLE_UNITS_DEPARTMENTS_PER_USER // see #1722
OPEN_LAW_BOOK
CITIZEN_RECORD_PAYMENTS
}

enum DashboardLayoutCardType {
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/middlewares/is-enabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const DEFAULT_DISABLED_FEATURES: Partial<
REQUIRED_CITIZEN_IMAGE: { isEnabled: false },
LEO_EDITABLE_CITIZEN_PROFILE: { isEnabled: false },
ALLOW_MULTIPLE_UNITS_DEPARTMENTS_PER_USER: { isEnabled: false },
CITIZEN_RECORD_PAYMENTS: { isEnabled: false },
};

export type CadFeatures = Record<TypesFeature | DatabaseFeature, boolean> & {
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/migrations/set-default-cad-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const DEFAULT_DISABLED_FEATURES: Partial<Record<Feature, { isEnabled: boolean }>
REQUIRED_CITIZEN_IMAGE: { isEnabled: false },
LEO_EDITABLE_CITIZEN_PROFILE: { isEnabled: false },
ALLOW_MULTIPLE_UNITS_DEPARTMENTS_PER_USER: { isEnabled: false },
CITIZEN_RECORD_PAYMENTS: { isEnabled: false },
};

/**
Expand Down
4 changes: 3 additions & 1 deletion apps/client/locales/en/cad-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@
"ALLOW_MULTIPLE_UNITS_DEPARTMENTS_PER_USER": "Allow multiple units with the same callsign and department per user",
"ALLOW_MULTIPLE_UNITS_DEPARTMENTS_PER_USER-description": "When enabled, officers and deputies can create multiple units with the same callsign and department.",
"OPEN_LAW_BOOK": "Open Law Book",
"OPEN_LAW_BOOK-description": "When enabled, this will allow every user to view the CAD's penal codes (Law Book)"
"OPEN_LAW_BOOK-description": "When enabled, this will allow every user to view the CAD's penal codes (Law Book)",
"CITIZEN_RECORD_PAYMENTS": "Citizen Record Payments",
"CITIZEN_RECORD_PAYMENTS-description": "When enabled, this will allow citizens to mark their own records as paid."
},
"Permissions": {
"defaultPermissions": "Default Permissions",
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/hooks/useFeatureEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const DEFAULT_DISABLED_FEATURES = {
REQUIRED_CITIZEN_IMAGE: { isEnabled: false },
LEO_EDITABLE_CITIZEN_PROFILE: { isEnabled: false },
ALLOW_MULTIPLE_UNITS_DEPARTMENTS_PER_USER: { isEnabled: false },
CITIZEN_RECORD_PAYMENTS: { isEnabled: false },
} satisfies Partial<Record<Feature, { isEnabled: boolean }>>;

export const DEFAULT_FEATURE_OPTIONS = {
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const Feature = {
LEO_EDITABLE_CITIZEN_PROFILE: "LEO_EDITABLE_CITIZEN_PROFILE",
ALLOW_MULTIPLE_UNITS_DEPARTMENTS_PER_USER: "ALLOW_MULTIPLE_UNITS_DEPARTMENTS_PER_USER",
OPEN_LAW_BOOK: "OPEN_LAW_BOOK",
CITIZEN_RECORD_PAYMENTS: "CITIZEN_RECORD_PAYMENTS",
} as const;

export type Feature = (typeof Feature)[keyof typeof Feature];
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/api-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function getAPIUrl(): string {
const envUrl = process.env.NEXT_PUBLIC_PROD_ORIGIN ?? "http://localhost:8080/v1";

if (process.env.NODE_ENV === "development") {
return "http://localhost:8080/v1";
return "http://172.20.10.2:8080/v1";
}

if (envUrl.endsWith("/v1")) {
Expand Down

0 comments on commit f257193

Please sign in to comment.