Skip to content

QUACK-5912 Paid breaks #943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@timetac/js-client-library",
"version": "2.102.0",
"version": "2.98.0-paid-breaks-beta-3",
"description": "TimeTac API JS client library",
"homepage": "https://github.com/TimeTac/js-client-library#readme",
"repository": {
Expand Down
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import { WorkingTimeCyclesEndpoint } from './workingTimeCycles';
import { TimeTrackingChangelogsEndPoint } from './timeTrackingChangelogs';
import { UserPreferencesEndpoint } from './userPreferences';
import { CalculationStatesEndpoint } from './calculationStates';
import { PaidBreaksHistoryEndpoint } from './paidBreaksHistory';
import { OtherPaidLeaveLimitationsEndpoint } from './otherPaidLeaveLimitations';

export { AbsenceBan } from './absenceBans/types';
Expand Down Expand Up @@ -217,8 +218,8 @@ export { UserEvent, UserEventCreate } from './userEvents/types';
export { CalculationStates } from './calculationStates/types';
export * from './workingTimeBalanceRules/types';
export * from './workingTimeCycles/types';

export * from './timeTrackingChangelogs/types';
export * from './paidBreaksHistory/types';

const DEFAULT_HOST = 'api.timetac.com';

Expand Down Expand Up @@ -318,6 +319,7 @@ export default class Api {
public workingTimeCycles: WorkingTimeCyclesEndpoint;
public userPreferences: UserPreferencesEndpoint;
public calculationStates: CalculationStatesEndpoint;
public paidBreaksHistory: PaidBreaksHistoryEndpoint;
public otherPaidLeaveLimitations: OtherPaidLeaveLimitationsEndpoint;

constructor(config: ApiConfig) {
Expand Down Expand Up @@ -413,6 +415,8 @@ export default class Api {

this.holidayAdjustment = new HolidayAdjustmentEndpoint(this.config);
this.hourTypes = new HourTypesEndpoint(this.config);
this.paidBreaksHistory = new PaidBreaksHistoryEndpoint(this.config);

useInterceptors({ state: this.state, config: this.config, authentication: this.authentication });
}

Expand Down
8 changes: 8 additions & 0 deletions src/paidBreaksHistory/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import BaseApi from '../baseApi';

const resourceName = 'paidBreaksHistory';
type ResourceName = typeof resourceName;

export class PaidBreaksHistoryEndpoint extends BaseApi<ResourceName> {
public readonly resourceName = resourceName;
}
7 changes: 7 additions & 0 deletions src/paidBreaksHistory/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type PaidBreaksHistory = {
id: number;
user_id: number;
quota_value: number;
valid_from: string;
created_at: string;
};
4 changes: 4 additions & 0 deletions src/timesheetAccountings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export type TimesheetAccounting = {
rest_period_violation: boolean;
rest_period_weekly_violation: boolean;
plausibility_conflict_violation: boolean;
paid_break?: number;
unpaid_break?: number;
paid_break_details?: string;
unpaid_break_details?: string;
};

export type TimesheetAccountingApproveRequest = {
Expand Down
2 changes: 2 additions & 0 deletions src/users/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export type UserReadFull = UserReadObscured & {
overtime__all_inc_ov_hours_per_cycle_valid_starting_from: string;
overtime_allowance_clear_working_time_saldo_valid_starting_from: string;
working_time_balance_rule_cycle_id?: number;
paid_break_day_quota_in_minutes?: number;
paid_break_day_quota_valid_from?: string;
};

export type UserRead = UserReadFull | UserReadObscured;
Expand Down
3 changes: 3 additions & 0 deletions src/utils/response/apiResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import { WorkingTimeCycle } from '../../workingTimeCycles/types';
import { TimeTrackingChangelogs } from '../../timeTrackingChangelogs/types';
import { UserPreferenceRead } from '../../userPreferences/types';
import { CalculationStates } from '../../calculationStates/types';
import { PaidBreaksHistory } from '../../paidBreaksHistory/types';
import { OtherPaidLeaveLimitation } from '../../otherPaidLeaveLimitations/types';

// Because types cannot be iterated at runtime, we add the keys of Resources here as a value
Expand Down Expand Up @@ -123,6 +124,7 @@ export const resourceNameArray = [
'workSchedules',
'workScheduleDays',
'workScheduleDayDefinitions',
'paidBreaksHistory',
'publicHolidayTemplates',
'publicHolidays',
'userRoles',
Expand Down Expand Up @@ -246,6 +248,7 @@ export interface Resources {
workingTimeCycles: WorkingTimeCycle;
userPreferences: UserPreferenceRead;
calculationStates: CalculationStates;
paidBreaksHistory: PaidBreaksHistory;
otherPaidLeaveLimitations: OtherPaidLeaveLimitation;
}

Expand Down
Loading