115 lines
3.1 KiB
TypeScript
115 lines
3.1 KiB
TypeScript
import { Schedule as CwSchedule } from "../../generated/prisma/client";
|
|
import { Translation } from "./types";
|
|
|
|
type ApiScheduleRecord = {
|
|
id: number;
|
|
name: string;
|
|
description: string | null;
|
|
closedFlag: boolean;
|
|
reminderFlag: boolean;
|
|
allDayFlag: boolean;
|
|
acknowledgementFlag: boolean;
|
|
meetingFlag: boolean;
|
|
recurringFlag: boolean;
|
|
billableFlag: boolean;
|
|
acknowledgedById: string | null;
|
|
acknowledgedAt: Date | null;
|
|
startDate: Date | null;
|
|
endDate: Date | null;
|
|
hoursScheduled: number | null;
|
|
duration: number | null;
|
|
hoursPerDay: number | null;
|
|
reminderMinutes: number | null;
|
|
statusId: number | null;
|
|
typeId: number | null;
|
|
scheduleSpanId: number | null;
|
|
memberId: string | null;
|
|
updatedById: string | null;
|
|
createdById: string | null;
|
|
closedById: string | null;
|
|
closedAt: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
};
|
|
|
|
export const scheduleTranslation: Translation<CwSchedule, ApiScheduleRecord> = {
|
|
values: [
|
|
{ from: "scheduleRecId", to: "id" },
|
|
{
|
|
from: "scheduleDesc",
|
|
to: "name",
|
|
process: (value) => (value ? value : ""),
|
|
},
|
|
{ from: "scheduleDesc", to: "description" },
|
|
{
|
|
from: "closeFlag",
|
|
to: "closedFlag",
|
|
process: (value) => Boolean(value),
|
|
},
|
|
{
|
|
from: "reminderFlag",
|
|
to: "reminderFlag",
|
|
process: (value) => Boolean(value),
|
|
},
|
|
{
|
|
from: "allDayFlag",
|
|
to: "allDayFlag",
|
|
process: (value) => Boolean(value),
|
|
},
|
|
{
|
|
from: "ackFlag",
|
|
to: "acknowledgementFlag",
|
|
process: (value) => Boolean(value),
|
|
},
|
|
{
|
|
from: "meetingFlag",
|
|
to: "meetingFlag",
|
|
process: (value) => Boolean(value),
|
|
},
|
|
{
|
|
from: "recurringFlag",
|
|
to: "recurringFlag",
|
|
process: (value) => Boolean(value),
|
|
},
|
|
{
|
|
from: "billableFlag",
|
|
to: "billableFlag",
|
|
process: (value) => Boolean(value),
|
|
},
|
|
{ from: "acknowledgedBy", to: "acknowledgedById" },
|
|
{ from: "ackDateUtc", to: "acknowledgedAt" },
|
|
{ from: "dateTimeStartUtc", to: "startDate" },
|
|
{ from: "dateTimeEndUtc", to: "endDate" },
|
|
{
|
|
from: "hoursSched",
|
|
to: "hoursScheduled",
|
|
process: (value) => (value != null ? Number(value) : null),
|
|
},
|
|
{ from: "duration", to: "duration" },
|
|
{
|
|
from: "hoursPerDay",
|
|
to: "hoursPerDay",
|
|
process: (value) => (value != null ? Number(value) : null),
|
|
},
|
|
{ from: "reminderMinutes", to: "reminderMinutes" },
|
|
{ from: "scheduleStatusRecId", to: "statusId" },
|
|
{ from: "scheduleTypeRecId", to: "typeId" },
|
|
{ from: "scheduleSpanRecId", to: "scheduleSpanId" },
|
|
{ from: "memberId", to: "memberId" },
|
|
{ from: "updatedBy", to: "updatedById" },
|
|
{ from: "enteredBy", to: "createdById" },
|
|
{ from: "closedBy", to: "closedById" },
|
|
{ from: "closeDateUtc", to: "closedAt" },
|
|
{
|
|
from: "dateEnteredUtc",
|
|
to: "createdAt",
|
|
process: (value) => (value as Date | null) ?? new Date(0),
|
|
},
|
|
{
|
|
from: "lastUpdateUtc",
|
|
to: "updatedAt",
|
|
process: (value) => (value as Date | null) ?? new Date(0),
|
|
},
|
|
],
|
|
};
|