(dc): move types.ts to database module

This commit is contained in:
Marcel Arndt 2024-07-18 13:43:53 +02:00
parent 62eafe44dd
commit fd8b230fa4
3 changed files with 460 additions and 990 deletions

View File

@ -1,535 +0,0 @@
import type { ColumnType } from "kysely";
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S, I | undefined, U>
: ColumnType<T, T | undefined, T>;
export type Timestamp = ColumnType<Date, Date | string, Date | string>;
export const TicketState = {
CREATED: "CREATED",
APPROVAL_REQUIRED: "APPROVAL_REQUIRED",
READY: "READY",
DONE: "DONE",
BILLABLE: "BILLABLE",
ARCHIVED: "ARCHIVED"
} as const;
export type TicketState = (typeof TicketState)[keyof typeof TicketState];
export const TicketValidationState = {
CREATED: "CREATED",
USER_INTERACTION_REQUIRED: "USER_INTERACTION_REQUIRED",
TD_UNCERTAIN: "TD_UNCERTAIN",
DOCUMENTS_MISSING: "DOCUMENTS_MISSING",
ARCHIVED: "ARCHIVED"
} as const;
export type TicketValidationState = (typeof TicketValidationState)[keyof typeof TicketValidationState];
export const ApprovalState = {
UNKNOWN: "UNKNOWN",
FREE: "FREE",
REQUIRED: "REQUIRED",
REQUESTED: "REQUESTED",
APPROVED: "APPROVED"
} as const;
export type ApprovalState = (typeof ApprovalState)[keyof typeof ApprovalState];
export const CostTypeVariant = {
NACHTZUSCHLAG: "NACHTZUSCHLAG",
WOCHENENDZUSCHLAG: "WOCHENENDZUSCHLAG",
FEIERTAGSZUSCHLAG: "FEIERTAGSZUSCHLAG",
DESINFEKTIONSZUSCHLAG: "DESINFEKTIONSZUSCHLAG",
KILOMETERZUSCHLAG: "KILOMETERZUSCHLAG",
FAHRZEUGZUSCHLAG: "FAHRZEUGZUSCHLAG",
TSWDIFFERENZIERUNG: "TSWDIFFERENZIERUNG",
GRUNDPREIS: "GRUNDPREIS"
} as const;
export type CostTypeVariant = (typeof CostTypeVariant)[keyof typeof CostTypeVariant];
export type Anomaly = {
id: string;
type: string;
description: string;
groupKey: string;
groupDescription: string;
workedOnBy: string;
sleepTimer: number;
sleepSince: Timestamp | null;
resolvedAt: Timestamp | null;
manuallyResolved: Generated<boolean>;
createdAt: Generated<Timestamp>;
};
export type AttendanceRegistration = {
attendanceRegistrationId: number;
employeeId: number;
personnelNumber: string;
dateTime: Timestamp;
event: string;
};
export type AttendanceRegistrationSource = {
internalId: Generated<string>;
insertedAt: Generated<Timestamp>;
jobId: string;
attendanceRegistrationId: string | null;
employeeId: string | null;
personnelNumber: string | null;
dateTime: string | null;
event: string | null;
};
export type AttendanceRegistrationStaging = {
internalId: Generated<string>;
attendanceRegistrationId: number;
employeeId: number;
dateTime: Timestamp;
event: string;
};
export type AvicennaTenant = {
id: Generated<string>;
healthInsuranceNumber: string;
name: string;
};
export type AvicennaTenantToTariffGroup = {
A: string;
B: string;
};
export type CostType = {
id: Generated<string>;
description: string;
variant: CostTypeVariant;
costAmount: number;
timeRange: string | null;
kmInclusive: number | null;
excludeCarNames: string[];
infectionType: string | null;
tariffId: string | null;
};
export type DyflexisEmployee = {
id: number;
firstname: string;
surname: string;
contractStart: Timestamp;
contractEnd: Timestamp | null;
contractHoursWeek: number;
contractSalaryHour: number;
};
export type Employee = {
id: string;
name: string;
surname: string;
personnelNumber: string | null;
mobile: string | null;
qualification: string | null;
occuptationalHealthExamination: Timestamp | null;
personTransportCertificate: Timestamp | null;
};
export type EmployeeDispoLiveSource = {
internalId: Generated<string>;
insertedAt: Generated<Timestamp>;
jobId: string;
id: string | null;
pScheinAblaufDatum: string | null;
name: string | null;
surname: string | null;
persId: string | null;
importPersId: string | null;
qualifikation: string | null;
};
export type EmployeeDispoLiveStaging = {
internalId: Generated<string>;
id: string;
name: string | null;
surname: string | null;
personnelNumber: string | null;
qualification: string | null;
personTransportCertificate: Timestamp | null;
};
export type EmployeeDyflexisSource = {
internalId: Generated<string>;
insertedAt: Generated<Timestamp>;
jobId: string;
id: string | null;
firstname: string | null;
surname: string | null;
contract_id: string | null;
contract_start: string | null;
contract_end: string | null;
contract_hours_week: string | null;
contract_salary_hour: string | null;
};
export type EmployeeDyflexisStaging = {
internalId: Generated<string>;
id: number;
firstname: string;
surname: string;
contractStart: Timestamp;
contractEnd: Timestamp;
contractHoursWeek: number;
contractSalaryHour: number;
};
export type Patient = {
id: string;
surname: string | null;
name: string | null;
street: string | null;
zip: string | null;
city: string | null;
birthday: Timestamp | null;
healthinsuranceId: string | null;
healthinsurance: string | null;
careDegree: string | null;
disabilityMark1: string | null;
disabilityMark2: string | null;
};
export type PatientSource = {
internalId: Generated<string>;
insertedAt: Generated<Timestamp>;
jobId: string;
id: string | null;
surname: string | null;
name: string | null;
street: string | null;
zip: string | null;
city: string | null;
birthday: string | null;
kkId: string | null;
krankenkasse: string | null;
pflegestufe: string | null;
behinderung1: string | null;
behinderung2: string | null;
};
export type PatientStaging = {
internalId: Generated<string>;
id: string | null;
surname: string | null;
name: string | null;
street: string | null;
zip: string | null;
city: string | null;
birthday: Timestamp | null;
healthinsuranceId: string | null;
healthinsurance: string | null;
careDegree: string | null;
disabilityMark1: string | null;
disabilityMark2: string | null;
};
export type PlannedTime = {
id: string;
userId: string;
firstname: string | null;
surname: string | null;
startDate: Timestamp | null;
endDate: Timestamp | null;
department: string | null;
pause: number;
duration: number;
note: string | null;
};
export type PlannedTimeSource = {
internalId: Generated<string>;
insertedAt: Generated<Timestamp>;
jobId: string;
id: string | null;
user_id: string | null;
firstname: string | null;
surname: string | null;
department_id: string | null;
department_name: string | null;
start_date: string | null;
end_date: string | null;
pauze: string | null;
duration: string | null;
deleted: string | null;
mark: string | null;
};
export type PlannedTimeStaging = {
internalId: Generated<string>;
id: number;
employeeId: number;
firstname: string | null;
surname: string | null;
departmentName: string | null;
startDate: Timestamp;
endDate: Timestamp;
deleted: boolean;
mark: string | null;
};
export type SolutionTarget = {
id: Generated<string>;
name: string;
anomalyId: string | null;
};
export type SolutionTargetStep = {
id: Generated<string>;
description: string;
solutionTargetId: string | null;
};
export type Tariff = {
id: Generated<string>;
validFrom: Timestamp | null;
validTo: Timestamp | null;
tariffGroupId: string | null;
};
export type TariffGroup = {
id: Generated<string>;
description: string;
ordinanceType: string;
};
export type Ticket = {
id: Generated<string>;
currentState: TicketValidationState;
notes: string[];
errors: string[];
isUrgent: Generated<boolean>;
urgency: Generated<Timestamp>;
approvalState: ApprovalState | null;
documentInfo: Generated<unknown | null>;
createdAt: Generated<Timestamp>;
};
export type TicketStateHistory = {
id: Generated<string>;
state: TicketValidationState;
createdAt: Generated<Timestamp>;
ticketId: string;
};
export type Tour = {
id: Generated<string>;
done: boolean;
direction: string;
carName: string | null;
operationId: string;
driverId: string | null;
driverName: string | null;
codriverId: string | null;
codriverName: string | null;
patientId: string | null;
patientName: string | null;
patientSurname: string | null;
patientStreet: string | null;
patientZip: string | null;
patientCity: string | null;
healthInsurance: string | null;
healthInsuranceNumber: string | null;
type: string | null;
category: string | null;
transportType: string | null;
ordinanceType: string | null;
rangeEndDate: Timestamp | null;
startInstitution: string | null;
startStreet: string | null;
startZip: string | null;
startCity: string | null;
targetInstitution: string | null;
targetStreet: string | null;
targetZip: string | null;
targetCity: string | null;
startDate: Timestamp;
check: Generated<number>;
occupiedKm: number | null;
totalKm: number | null;
startBegin: string | null;
startEnd: string | null;
target: string | null;
targetBegin: string | null;
empty: string | null;
hasInfection: Generated<boolean>;
infectionName: string | null;
revenueDispoLive: number | null;
billDate: Timestamp | null;
billNumber: string | null;
revenue: Generated<number>;
consumptionCosts: Generated<number>;
revenueDeviation: Generated<number>;
createdAt: Timestamp | null;
deletedAt: Timestamp | null;
ticketId: string | null;
};
export type TourSource = {
internalId: Generated<string>;
insertedAt: Generated<Timestamp>;
jobId: string;
id: string | null;
check: string | null;
createTime: string | null;
empfangenVonId: string | null;
endgen: string | null;
serienId: string | null;
serienKategorName: string | null;
serienKategorie: string | null;
zadStatus: string | null;
abrDate: string | null;
abrNum: string | null;
abrTime: string | null;
ausrueckZeit: string | null;
startTime: string | null;
startDate: string | null;
date: string | null;
date_iso: string | null;
dauergenehmigung: string | null;
direction: string | null;
distanceValue: string | null;
besetztKm: string | null;
gefahren: string | null;
gesamtPreis: string | null;
infektion: string | null;
itDesc: string | null;
itKrz: string | null;
itName: string | null;
kkId: string | null;
krankenkasse: string | null;
patId: string | null;
patName: string | null;
patSurname: string | null;
patStreet: string | null;
patZip: string | null;
patCity: string | null;
startInstitution: string | null;
startStreet: string | null;
startZip: string | null;
startCity: string | null;
targetInstitution: string | null;
targetStreet: string | null;
targetZip: string | null;
targetCity: string | null;
transportKrz: string | null;
transportName: string | null;
transportart: string | null;
verordnungsId: string | null;
verordnungsName: string | null;
type: string | null;
startBegin: string | null;
startEnd: string | null;
frei: string | null;
ziel: string | null;
zielBegin: string | null;
endTime: string | null;
endDate: string | null;
einsatzNummer: string | null;
carName: string | null;
carNo: string | null;
beifahrerName: string | null;
beifahrer: string | null;
fahrerName: string | null;
fahrer: string | null;
color: string | null;
};
export type TourStaging = {
internalId: Generated<string>;
id: string | null;
done: boolean | null;
direction: string | null;
carName: string | null;
operationId: string | null;
driverId: string | null;
driverName: string | null;
codriverId: string | null;
codriverName: string | null;
patientId: string | null;
patientName: string | null;
patientSurname: string | null;
patientStreet: string | null;
patientZip: string | null;
patientCity: string | null;
healthInsurance: string | null;
healthInsuranceNumber: string | null;
type: string | null;
category: string | null;
transportType: string | null;
ordinanceType: string | null;
rangeEndDate: Timestamp | null;
startInstitution: string | null;
startStreet: string | null;
startZip: string | null;
startCity: string | null;
targetInstitution: string | null;
targetStreet: string | null;
targetZip: string | null;
targetCity: string | null;
startDate: Timestamp | null;
check: Generated<number>;
occupiedKm: number | null;
totalKm: number | null;
startBegin: string | null;
startEnd: string | null;
target: string | null;
targetBegin: string | null;
empty: string | null;
hasInfection: Generated<boolean>;
infectionName: string | null;
revenueDispoLive: number | null;
billDate: Timestamp | null;
billNumber: string | null;
revenue: Generated<number>;
revenueDeviation: Generated<number>;
consumptionCosts: Generated<number>;
createdAt: Timestamp | null;
};
export type Trace = {
id: Generated<string>;
type: string;
entityKey: string;
createdAt: Generated<Timestamp>;
};
export type WorkTime = {
id: string;
userId: string;
firstname: string;
surname: string;
startDate: Timestamp | null;
endDate: Timestamp | null;
department: string | null;
pause: number;
duration: number;
};
export type WorkTimeSource = {
internalId: Generated<string>;
insertedAt: Generated<Timestamp>;
jobId: string;
id: string | null;
user_id: string | null;
firstname: string | null;
surname: string | null;
department_id: string | null;
department_name: string | null;
start_date: string | null;
end_date: string | null;
pauze: string | null;
duration: string | null;
};
export type WorkTimeStaging = {
internalId: Generated<string>;
id: number;
employeeId: number;
firstname: string;
surname: string;
departmentName: string | null;
startDate: Timestamp;
endDate: Timestamp;
};
export type DB = {
_AvicennaTenantToTariffGroup: AvicennaTenantToTariffGroup;
Anomaly: Anomaly;
AttendanceRegistration: AttendanceRegistration;
AttendanceRegistrationSource: AttendanceRegistrationSource;
AttendanceRegistrationStaging: AttendanceRegistrationStaging;
AvicennaTenant: AvicennaTenant;
CostType: CostType;
DyflexisEmployee: DyflexisEmployee;
Employee: Employee;
EmployeeDispoLiveSource: EmployeeDispoLiveSource;
EmployeeDispoLiveStaging: EmployeeDispoLiveStaging;
EmployeeDyflexisSource: EmployeeDyflexisSource;
EmployeeDyflexisStaging: EmployeeDyflexisStaging;
Patient: Patient;
PatientSource: PatientSource;
PatientStaging: PatientStaging;
PlannedTime: PlannedTime;
PlannedTimeSource: PlannedTimeSource;
PlannedTimeStaging: PlannedTimeStaging;
SolutionTarget: SolutionTarget;
SolutionTargetStep: SolutionTargetStep;
Tariff: Tariff;
TariffGroup: TariffGroup;
Ticket: Ticket;
TicketStateHistory: TicketStateHistory;
Tour: Tour;
TourSource: TourSource;
TourStaging: TourStaging;
Trace: Trace;
WorkTime: WorkTime;
WorkTimeSource: WorkTimeSource;
WorkTimeStaging: WorkTimeStaging;
};

