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
|
@@ -3,54 +3,46 @@ import { ApiShift } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { Shift } from '../models/shift.model.js';
|
|
5
5
|
import { ShiftsQueryParams } from '../interfaces/query-params/shifts-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'end_time' | 'start_time' | 'location';
|
|
8
|
-
declare class ShiftsService extends Service {
|
|
7
|
+
export declare class ShiftsService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiShift, RequiredProps>): Promise<Shift>;
|
|
11
10
|
create(data: RequirementsOf<ApiShift, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiShift, RequiredProps>, options: Options<InternalQueryParams>): Promise<Shift>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiShift, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiShift, RequiredProps>, options: Options): Promise<Shift>;
|
|
16
14
|
get(id: number): Promise<Shift>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<ShiftsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiShift[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiShift, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<Shift>;
|
|
19
|
+
list(query: ShiftsQueryParams, options?: Options): AsyncGenerator<Shift, void, unknown>;
|
|
20
|
+
listAll(query: ShiftsQueryParams, options?: Options): Promise<Shift[]>;
|
|
21
|
+
listByPage(query: ShiftsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiShift[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiShift>): Promise<Shift>;
|
|
26
23
|
update(id: number, data: Partial<ApiShift>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiShift>, options: Options<InternalQueryParams>): Promise<Shift>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiShift, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiShift>, options: Options): Promise<Shift>;
|
|
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
|
acknowledge(data: number[]): Promise<number>;
|
|
38
33
|
acknowledge(data: number[], options: {
|
|
39
34
|
rawResponse: true;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
acknowledge(data: number[], options: Options<InternalQueryParams>): Promise<number>;
|
|
35
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
36
|
+
acknowledge(data: number[], options: Options): Promise<number>;
|
|
43
37
|
publish(data: number[]): Promise<number>;
|
|
44
38
|
publish(data: number[], options: {
|
|
45
39
|
rawResponse: true;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
publish(data: number[], options: Options<InternalQueryParams>): Promise<number>;
|
|
40
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
41
|
+
publish(data: number[], options: Options): Promise<number>;
|
|
49
42
|
unpublish(data: number[]): Promise<number>;
|
|
50
43
|
unpublish(data: number[], options: {
|
|
51
44
|
rawResponse: true;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
unpublish(data: number[], options: Options<InternalQueryParams>): Promise<number>;
|
|
45
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
46
|
+
unpublish(data: number[], options: Options): Promise<number>;
|
|
55
47
|
}
|
|
56
|
-
export {
|
|
48
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { Shift } from '../models/shift.model.js';
|
|
3
3
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
-
class ShiftsService extends Service {
|
|
4
|
+
export class ShiftsService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/shifts';
|
|
@@ -12,15 +12,15 @@ class ShiftsService 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 Shift(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 Shift(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async listAll() {
|
|
20
|
+
async listAll(query, options) {
|
|
21
21
|
try {
|
|
22
22
|
const shifts = [];
|
|
23
|
-
for await (const shift of this.list()) {
|
|
23
|
+
for await (const shift of this.list(query, options)) {
|
|
24
24
|
shifts.push(shift);
|
|
25
25
|
}
|
|
26
26
|
return shifts;
|
|
@@ -29,8 +29,8 @@ class ShiftsService 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
|
|
@@ -54,4 +54,3 @@ class ShiftsService extends Service {
|
|
|
54
54
|
return super.fetch({ url: '/shifts_published', data, method: 'DELETE' }).then((res) => Promise.resolve(options?.rawResponse ? res : res.status), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
export { ShiftsService };
|
|
@@ -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 };
|
|
@@ -12,15 +12,15 @@ class UsersService 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 User(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 User(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async listAll() {
|
|
20
|
+
async listAll(query, options) {
|
|
21
21
|
try {
|
|
22
22
|
const users = [];
|
|
23
|
-
for await (const user of this.list()) {
|
|
23
|
+
for await (const user of this.list(query, options)) {
|
|
24
24
|
users.push(user);
|
|
25
25
|
}
|
|
26
26
|
return users;
|
|
@@ -29,8 +29,8 @@ class UsersService 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
|
package/dist/mjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const Version = { version: '1.0.
|
|
1
|
+
export const Version = { version: '1.0.27' };
|
package/package.json
CHANGED
package/src/rotacloud.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
AttendanceService,
|
|
4
4
|
AvailabilityService,
|
|
5
5
|
DailyBudgetsService,
|
|
6
|
+
DailyRevenueService,
|
|
6
7
|
DaysOffService,
|
|
7
8
|
GroupsService,
|
|
8
9
|
LeaveEmbargoesService,
|
|
@@ -23,6 +24,7 @@ export class RotaCloud {
|
|
|
23
24
|
public attendance = new AttendanceService();
|
|
24
25
|
public availability = new AvailabilityService();
|
|
25
26
|
public dailyBudgets = new DailyBudgetsService();
|
|
27
|
+
public dailyRevenue = new DailyRevenueService();
|
|
26
28
|
public daysOff = new DaysOffService();
|
|
27
29
|
public group = new GroupsService();
|
|
28
30
|
public leaveEmbargoes = new LeaveEmbargoesService();
|
|
@@ -2,22 +2,21 @@ import { Account } from '../models/account.model.js';
|
|
|
2
2
|
import { Service, Options } from './index.js';
|
|
3
3
|
|
|
4
4
|
import { ApiAccount } from '../interfaces/index.js';
|
|
5
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
6
5
|
|
|
7
6
|
class AccountsService extends Service {
|
|
8
7
|
private apiPath = '/accounts';
|
|
9
8
|
|
|
10
|
-
async *list(options?: Options
|
|
9
|
+
async *list(options?: Options) {
|
|
11
10
|
for await (const res of super.iterator<ApiAccount>({ url: this.apiPath }, options)) {
|
|
12
11
|
yield new Account(res);
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
listAll(): Promise<Account[]>;
|
|
17
|
-
async listAll() {
|
|
15
|
+
listAll(options?: Options): Promise<Account[]>;
|
|
16
|
+
async listAll(options?: Options) {
|
|
18
17
|
try {
|
|
19
18
|
const accounts = [] as Account[];
|
|
20
|
-
for await (const account of this.list()) {
|
|
19
|
+
for await (const account of this.list(options)) {
|
|
21
20
|
accounts.push(account);
|
|
22
21
|
}
|
|
23
22
|
return accounts;
|
|
@@ -26,7 +25,7 @@ class AccountsService extends Service {
|
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
listByPage(options?: Options
|
|
28
|
+
listByPage(options?: Options) {
|
|
30
29
|
return super.iterator<ApiAccount>({ url: this.apiPath }, options).byPage();
|
|
31
30
|
}
|
|
32
31
|
}
|
|
@@ -5,23 +5,19 @@ import { Service, Options, RequirementsOf } from './index.js';
|
|
|
5
5
|
import { Attendance } from '../models/attendance.model.js';
|
|
6
6
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
7
7
|
import { AttendanceQueryParams } from '../interfaces/query-params/attendance-query-params.interface.js';
|
|
8
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
9
8
|
|
|
10
9
|
type RequiredProps = 'user' | 'in_time';
|
|
11
10
|
|
|
12
|
-
class AttendanceService extends Service {
|
|
11
|
+
export class AttendanceService extends Service {
|
|
13
12
|
private apiPath = '/attendance';
|
|
14
13
|
|
|
15
14
|
create(data: RequirementsOf<ApiAttendance, RequiredProps>): Promise<Attendance>;
|
|
16
15
|
create(
|
|
17
16
|
data: RequirementsOf<ApiAttendance, RequiredProps>,
|
|
18
|
-
options: { rawResponse: true
|
|
17
|
+
options: { rawResponse: true } & Options
|
|
19
18
|
): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
20
|
-
create(
|
|
21
|
-
|
|
22
|
-
options: Options<InternalQueryParams>
|
|
23
|
-
): Promise<ApiAttendance>;
|
|
24
|
-
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options?: Options<InternalQueryParams>) {
|
|
19
|
+
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: Options): Promise<ApiAttendance>;
|
|
20
|
+
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options?: Options) {
|
|
25
21
|
return super.fetch<ApiAttendance>({ url: this.apiPath, data, method: 'POST' }).then(
|
|
26
22
|
(res) => Promise.resolve(options?.rawResponse ? res : new Attendance(res.data)),
|
|
27
23
|
(err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err))
|
|
@@ -29,29 +25,26 @@ class AttendanceService extends Service {
|
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
get(id: number): Promise<Attendance>;
|
|
32
|
-
get(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
36
|
-
get(id: number, options: Options<InternalQueryParams>): Promise<ApiAttendance>;
|
|
37
|
-
get(id: number, options?: Options<InternalQueryParams>) {
|
|
28
|
+
get(id: number, options: { rawResponse: true } & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
29
|
+
get(id: number, options: Options): Promise<Attendance>;
|
|
30
|
+
get(id: number, options?: Options) {
|
|
38
31
|
return super.fetch<ApiAttendance>({ url: `${this.apiPath}/${id}` }, options).then(
|
|
39
32
|
(res) => Promise.resolve(options?.rawResponse ? res : new Attendance(res.data)),
|
|
40
33
|
(err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err))
|
|
41
34
|
);
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
async *list(options?: Options
|
|
45
|
-
for await (const res of super.iterator<ApiAttendance>({ url: this.apiPath }, options)) {
|
|
37
|
+
async *list(query: AttendanceQueryParams, options?: Options) {
|
|
38
|
+
for await (const res of super.iterator<ApiAttendance>({ url: this.apiPath, params: query }, options)) {
|
|
46
39
|
yield new Attendance(res);
|
|
47
40
|
}
|
|
48
41
|
}
|
|
49
42
|
|
|
50
|
-
listAll(): Promise<Attendance[]>;
|
|
51
|
-
async listAll() {
|
|
43
|
+
listAll(query: AttendanceQueryParams, options?: Options): Promise<Attendance[]>;
|
|
44
|
+
async listAll(query: AttendanceQueryParams, options?: Options) {
|
|
52
45
|
try {
|
|
53
46
|
const attendance = [] as Attendance[];
|
|
54
|
-
for await (const atten of this.list()) {
|
|
47
|
+
for await (const atten of this.list(query, options)) {
|
|
55
48
|
attendance.push(atten);
|
|
56
49
|
}
|
|
57
50
|
return attendance;
|
|
@@ -60,18 +53,18 @@ class AttendanceService extends Service {
|
|
|
60
53
|
}
|
|
61
54
|
}
|
|
62
55
|
|
|
63
|
-
listByPage(options?: Options
|
|
64
|
-
return super.iterator<ApiAttendance>({ url: this.apiPath }, options).byPage();
|
|
56
|
+
listByPage(query: AttendanceQueryParams, options?: Options) {
|
|
57
|
+
return super.iterator<ApiAttendance>({ url: this.apiPath, params: query }, options).byPage();
|
|
65
58
|
}
|
|
66
59
|
|
|
67
60
|
update(id: number, data: Partial<ApiAttendance>): Promise<Attendance>;
|
|
68
61
|
update(
|
|
69
62
|
id: number,
|
|
70
63
|
data: Partial<ApiAttendance>,
|
|
71
|
-
options: { rawResponse: true
|
|
64
|
+
options: { rawResponse: true } & Options
|
|
72
65
|
): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
73
|
-
update(id: number, data: Partial<ApiAttendance>, options: Options
|
|
74
|
-
update(id: number, data: Partial<ApiAttendance>, options?: Options
|
|
66
|
+
update(id: number, data: Partial<ApiAttendance>, options: Options): Promise<Attendance>;
|
|
67
|
+
update(id: number, data: Partial<ApiAttendance>, options?: Options) {
|
|
75
68
|
return super
|
|
76
69
|
.fetch<ApiAttendance>({
|
|
77
70
|
url: `${this.apiPath}/${id}`,
|
|
@@ -85,17 +78,12 @@ class AttendanceService extends Service {
|
|
|
85
78
|
}
|
|
86
79
|
|
|
87
80
|
delete(id: number): Promise<number>;
|
|
88
|
-
delete(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
92
|
-
delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
|
|
93
|
-
delete(id: number, options?: Options<InternalQueryParams>) {
|
|
81
|
+
delete(id: number, options: { rawResponse: true } & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
82
|
+
delete(id: number, options: Options): Promise<number>;
|
|
83
|
+
delete(id: number, options?: Options) {
|
|
94
84
|
return super.fetch<ApiAttendance>({ url: `${this.apiPath}/${id}`, method: 'DELETE' }).then(
|
|
95
85
|
(res) => Promise.resolve(options?.rawResponse ? res : res.status),
|
|
96
86
|
(err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err))
|
|
97
87
|
);
|
|
98
88
|
}
|
|
99
89
|
}
|
|
100
|
-
|
|
101
|
-
export { AttendanceService };
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { Service, Options
|
|
2
|
+
import { Service, Options } from './index.js';
|
|
3
3
|
|
|
4
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
5
4
|
import { AvailabilityQueryParams } from '../interfaces/query-params/availability-query-params.interface.js';
|
|
6
5
|
import { Availability } from '../models/availability.model.js';
|
|
7
6
|
import { ApiAvailability } from '../interfaces/availability.interface.js';
|
|
8
7
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
9
8
|
|
|
10
|
-
type RequiredProps = 'start' | 'end';
|
|
11
|
-
type RequiredOptions<T> = RequirementsOf<Options<T>, 'params'>;
|
|
12
|
-
|
|
13
9
|
export class AvailabilityService extends Service {
|
|
14
10
|
private apiPath = '/availability';
|
|
15
11
|
|
|
16
12
|
update(data: ApiAvailability): Promise<Availability>;
|
|
17
|
-
update(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
): Promise<AxiosResponse<ApiAvailability>>;
|
|
21
|
-
update(
|
|
22
|
-
data: ApiAvailability,
|
|
23
|
-
options?: Options<InternalQueryParams>
|
|
24
|
-
): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
25
|
-
update(data: ApiAvailability, options?: Options<InternalQueryParams>) {
|
|
13
|
+
update(data: ApiAvailability, options: { rawResponse: true } & Options): Promise<AxiosResponse<ApiAvailability>>;
|
|
14
|
+
update(data: ApiAvailability, options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
15
|
+
update(data: ApiAvailability, options?: Options) {
|
|
26
16
|
return super
|
|
27
17
|
.fetch<ApiAvailability>({
|
|
28
18
|
url: this.apiPath,
|
|
@@ -37,15 +27,9 @@ export class AvailabilityService extends Service {
|
|
|
37
27
|
|
|
38
28
|
/** Alias of {@link AvailabilityService["update"]} */
|
|
39
29
|
create(data: ApiAvailability): Promise<Availability>;
|
|
40
|
-
create(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
): Promise<AxiosResponse<ApiAvailability>>;
|
|
44
|
-
create(
|
|
45
|
-
data: ApiAvailability,
|
|
46
|
-
options?: Options<InternalQueryParams>
|
|
47
|
-
): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
48
|
-
create(data: ApiAvailability, options?: Options<InternalQueryParams>) {
|
|
30
|
+
create(data: ApiAvailability, options: { rawResponse: true } & Options): Promise<AxiosResponse<ApiAvailability>>;
|
|
31
|
+
create(data: ApiAvailability, options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
32
|
+
create(data: ApiAvailability, options?: Options) {
|
|
49
33
|
return this.update(data, options);
|
|
50
34
|
}
|
|
51
35
|
|
|
@@ -53,14 +37,10 @@ export class AvailabilityService extends Service {
|
|
|
53
37
|
delete(
|
|
54
38
|
user: number,
|
|
55
39
|
dates: string[],
|
|
56
|
-
options: { rawResponse: true
|
|
40
|
+
options: { rawResponse: true } & Options
|
|
57
41
|
): Promise<AxiosResponse<ApiAvailability>>;
|
|
58
|
-
delete(
|
|
59
|
-
|
|
60
|
-
dates: string[],
|
|
61
|
-
options?: Options<InternalQueryParams>
|
|
62
|
-
): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
63
|
-
delete(user: number, dates: string[], options?: Options<InternalQueryParams>) {
|
|
42
|
+
delete(user: number, dates: string[], options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
|
|
43
|
+
delete(user: number, dates: string[], options?: Options) {
|
|
64
44
|
return this.update(
|
|
65
45
|
{
|
|
66
46
|
user,
|
|
@@ -76,13 +56,13 @@ export class AvailabilityService extends Service {
|
|
|
76
56
|
);
|
|
77
57
|
}
|
|
78
58
|
|
|
79
|
-
async *list(
|
|
80
|
-
for await (const res of super.iterator<ApiAvailability>({ url: this.apiPath }, options)) {
|
|
59
|
+
async *list(query: AvailabilityQueryParams, options?: Options) {
|
|
60
|
+
for await (const res of super.iterator<ApiAvailability>({ url: this.apiPath, params: query }, options)) {
|
|
81
61
|
yield new Availability(res);
|
|
82
62
|
}
|
|
83
63
|
}
|
|
84
64
|
|
|
85
|
-
listByPage(
|
|
86
|
-
return super.iterator<ApiAvailability>({ url: this.apiPath }, options).byPage();
|
|
65
|
+
listByPage(query: AvailabilityQueryParams, options?: Options) {
|
|
66
|
+
return super.iterator<ApiAvailability>({ url: this.apiPath, params: query }, options).byPage();
|
|
87
67
|
}
|
|
88
68
|
}
|
|
@@ -5,22 +5,21 @@ import { Service, Options } from './index.js';
|
|
|
5
5
|
import { DailyBudgets } from '../models/daily-budgets.model.js';
|
|
6
6
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
7
7
|
import { DailyBudgetsQueryParams } from '../interfaces/query-params/daily-budgets-query-params.interface.js';
|
|
8
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
9
8
|
|
|
10
|
-
class DailyBudgetsService extends Service {
|
|
9
|
+
export class DailyBudgetsService extends Service {
|
|
11
10
|
private apiPath = '/daily_budgets';
|
|
12
11
|
|
|
13
|
-
async *list(options?: Options
|
|
14
|
-
for await (const res of super.iterator<ApiDailyBudgets>({ url: this.apiPath }, options)) {
|
|
12
|
+
async *list(query: DailyBudgetsQueryParams, options?: Options) {
|
|
13
|
+
for await (const res of super.iterator<ApiDailyBudgets>({ url: this.apiPath, params: query }, options)) {
|
|
15
14
|
yield new DailyBudgets(res);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
listAll(): Promise<DailyBudgets[]>;
|
|
20
|
-
async listAll() {
|
|
18
|
+
listAll(query: DailyBudgetsQueryParams, options?: Options): Promise<DailyBudgets[]>;
|
|
19
|
+
async listAll(query: DailyBudgetsQueryParams, options?: Options) {
|
|
21
20
|
try {
|
|
22
21
|
const attendance = [] as DailyBudgets[];
|
|
23
|
-
for await (const atten of this.list()) {
|
|
22
|
+
for await (const atten of this.list(query, options)) {
|
|
24
23
|
attendance.push(atten);
|
|
25
24
|
}
|
|
26
25
|
return attendance;
|
|
@@ -29,29 +28,26 @@ class DailyBudgetsService extends Service {
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
listByPage(options?: Options
|
|
33
|
-
return super.iterator<ApiDailyBudgets>({ url: this.apiPath }, options).byPage();
|
|
31
|
+
listByPage(query: DailyBudgetsQueryParams, options?: Options) {
|
|
32
|
+
return super.iterator<ApiDailyBudgets>({ url: this.apiPath, params: query }, options).byPage();
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
update(
|
|
35
|
+
update(data: Partial<ApiDailyBudgets>[]): Promise<number>;
|
|
37
36
|
update(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
options: { rawResponse: true; params?: InternalQueryParams }
|
|
37
|
+
data: Partial<ApiDailyBudgets>[],
|
|
38
|
+
options: { rawResponse: true } & Options
|
|
41
39
|
): Promise<AxiosResponse<ApiDailyBudgets, any>>;
|
|
42
|
-
update(
|
|
43
|
-
update(
|
|
40
|
+
update(data: Partial<ApiDailyBudgets>[], options: Options): Promise<number>;
|
|
41
|
+
update(data: Partial<ApiDailyBudgets>[], options?: Options) {
|
|
44
42
|
return super
|
|
45
43
|
.fetch<ApiDailyBudgets>({
|
|
46
|
-
url: `${this.apiPath}
|
|
44
|
+
url: `${this.apiPath}`,
|
|
47
45
|
data,
|
|
48
46
|
method: 'POST',
|
|
49
47
|
})
|
|
50
48
|
.then(
|
|
51
|
-
(res) => Promise.resolve(options?.rawResponse ? res :
|
|
49
|
+
(res) => Promise.resolve(options?.rawResponse ? res : res.status),
|
|
52
50
|
(err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err))
|
|
53
51
|
);
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
|
|
57
|
-
export { DailyBudgetsService };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiDailyRevenue } from '../interfaces/daily-revenue.interface.js';
|
|
3
|
+
import { Service, Options } from './index.js';
|
|
4
|
+
|
|
5
|
+
import { DailyRevenue } from '../models/daily-revenue.model.js';
|
|
6
|
+
import { ErrorResponse } from '../models/error-response.model.js';
|
|
7
|
+
import { DailyRevenueQueryParams } from '../interfaces/query-params/daily-revenue-query-params.interface.js';
|
|
8
|
+
|
|
9
|
+
export class DailyRevenueService extends Service {
|
|
10
|
+
private apiPath = '/daily_revenue';
|
|
11
|
+
|
|
12
|
+
async *list(query: DailyRevenueQueryParams, options?: Options) {
|
|
13
|
+
for await (const res of super.iterator<ApiDailyRevenue>({ url: this.apiPath, params: query }, options)) {
|
|
14
|
+
yield new DailyRevenue(res);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
listAll(query: DailyRevenueQueryParams, options?: Options): Promise<DailyRevenue[]>;
|
|
19
|
+
async listAll(query: DailyRevenueQueryParams, options?: Options) {
|
|
20
|
+
try {
|
|
21
|
+
const attendance = [] as DailyRevenue[];
|
|
22
|
+
for await (const atten of this.list(query, options)) {
|
|
23
|
+
attendance.push(atten);
|
|
24
|
+
}
|
|
25
|
+
return attendance;
|
|
26
|
+
} catch (err) {
|
|
27
|
+
return err;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
listByPage(query: DailyRevenueQueryParams, options?: Options) {
|
|
32
|
+
return super.iterator<ApiDailyRevenue>({ url: this.apiPath, params: query }, options).byPage();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
update(data: Partial<ApiDailyRevenue>[]): Promise<number>;
|
|
36
|
+
update(
|
|
37
|
+
data: Partial<ApiDailyRevenue>[],
|
|
38
|
+
options: { rawResponse: true } & Options
|
|
39
|
+
): Promise<AxiosResponse<ApiDailyRevenue, any>>;
|
|
40
|
+
update(data: Partial<ApiDailyRevenue>[], options: Options): Promise<number>;
|
|
41
|
+
update(data: Partial<ApiDailyRevenue>[], options?: Options) {
|
|
42
|
+
return super
|
|
43
|
+
.fetch<ApiDailyRevenue>({
|
|
44
|
+
url: `${this.apiPath}`,
|
|
45
|
+
data,
|
|
46
|
+
method: 'POST',
|
|
47
|
+
})
|
|
48
|
+
.then(
|
|
49
|
+
(res) => Promise.resolve(options?.rawResponse ? res : res.status),
|
|
50
|
+
(err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err))
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|