shared-ritm 1.2.134 → 1.2.135
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/types/api/services/ScheduleService.d.ts +7 -7
- package/dist/types/api/types/Api_Projects.d.ts +1 -0
- package/dist/types/api/types/Api_Schedule.d.ts +13 -0
- package/package.json +1 -1
- package/src/api/services/ScheduleService.ts +9 -8
- package/src/api/types/Api_Projects.ts +1 -0
- package/src/api/types/Api_Schedule.ts +12 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import ApiService from '../settings/ApiService';
|
|
2
|
-
import { Api_Schedule_Add_Shift, Api_Schedule_Complete_Brigade, Api_Schedule_Config, Api_Schedule_Edit_Shifts, Api_Schedule_Swap_Shifts, Api_Schedule_Table_Brigade } from '@/api/types/Api_Schedule';
|
|
2
|
+
import { Api_Schedule_Add_Shift, Api_Schedule_Complete_Brigade, Api_Schedule_Config, Api_Schedule_Edit_Shifts, Api_Schedule_Item, Api_Schedule_Swap_Shifts, Api_Schedule_Table_Brigade } from '@/api/types/Api_Schedule';
|
|
3
3
|
declare class ScheduleService extends ApiService {
|
|
4
4
|
fetchScheduleConfig(): Promise<Api_Schedule_Config>;
|
|
5
|
-
fetchSchedule(id: string): Promise<
|
|
6
|
-
fetchScheduleTable(id: string): Promise<
|
|
5
|
+
fetchSchedule(id: string): Promise<Api_Schedule_Item[]>;
|
|
6
|
+
fetchScheduleTable(id: string): Promise<Api_Schedule_Table_Brigade[]>;
|
|
7
7
|
completeBrigadeSchedule(id: string, body: Api_Schedule_Complete_Brigade): Promise<Api_Schedule_Table_Brigade>;
|
|
8
8
|
autocompleteBrigadesSchedule(id: string, body: {
|
|
9
9
|
shifts: string[];
|
|
10
|
-
}): Promise<
|
|
11
|
-
addBrigadeShift(id: string, body: Api_Schedule_Add_Shift): Promise<
|
|
12
|
-
swapBrigadeShifts(id: string, body: Api_Schedule_Swap_Shifts): Promise<
|
|
10
|
+
}): Promise<Api_Schedule_Item[]>;
|
|
11
|
+
addBrigadeShift(id: string, body: Api_Schedule_Add_Shift): Promise<Api_Schedule_Item[]>;
|
|
12
|
+
swapBrigadeShifts(id: string, body: Api_Schedule_Swap_Shifts): Promise<Api_Schedule_Item[]>;
|
|
13
13
|
editBrigadeShifts(id: string, body: Api_Schedule_Edit_Shifts): Promise<any>;
|
|
14
14
|
deleteBrigadeShifts(id: string, shift_ids: string[]): Promise<any>;
|
|
15
|
-
deleteBrigadesFromSchedule(id: string, brigade_ids: string[]): Promise<
|
|
15
|
+
deleteBrigadesFromSchedule(id: string, brigade_ids: string[]): Promise<string>;
|
|
16
16
|
}
|
|
17
17
|
export default function useScheduleService(): ScheduleService;
|
|
18
18
|
export {};
|
|
@@ -38,3 +38,16 @@ export type Api_Schedule_Edit_Shifts = {
|
|
|
38
38
|
shift_ids: string[];
|
|
39
39
|
shift_template_id: string;
|
|
40
40
|
};
|
|
41
|
+
export type Api_Schedule_Shift = {
|
|
42
|
+
id: string;
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
shift_template: Api_Schedule_Shift_Template;
|
|
46
|
+
};
|
|
47
|
+
export type Api_Schedule_Item = {
|
|
48
|
+
brigade: Api_Schedule_Table_Brigade;
|
|
49
|
+
shifts: {
|
|
50
|
+
date: string;
|
|
51
|
+
shift: Api_Schedule_Shift;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Api_Schedule_Complete_Brigade,
|
|
5
5
|
Api_Schedule_Config,
|
|
6
6
|
Api_Schedule_Edit_Shifts,
|
|
7
|
+
Api_Schedule_Item,
|
|
7
8
|
Api_Schedule_Swap_Shifts,
|
|
8
9
|
Api_Schedule_Table_Brigade,
|
|
9
10
|
} from '@/api/types/Api_Schedule'
|
|
@@ -13,12 +14,12 @@ class ScheduleService extends ApiService {
|
|
|
13
14
|
return this.get<Api_Schedule_Config>('schedule/config')
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
public fetchSchedule(id: string): Promise<
|
|
17
|
-
return this.get<
|
|
17
|
+
public fetchSchedule(id: string): Promise<Api_Schedule_Item[]> {
|
|
18
|
+
return this.get<Api_Schedule_Item[]>(`schedule/${id}`)
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
public fetchScheduleTable(id: string): Promise<
|
|
21
|
-
return this.get<
|
|
21
|
+
public fetchScheduleTable(id: string): Promise<Api_Schedule_Table_Brigade[]> {
|
|
22
|
+
return this.get<Api_Schedule_Table_Brigade[]>(`schedule/${id}/get_brigades_table`)
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
public completeBrigadeSchedule(id: string, body: Api_Schedule_Complete_Brigade): Promise<Api_Schedule_Table_Brigade> {
|
|
@@ -28,15 +29,15 @@ class ScheduleService extends ApiService {
|
|
|
28
29
|
)
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
public autocompleteBrigadesSchedule(id: string, body: { shifts: string[] }): Promise<
|
|
32
|
+
public autocompleteBrigadesSchedule(id: string, body: { shifts: string[] }): Promise<Api_Schedule_Item[]> {
|
|
32
33
|
return this.post(`schedule/${id}/autocomplete`, body)
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
public addBrigadeShift(id: string, body: Api_Schedule_Add_Shift): Promise<
|
|
36
|
+
public addBrigadeShift(id: string, body: Api_Schedule_Add_Shift): Promise<Api_Schedule_Item[]> {
|
|
36
37
|
return this.post(`schedule/${id}/shifts`, body)
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
public swapBrigadeShifts(id: string, body: Api_Schedule_Swap_Shifts): Promise<
|
|
40
|
+
public swapBrigadeShifts(id: string, body: Api_Schedule_Swap_Shifts): Promise<Api_Schedule_Item[]> {
|
|
40
41
|
return this.patch(`schedule/${id}/shifts/switch_shift_templates`, body)
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -48,7 +49,7 @@ class ScheduleService extends ApiService {
|
|
|
48
49
|
return this.delete(`schedule/${id}/shifts`, { data: { shift_ids } })
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
public deleteBrigadesFromSchedule(id: string, brigade_ids: string[]): Promise<
|
|
52
|
+
public deleteBrigadesFromSchedule(id: string, brigade_ids: string[]): Promise<string> {
|
|
52
53
|
return this.patch(`schedule/${id}/delete_brigades`, { brigade_ids })
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -44,3 +44,15 @@ export type Api_Schedule_Edit_Shifts = {
|
|
|
44
44
|
shift_ids: string[]
|
|
45
45
|
shift_template_id: string
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
export type Api_Schedule_Shift = {
|
|
49
|
+
id: string
|
|
50
|
+
from: string
|
|
51
|
+
to: string
|
|
52
|
+
shift_template: Api_Schedule_Shift_Template
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type Api_Schedule_Item = {
|
|
56
|
+
brigade: Api_Schedule_Table_Brigade
|
|
57
|
+
shifts: { date: string; shift: Api_Schedule_Shift }[]
|
|
58
|
+
}
|