feat: add updatedAt field to tour from DL Api

This commit is contained in:
Marcel Arndt 2025-06-30 07:53:53 +02:00
parent 5f37743019
commit b9fd09a79f
10 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,8 @@
-- AlterTable
ALTER TABLE "Tour" ADD COLUMN "updatedAt" TIMESTAMP(3);
-- AlterTable
ALTER TABLE "TourSource" ADD COLUMN "lastUpdate" TEXT;
-- AlterTable
ALTER TABLE "TourStaging" ADD COLUMN "updatedAt" TIMESTAMP(3);

View File

@ -31,6 +31,7 @@ model TourSource {
id String?
check String?
createTime String? // yyyy-MM-dd HH:mm:ss 'Europe/Berlin'
lastUpdate String? // yyyy-MM-dd HH:mm:ss 'Europe/Berlin'
empfangenVonId String?
endgen String? // yyyy-MM-dd
serienId String?
@ -256,6 +257,7 @@ model TourStaging {
consumptionCosts Float @default(0)
createdAt DateTime?
updatedAt DateTime?
}
model PatientStaging {
@ -394,6 +396,7 @@ model Tour {
revenueDeviation Float @default(0)
createdAt DateTime?
updatedAt DateTime?
deletedAt DateTime?
Ticket Ticket? @relation(fields: [ticketId], references: [id])
ticketId String? @db.Uuid

View File

@ -364,6 +364,7 @@ type Tour {
totalKm: Float!
transportType: String
type: String!
updatedAt: DateTime
}
type TourCostBreakdown {

View File

@ -337,6 +337,7 @@ export type Tour = {
consumptionCosts: Generated<number>;
revenueDeviation: Generated<number>;
createdAt: Timestamp | null;
updatedAt: Timestamp | null;
deletedAt: Timestamp | null;
ticketId: string | null;
};
@ -347,6 +348,7 @@ export type TourSource = {
id: string | null;
check: string | null;
createTime: string | null;
lastUpdate: string | null;
empfangenVonId: string | null;
endgen: string | null;
serienId: string | null;
@ -459,6 +461,7 @@ export type TourStaging = {
revenueDeviation: Generated<number>;
consumptionCosts: Generated<number>;
createdAt: Timestamp | null;
updatedAt: Timestamp | null;
};
export type Trace = {
id: Generated<string>;

View File

@ -98,6 +98,8 @@ export class TourObjectType implements Tour {
@Field({ nullable: true })
createdAt: Date | null;
@Field({ nullable: true })
updatedAt: Date | null;
@Field({ nullable: true })
deletedAt: Date | null;
@Field(() => Boolean, { nullable: true })

View File

@ -100,6 +100,7 @@ export class DispoLiveExtractorsService {
_id,
check,
createTime,
lastUpdate,
empfangenVonId,
endgen,
serienId,
@ -166,6 +167,7 @@ export class DispoLiveExtractorsService {
id: _id ? `${_id}` : undefined,
check: check ? `${check}` : undefined,
createTime: createTime ? `${createTime}` : undefined,
lastUpdate: lastUpdate ? `${lastUpdate}` : undefined,
empfangenVonId: empfangenVonId
? `${empfangenVonId}`
: undefined,

View File

@ -2,6 +2,7 @@ export interface TourRaw {
_id?: string;
check?: string;
createTime?: string; // yyyy-MM-dd HH:mm:ss 'Europe/Berlin' OR yyyy-MM-dd 'Europe/Berlin'
lastUpdate?: string; // yyyy-MM-dd HH:mm:ss 'Europe/Berlin'
empfangenVonId?: string;
endgen?: string; // yyyy-MM-dd
serienId?: string;
@ -140,3 +141,11 @@ export interface EmployeeDyflexisRaw {
contract_hours_week?: string; // Float string
contract_salary_hour?: string; // Float string
}
export interface TourSummaryDto {
_id: string;
date: string; // yyyy-MM-dd
einsatznummer: string;
check: string;
lastUpdate?: string;
}

View File

@ -94,6 +94,7 @@ export class TourLoader {
billDate,
billNumber,
createdAt,
updatedAt
} = tour;
return {
@ -145,6 +146,7 @@ export class TourLoader {
billDate,
billNumber,
createdAt,
updatedAt,
...(ticketId ? { ticketId } : {}),
};
}

View File

@ -57,6 +57,7 @@ export interface TourPreStaging {
consumptionCosts?: number;
createdAt?: Date;
updatedAt?: Date;
}
export interface PatientPreStaging {

View File

@ -57,6 +57,11 @@ export class TourTransformer {
: transformProperties(parseCETDateTime('yyyy-MM-dd'))(
pick(['createTime'])(tourSource),
)),
...(tourSource.lastUpdate
? transformProperties(parseCETDateTime('yyyy-MM-dd HH:mm:ss'))(
pick(['lastUpdate'])(tourSource),
)
: undefined),
...transformProperties(parseBoolean)(
pick(['infektion', 'gefahren'])(tourSource),
),
@ -107,6 +112,7 @@ export class TourTransformer {
abrDate,
abrNum,
createTime,
lastUpdate,
} = tourParsed;
return {
@ -155,6 +161,7 @@ export class TourTransformer {
billDate: abrDate,
billNumber: abrNum,
createdAt: createTime,
updatedAt: lastUpdate,
revenue: 0,
consumptionCosts: 0,
} as unknown as TourPreStaging;