diff --git a/src/utils/translators/ldb/staffStation.ts b/src/utils/translators/ldb/staffStation.ts new file mode 100644 index 0000000..d5dd100 --- /dev/null +++ b/src/utils/translators/ldb/staffStation.ts @@ -0,0 +1,43 @@ +export type { StaffLdb, NrccMessage, TrainServices, + ServiceLocation } from '@owlboard/ts-types' + +/// I do not yet have a type defined for any of the input object +export function transform(input: Object): StaffLdb { + let output: StaffLdb + return output +} + +function transformNrcc(input: any): NrccMessage[] { + let output: NrccMessage[] = [] + if (!Array.isArray(input?.message)) { + input.message = [input.message] + } + for (const item of input?.message) { + let message = { + severity: item?.severity, + xhtmlMessage: item?.xhtmlMessage + } + output.push(message) + } + return output +} + +function transformTrainServices(input: Object): TrainServices[] { + let output: TrainServices[] + return output +} + +function transformLocation(input: any): ServiceLocation { + let output: ServiceLocation[] = [] + if (!Array.isArray(input)) { + input = [input] + } + for (const item of input) { + const location: ServiceLocation = { + tiploc: item?.tiploc, + name: item?.locationName + } + output.push(location) + } + return output +} \ No newline at end of file