-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(entities): add Administration, ControlUnit, DepartmentArea & Sta…
…tion
- Loading branch information
1 parent
5f43efc
commit 9f04ac9
Showing
6 changed files
with
232 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { ControlUnit } from './ControlUnit' | ||
|
||
export namespace Administration { | ||
export interface Administration { | ||
controlUnitIds: number[] | ||
controlUnits: ControlUnit.ControlUnitData[] | ||
id: number | ||
isArchived: boolean | ||
name: string | ||
} | ||
|
||
// --------------------------------------------------------------------------- | ||
// Types | ||
|
||
export type AdministrationData = Omit<Administration, 'controlUnitIds' | 'controlUnits'> | ||
export type NewAdministrationData = Omit<AdministrationData, 'id'> | ||
} |
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,169 @@ | ||
import { Mission } from './Mission' | ||
|
||
import type { Administration } from './Administration' | ||
import type { DepartmentArea } from './DepartmentArea' | ||
import type { Station } from './Station' | ||
|
||
export namespace ControlUnit { | ||
export interface ControlUnit { | ||
administration: Administration.AdministrationData | ||
administrationId: number | ||
/** Area of intervention for this unit. */ | ||
areaNote: string | undefined | ||
controlUnitContactIds: number[] | ||
controlUnitContacts: ControlUnitContactData[] | ||
controlUnitResourceIds: number[] | ||
// `ControlUnitResource` and not `ControlUnitResourceData` because we need `base` data for each resource | ||
controlUnitResources: ControlUnitResource[] | ||
departmentArea: DepartmentArea.DepartmentArea | undefined | ||
/** `departmentAreaInseeCode` is the `departmentArea` ID. */ | ||
departmentAreaInseeCode: string | undefined | ||
id: number | ||
isArchived: boolean | ||
name: string | ||
/** Conditions under which this unit should be contacted. */ | ||
termsNote: string | undefined | ||
} | ||
|
||
export interface ControlUnitContact { | ||
controlUnit: ControlUnitData | ||
controlUnitId: number | ||
email: string | undefined | ||
id: number | ||
name: string | ||
phone: string | undefined | ||
} | ||
|
||
export interface ControlUnitResource { | ||
controlUnit: ControlUnitData | ||
controlUnitId: number | ||
id: number | ||
isArchived: boolean | ||
name: string | ||
note: string | undefined | ||
/** Base64 Data URI. */ | ||
photo: string | undefined | ||
station: Station.StationData | ||
stationId: number | ||
type: ControlUnitResourceType | ||
} | ||
|
||
// --------------------------------------------------------------------------- | ||
// Constants | ||
|
||
export enum ControlUnitContactPredefinedName { | ||
ADJUNCT = 'Adjoint', | ||
BRIDGE = 'Passerelle', | ||
COMMANDER = 'Commandant', | ||
COMMANDER_A = 'Commandant bordée A', | ||
COMMANDER_B = 'Commandant bordée B', | ||
CREW_A = 'Équipage A', | ||
CREW_B = 'Équipage B', | ||
DML = 'DML', | ||
DOCK = 'Quai', | ||
LAND = 'Terre', | ||
LAND_ON_CALL = 'Permanence terre', | ||
NEAR_COAST = 'Proche côte', | ||
OFFICE = 'Bureau de l’unité', | ||
ONBOARD_PHONE = 'Téléphone de bord', | ||
ON_CALL = 'Permanence', | ||
OPERATIONAL_CENTER = 'Centre opérationnel', | ||
OPERATIONAL_CENTER_HNO = 'Centre opérationnel - HNO', // Heures Non-Ouvrées | ||
OPERATIONAL_CENTER_HO = 'Centre opérationnel - HO', // Heures Ouvrées | ||
PERMANENT_CONTACT_ONBOARD = 'Contact permanent à bord', | ||
SEA = 'Mer', | ||
SECRETARIAT = 'Secrétariat', | ||
SERVICE_CHIEF = 'Chef de service', | ||
UNIT_CHIEF = 'Chef d’unité', | ||
UNKNOWN = 'Nom de contact à renseigner' | ||
} | ||
|
||
// Don't forget to mirror any update here in both Postgre & Backend enums. | ||
export enum ControlUnitResourceType { | ||
AIRPLANE = 'AIRPLANE', | ||
BARGE = 'BARGE', | ||
CAR = 'CAR', | ||
DRONE = 'DRONE', | ||
EQUESTRIAN = 'EQUESTRIAN', | ||
FAST_BOAT = 'FAST_BOAT', | ||
FRIGATE = 'FRIGATE', | ||
HELICOPTER = 'HELICOPTER', | ||
HYDROGRAPHIC_SHIP = 'HYDROGRAPHIC_SHIP', | ||
KAYAK = 'KAYAK', | ||
LIGHT_FAST_BOAT = 'LIGHT_FAST_BOAT', | ||
MINE_DIVER = 'MINE_DIVER', | ||
MOTORCYCLE = 'MOTORCYCLE', | ||
NET_LIFTER = 'NET_LIFTER', | ||
NO_RESOURCE = 'NO_RESOURCE', | ||
OTHER = 'OTHER', | ||
PATROL_BOAT = 'PATROL_BOAT', | ||
PEDESTRIAN = 'PEDESTRIAN', | ||
PIROGUE = 'PIROGUE', | ||
RIGID_HULL = 'RIGID_HULL', | ||
SEA_SCOOTER = 'SEA_SCOOTER', | ||
SEMI_RIGID = 'SEMI_RIGID', | ||
SUPPORT_SHIP = 'SUPPORT_SHIP', | ||
TRAINING_SHIP = 'TRAINING_SHIP', | ||
TUGBOAT = 'TUGBOAT' | ||
} | ||
export enum ControlUnitResourceTypeLabel { | ||
AIRPLANE = 'Avion', | ||
BARGE = 'Barge', | ||
CAR = 'Voiture', | ||
DRONE = 'Drône', | ||
EQUESTRIAN = 'Équestre', | ||
FAST_BOAT = 'Vedette', | ||
FRIGATE = 'Frégate', | ||
HELICOPTER = 'Hélicoptère', | ||
HYDROGRAPHIC_SHIP = 'Bâtiment hydrographique', | ||
KAYAK = 'Kayak', | ||
LIGHT_FAST_BOAT = 'Vedette légère', | ||
MINE_DIVER = 'Plongeur démineur', | ||
MOTORCYCLE = 'Moto', | ||
NET_LIFTER = 'Remonte-filets', | ||
NO_RESOURCE = 'Aucun moyen', | ||
OTHER = 'Autre', | ||
PATROL_BOAT = 'Patrouilleur', | ||
PEDESTRIAN = 'Piéton', | ||
PIROGUE = 'Pirogue', | ||
RIGID_HULL = 'Coque rigide', | ||
SEA_SCOOTER = 'Scooter de mer', | ||
SEMI_RIGID = 'Semi-rigide', | ||
SUPPORT_SHIP = 'Bâtiment de soutien', | ||
TRAINING_SHIP = 'Bâtiment-école', | ||
TUGBOAT = 'Remorqueur' | ||
} | ||
|
||
// List of PAM units identifiers | ||
// 10141 PAM Gyptis | ||
// 10404 PAM Iris | ||
// 10121 PAM Jeanne Barret | ||
// 10345 PAM Osiris | ||
// 10080 PAM Themis | ||
export const PAMControlUnitIds = [10141, 10404, 10121, 10345, 10080] | ||
|
||
// --------------------------------------------------------------------------- | ||
// Types | ||
|
||
export type ControlUnitData = Omit< | ||
ControlUnit, | ||
| 'administration' | ||
| 'controlUnitContactIds' | ||
| 'controlUnitContacts' | ||
| 'controlUnitResourceIds' | ||
| 'controlUnitResources' | ||
| 'departmentArea' | ||
> | ||
export type NewControlUnitData = Omit<ControlUnitData, 'id'> | ||
|
||
export type ControlUnitContactData = Omit<ControlUnitContact, 'controlUnit'> | ||
export type NewControlUnitContactData = Omit<ControlUnitContactData, 'id'> | ||
|
||
export type ControlUnitResourceData = Omit<ControlUnitResource, 'controlUnit' | 'station'> | ||
export type NewControlUnitResourceData = Omit<ControlUnitResourceData, 'id'> | ||
|
||
export type EngagedControlUnits = { | ||
controlUnit: ControlUnit | ||
missionSources: Mission.MissionSourceEnum[] | ||
}[] | ||
} |
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,7 @@ | ||
export namespace DepartmentArea { | ||
export interface DepartmentArea { | ||
/** `inseeCode` is the ID. */ | ||
inseeCode: string | ||
name: string | ||
} | ||
} |
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,8 @@ | ||
export namespace Mission { | ||
export enum MissionSourceEnum { | ||
MONITORENV = 'MONITORENV', | ||
MONITORFISH = 'MONITORFISH', | ||
POSEIDON_CACEM = 'POSEIDON_CACEM', | ||
POSEIDON_CNSP = 'POSEIDON_CNSP' | ||
} | ||
} |
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,18 @@ | ||
import type { ControlUnit } from './ControlUnit' | ||
|
||
export namespace Station { | ||
export interface Station { | ||
controlUnitResourceIds: number[] | ||
controlUnitResources: ControlUnit.ControlUnitResourceData[] | ||
id: number | ||
latitude: number | ||
longitude: number | ||
name: string | ||
} | ||
|
||
// --------------------------------------------------------------------------- | ||
// Types | ||
|
||
export type StationData = Omit<Station, 'controlUnitResourceIds' | 'controlUnitResources'> | ||
export type NewStationData = Omit<StationData, 'id'> | ||
} |
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