-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into sampling-container
- Loading branch information
Showing
204 changed files
with
9,415 additions
and
2,308 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Date formats. | ||
* | ||
* See BC Gov standards: https://www2.gov.bc.ca/gov/content/governments/services-for-government/policies-procedures/web-content-development-guides/writing-for-the-web/web-style-guide/numbers | ||
*/ | ||
export const DefaultDateFormat = 'YYYY-MM-DD'; // 2020-01-05 | ||
|
||
export const DefaultDateFormatReverse = 'DD-MM-YYYY'; // 05-01-2020 | ||
|
||
export const AltDateFormat = 'YYYY/MM/DD'; // 2020/01/05 | ||
|
||
export const AltDateFormatReverse = 'DD/MM/YYYY'; // 05/01/2020 | ||
|
||
/* | ||
* Time formats. | ||
*/ | ||
export const DefaultTimeFormat = 'HH:mm:ss'; // 23:00:00 | ||
|
||
/* | ||
* Datetime formats. | ||
*/ | ||
export const DefaultDateTimeFormat = `${DefaultDateFormat}T${DefaultTimeFormat}`; // 2020-01-05T23:00:00 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { z } from 'zod'; | ||
|
||
// Define the alert schema | ||
export const IAlert = z.object({ | ||
alert_id: z.number(), | ||
alert_type_id: z.number().int(), | ||
name: z.string(), | ||
message: z.string(), | ||
severity: z.enum(['info', 'success', 'error', 'warning']), | ||
data: z.object({}).nullable(), | ||
record_end_date: z.string().nullable(), | ||
status: z.enum(['active', 'expired']) | ||
}); | ||
|
||
// Infer types from the schema | ||
export type IAlert = z.infer<typeof IAlert>; | ||
export type IAlertCreateObject = Omit<IAlert, 'alert_id' | 'status'>; | ||
export type IAlertUpdateObject = Omit<IAlert, 'status'>; | ||
|
||
// Filter object for viewing alerts | ||
export interface IAlertFilterObject { | ||
expiresBefore?: string; | ||
expiresAfter?: string; | ||
types?: string[]; | ||
} | ||
|
||
// Define severity and status types | ||
export type IAlertSeverity = 'info' | 'success' | 'error' | 'warning'; | ||
export type IAlertStatus = 'active' | 'expired'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export interface ISiteAdvancedFilters { | ||
survey_id?: number; | ||
keyword?: string; | ||
system_user_id?: number; | ||
} | ||
|
||
export interface IMethodAdvancedFilters { | ||
survey_id?: number; | ||
sample_site_id?: number; | ||
keyword?: string; | ||
system_user_id?: number; | ||
} | ||
|
||
export interface IPeriodAdvancedFilters { | ||
survey_id?: number; | ||
sample_site_id?: number; | ||
sample_method_id?: number; | ||
system_user_id?: number; | ||
} |
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,83 @@ | ||
import { OpenAPIV3 } from 'openapi-types'; | ||
|
||
/** | ||
* Base schema for system alerts | ||
*/ | ||
const baseSystemAlertSchema: OpenAPIV3.SchemaObject = { | ||
type: 'object', | ||
description: 'Schema defining alerts created by system administrators.', | ||
additionalProperties: false, | ||
properties: { | ||
name: { | ||
description: 'Name to display as the title of the alert', | ||
type: 'string' | ||
}, | ||
message: { | ||
description: 'Message to display on the alert', | ||
type: 'string' | ||
}, | ||
alert_type_id: { | ||
description: 'Type of the alert, controlling how it is displayed.', | ||
type: 'number' | ||
}, | ||
severity: { | ||
description: 'Severity level of the alert', | ||
type: 'string', | ||
enum: ['info', 'success', 'warning', 'error'] | ||
}, | ||
data: { | ||
description: 'Data associated with the alert', | ||
type: 'object', | ||
nullable: true | ||
}, | ||
record_end_date: { | ||
description: 'End date of the alert', | ||
type: 'string', | ||
nullable: true | ||
} | ||
} | ||
}; | ||
|
||
/** | ||
* Schema for updating system alerts | ||
*/ | ||
export const systemAlertPutSchema: OpenAPIV3.SchemaObject = { | ||
...baseSystemAlertSchema, | ||
required: ['alert_id', 'name', 'message', 'data', 'alert_type_id', 'record_end_date', 'severity'], | ||
additionalProperties: false, | ||
properties: { | ||
...baseSystemAlertSchema.properties, | ||
alert_id: { | ||
type: 'integer', | ||
minimum: 1, | ||
description: 'Primary key of the alert' | ||
} | ||
} | ||
}; | ||
|
||
/** | ||
* Schema for getting system alerts | ||
*/ | ||
export const systemAlertGetSchema: OpenAPIV3.SchemaObject = { | ||
...baseSystemAlertSchema, | ||
required: ['alert_id', 'name', 'message', 'data', 'alert_type_id', 'record_end_date', 'severity', 'status'], | ||
additionalProperties: false, | ||
properties: { | ||
...systemAlertPutSchema.properties, | ||
status: { | ||
type: 'string', | ||
enum: ['active', 'expired'], | ||
description: | ||
'Status of the alert based on comparing the current date to record_end_date, calculated in the get query.' | ||
} | ||
} | ||
}; | ||
|
||
/** | ||
* Schema for creating system alerts | ||
*/ | ||
export const systemAlertCreateSchema: OpenAPIV3.SchemaObject = { | ||
...baseSystemAlertSchema, | ||
additionalProperties: false, | ||
required: ['name', 'message', 'data', 'alert_type_id', 'record_end_date', 'severity'] | ||
}; |
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
Oops, something went wrong.