View File

@ -13,7 +13,7 @@ generator kysely {
provider = "prisma-kysely"
previewFeatures = ["postgresqlExtensions"]
output = "../libs/api/data-access-database/src/lib"
output = "../src/core/database"
fileName = "types.ts"
}

View File

@ -1,47 +1,45 @@
import type { ColumnType } from 'kysely';
import type { ColumnType } from "kysely";
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S, I | undefined, U>
: ColumnType<T, T | undefined, T>;
export type Timestamp = ColumnType<Date, Date | string, Date | string>;
export const CostTypeVariant = {
NACHTZUSCHLAG: 'NACHTZUSCHLAG',
WOCHENENDZUSCHLAG: 'WOCHENENDZUSCHLAG',
FEIERTAGSZUSCHLAG: 'FEIERTAGSZUSCHLAG',
DESINFEKTIONSZUSCHLAG: 'DESINFEKTIONSZUSCHLAG',
KILOMETERZUSCHLAG: 'KILOMETERZUSCHLAG',
FAHRZEUGZUSCHLAG: 'FAHRZEUGZUSCHLAG',
TSWDIFFERENZIERUNG: 'TSWDIFFERENZIERUNG',
GRUNDPREIS: 'GRUNDPREIS',
} as const;
export type CostTypeVariant =
(typeof CostTypeVariant)[keyof typeof CostTypeVariant];
export const TicketState = {
CREATED: 'CREATED',
APPROVAL_REQUIRED: 'APPROVAL_REQUIRED',
READY: 'READY',
DONE: 'DONE',
BILLABLE: 'BILLABLE',
ARCHIVED: 'ARCHIVED',
CREATED: "CREATED",
APPROVAL_REQUIRED: "APPROVAL_REQUIRED",
READY: "READY",
DONE: "DONE",
BILLABLE: "BILLABLE",
ARCHIVED: "ARCHIVED"
} as const;
export type TicketState = (typeof TicketState)[keyof typeof TicketState];
export const TicketValidationState = {
CREATED: 'CREATED',
USER_INTERACTION_REQUIRED: 'USER_INTERACTION_REQUIRED',
TD_UNCERTAIN: 'TD_UNCERTAIN',
DOCUMENTS_MISSING: 'DOCUMENTS_MISSING',
ARCHIVED: 'ARCHIVED',
CREATED: "CREATED",
USER_INTERACTION_REQUIRED: "USER_INTERACTION_REQUIRED",
TD_UNCERTAIN: "TD_UNCERTAIN",
DOCUMENTS_MISSING: "DOCUMENTS_MISSING",
ARCHIVED: "ARCHIVED"
} as const;
export type TicketValidationState =
(typeof TicketValidationState)[keyof typeof TicketValidationState];
export type TicketValidationState = (typeof TicketValidationState)[keyof typeof TicketValidationState];
export const ApprovalState = {
UNKNOWN: 'UNKNOWN',
FREE: 'FREE',
REQUIRED: 'REQUIRED',
REQUESTED: 'REQUESTED',
APPROVED: 'APPROVED',
UNKNOWN: "UNKNOWN",
FREE: "FREE",
REQUIRED: "REQUIRED",
REQUESTED: "REQUESTED",
APPROVED: "APPROVED"
} as const;
export type ApprovalState = (typeof ApprovalState)[keyof typeof ApprovalState];
export const CostTypeVariant = {
NACHTZUSCHLAG: "NACHTZUSCHLAG",
WOCHENENDZUSCHLAG: "WOCHENENDZUSCHLAG",
FEIERTAGSZUSCHLAG: "FEIERTAGSZUSCHLAG",
DESINFEKTIONSZUSCHLAG: "DESINFEKTIONSZUSCHLAG",
KILOMETERZUSCHLAG: "KILOMETERZUSCHLAG",
FAHRZEUGZUSCHLAG: "FAHRZEUGZUSCHLAG",
TSWDIFFERENZIERUNG: "TSWDIFFERENZIERUNG",
GRUNDPREIS: "GRUNDPREIS"
} as const;
export type CostTypeVariant = (typeof CostTypeVariant)[keyof typeof CostTypeVariant];
export type Anomaly = {
id: string;
type: string;
@ -100,12 +98,11 @@ export type CostType = {
tariffId: string | null;
};
export type DyflexisEmployee = {
id: Generated<string>;
userId: string;
id: number;
firstname: string;
surname: string;
contractStart: string;
contractEnd: string | null;
contractStart: Timestamp;
contractEnd: Timestamp | null;
contractHoursWeek: number;
contractSalaryHour: number;
};
@ -131,6 +128,15 @@ export type EmployeeDispoLiveSource = {
importPersId: string | null;
qualifikation: string | null;
};
export type EmployeeDispoLiveStaging = {
internalId: Generated<string>;
id: string;
name: string | null;
surname: string | null;
personnelNumber: string | null;
qualification: string | null;
personTransportCertificate: Timestamp | null;
};
export type EmployeeDyflexisSource = {
internalId: Generated<string>;
insertedAt: Generated<Timestamp>;
@ -144,7 +150,7 @@ export type EmployeeDyflexisSource = {
contract_hours_week: string | null;
contract_salary_hour: string | null;
};
export type EmployeeStaging = {
export type EmployeeDyflexisStaging = {
internalId: Generated<string>;
id: number;
firstname: string;
@ -153,8 +159,6 @@ export type EmployeeStaging = {
contractEnd: Timestamp;
contractHoursWeek: number;
contractSalaryHour: number;
personTransportCertificate: Timestamp | null;
qualification: string | null;
};
export type Patient = {
id: string;
@ -506,8 +510,9 @@ export type DB = {
DyflexisEmployee: DyflexisEmployee;
Employee: Employee;
EmployeeDispoLiveSource: EmployeeDispoLiveSource;
EmployeeDispoLiveStaging: EmployeeDispoLiveStaging;
EmployeeDyflexisSource: EmployeeDyflexisSource;
EmployeeStaging: EmployeeStaging;
EmployeeDyflexisStaging: EmployeeDyflexisStaging;
Patient: Patient;
PatientSource: PatientSource;
PatientStaging: PatientStaging;