Skip to content

Commit

Permalink
fix: Improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
KW-clickbits committed Apr 29, 2021
1 parent 73003d1 commit 9266392
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions src/internals/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,14 @@ export type User = {
timezone: string;
};

export enum EntryType {
TimeEntry = 1,
UnitLumpsumEntry = 2,
LumpsumEntry = 3,
}
const timeEntryType = 1;
const unitLumpsumEntryType = 2;
const lumpSumEntryType = 3;

type BaseEntry = {
id: number;
customersId: number | 0;
projectsId: number | 0;
projectsId: number | null;
usersId: number;
billable: 0 | 1 | 2;
textsId: number | null;
Expand All @@ -84,7 +82,7 @@ type BaseEntry = {
};

export type TimeEntry = BaseEntry & {
type: EntryType.TimeEntry;
type: typeof timeEntryType;
servicesId: number;
servicesName?: string; // deprecated
duration: number;
Expand All @@ -97,14 +95,14 @@ export type TimeEntry = BaseEntry & {
};

export type LumpsumEntry = BaseEntry & {
type: EntryType.LumpsumEntry;
type: typeof lumpSumEntryType;
servicesId: number;
servicesName?: string; // deprecated
lumpsum: number;
};

export type UnitLumpsumEntry = BaseEntry & {
type: EntryType.UnitLumpsumEntry;
type: typeof unitLumpsumEntryType;
lumpsumsId: number;
lumpsumsAmount: number;
lumpsumsPrice?: number;
Expand Down Expand Up @@ -266,21 +264,6 @@ export type TargetHoursRow = {
workdaySunday: boolean;
};

export type HolidayQuotasRow = {
id: number;
usersId: number;
yearSince: number;
yearUntil: number;
count: number;
};

export type HolidaysCarryRow = {
usersId: number;
year: number;
count: number;
note: string;
};

export type Paging = {
itemsPerPage: number;
currentPage: number;
Expand Down

0 comments on commit 9266392

Please sign in to comment.