rotacloud 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/rotacloud.d.ts +2 -1
- package/dist/cjs/rotacloud.js +1 -0
- package/dist/cjs/services/accounts.service.d.ts +3 -4
- package/dist/cjs/services/accounts.service.js +2 -2
- package/dist/cjs/services/attendance.service.d.ts +13 -18
- package/dist/cjs/services/attendance.service.js +6 -6
- package/dist/cjs/services/availability.service.d.ts +9 -16
- package/dist/cjs/services/availability.service.js +4 -4
- package/dist/cjs/services/daily-budgets.service.d.ts +8 -11
- package/dist/cjs/services/daily-budgets.service.js +9 -9
- package/dist/cjs/services/daily-revenue.service.d.ts +16 -0
- package/dist/cjs/services/daily-revenue.service.js +99 -0
- package/dist/cjs/services/days-off.service.d.ts +8 -12
- package/dist/cjs/services/days-off.service.js +6 -6
- package/dist/cjs/services/groups.service.d.ts +13 -18
- package/dist/cjs/services/groups.service.js +6 -6
- package/dist/cjs/services/index.d.ts +1 -0
- package/dist/cjs/services/index.js +1 -0
- package/dist/cjs/services/leave-embargoes.service.d.ts +13 -18
- package/dist/cjs/services/leave-embargoes.service.js +6 -6
- package/dist/cjs/services/leave-request.service.d.ts +12 -17
- package/dist/cjs/services/leave-request.service.js +4 -4
- package/dist/cjs/services/leave.service.d.ts +13 -18
- package/dist/cjs/services/leave.service.js +9 -9
- package/dist/cjs/services/locations.service.d.ts +13 -18
- package/dist/cjs/services/locations.service.js +6 -6
- package/dist/cjs/services/roles.service.d.ts +13 -18
- package/dist/cjs/services/roles.service.js +6 -6
- package/dist/cjs/services/service.d.ts +6 -4
- package/dist/cjs/services/service.js +2 -2
- package/dist/cjs/services/shifts.service.d.ts +19 -27
- package/dist/cjs/services/shifts.service.js +6 -6
- package/dist/cjs/services/users.service.d.ts +11 -16
- package/dist/cjs/services/users.service.js +6 -6
- package/dist/cjs/version.js +1 -1
- package/dist/mjs/rotacloud.d.ts +2 -1
- package/dist/mjs/rotacloud.js +2 -1
- package/dist/mjs/services/accounts.service.d.ts +3 -4
- package/dist/mjs/services/accounts.service.js +2 -2
- package/dist/mjs/services/attendance.service.d.ts +13 -18
- package/dist/mjs/services/attendance.service.js +7 -8
- package/dist/mjs/services/availability.service.d.ts +9 -16
- package/dist/mjs/services/availability.service.js +4 -4
- package/dist/mjs/services/daily-budgets.service.d.ts +8 -11
- package/dist/mjs/services/daily-budgets.service.js +10 -11
- package/dist/mjs/services/daily-revenue.service.d.ts +16 -0
- package/dist/mjs/services/daily-revenue.service.js +38 -0
- package/dist/mjs/services/days-off.service.d.ts +8 -12
- package/dist/mjs/services/days-off.service.js +7 -8
- package/dist/mjs/services/groups.service.d.ts +13 -18
- package/dist/mjs/services/groups.service.js +7 -8
- package/dist/mjs/services/index.d.ts +1 -0
- package/dist/mjs/services/index.js +1 -0
- package/dist/mjs/services/leave-embargoes.service.d.ts +13 -18
- package/dist/mjs/services/leave-embargoes.service.js +7 -8
- package/dist/mjs/services/leave-request.service.d.ts +12 -17
- package/dist/mjs/services/leave-request.service.js +5 -6
- package/dist/mjs/services/leave.service.d.ts +13 -18
- package/dist/mjs/services/leave.service.js +10 -11
- package/dist/mjs/services/locations.service.d.ts +13 -18
- package/dist/mjs/services/locations.service.js +7 -8
- package/dist/mjs/services/roles.service.d.ts +13 -18
- package/dist/mjs/services/roles.service.js +7 -8
- package/dist/mjs/services/service.d.ts +6 -4
- package/dist/mjs/services/service.js +7 -2
- package/dist/mjs/services/shifts.service.d.ts +19 -27
- package/dist/mjs/services/shifts.service.js +7 -8
- package/dist/mjs/services/users.service.d.ts +11 -16
- package/dist/mjs/services/users.service.js +6 -6
- package/dist/mjs/version.js +1 -1
- package/package.json +1 -1
- package/src/rotacloud.ts +2 -0
- package/src/services/accounts.service.ts +5 -6
- package/src/services/attendance.service.ts +20 -32
- package/src/services/availability.service.ts +14 -34
- package/src/services/daily-budgets.service.ts +15 -19
- package/src/services/daily-revenue.service.ts +53 -0
- package/src/services/days-off.service.ts +15 -21
- package/src/services/groups.service.ts +21 -23
- package/src/services/index.ts +1 -0
- package/src/services/leave-embargoes.service.ts +21 -30
- package/src/services/leave-request.service.ts +20 -31
- package/src/services/leave.service.ts +24 -29
- package/src/services/locations.service.ts +20 -26
- package/src/services/roles.service.ts +20 -24
- package/src/services/service.ts +18 -8
- package/src/services/shifts.service.ts +29 -41
- package/src/services/users.service.ts +19 -20
- package/src/version.ts +1 -1
|
@@ -43,14 +43,14 @@ class ShiftsService extends index_js_1.Service {
|
|
|
43
43
|
get(id, options) {
|
|
44
44
|
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new shift_model_js_1.Shift(res.data)), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
|
|
45
45
|
}
|
|
46
|
-
list(options) {
|
|
46
|
+
list(query, options) {
|
|
47
47
|
const _super = Object.create(null, {
|
|
48
48
|
iterator: { get: () => super.iterator }
|
|
49
49
|
});
|
|
50
50
|
return __asyncGenerator(this, arguments, function* list_1() {
|
|
51
51
|
var e_1, _a;
|
|
52
52
|
try {
|
|
53
|
-
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
53
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
54
54
|
const res = _c.value;
|
|
55
55
|
yield yield __await(new shift_model_js_1.Shift(res));
|
|
56
56
|
}
|
|
@@ -64,13 +64,13 @@ class ShiftsService extends index_js_1.Service {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
listAll() {
|
|
67
|
+
listAll(query, options) {
|
|
68
68
|
var e_2, _a;
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
try {
|
|
71
71
|
const shifts = [];
|
|
72
72
|
try {
|
|
73
|
-
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
73
|
+
for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
74
|
const shift = _c.value;
|
|
75
75
|
shifts.push(shift);
|
|
76
76
|
}
|
|
@@ -89,8 +89,8 @@ class ShiftsService extends index_js_1.Service {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
listByPage(options) {
|
|
93
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
92
|
+
listByPage(query, options) {
|
|
93
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
94
94
|
}
|
|
95
95
|
update(id, data, options) {
|
|
96
96
|
return super
|
|
@@ -3,36 +3,31 @@ import { ApiUser } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { User } from '../models/user.model.js';
|
|
5
5
|
import { UsersQueryParams } from '../interfaces/query-params/users-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'first_name' | 'last_name';
|
|
8
7
|
declare class UsersService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiUser, RequiredProps>): Promise<User>;
|
|
11
10
|
create(data: RequirementsOf<ApiUser, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiUser, RequiredProps>, options: Options<InternalQueryParams>): Promise<User>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiUser, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiUser, RequiredProps>, options: Options): Promise<User>;
|
|
16
14
|
get(id: number): Promise<User>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<UsersQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiUser[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiUser, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<User>;
|
|
19
|
+
list(query: UsersQueryParams, options?: Options): AsyncGenerator<User, void, unknown>;
|
|
20
|
+
listAll(query: UsersQueryParams, options?: Options): Promise<User[]>;
|
|
21
|
+
listByPage(query: UsersQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiUser[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiUser>): Promise<User>;
|
|
26
23
|
update(id: number, data: Partial<ApiUser>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiUser>, options: Options<InternalQueryParams>): Promise<User>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiUser, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiUser>, options: Options): Promise<User>;
|
|
31
27
|
delete(id: number): Promise<number>;
|
|
32
28
|
delete(id: number, options: {
|
|
33
29
|
rawResponse: true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
|
|
30
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
31
|
+
delete(id: number, options: Options): Promise<number>;
|
|
37
32
|
}
|
|
38
33
|
export { UsersService };
|
|
@@ -43,14 +43,14 @@ class UsersService extends index_js_1.Service {
|
|
|
43
43
|
get(id, options) {
|
|
44
44
|
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new user_model_js_1.User(res.data)), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
|
|
45
45
|
}
|
|
46
|
-
list(options) {
|
|
46
|
+
list(query, options) {
|
|
47
47
|
const _super = Object.create(null, {
|
|
48
48
|
iterator: { get: () => super.iterator }
|
|
49
49
|
});
|
|
50
50
|
return __asyncGenerator(this, arguments, function* list_1() {
|
|
51
51
|
var e_1, _a;
|
|
52
52
|
try {
|
|
53
|
-
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
53
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
54
54
|
const res = _c.value;
|
|
55
55
|
yield yield __await(new user_model_js_1.User(res));
|
|
56
56
|
}
|
|
@@ -64,13 +64,13 @@ class UsersService extends index_js_1.Service {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
listAll() {
|
|
67
|
+
listAll(query, options) {
|
|
68
68
|
var e_2, _a;
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
try {
|
|
71
71
|
const users = [];
|
|
72
72
|
try {
|
|
73
|
-
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
73
|
+
for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
74
|
const user = _c.value;
|
|
75
75
|
users.push(user);
|
|
76
76
|
}
|
|
@@ -89,8 +89,8 @@ class UsersService extends index_js_1.Service {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
listByPage(options) {
|
|
93
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
92
|
+
listByPage(query, options) {
|
|
93
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
94
94
|
}
|
|
95
95
|
update(id, data, options) {
|
|
96
96
|
return super
|
package/dist/cjs/version.js
CHANGED
package/dist/mjs/rotacloud.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
2
2
|
import { SDKConfig } from './interfaces/index.js';
|
|
3
3
|
export declare class RotaCloud {
|
|
4
4
|
static config: SDKConfig;
|
|
@@ -7,6 +7,7 @@ export declare class RotaCloud {
|
|
|
7
7
|
attendance: AttendanceService;
|
|
8
8
|
availability: AvailabilityService;
|
|
9
9
|
dailyBudgets: DailyBudgetsService;
|
|
10
|
+
dailyRevenue: DailyRevenueService;
|
|
10
11
|
daysOff: DaysOffService;
|
|
11
12
|
group: GroupsService;
|
|
12
13
|
leaveEmbargoes: LeaveEmbargoesService;
|
package/dist/mjs/rotacloud.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService, } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService, } from './services/index.js';
|
|
2
2
|
export class RotaCloud {
|
|
3
3
|
constructor(config) {
|
|
4
4
|
this.defaultAPIURI = 'https://api.rotacloud.com/v1';
|
|
@@ -6,6 +6,7 @@ export class RotaCloud {
|
|
|
6
6
|
this.attendance = new AttendanceService();
|
|
7
7
|
this.availability = new AvailabilityService();
|
|
8
8
|
this.dailyBudgets = new DailyBudgetsService();
|
|
9
|
+
this.dailyRevenue = new DailyRevenueService();
|
|
9
10
|
this.daysOff = new DaysOffService();
|
|
10
11
|
this.group = new GroupsService();
|
|
11
12
|
this.leaveEmbargoes = new LeaveEmbargoesService();
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Account } from '../models/account.model.js';
|
|
2
2
|
import { Service, Options } from './index.js';
|
|
3
3
|
import { ApiAccount } from '../interfaces/index.js';
|
|
4
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
5
4
|
declare class AccountsService extends Service {
|
|
6
5
|
private apiPath;
|
|
7
|
-
list(options?: Options
|
|
8
|
-
listAll(): Promise<Account[]>;
|
|
9
|
-
listByPage(options?: Options
|
|
6
|
+
list(options?: Options): AsyncGenerator<Account, void, unknown>;
|
|
7
|
+
listAll(options?: Options): Promise<Account[]>;
|
|
8
|
+
listByPage(options?: Options): AsyncGenerator<import("axios").AxiosResponse<ApiAccount[], any>, any, unknown>;
|
|
10
9
|
}
|
|
11
10
|
export { AccountsService };
|
|
@@ -10,10 +10,10 @@ class AccountsService extends Service {
|
|
|
10
10
|
yield new Account(res);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
async listAll() {
|
|
13
|
+
async listAll(options) {
|
|
14
14
|
try {
|
|
15
15
|
const accounts = [];
|
|
16
|
-
for await (const account of this.list()) {
|
|
16
|
+
for await (const account of this.list(options)) {
|
|
17
17
|
accounts.push(account);
|
|
18
18
|
}
|
|
19
19
|
return accounts;
|
|
@@ -3,36 +3,31 @@ import { ApiAttendance } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { Attendance } from '../models/attendance.model.js';
|
|
5
5
|
import { AttendanceQueryParams } from '../interfaces/query-params/attendance-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'user' | 'in_time';
|
|
8
|
-
declare class AttendanceService extends Service {
|
|
7
|
+
export declare class AttendanceService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiAttendance, RequiredProps>): Promise<Attendance>;
|
|
11
10
|
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: Options<InternalQueryParams>): Promise<ApiAttendance>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: Options): Promise<ApiAttendance>;
|
|
16
14
|
get(id: number): Promise<Attendance>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<AttendanceQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiAttendance[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<Attendance>;
|
|
19
|
+
list(query: AttendanceQueryParams, options?: Options): AsyncGenerator<Attendance, void, unknown>;
|
|
20
|
+
listAll(query: AttendanceQueryParams, options?: Options): Promise<Attendance[]>;
|
|
21
|
+
listByPage(query: AttendanceQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiAttendance[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiAttendance>): Promise<Attendance>;
|
|
26
23
|
update(id: number, data: Partial<ApiAttendance>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiAttendance>, options: Options<InternalQueryParams>): Promise<Attendance>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiAttendance>, options: Options): Promise<Attendance>;
|
|
31
27
|
delete(id: number): Promise<number>;
|
|
32
28
|
delete(id: number, options: {
|
|
33
29
|
rawResponse: true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
|
|
30
|
+
} & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
31
|
+
delete(id: number, options: Options): Promise<number>;
|
|
37
32
|
}
|
|
38
|
-
export {
|
|
33
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { Attendance } from '../models/attendance.model.js';
|
|
3
3
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
-
class AttendanceService extends Service {
|
|
4
|
+
export class AttendanceService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/attendance';
|
|
@@ -12,15 +12,15 @@ class AttendanceService extends Service {
|
|
|
12
12
|
get(id, options) {
|
|
13
13
|
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve(options?.rawResponse ? res : new Attendance(res.data)), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
14
14
|
}
|
|
15
|
-
async *list(options) {
|
|
16
|
-
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
15
|
+
async *list(query, options) {
|
|
16
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
17
17
|
yield new Attendance(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async listAll() {
|
|
20
|
+
async listAll(query, options) {
|
|
21
21
|
try {
|
|
22
22
|
const attendance = [];
|
|
23
|
-
for await (const atten of this.list()) {
|
|
23
|
+
for await (const atten of this.list(query, options)) {
|
|
24
24
|
attendance.push(atten);
|
|
25
25
|
}
|
|
26
26
|
return attendance;
|
|
@@ -29,8 +29,8 @@ class AttendanceService extends Service {
|
|
|
29
29
|
return err;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
listByPage(options) {
|
|
33
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
32
|
+
listByPage(query, options) {
|
|
33
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
34
34
|
}
|
|
35
35
|
update(id, data, options) {
|
|
36
36
|
return super
|
|
@@ -45,4 +45,3 @@ class AttendanceService extends Service {
|
|
|
45
45
|
return super.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' }).then((res) => Promise.resolve(options?.rawResponse ? res : res.status), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
export { AttendanceService };
|
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { Service, Options
|
|
3
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
2
|
+
import { Service, Options } from './index.js';
|
|
4
3
|
import { AvailabilityQueryParams } from '../interfaces/query-params/availability-query-params.interface.js';
|
|
5
4
|
import { Availability } from '../models/availability.model.js';
|
|
6
5
|
import { ApiAvailability } from '../interfaces/availability.interface.js';
|
|
7
|
-
declare type RequiredProps = 'start' | 'end';
|
|
8
|
-
declare type RequiredOptions<T> = RequirementsOf<Options<T>, 'params'>;
|
|
9
6
|
export declare class AvailabilityService extends Service {
|
|
10
7
|
private apiPath;
|
|
11
8
|
update(data: ApiAvailability): Promise<Availability>;
|
|
12
9
|
update(data: ApiAvailability, options: {
|
|
13
10
|
rawResponse: true;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
update(data: ApiAvailability, options?: Options<InternalQueryParams>): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
11
|
+
} & Options): Promise<AxiosResponse<ApiAvailability>>;
|
|
12
|
+
update(data: ApiAvailability, options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
17
13
|
/** Alias of {@link AvailabilityService["update"]} */
|
|
18
14
|
create(data: ApiAvailability): Promise<Availability>;
|
|
19
15
|
create(data: ApiAvailability, options: {
|
|
20
16
|
rawResponse: true;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
create(data: ApiAvailability, options?: Options<InternalQueryParams>): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiAvailability>>;
|
|
18
|
+
create(data: ApiAvailability, options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
24
19
|
delete(user: number, dates: string[]): Promise<Availability>;
|
|
25
20
|
delete(user: number, dates: string[], options: {
|
|
26
21
|
rawResponse: true;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
listByPage(options: RequiredOptions<RequirementsOf<AvailabilityQueryParams, RequiredProps> & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiAvailability[], any>, any, unknown>;
|
|
22
|
+
} & Options): Promise<AxiosResponse<ApiAvailability>>;
|
|
23
|
+
delete(user: number, dates: string[], options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
24
|
+
list(query: AvailabilityQueryParams, options?: Options): AsyncGenerator<Availability, void, unknown>;
|
|
25
|
+
listByPage(query: AvailabilityQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiAvailability[], any>, any, unknown>;
|
|
32
26
|
}
|
|
33
|
-
export {};
|
|
@@ -30,12 +30,12 @@ export class AvailabilityService extends Service {
|
|
|
30
30
|
}),
|
|
31
31
|
}, options);
|
|
32
32
|
}
|
|
33
|
-
async *list(options) {
|
|
34
|
-
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
33
|
+
async *list(query, options) {
|
|
34
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
35
35
|
yield new Availability(res);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
listByPage(options) {
|
|
39
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
38
|
+
listByPage(query, options) {
|
|
39
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -3,17 +3,14 @@ import { ApiDailyBudgets } from '../interfaces/daily-budgets.interface.js';
|
|
|
3
3
|
import { Service, Options } from './index.js';
|
|
4
4
|
import { DailyBudgets } from '../models/daily-budgets.model.js';
|
|
5
5
|
import { DailyBudgetsQueryParams } from '../interfaces/query-params/daily-budgets-query-params.interface.js';
|
|
6
|
-
|
|
7
|
-
declare class DailyBudgetsService extends Service {
|
|
6
|
+
export declare class DailyBudgetsService extends Service {
|
|
8
7
|
private apiPath;
|
|
9
|
-
list(options?: Options
|
|
10
|
-
listAll(): Promise<DailyBudgets[]>;
|
|
11
|
-
listByPage(options?: Options
|
|
12
|
-
update(
|
|
13
|
-
update(
|
|
8
|
+
list(query: DailyBudgetsQueryParams, options?: Options): AsyncGenerator<DailyBudgets, void, unknown>;
|
|
9
|
+
listAll(query: DailyBudgetsQueryParams, options?: Options): Promise<DailyBudgets[]>;
|
|
10
|
+
listByPage(query: DailyBudgetsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiDailyBudgets[], any>, any, unknown>;
|
|
11
|
+
update(data: Partial<ApiDailyBudgets>[]): Promise<number>;
|
|
12
|
+
update(data: Partial<ApiDailyBudgets>[], options: {
|
|
14
13
|
rawResponse: true;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
update(id: number, data: Partial<ApiDailyBudgets>, options: Options<InternalQueryParams>): Promise<ApiDailyBudgets>;
|
|
14
|
+
} & Options): Promise<AxiosResponse<ApiDailyBudgets, any>>;
|
|
15
|
+
update(data: Partial<ApiDailyBudgets>[], options: Options): Promise<number>;
|
|
18
16
|
}
|
|
19
|
-
export { DailyBudgetsService };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { DailyBudgets } from '../models/daily-budgets.model.js';
|
|
3
3
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
-
class DailyBudgetsService extends Service {
|
|
4
|
+
export class DailyBudgetsService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/daily_budgets';
|
|
8
8
|
}
|
|
9
|
-
async *list(options) {
|
|
10
|
-
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
9
|
+
async *list(query, options) {
|
|
10
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
11
11
|
yield new DailyBudgets(res);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
async listAll() {
|
|
14
|
+
async listAll(query, options) {
|
|
15
15
|
try {
|
|
16
16
|
const attendance = [];
|
|
17
|
-
for await (const atten of this.list()) {
|
|
17
|
+
for await (const atten of this.list(query, options)) {
|
|
18
18
|
attendance.push(atten);
|
|
19
19
|
}
|
|
20
20
|
return attendance;
|
|
@@ -23,17 +23,16 @@ class DailyBudgetsService extends Service {
|
|
|
23
23
|
return err;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
listByPage(options) {
|
|
27
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
26
|
+
listByPage(query, options) {
|
|
27
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
28
28
|
}
|
|
29
|
-
update(
|
|
29
|
+
update(data, options) {
|
|
30
30
|
return super
|
|
31
31
|
.fetch({
|
|
32
|
-
url: `${this.apiPath}
|
|
32
|
+
url: `${this.apiPath}`,
|
|
33
33
|
data,
|
|
34
34
|
method: 'POST',
|
|
35
35
|
})
|
|
36
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res :
|
|
36
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
export { DailyBudgetsService };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiDailyRevenue } from '../interfaces/daily-revenue.interface.js';
|
|
3
|
+
import { Service, Options } from './index.js';
|
|
4
|
+
import { DailyRevenue } from '../models/daily-revenue.model.js';
|
|
5
|
+
import { DailyRevenueQueryParams } from '../interfaces/query-params/daily-revenue-query-params.interface.js';
|
|
6
|
+
export declare class DailyRevenueService extends Service {
|
|
7
|
+
private apiPath;
|
|
8
|
+
list(query: DailyRevenueQueryParams, options?: Options): AsyncGenerator<DailyRevenue, void, unknown>;
|
|
9
|
+
listAll(query: DailyRevenueQueryParams, options?: Options): Promise<DailyRevenue[]>;
|
|
10
|
+
listByPage(query: DailyRevenueQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiDailyRevenue[], any>, any, unknown>;
|
|
11
|
+
update(data: Partial<ApiDailyRevenue>[]): Promise<number>;
|
|
12
|
+
update(data: Partial<ApiDailyRevenue>[], options: {
|
|
13
|
+
rawResponse: true;
|
|
14
|
+
} & Options): Promise<AxiosResponse<ApiDailyRevenue, any>>;
|
|
15
|
+
update(data: Partial<ApiDailyRevenue>[], options: Options): Promise<number>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Service } from './index.js';
|
|
2
|
+
import { DailyRevenue } from '../models/daily-revenue.model.js';
|
|
3
|
+
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
+
export class DailyRevenueService extends Service {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.apiPath = '/daily_revenue';
|
|
8
|
+
}
|
|
9
|
+
async *list(query, options) {
|
|
10
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
11
|
+
yield new DailyRevenue(res);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async listAll(query, options) {
|
|
15
|
+
try {
|
|
16
|
+
const attendance = [];
|
|
17
|
+
for await (const atten of this.list(query, options)) {
|
|
18
|
+
attendance.push(atten);
|
|
19
|
+
}
|
|
20
|
+
return attendance;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
return err;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
listByPage(query, options) {
|
|
27
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
28
|
+
}
|
|
29
|
+
update(data, options) {
|
|
30
|
+
return super
|
|
31
|
+
.fetch({
|
|
32
|
+
url: `${this.apiPath}`,
|
|
33
|
+
data,
|
|
34
|
+
method: 'POST',
|
|
35
|
+
})
|
|
36
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { ApiDaysOff } from '../interfaces/index.js';
|
|
3
3
|
import { Service, Options } from './index.js';
|
|
4
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
5
4
|
import { DaysOff } from '../models/days-off.model.js';
|
|
6
5
|
import { DaysOffQueryParams } from '../interfaces/query-params/days-off-query-params.interface.js';
|
|
7
|
-
declare class DaysOffService extends Service<ApiDaysOff> {
|
|
6
|
+
export declare class DaysOffService extends Service<ApiDaysOff> {
|
|
8
7
|
private apiPath;
|
|
9
8
|
create(dates: string[], users: number[]): Promise<number>;
|
|
10
9
|
create(dates: string[], users: number[], options: {
|
|
11
10
|
rawResponse: true;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
listByPage(options?: Options<DaysOffQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiDaysOff[], any>, any, unknown>;
|
|
11
|
+
} & Options): Promise<AxiosResponse<ApiDaysOff, any>>;
|
|
12
|
+
create(dates: string[], users: number[], options: Options): Promise<number>;
|
|
13
|
+
list(query: DaysOffQueryParams, options?: Options): AsyncGenerator<DaysOff, void, unknown>;
|
|
14
|
+
listAll(query: DaysOffQueryParams, options?: Options): Promise<DaysOff[]>;
|
|
15
|
+
listByPage(query: DaysOffQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiDaysOff[], any>, any, unknown>;
|
|
18
16
|
delete(dates: string[], users: number[]): Promise<number>;
|
|
19
17
|
delete(dates: string[], users: number[], options: {
|
|
20
18
|
rawResponse: true;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
delete(dates: string[], users: number[], options: Options<InternalQueryParams>): Promise<number>;
|
|
19
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
20
|
+
delete(dates: string[], users: number[], options: Options): Promise<number>;
|
|
24
21
|
}
|
|
25
|
-
export { DaysOffService };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
3
3
|
import { DaysOff } from '../models/days-off.model.js';
|
|
4
|
-
class DaysOffService extends Service {
|
|
4
|
+
export class DaysOffService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/days_off';
|
|
@@ -18,15 +18,15 @@ class DaysOffService extends Service {
|
|
|
18
18
|
})
|
|
19
19
|
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
20
20
|
}
|
|
21
|
-
async *list(options) {
|
|
22
|
-
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
21
|
+
async *list(query, options) {
|
|
22
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
23
23
|
yield new DaysOff(res);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
async listAll() {
|
|
26
|
+
async listAll(query, options) {
|
|
27
27
|
try {
|
|
28
28
|
const daysOff = [];
|
|
29
|
-
for await (const dayOff of this.list()) {
|
|
29
|
+
for await (const dayOff of this.list(query, options)) {
|
|
30
30
|
daysOff.push(dayOff);
|
|
31
31
|
}
|
|
32
32
|
return daysOff;
|
|
@@ -35,8 +35,8 @@ class DaysOffService extends Service {
|
|
|
35
35
|
return err;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
listByPage(options) {
|
|
39
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
38
|
+
listByPage(query, options) {
|
|
39
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
40
40
|
}
|
|
41
41
|
delete(dates, users, options) {
|
|
42
42
|
return super
|
|
@@ -51,4 +51,3 @@ class DaysOffService extends Service {
|
|
|
51
51
|
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
export { DaysOffService };
|
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { ApiGroup } from '../interfaces/index.js';
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
5
4
|
import { Group } from '../models/group.model.js';
|
|
6
5
|
import { GroupsQueryParams } from '../interfaces/query-params/groups-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'name';
|
|
8
|
-
declare class GroupsService extends Service {
|
|
7
|
+
export declare class GroupsService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiGroup, RequiredProps>): Promise<Group>;
|
|
11
10
|
create(data: RequirementsOf<ApiGroup, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiGroup, RequiredProps>, options: Options<InternalQueryParams>): Promise<Group>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiGroup, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiGroup, RequiredProps>, options: Options): Promise<Group>;
|
|
16
14
|
get(id: number): Promise<Group>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<GroupsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiGroup[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiGroup, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<Group>;
|
|
19
|
+
list(query: GroupsQueryParams, options?: Options): AsyncGenerator<Group, void, unknown>;
|
|
20
|
+
listAll(query: GroupsQueryParams, options?: Options): Promise<Group[]>;
|
|
21
|
+
listByPage(query: GroupsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiGroup[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiGroup>): Promise<Group>;
|
|
26
23
|
update(id: number, data: Partial<ApiGroup>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiGroup>, options: Options<InternalQueryParams>): Promise<Group>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiGroup, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiGroup>, options: Options): Promise<Group>;
|
|
31
27
|
delete(id: number): Promise<number>;
|
|
32
28
|
delete(id: number, options: {
|
|
33
29
|
rawResponse: true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
|
|
30
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
31
|
+
delete(id: number, options: Options): Promise<number>;
|
|
37
32
|
}
|
|
38
|
-
export {
|
|
33
|
+
export {};
|