rotacloud 1.0.23 → 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/.github/workflows/publish.yml +1 -1
- package/README.md +1 -2
- package/dist/cjs/interfaces/query-params/daily-budgets-query-params.interface.d.ts +2 -2
- package/dist/cjs/models/daily-budgets.model.js +2 -0
- package/dist/cjs/rotacloud.d.ts +3 -1
- package/dist/cjs/rotacloud.js +2 -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 +16 -0
- package/dist/cjs/services/daily-budgets.service.js +99 -0
- 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 +2 -0
- package/dist/cjs/services/index.js +2 -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/interfaces/query-params/daily-budgets-query-params.interface.d.ts +2 -2
- package/dist/mjs/models/daily-budgets.model.js +2 -0
- package/dist/mjs/rotacloud.d.ts +3 -1
- package/dist/mjs/rotacloud.js +3 -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 +16 -0
- package/dist/mjs/services/daily-budgets.service.js +38 -0
- 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 +2 -0
- package/dist/mjs/services/index.js +2 -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 -3
- package/src/interfaces/query-params/daily-budgets-query-params.interface.ts +2 -2
- package/src/models/daily-budgets.model.ts +2 -0
- package/src/rotacloud.ts +4 -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 +53 -0
- 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 +2 -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
|
@@ -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 {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
3
3
|
import { Group } from '../models/group.model.js';
|
|
4
|
-
class GroupsService extends Service {
|
|
4
|
+
export class GroupsService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/groups';
|
|
@@ -12,15 +12,15 @@ class GroupsService 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 Group(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 Group(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async listAll() {
|
|
20
|
+
async listAll(query, options) {
|
|
21
21
|
try {
|
|
22
22
|
const groups = [];
|
|
23
|
-
for await (const group of this.list()) {
|
|
23
|
+
for await (const group of this.list(query, options)) {
|
|
24
24
|
groups.push(group);
|
|
25
25
|
}
|
|
26
26
|
return groups;
|
|
@@ -29,8 +29,8 @@ class GroupsService 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 GroupsService 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 { GroupsService };
|
|
@@ -2,6 +2,8 @@ export * from './service.js';
|
|
|
2
2
|
export * from './accounts.service.js';
|
|
3
3
|
export * from './attendance.service.js';
|
|
4
4
|
export * from './availability.service.js';
|
|
5
|
+
export * from './daily-budgets.service.js';
|
|
6
|
+
export * from './daily-revenue.service.js';
|
|
5
7
|
export * from './days-off.service.js';
|
|
6
8
|
export * from './groups.service.js';
|
|
7
9
|
export * from './leave-request.service.js';
|
|
@@ -2,6 +2,8 @@ export * from './service.js';
|
|
|
2
2
|
export * from './accounts.service.js';
|
|
3
3
|
export * from './attendance.service.js';
|
|
4
4
|
export * from './availability.service.js';
|
|
5
|
+
export * from './daily-budgets.service.js';
|
|
6
|
+
export * from './daily-revenue.service.js';
|
|
5
7
|
export * from './days-off.service.js';
|
|
6
8
|
export * from './groups.service.js';
|
|
7
9
|
export * from './leave-request.service.js';
|
|
@@ -2,37 +2,32 @@ import { AxiosResponse } from 'axios';
|
|
|
2
2
|
import { ApiLeaveEmbargo } from '../interfaces/index.js';
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { LeaveEmbargo } from '../models/leave-embargo.model.js';
|
|
5
|
-
import {
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
5
|
+
import { LeaveEmbargoesQueryParams } from '../rotacloud.js';
|
|
7
6
|
declare type RequiredProps = 'start_date' | 'end_date' | 'users';
|
|
8
|
-
declare class LeaveEmbargoesService extends Service {
|
|
7
|
+
export declare class LeaveEmbargoesService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiLeaveEmbargo, RequiredProps>): Promise<LeaveEmbargo>;
|
|
11
10
|
create(data: RequirementsOf<ApiLeaveEmbargo, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiLeaveEmbargo, RequiredProps>, options: Options<InternalQueryParams>): Promise<LeaveEmbargo>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiLeaveEmbargo, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiLeaveEmbargo, RequiredProps>, options: Options): Promise<LeaveEmbargo>;
|
|
16
14
|
get(id: number): Promise<LeaveEmbargo>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
params?: InternalQueryParams;
|
|
20
17
|
}): Promise<AxiosResponse<ApiLeaveEmbargo, any>>;
|
|
21
|
-
get(id: number, options: Options
|
|
22
|
-
list(options?: Options
|
|
23
|
-
listAll(): Promise<LeaveEmbargo[]>;
|
|
24
|
-
listByPage(options?: Options
|
|
18
|
+
get(id: number, options: Options): Promise<LeaveEmbargo>;
|
|
19
|
+
list(query: LeaveEmbargoesQueryParams, options?: Options): AsyncGenerator<LeaveEmbargo, void, unknown>;
|
|
20
|
+
listAll(query: LeaveEmbargoesQueryParams, options?: Options): Promise<LeaveEmbargo[]>;
|
|
21
|
+
listByPage(query: LeaveEmbargoesQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiLeaveEmbargo[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiLeaveEmbargo>): Promise<LeaveEmbargo>;
|
|
26
23
|
update(id: number, data: Partial<ApiLeaveEmbargo>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiLeaveEmbargo>, options: Options<InternalQueryParams>): Promise<LeaveEmbargo>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiLeaveEmbargo, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiLeaveEmbargo>, options: Options): Promise<LeaveEmbargo>;
|
|
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 {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { LeaveEmbargo } from '../models/leave-embargo.model.js';
|
|
3
3
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
-
class LeaveEmbargoesService extends Service {
|
|
4
|
+
export class LeaveEmbargoesService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/leave_embargoes';
|
|
@@ -12,15 +12,15 @@ class LeaveEmbargoesService 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 LeaveEmbargo(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 LeaveEmbargo(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async listAll() {
|
|
20
|
+
async listAll(query, options) {
|
|
21
21
|
try {
|
|
22
22
|
const leave = [];
|
|
23
|
-
for await (const leaveEmbargoRecord of this.list()) {
|
|
23
|
+
for await (const leaveEmbargoRecord of this.list(query, options)) {
|
|
24
24
|
leave.push(leaveEmbargoRecord);
|
|
25
25
|
}
|
|
26
26
|
return leave;
|
|
@@ -29,8 +29,8 @@ class LeaveEmbargoesService 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 LeaveEmbargoesService 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 { LeaveEmbargoesService };
|
|
@@ -2,37 +2,32 @@ import { AxiosResponse } from 'axios';
|
|
|
2
2
|
import { ApiLeaveRequest } from '../interfaces/index.js';
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { LeaveQueryParams } from '../interfaces/query-params/leave-query-params.interface.js';
|
|
5
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
6
5
|
import { LeaveRequest } from '../models/leave-request.model.js';
|
|
7
6
|
declare type RequiredProps = 'start_date' | 'end_date' | 'type' | 'user';
|
|
8
|
-
declare class LeaveRequestService extends Service {
|
|
7
|
+
export declare class LeaveRequestService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiLeaveRequest, RequiredProps>): Promise<LeaveRequest>;
|
|
11
10
|
create(data: RequirementsOf<ApiLeaveRequest, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiLeaveRequest, RequiredProps>, options: Options<InternalQueryParams>): Promise<LeaveRequest>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiLeaveRequest, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiLeaveRequest, RequiredProps>, options: Options): Promise<LeaveRequest>;
|
|
16
14
|
get(id: number): Promise<LeaveRequest>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
params?: InternalQueryParams;
|
|
20
17
|
}): Promise<AxiosResponse<ApiLeaveRequest, any>>;
|
|
21
|
-
get(id: number, options: Options
|
|
22
|
-
list(options?: Options
|
|
23
|
-
listAll(): Promise<LeaveRequest[]>;
|
|
24
|
-
listByPage(options?: Options
|
|
18
|
+
get(id: number, options: Options): Promise<LeaveRequest>;
|
|
19
|
+
list(query: LeaveQueryParams, options?: Options): AsyncGenerator<LeaveRequest, void, unknown>;
|
|
20
|
+
listAll(query: LeaveQueryParams, options?: Options): Promise<LeaveRequest[]>;
|
|
21
|
+
listByPage(options?: Options): AsyncGenerator<AxiosResponse<ApiLeaveRequest[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiLeaveRequest>): Promise<LeaveRequest>;
|
|
26
23
|
update(id: number, data: Partial<ApiLeaveRequest>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiLeaveRequest>, options: Options<InternalQueryParams>): Promise<LeaveRequest>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiLeaveRequest, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiLeaveRequest>, options: Options): Promise<LeaveRequest>;
|
|
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<ApiLeaveRequest, 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 { ErrorResponse } from '../models/error-response.model.js';
|
|
3
3
|
import { LeaveRequest } from '../models/leave-request.model.js';
|
|
4
|
-
class LeaveRequestService extends Service {
|
|
4
|
+
export class LeaveRequestService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/leave_requests';
|
|
@@ -12,15 +12,15 @@ class LeaveRequestService 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 LeaveRequest(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:
|
|
15
|
+
async *list(query, options) {
|
|
16
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
17
17
|
yield new LeaveRequest(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async listAll() {
|
|
20
|
+
async listAll(query, options) {
|
|
21
21
|
try {
|
|
22
22
|
const leave = [];
|
|
23
|
-
for await (const leaveRequestRecord of this.list()) {
|
|
23
|
+
for await (const leaveRequestRecord of this.list(query, options)) {
|
|
24
24
|
leave.push(leaveRequestRecord);
|
|
25
25
|
}
|
|
26
26
|
return leave;
|
|
@@ -45,4 +45,3 @@ class LeaveRequestService 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 { LeaveRequestService };
|
|
@@ -3,38 +3,33 @@ import { ApiLeave } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { Leave } from '../models/leave.model.js';
|
|
5
5
|
import { LeaveQueryParams } from '../interfaces/query-params/leave-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
import { LeaveType } from '../models/leave-type.model.js';
|
|
8
7
|
declare type RequiredProps = 'users' | 'type' | 'start_date' | 'end_date';
|
|
9
|
-
declare class LeaveService extends Service {
|
|
8
|
+
export declare class LeaveService extends Service {
|
|
10
9
|
private apiPath;
|
|
11
10
|
create(data: RequirementsOf<ApiLeave, RequiredProps>): Promise<Leave[]>;
|
|
12
11
|
create(data: RequirementsOf<ApiLeave, RequiredProps>, options: {
|
|
13
12
|
rawResponse: true;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
create(data: RequirementsOf<ApiLeave, RequiredProps>, options: Options<InternalQueryParams>): Promise<Leave[]>;
|
|
13
|
+
} & Options): Promise<AxiosResponse<ApiLeave[], any>>;
|
|
14
|
+
create(data: RequirementsOf<ApiLeave, RequiredProps>, options: Options): Promise<Leave[]>;
|
|
17
15
|
get(id: number): Promise<Leave>;
|
|
18
16
|
get(id: number, options: {
|
|
19
17
|
rawResponse: true;
|
|
20
|
-
params?: InternalQueryParams;
|
|
21
18
|
}): Promise<AxiosResponse<ApiLeave, any>>;
|
|
22
|
-
get(id: number, options: Options
|
|
23
|
-
list(options?: Options
|
|
24
|
-
listAll(): Promise<Leave[]>;
|
|
25
|
-
listLeaveTypes(options?: Options
|
|
26
|
-
listByPage(options?: Options
|
|
19
|
+
get(id: number, options: Options): Promise<Leave>;
|
|
20
|
+
list(query: LeaveQueryParams, options?: Options): AsyncGenerator<Leave, void, unknown>;
|
|
21
|
+
listAll(query: LeaveQueryParams, options?: Options): Promise<Leave[]>;
|
|
22
|
+
listLeaveTypes(query: LeaveQueryParams, options?: Options): AsyncGenerator<LeaveType, void, unknown>;
|
|
23
|
+
listByPage(query: LeaveQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiLeave[], any>, any, unknown>;
|
|
27
24
|
update(id: number, data: Partial<ApiLeave>): Promise<Leave>;
|
|
28
25
|
update(id: number, data: Partial<ApiLeave>, options: {
|
|
29
26
|
rawResponse: true;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
update(id: number, data: Partial<ApiLeave>, options: Options<InternalQueryParams>): Promise<Leave>;
|
|
27
|
+
} & Options): Promise<AxiosResponse<ApiLeave, any>>;
|
|
28
|
+
update(id: number, data: Partial<ApiLeave>, options: Options): Promise<Leave>;
|
|
33
29
|
delete(id: number): Promise<number>;
|
|
34
30
|
delete(id: number, options: {
|
|
35
31
|
rawResponse: true;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
|
|
32
|
+
} & Options): Promise<AxiosResponse<ApiLeave, any>>;
|
|
33
|
+
delete(id: number, options: Options): Promise<number>;
|
|
39
34
|
}
|
|
40
|
-
export {
|
|
35
|
+
export {};
|
|
@@ -2,26 +2,26 @@ import { Service } from './index.js';
|
|
|
2
2
|
import { Leave } from '../models/leave.model.js';
|
|
3
3
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
4
|
import { LeaveType } from '../models/leave-type.model.js';
|
|
5
|
-
class LeaveService extends Service {
|
|
5
|
+
export class LeaveService extends Service {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.apiPath = '/leave';
|
|
9
9
|
}
|
|
10
10
|
create(data, options) {
|
|
11
|
-
return super.fetch({ url:
|
|
11
|
+
return super.fetch({ url: this.apiPath, data, method: 'POST' }).then((res) => Promise.resolve(options?.rawResponse ? res : [...res.data.map((leave) => new Leave(leave))]), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
12
12
|
}
|
|
13
13
|
get(id, options) {
|
|
14
14
|
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve(options?.rawResponse ? res : new Leave(res.data)), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
15
15
|
}
|
|
16
|
-
async *list(options) {
|
|
17
|
-
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
16
|
+
async *list(query, options) {
|
|
17
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
18
18
|
yield new Leave(res);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
async listAll() {
|
|
21
|
+
async listAll(query, options) {
|
|
22
22
|
try {
|
|
23
23
|
const leave = [];
|
|
24
|
-
for await (const leaveRecord of this.list()) {
|
|
24
|
+
for await (const leaveRecord of this.list(query, options)) {
|
|
25
25
|
leave.push(leaveRecord);
|
|
26
26
|
}
|
|
27
27
|
return leave;
|
|
@@ -30,13 +30,13 @@ class LeaveService extends Service {
|
|
|
30
30
|
return err;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
async *listLeaveTypes(options) {
|
|
34
|
-
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
33
|
+
async *listLeaveTypes(query, options) {
|
|
34
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
35
35
|
yield new LeaveType(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
|
update(id, data, options) {
|
|
42
42
|
return super
|
|
@@ -51,4 +51,3 @@ class LeaveService extends Service {
|
|
|
51
51
|
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)));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
export { LeaveService };
|
|
@@ -3,36 +3,31 @@ import { ApiLocation } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { Location } from '../models/location.model.js';
|
|
5
5
|
import { LocationsQueryParams } from '../interfaces/query-params/locations-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'name';
|
|
8
|
-
declare class LocationsService extends Service {
|
|
7
|
+
export declare class LocationsService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiLocation, RequiredProps>): Promise<Location>;
|
|
11
10
|
create(data: RequirementsOf<ApiLocation, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiLocation, RequiredProps>, options: Options<InternalQueryParams>): Promise<ApiLocation>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiLocation, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiLocation, RequiredProps>, options: Options): Promise<Location>;
|
|
16
14
|
get(id: number): Promise<Location>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<LocationsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiLocation[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiLocation, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<Location>;
|
|
19
|
+
list(query: LocationsQueryParams, options?: Options): AsyncGenerator<Location, void, unknown>;
|
|
20
|
+
listAll(query: LocationsQueryParams, options?: Options): Promise<Location[]>;
|
|
21
|
+
listByPage(query: LocationsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiLocation[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiLocation>): Promise<Location>;
|
|
26
23
|
update(id: number, data: Partial<ApiLocation>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiLocation>, options: Options<InternalQueryParams>): Promise<ApiLocation>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiLocation, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiLocation>, options: Options): Promise<Location>;
|
|
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 {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { Location } from '../models/location.model.js';
|
|
3
3
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
-
class LocationsService extends Service {
|
|
4
|
+
export class LocationsService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/locations';
|
|
@@ -12,15 +12,15 @@ class LocationsService 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 Location(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 Location(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async listAll() {
|
|
20
|
+
async listAll(query, options) {
|
|
21
21
|
try {
|
|
22
22
|
const locations = [];
|
|
23
|
-
for await (const location of this.list()) {
|
|
23
|
+
for await (const location of this.list(query, options)) {
|
|
24
24
|
locations.push(location);
|
|
25
25
|
}
|
|
26
26
|
return locations;
|
|
@@ -29,8 +29,8 @@ class LocationsService 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 LocationsService 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 { LocationsService };
|
|
@@ -3,36 +3,31 @@ import { ApiRole } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { Role } from '../models/role.model.js';
|
|
5
5
|
import { RolesQueryParams } from '../interfaces/query-params/roles-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'name';
|
|
8
|
-
declare class RolesService extends Service {
|
|
7
|
+
export declare class RolesService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiRole, RequiredProps>): Promise<Role>;
|
|
11
10
|
create(data: RequirementsOf<ApiRole, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiRole, RequiredProps>, options: Options<InternalQueryParams>): Promise<Role>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiRole, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiRole, RequiredProps>, options: Options): Promise<Role>;
|
|
16
14
|
get(id: number): Promise<Role>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<RolesQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiRole[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiRole, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<Role>;
|
|
19
|
+
list(query: RolesQueryParams, options?: Options): AsyncGenerator<Role, void, unknown>;
|
|
20
|
+
listAll(query: RolesQueryParams, options?: Options): Promise<Role[]>;
|
|
21
|
+
listByPage(query: RolesQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiRole[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiRole>): Promise<Role>;
|
|
26
23
|
update(id: number, data: Partial<ApiRole>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiRole>, options: Options<InternalQueryParams>): Promise<Role>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiRole, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiRole>, options: Options): Promise<Role>;
|
|
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 {};
|