Skip to content

Commit

Permalink
renaming HolidaysQuota and HolidaysCarryover
Browse files Browse the repository at this point in the history
  • Loading branch information
dsumer committed Nov 10, 2023
1 parent 4b3ad0a commit 7af5503
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 37 deletions.
12 changes: 6 additions & 6 deletions src/clockodo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
28 changes: 14 additions & 14 deletions src/clockodo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -846,15 +846,15 @@ export class Clockodo {
return this.api.get("/overtimecarry", params);
}

async getHolidaysquota(
params?: Params<HolidaysquotaRowParams>
): Promise<HolidaysquotaRowReturnType> {
async getHolidaysQuotas(
params?: Params<HolidaysQuotasParams>
): Promise<HolidaysQuotasReturnType> {
return this.api.get("/holidaysquota", params);
}

async getHolidayscarry(
params?: Params<HolidayscarryRowParams>
): Promise<HolidayscarryRowReturnType> {
async getHolidaysCarryovers(
params?: Params<HolidaysCarryoversParams>
): Promise<HolidaysCarryoversReturnType> {
return this.api.get("/holidayscarry", params);
}
}
Expand Down Expand Up @@ -1173,18 +1173,18 @@ export type OvertimecarryRowParams = {
year?: number;
};

export type HolidaysquotaRowReturnType = {
holidaysquota: Array<HolidaysquotaRow>;
export type HolidaysQuotasReturnType = {
holidaysquota: Array<HolidaysQuota>;
};
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<HolidayscarryRow>;
export type HolidaysCarryoversReturnType = {
holidayscarry: Array<HolidaysCarryover>;
};
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 */
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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] }),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type HolidayscarryRow = {
export type HolidaysCarryover = {
/** The related employee's ID */
usersId: number;
/**
Expand Down
6 changes: 3 additions & 3 deletions src/models/holidaysquota.mocks.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { faker } from "@faker-js/faker";
import { HolidaysquotaRow } from "./holidaysquota.js";
import { HolidaysQuota } from "./holidaysQuota.js";

type Options = {
count?: number;
yearSinceMinMax?: [number, number];
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 {
Expand Down
7 changes: 1 addition & 6 deletions src/models/holidaysquota.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type HolidaysquotaRow = {
export type HolidaysQuota = {
/** The ID of the holiday quota settings */
id: number;
/** The related employee's ID */
Expand All @@ -15,8 +15,3 @@ export type HolidaysquotaRow = {
count: number;
note: string | null;
};

/**
* @deprecated Please use HolidaysquotaRow type
*/
export type HolidayquotaRow = HolidaysquotaRow;

0 comments on commit 7af5503

Please sign in to comment.