From 7af5503b363c8ce864bd5dd808c7d3cbde8a22d1 Mon Sep 17 00:00:00 2001 From: Dominik Sumer Date: Fri, 10 Nov 2023 11:55:59 +0100 Subject: [PATCH] renaming HolidaysQuota and HolidaysCarryover --- src/clockodo.test.ts | 12 ++++---- src/clockodo.ts | 28 +++++++++---------- src/index.ts | 4 +-- src/mocks.ts | 4 +-- ...ry.mocks.ts => holidaysCarryover.mocks.ts} | 6 ++-- ...{holidayscarry.ts => holidaysCarryover.ts} | 2 +- src/models/holidaysquota.mocks.ts | 6 ++-- src/models/holidaysquota.ts | 7 +---- 8 files changed, 32 insertions(+), 37 deletions(-) rename src/models/{holidayscarry.mocks.ts => holidaysCarryover.mocks.ts} (71%) rename src/models/{holidayscarry.ts => holidaysCarryover.ts} (85%) diff --git a/src/clockodo.test.ts b/src/clockodo.test.ts index 30b93f1a..d0a3e035 100644 --- a/src/clockodo.test.ts +++ b/src/clockodo.test.ts @@ -665,25 +665,25 @@ describe("Clockodo (instance)", () => { }); }); - describe("getHolidaysquota()", () => { - it("correctly builds getHolidaysquota() request", async () => { + describe("getHolidaysQuotas()", () => { + it("correctly builds getHolidaysQuotas() request", async () => { const nockScope = nock(CLOCKODO_API) .get("/holidaysquota?users_id=17") .reply(200, {}); - await clockodo.getHolidaysquota({ usersId: 17 }); + await clockodo.getHolidaysQuotas({ usersId: 17 }); nockScope.done(); }); }); - describe("getHolidayscarry()", () => { - it("correctly builds getHolidayscarry() request", async () => { + describe("getHolidaysCarryovers()", () => { + it("correctly builds getHolidaysCarryovers() request", async () => { const nockScope = nock(CLOCKODO_API) .get("/holidayscarry?users_id=17&year=2028") .reply(200, {}); - await clockodo.getHolidayscarry({ usersId: 17, year: 2028 }); + await clockodo.getHolidaysCarryovers({ usersId: 17, year: 2028 }); nockScope.done(); }); diff --git a/src/clockodo.ts b/src/clockodo.ts index 1f3acaa6..bcf5928b 100644 --- a/src/clockodo.ts +++ b/src/clockodo.ts @@ -42,8 +42,8 @@ import { WorkTimeDay, } from "./models/workTimes.js"; import { OvertimecarryRow } from "./models/overtimecarry.js"; -import { HolidaysquotaRow } from "./models/holidaysquota.js"; -import { HolidayscarryRow } from "./models/holidayscarry.js"; +import { HolidaysQuota } from "./models/holidaysQuota.js"; +import { HolidaysCarryover } from "./models/holidaysCarryover.js"; export class Clockodo { api: Api; @@ -846,15 +846,15 @@ export class Clockodo { return this.api.get("/overtimecarry", params); } - async getHolidaysquota( - params?: Params - ): Promise { + async getHolidaysQuotas( + params?: Params + ): Promise { return this.api.get("/holidaysquota", params); } - async getHolidayscarry( - params?: Params - ): Promise { + async getHolidaysCarryovers( + params?: Params + ): Promise { return this.api.get("/holidayscarry", params); } } @@ -1173,18 +1173,18 @@ export type OvertimecarryRowParams = { year?: number; }; -export type HolidaysquotaRowReturnType = { - holidaysquota: Array; +export type HolidaysQuotasReturnType = { + holidaysquota: Array; }; -export type HolidaysquotaRowParams = { +export type HolidaysQuotasParams = { /** The user ID by which the holidays quota rows should be filtered */ usersId?: number; }; -export type HolidayscarryRowReturnType = { - holidayscarry: Array; +export type HolidaysCarryoversReturnType = { + holidayscarry: Array; }; -export type HolidayscarryRowParams = { +export type HolidaysCarryoversParams = { /** The user ID by which the holidays carry rows should be filtered */ usersId?: number; /** The year to which the data should be restricted to */ diff --git a/src/index.ts b/src/index.ts index 8ef76776..2a260cb4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,8 +6,8 @@ export * from "./models/dateTime.js"; export * from "./models/entriesText.js"; export * from "./models/entry.js"; export * from "./models/entryGroup.js"; -export * from "./models/holidayscarry.js"; -export * from "./models/holidaysquota.js"; +export * from "./models/holidaysCarryover.js"; +export * from "./models/holidaysQuota.js"; export * from "./models/lumpsumService.js"; export * from "./models/nonbusinessDay.js"; export * from "./models/nonbusinessGroup.js"; diff --git a/src/mocks.ts b/src/mocks.ts index 3b831aa6..53369e53 100644 --- a/src/mocks.ts +++ b/src/mocks.ts @@ -4,8 +4,8 @@ export * from "./models/absence.mocks.js"; export * from "./models/customer.mocks.js"; export * from "./models/entry.mocks.js"; // export * from "./models/entryGroup.mocks.js"; -export * from "./models/holidayscarry.mocks.js"; -export * from "./models/holidaysquota.mocks.js"; +export * from "./models/holidaysCarryover.mocks.js"; +export * from "./models/holidaysQuota.mocks.js"; export * from "./models/lumpsumService.mocks.js"; export * from "./models/service.mocks.js"; export * from "./models/nonbusinessDay.mocks.js"; diff --git a/src/models/holidayscarry.mocks.ts b/src/models/holidaysCarryover.mocks.ts similarity index 71% rename from src/models/holidayscarry.mocks.ts rename to src/models/holidaysCarryover.mocks.ts index 296db69f..e3ca59dc 100644 --- a/src/models/holidayscarry.mocks.ts +++ b/src/models/holidaysCarryover.mocks.ts @@ -1,16 +1,16 @@ import { faker } from "@faker-js/faker"; -import { HolidayscarryRow } from "./holidayscarry.js"; +import { HolidaysCarryover } from "./holidaysCarryover.js"; type Options = { count?: number; yearMinMax?: [number, number]; }; -export const createHolidayscarryMocks = ({ +export const createHolidaysCarryoverMocks = ({ count = 1, yearMinMax = [1900, 2024], }: Options = {}) => { - return Array.from({ length: count }, (): HolidayscarryRow => { + return Array.from({ length: count }, (): HolidaysCarryover => { return { usersId: 0, year: faker.datatype.number({ min: yearMinMax[0], max: yearMinMax[1] }), diff --git a/src/models/holidayscarry.ts b/src/models/holidaysCarryover.ts similarity index 85% rename from src/models/holidayscarry.ts rename to src/models/holidaysCarryover.ts index 2badd637..8d920571 100644 --- a/src/models/holidayscarry.ts +++ b/src/models/holidaysCarryover.ts @@ -1,4 +1,4 @@ -export type HolidayscarryRow = { +export type HolidaysCarryover = { /** The related employee's ID */ usersId: number; /** diff --git a/src/models/holidaysquota.mocks.ts b/src/models/holidaysquota.mocks.ts index b858f543..48ca39a7 100644 --- a/src/models/holidaysquota.mocks.ts +++ b/src/models/holidaysquota.mocks.ts @@ -1,5 +1,5 @@ import { faker } from "@faker-js/faker"; -import { HolidaysquotaRow } from "./holidaysquota.js"; +import { HolidaysQuota } from "./holidaysQuota.js"; type Options = { count?: number; @@ -7,12 +7,12 @@ type Options = { yearUntilMinMax?: [number, number]; }; -export const createHolidaysquotaMocks = ({ +export const createHolidaysQuotaMocks = ({ count = 1, yearSinceMinMax = [2020, 2021], yearUntilMinMax = [2021, 2022], }: Options = {}) => { - return Array.from({ length: count }, (_, index): HolidaysquotaRow => { + return Array.from({ length: count }, (_, index): HolidaysQuota => { const id = index; return { diff --git a/src/models/holidaysquota.ts b/src/models/holidaysquota.ts index 0d5bffeb..9c248eb6 100644 --- a/src/models/holidaysquota.ts +++ b/src/models/holidaysquota.ts @@ -1,4 +1,4 @@ -export type HolidaysquotaRow = { +export type HolidaysQuota = { /** The ID of the holiday quota settings */ id: number; /** The related employee's ID */ @@ -15,8 +15,3 @@ export type HolidaysquotaRow = { count: number; note: string | null; }; - -/** - * @deprecated Please use HolidaysquotaRow type - */ -export type HolidayquotaRow = HolidaysquotaRow;