diff --git a/src/clockodo.ts b/src/clockodo.ts index 0fe3db8b..ecae70b6 100644 --- a/src/clockodo.ts +++ b/src/clockodo.ts @@ -41,6 +41,7 @@ import { WorkTimeChangeRequestStatus, WorkTimeDay, } from "./models/workTimes.js"; +import { OvertimecarryRow } from "./models/overtimecarry.js"; export class Clockodo { api: Api; @@ -765,6 +766,12 @@ export class Clockodo { remainingParams ); } + + async getOvertimecarry( + params?: Params + ): Promise { + return this.api.get("/overtimecarry", params); + } } export type AbsenceReturnType = { absence: Absence }; @@ -1053,3 +1060,13 @@ export type AddWorkTimesChangeRequestReturnType = **/ replacedChangeRequest: null; }; + +export type OvertimecarryRowReturnType = { + overtimecarry: Array; +}; +export type OvertimecarryRowParams = { + /** The user ID by which the overtime carry rows should be filtered */ + usersId?: number; + /** The year to which the data should be restricted to */ + year?: number; +}; diff --git a/src/index.ts b/src/index.ts index f7c29bf8..8ef76776 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ export * from "./models/holidaysquota.js"; export * from "./models/lumpsumService.js"; export * from "./models/nonbusinessDay.js"; export * from "./models/nonbusinessGroup.js"; +export * from "./models/overtimecarry.js"; export * from "./models/project.js"; export * from "./models/service.js"; export * from "./models/targethours.js"; diff --git a/src/mocks.ts b/src/mocks.ts index c9b9646e..fdae7fa8 100644 --- a/src/mocks.ts +++ b/src/mocks.ts @@ -8,6 +8,7 @@ export * from "./models/entry.mocks.js"; // export * from "./models/holidaysquota.mocks.js"; export * from "./models/lumpsumService.mocks.js"; export * from "./models/nonbusinessDay.mocks.js"; +export * from "./models/overtimecarry.mocks.js"; export * from "./models/project.mocks.js"; // export * from "./models/service.mocks.js"; export * from "./models/targethours.mocks.js"; diff --git a/src/models/overtimecarry.mocks.ts b/src/models/overtimecarry.mocks.ts new file mode 100644 index 00000000..cb30d58f --- /dev/null +++ b/src/models/overtimecarry.mocks.ts @@ -0,0 +1,16 @@ +import { faker } from "@faker-js/faker"; +import { OvertimecarryRow } from "./overtimecarry.js"; + +export const createOvertimecarryMocks = ({ + count = 1, + usersId = 0, +}: { count?: number; usersId?: number } = {}) => { + return Array.from({ length: count }, (): OvertimecarryRow => { + return { + usersId, + year: faker.datatype.number({ min: 1900, max: 2024 }), + note: faker.datatype.boolean() ? faker.lorem.sentences(2) : null, + hours: faker.datatype.number({ min: 0, max: 100 }), + }; + }); +}; diff --git a/src/models/overtimecarry.ts b/src/models/overtimecarry.ts new file mode 100644 index 00000000..7053c693 --- /dev/null +++ b/src/models/overtimecarry.ts @@ -0,0 +1,12 @@ +export type OvertimecarryRow = { + /** The related employee's ID */ + usersId: number; + /** + * Year for which the overtime carryover applies + * Format YYYY + */ + year: number; + /** Number of hours */ + hours: number; + note: string | null; +};