Skip to content

Commit

Permalink
feat: able to configure licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Sep 29, 2023
1 parent f81aa10 commit 26c6ac7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ export class CADSettingsController {
waterLicenseNumberLength: data.waterLicenseNumberLength,
signal100RepeatAmount: data.signal100RepeatAmount,
signal100RepeatIntervalMs: data.signal100RepeatIntervalMs,
huntingLicenseTemplate: data.huntingLicenseTemplate,
huntingLicenseMaxPoints: data.huntingLicenseMaxPoints,
huntingLicenseNumberLength: data.huntingLicenseNumberLength,
fishingLicenseTemplate: data.fishingLicenseTemplate,
fishingLicenseMaxPoints: data.fishingLicenseMaxPoints,
fishingLicenseNumberLength: data.fishingLicenseNumberLength,
},
include: { webhooks: true },
});
Expand Down
10 changes: 10 additions & 0 deletions apps/api/src/lib/citizen/citizen-create-data-obj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ export async function citizenObjectFromData(options: Options) {
template: miscCadSettings?.waterLicenseTemplate,
length: miscCadSettings?.waterLicenseNumberLength ?? 8,
}),

huntingLicenseNumber: generateLicenseNumber({
template: miscCadSettings?.huntingLicenseTemplate,
length: miscCadSettings?.huntingLicenseNumberLength ?? 8,
}),

fishingLicenseNumber: generateLicenseNumber({
template: miscCadSettings?.fishingLicenseTemplate,
length: miscCadSettings?.fishingLicenseNumberLength ?? 8,
}),
};

if (typeof options.defaultLicenseValueId !== "undefined") {
Expand Down
4 changes: 4 additions & 0 deletions apps/client/locales/en/cad-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@
"weaponLicenseTemplateInfo": "This is the template for weapon license numbers. You can use the following variables: {variables}. Note: this will only apply to newly created citizens.",
"waterLicenseTemplate": "Water license number template",
"waterLicenseTemplateInfo": "This is the template for water license numbers. You can use the following variables: {variables}. Note: this will only apply to newly created citizens.",
"huntingLicenseTemplate": "Hunting license number template",
"huntingLicenseTemplateInfo": "This is the template for hunting license numbers. You can use the following variables: {variables}. Note: this will only apply to newly created citizens.",
"fishingLicenseTemplate": "Fishing license number template",
"fishingLicenseTemplateInfo": "This is the template for fishing license numbers. You can use the following variables: {variables}. Note: this will only apply to newly created citizens.",
"miscSettings": "Miscellaneous Settings",
"cadRelated": "CAD Related",
"inactivityTimeouts": "Inactivity Timeouts",
Expand Down
14 changes: 10 additions & 4 deletions packages/schemas/src/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ export const CAD_MISC_SETTINGS_SCHEMA = z.object({
driversLicenseNumberLength: z.number().finite().nullable(),
pilotLicenseTemplate: z.string().nullable(),
pilotLicenseNumberLength: z.number().finite().nullable(),
weaponLicenseTemplate: z.string().nullable(),
weaponLicenseNumberLength: z.number().finite().nullable(),
pilotLicenseMaxPoints: z.number().finite().nullable(),
fishingLicenseTemplate: z.string().nullable(),
fishingLicenseNumberLength: z.number().finite().nullable(),
fishingLicenseMaxPoints: z.number().finite().nullable(),
waterLicenseTemplate: z.string().nullable(),
waterLicenseMaxPoints: z.number().finite().nullable(),
waterLicenseNumberLength: z.number().finite().nullable(),
huntingLicenseTemplate: z.string().nullable(),
huntingLicenseNumberLength: z.number().finite().nullable(),
huntingLicenseMaxPoints: z.number().finite().nullable(),
driversLicenseMaxPoints: z.number().finite().nullable(),
pilotLicenseMaxPoints: z.number().finite().nullable(),
weaponLicenseMaxPoints: z.number().finite().nullable(),
waterLicenseMaxPoints: z.number().finite().nullable(),
weaponLicenseTemplate: z.string().nullable(),
weaponLicenseNumberLength: z.number().finite().nullable(),
signal100RepeatAmount: z.number().finite().nullable(),
signal100RepeatIntervalMs: z.number().finite().nullable(),
});
Expand Down

0 comments on commit 26c6ac7

Please sign in to comment.