@dative-gpi/foundation-core-services 0.0.51 → 0.0.53
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/composables/app/useAppOrganisationId.ts +2 -2
- package/composables/services/useAlerts.ts +4 -82
- package/composables/services/useConnectivityAlerts.ts +2 -46
- package/composables/services/useDeviceConnectivities.ts +2 -37
- package/composables/services/useDeviceOrganisations.ts +5 -78
- package/composables/services/useDeviceStatuses.ts +2 -36
- package/composables/services/useGroups.ts +4 -43
- package/composables/services/useOrganisations.ts +4 -43
- package/composables/services/useUserOrganisations.ts +6 -81
- package/package.json +4 -4
|
@@ -4,7 +4,7 @@ const organisationId = ref<string | null>(null);
|
|
|
4
4
|
|
|
5
5
|
export const useAppOrganisationId = () => {
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const setAppOrganisationId = (payload: string) => {
|
|
8
8
|
organisationId.value = payload;
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -13,6 +13,6 @@ export const useAppOrganisationId = () => {
|
|
|
13
13
|
return {
|
|
14
14
|
ready,
|
|
15
15
|
organisationId,
|
|
16
|
-
|
|
16
|
+
setAppOrganisationId
|
|
17
17
|
};
|
|
18
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
3
|
import { AlertDetails, AlertDetailsDTO, AlertFilters, AlertInfos, AlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
import { ComposableFactory,
|
|
4
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { ALERTS_URL, ALERT_URL } from "../../config/urls";
|
|
7
7
|
|
|
@@ -9,89 +9,11 @@ const AlertServiceFactory = new ServiceFactory<AlertDetailsDTO, AlertDetails>("a
|
|
|
9
9
|
factory.addGet(ALERT_URL),
|
|
10
10
|
factory.addGetMany<AlertInfosDTO, AlertInfos, AlertFilters>(ALERTS_URL, AlertInfos),
|
|
11
11
|
factory.addRemove(ALERT_URL),
|
|
12
|
-
factory.
|
|
13
|
-
|
|
14
|
-
const response = await ServiceFactory.http.patch(ALERT_URL(alertId));
|
|
15
|
-
const result = new AlertDetails(response.data);
|
|
16
|
-
|
|
17
|
-
notifyService.notify("update", result);
|
|
18
|
-
|
|
19
|
-
return result;
|
|
20
|
-
},
|
|
21
|
-
getNotify: async (alertId: string): Promise<AlertDetails> => {
|
|
22
|
-
const response = await ServiceFactory.http.get(ALERT_URL(alertId));
|
|
23
|
-
const result = new AlertDetails(response.data);
|
|
24
|
-
|
|
25
|
-
notifyService.notify("update", result);
|
|
26
|
-
|
|
27
|
-
return result;
|
|
28
|
-
},
|
|
29
|
-
removeNotify: (alertId: string): void => {
|
|
30
|
-
notifyService.notify("delete", alertId);
|
|
31
|
-
}
|
|
32
|
-
}))
|
|
12
|
+
factory.addCustom("acknowledge", (axios, alertId: string) => axios.patch(ALERT_URL(alertId))),
|
|
13
|
+
factory.addNotify()
|
|
33
14
|
));
|
|
34
15
|
|
|
35
16
|
export const useAlert = ComposableFactory.get(AlertServiceFactory);
|
|
36
17
|
export const useAlerts = ComposableFactory.getMany(AlertServiceFactory);
|
|
37
18
|
export const useRemoveAlert = ComposableFactory.remove(AlertServiceFactory);
|
|
38
|
-
export const useAcknowledgeAlert = ()
|
|
39
|
-
const service = AlertServiceFactory();
|
|
40
|
-
const subscribersIds : number[] = [];
|
|
41
|
-
|
|
42
|
-
const changing = ref(false);
|
|
43
|
-
const changed = ref<AlertDetails | null>(null);
|
|
44
|
-
|
|
45
|
-
onUnmounted(() => {
|
|
46
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
47
|
-
subscribersIds.length = 0;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const change = async (alertId: string) => {
|
|
51
|
-
changing.value = true;
|
|
52
|
-
try {
|
|
53
|
-
changed.value = await service.acknowledge(alertId);
|
|
54
|
-
}
|
|
55
|
-
finally {
|
|
56
|
-
changing.value = false;
|
|
57
|
-
}
|
|
58
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(changed)));
|
|
59
|
-
return changed;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
changing,
|
|
64
|
-
change,
|
|
65
|
-
changed
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export const useNotifyAlert = () => {
|
|
69
|
-
const service = AlertServiceFactory();
|
|
70
|
-
|
|
71
|
-
const fetching = ref(false);
|
|
72
|
-
const fetched = ref<AlertDetails | null>(null);
|
|
73
|
-
|
|
74
|
-
const fetch = async (alertId: string) => {
|
|
75
|
-
fetching.value = true;
|
|
76
|
-
try {
|
|
77
|
-
fetched.value = await service.getNotify(alertId);
|
|
78
|
-
}
|
|
79
|
-
finally {
|
|
80
|
-
fetching.value = false;
|
|
81
|
-
}
|
|
82
|
-
return fetched;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
fetching,
|
|
87
|
-
fetch,
|
|
88
|
-
fetched
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
export const useNotifyRemoveAlert = () => {
|
|
92
|
-
const service = AlertServiceFactory();
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
remove: service.removeNotify
|
|
96
|
-
};
|
|
97
|
-
}
|
|
19
|
+
export const useAcknowledgeAlert = ComposableFactory.custom(AlertServiceFactory, AlertServiceFactory.acknowledge);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import { ConnectivityAlertDetails, ConnectivityAlertDetailsDTO, ConnectivityAlertFilters, ConnectivityAlertInfos, ConnectivityAlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
@@ -9,51 +7,9 @@ const ConnectivityAlertServiceFactory = new ServiceFactory<ConnectivityAlertDeta
|
|
|
9
7
|
factory.addGet(CONNECTIVITY_ALERT_URL),
|
|
10
8
|
factory.addGetMany<ConnectivityAlertInfosDTO, ConnectivityAlertInfos, ConnectivityAlertFilters>(CONNECTIVITY_ALERTS_URL, ConnectivityAlertInfos),
|
|
11
9
|
factory.addRemove(CONNECTIVITY_ALERT_URL),
|
|
12
|
-
factory.addNotify(
|
|
13
|
-
getNotify: async (connectivityAlertId: string): Promise<ConnectivityAlertDetails> => {
|
|
14
|
-
const response = await ServiceFactory.http.get(CONNECTIVITY_ALERT_URL(connectivityAlertId));
|
|
15
|
-
const result = new ConnectivityAlertDetails(response.data);
|
|
16
|
-
|
|
17
|
-
notifyService.notify("update", result);
|
|
18
|
-
|
|
19
|
-
return result;
|
|
20
|
-
},
|
|
21
|
-
removeNotify: (connectivityAlertId: string): void => {
|
|
22
|
-
notifyService.notify("delete", connectivityAlertId);
|
|
23
|
-
}
|
|
24
|
-
}))
|
|
10
|
+
factory.addNotify()
|
|
25
11
|
));
|
|
26
12
|
|
|
27
13
|
export const useConnectivityAlert = ComposableFactory.get(ConnectivityAlertServiceFactory);
|
|
28
14
|
export const useConnectivityAlerts = ComposableFactory.getMany(ConnectivityAlertServiceFactory);
|
|
29
|
-
export const useRemoveConnectivityAlert = ComposableFactory.remove(ConnectivityAlertServiceFactory);
|
|
30
|
-
export const useNotifyConnectivityAlert = () => {
|
|
31
|
-
const service = ConnectivityAlertServiceFactory();
|
|
32
|
-
|
|
33
|
-
const fetching = ref(false);
|
|
34
|
-
const fetched = ref<ConnectivityAlertDetails | null>(null);
|
|
35
|
-
|
|
36
|
-
const fetch = async (connectivityAlertId: string) => {
|
|
37
|
-
fetching.value = true;
|
|
38
|
-
try {
|
|
39
|
-
fetched.value = await service.getNotify(connectivityAlertId);
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
fetching.value = false;
|
|
43
|
-
}
|
|
44
|
-
return fetched;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
fetching,
|
|
49
|
-
fetch,
|
|
50
|
-
fetched
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export const useNotifyRemoveConnectivityAlert = () => {
|
|
54
|
-
const service = ConnectivityAlertServiceFactory();
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
remove: service.removeNotify
|
|
58
|
-
};
|
|
59
|
-
}
|
|
15
|
+
export const useRemoveConnectivityAlert = ComposableFactory.remove(ConnectivityAlertServiceFactory);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import { DeviceConnectivityDetails, DeviceConnectivityDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
@@ -7,40 +5,7 @@ import { DEVICE_CONNECTIVITY_URL } from "../../config/urls";
|
|
|
7
5
|
|
|
8
6
|
const DeviceConnectivityServiceFactory = new ServiceFactory<DeviceConnectivityDetailsDTO, DeviceConnectivityDetails>("deviceConnectivity", DeviceConnectivityDetails).create(factory => factory.build(
|
|
9
7
|
factory.addGet(DEVICE_CONNECTIVITY_URL),
|
|
10
|
-
factory.addNotify(
|
|
11
|
-
getNotify: async (deviceConnectivityId: string): Promise<DeviceConnectivityDetails> => {
|
|
12
|
-
const response = await ServiceFactory.http.get(DEVICE_CONNECTIVITY_URL(deviceConnectivityId));
|
|
13
|
-
const result = new DeviceConnectivityDetails(response.data);
|
|
14
|
-
|
|
15
|
-
notifyService.notify("update", result);
|
|
16
|
-
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
}))
|
|
8
|
+
factory.addNotify()
|
|
20
9
|
));
|
|
21
10
|
|
|
22
|
-
export const useDeviceConnectivity = ComposableFactory.get(DeviceConnectivityServiceFactory);
|
|
23
|
-
export const useNotifyDeviceConnectivity = () => {
|
|
24
|
-
const service = DeviceConnectivityServiceFactory();
|
|
25
|
-
|
|
26
|
-
const fetching = ref(false);
|
|
27
|
-
const fetched = ref<DeviceConnectivityDetails | null>(null);
|
|
28
|
-
|
|
29
|
-
const fetch = async (deviceConnectivityId: string) => {
|
|
30
|
-
fetching.value = true;
|
|
31
|
-
try {
|
|
32
|
-
fetched.value = await service.getNotify(deviceConnectivityId);
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
fetching.value = false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return fetched;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
fetching,
|
|
43
|
-
fetch,
|
|
44
|
-
fetched
|
|
45
|
-
};
|
|
46
|
-
}
|
|
11
|
+
export const useDeviceConnectivity = ComposableFactory.get(DeviceConnectivityServiceFactory);
|
|
@@ -11,24 +11,9 @@ const DeviceOrganisationServiceFactory = new ServiceFactory<DeviceOrganisationDe
|
|
|
11
11
|
factory.addCreate<CreateDeviceOrganisationDTO>(DEVICE_ORGANISATIONS_URL),
|
|
12
12
|
factory.addUpdate<UpdateDeviceOrganisationDTO>(DEVICE_ORGANISATION_URL),
|
|
13
13
|
factory.addRemove(DEVICE_ORGANISATION_URL),
|
|
14
|
-
factory.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const result = new DeviceOrganisationDetails(response.data);
|
|
18
|
-
|
|
19
|
-
notifyService.notify("update", result);
|
|
20
|
-
|
|
21
|
-
return result;
|
|
22
|
-
},
|
|
23
|
-
changeLocation: async (deviceOrganisationId: string, payload: ChangeDeviceOrganisationLocationDTO): Promise<DeviceOrganisationDetails> => {
|
|
24
|
-
const response = await ServiceFactory.http.put(DEVICE_ORGANISATION_LOCATION_URL(deviceOrganisationId), payload);
|
|
25
|
-
const result = new DeviceOrganisationDetails(response.data);
|
|
26
|
-
|
|
27
|
-
notifyService.notify("update", result);
|
|
28
|
-
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
}))
|
|
14
|
+
factory.addCustom("changeGroup", (axios, deviceOrganisationId: string, payload: ChangeDeviceOrganisationGroupDTO) => axios.put(DEVICE_ORGANISATION_GROUP_URL(deviceOrganisationId), payload)),
|
|
15
|
+
factory.addCustom("changeLocation", (axios, deviceOrganisationId: string, payload: ChangeDeviceOrganisationLocationDTO) => axios.put(DEVICE_ORGANISATION_LOCATION_URL(deviceOrganisationId), payload)),
|
|
16
|
+
factory.addNotify()
|
|
32
17
|
));
|
|
33
18
|
|
|
34
19
|
export const useDeviceOrganisation = ComposableFactory.get(DeviceOrganisationServiceFactory);
|
|
@@ -36,63 +21,5 @@ export const useDeviceOrganisations = ComposableFactory.getMany(DeviceOrganisati
|
|
|
36
21
|
export const useCreateDeviceOrganisation = ComposableFactory.create(DeviceOrganisationServiceFactory);
|
|
37
22
|
export const useUpdateDeviceOrganisation = ComposableFactory.update(DeviceOrganisationServiceFactory);
|
|
38
23
|
export const useRemoveDeviceOrganisation = ComposableFactory.remove(DeviceOrganisationServiceFactory);
|
|
39
|
-
export const useChangeDeviceOrganisationGroup = ()
|
|
40
|
-
|
|
41
|
-
const subscriberIds: number[] = [];
|
|
42
|
-
|
|
43
|
-
const changing = ref(false);
|
|
44
|
-
const changed = ref<DeviceOrganisationDetails | null>(null);
|
|
45
|
-
|
|
46
|
-
onUnmounted(() => {
|
|
47
|
-
subscriberIds.forEach(id => service.unsubscribe(id));
|
|
48
|
-
subscriberIds.length = 0;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const change = async (deviceOrganisationId: string, payload: ChangeDeviceOrganisationGroupDTO) => {
|
|
52
|
-
changing.value = true;
|
|
53
|
-
try {
|
|
54
|
-
changed.value = await service.changeGroup(deviceOrganisationId, payload);
|
|
55
|
-
}
|
|
56
|
-
finally {
|
|
57
|
-
changing.value = false;
|
|
58
|
-
}
|
|
59
|
-
subscriberIds.push(service.subscribe("all", onEntityChanged(changed)));
|
|
60
|
-
return changed;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
changing,
|
|
65
|
-
change,
|
|
66
|
-
changed
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export const useChangeDeviceOrganisationLocation = () => {
|
|
70
|
-
const service = DeviceOrganisationServiceFactory();
|
|
71
|
-
const subscriberIds: number[] = [];
|
|
72
|
-
|
|
73
|
-
const changing = ref(false);
|
|
74
|
-
const changed = ref<DeviceOrganisationDetails | null>(null);
|
|
75
|
-
|
|
76
|
-
onUnmounted(() => {
|
|
77
|
-
subscriberIds.forEach(id => service.unsubscribe(id));
|
|
78
|
-
subscriberIds.length = 0;
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const change = async (deviceOrganisationId: string, payload: ChangeDeviceOrganisationLocationDTO) => {
|
|
82
|
-
changing.value = true;
|
|
83
|
-
try {
|
|
84
|
-
changed.value = await service.changeLocation(deviceOrganisationId, payload);
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
changing.value = false;
|
|
88
|
-
}
|
|
89
|
-
subscriberIds.push(service.subscribe("all", onEntityChanged(changed)));
|
|
90
|
-
return changed;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
changing,
|
|
95
|
-
change,
|
|
96
|
-
changed
|
|
97
|
-
}
|
|
98
|
-
}
|
|
24
|
+
export const useChangeDeviceOrganisationGroup = ComposableFactory.custom(DeviceOrganisationServiceFactory, DeviceOrganisationServiceFactory.changeGroup);
|
|
25
|
+
export const useChangeDeviceOrganisationLocation = ComposableFactory.custom(DeviceOrganisationServiceFactory, DeviceOrganisationServiceFactory.changeLocation);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import { DeviceStatusDetails, DeviceStatusDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
@@ -7,39 +5,7 @@ import { DEVICE_STATUS_URL } from "../../config/urls";
|
|
|
7
5
|
|
|
8
6
|
const DeviceStatusServiceFactory = new ServiceFactory<DeviceStatusDetailsDTO, DeviceStatusDetails>("deviceStatus", DeviceStatusDetails).create(factory => factory.build(
|
|
9
7
|
factory.addGet(DEVICE_STATUS_URL),
|
|
10
|
-
factory.addNotify(
|
|
11
|
-
getNotify: async (deviceStatusId: string): Promise<DeviceStatusDetails> => {
|
|
12
|
-
const response = await ServiceFactory.http.get(DEVICE_STATUS_URL(deviceStatusId));
|
|
13
|
-
const result = new DeviceStatusDetails(response.data);
|
|
14
|
-
|
|
15
|
-
notifyService.notify("update", result);
|
|
16
|
-
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
}))
|
|
8
|
+
factory.addNotify()
|
|
20
9
|
));
|
|
21
10
|
|
|
22
|
-
export const useDeviceStatus = ComposableFactory.get(DeviceStatusServiceFactory);
|
|
23
|
-
export const useNotifyDeviceStatus = () => {
|
|
24
|
-
const service = DeviceStatusServiceFactory();
|
|
25
|
-
|
|
26
|
-
const fetching = ref(false);
|
|
27
|
-
const fetched = ref<DeviceStatusDetails | null>(null);
|
|
28
|
-
|
|
29
|
-
const fetch = async (deviceStatusId: string) => {
|
|
30
|
-
fetching.value = true;
|
|
31
|
-
try {
|
|
32
|
-
fetched.value = await service.getNotify(deviceStatusId);
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
fetching.value = false;
|
|
36
|
-
}
|
|
37
|
-
return fetched;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
fetching,
|
|
42
|
-
fetch,
|
|
43
|
-
fetched
|
|
44
|
-
};
|
|
45
|
-
}
|
|
11
|
+
export const useDeviceStatus = ComposableFactory.get(DeviceStatusServiceFactory);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import { ChangeGroupParentDTO, CreateGroupDTO, GroupDetails, GroupDetailsDTO, GroupFilters, GroupInfos, GroupInfosDTO, UpdateGroupDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
import { ComposableFactory,
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
6
4
|
import { GROUPS_URL, GROUP_URL } from "../../config/urls";
|
|
7
5
|
|
|
@@ -11,16 +9,8 @@ const GroupServiceFactory = new ServiceFactory<GroupDetailsDTO, GroupDetails>("g
|
|
|
11
9
|
factory.addCreate<CreateGroupDTO>(GROUPS_URL),
|
|
12
10
|
factory.addUpdate<UpdateGroupDTO>(GROUP_URL),
|
|
13
11
|
factory.addRemove(GROUP_URL),
|
|
14
|
-
factory.
|
|
15
|
-
|
|
16
|
-
const response = await ServiceFactory.http.put(GROUP_URL(groupId), payload);
|
|
17
|
-
const result = new GroupDetails(response.data);
|
|
18
|
-
|
|
19
|
-
notifyService.notify("update", result);
|
|
20
|
-
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
}))
|
|
12
|
+
factory.addCustom("changeParent", (axios, groupdId: string, payload: ChangeGroupParentDTO) => axios.put(GROUP_URL(groupdId), payload)),
|
|
13
|
+
factory.addNotify()
|
|
24
14
|
));
|
|
25
15
|
|
|
26
16
|
export const useGroup = ComposableFactory.get(GroupServiceFactory);
|
|
@@ -28,33 +18,4 @@ export const useGroups = ComposableFactory.getMany(GroupServiceFactory);
|
|
|
28
18
|
export const useCreateGroup = ComposableFactory.create(GroupServiceFactory);
|
|
29
19
|
export const useUpdateGroup = ComposableFactory.update(GroupServiceFactory);
|
|
30
20
|
export const useRemoveGroup = ComposableFactory.remove(GroupServiceFactory);
|
|
31
|
-
export const useChangeGroupParent = ()
|
|
32
|
-
const service = GroupServiceFactory();
|
|
33
|
-
const subscriberIds: number[] = [];
|
|
34
|
-
|
|
35
|
-
const changing = ref(false);
|
|
36
|
-
const changed = ref<GroupDetails | null>(null);
|
|
37
|
-
|
|
38
|
-
onUnmounted(() => {
|
|
39
|
-
subscriberIds.forEach(id => service.unsubscribe(id));
|
|
40
|
-
subscriberIds.length = 0;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const change = async (groupId: string, payload: ChangeGroupParentDTO) => {
|
|
44
|
-
changing.value = true;
|
|
45
|
-
try {
|
|
46
|
-
changed.value = await service.changeParent(groupId, payload);
|
|
47
|
-
}
|
|
48
|
-
finally {
|
|
49
|
-
changing.value = false;
|
|
50
|
-
}
|
|
51
|
-
subscriberIds.push(service.subscribe("all", onEntityChanged(changed)));
|
|
52
|
-
return changed;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
changing,
|
|
57
|
-
change,
|
|
58
|
-
changed
|
|
59
|
-
}
|
|
60
|
-
}
|
|
21
|
+
export const useChangeGroupParent = ComposableFactory.custom(GroupServiceFactory, GroupServiceFactory.changeParent);
|
|
@@ -1,51 +1,12 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import { OrganisationDetails, OrganisationDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
2
|
import { ChangeOrganisationDashboardDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
5
|
-
import {
|
|
3
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
6
4
|
|
|
7
5
|
import { ORGANISATION_DASHBOARD_URL } from "../../config/urls";
|
|
8
6
|
|
|
9
7
|
const OrganisationServiceFactory = new ServiceFactory<OrganisationDetailsDTO, OrganisationDetails>("organisation", OrganisationDetails).create(factory => factory.build(
|
|
10
|
-
factory.
|
|
11
|
-
|
|
12
|
-
const response = await ServiceFactory.http.put(ORGANISATION_DASHBOARD_URL(), payload);
|
|
13
|
-
const result = new OrganisationDetails(response.data);
|
|
14
|
-
|
|
15
|
-
notifyService.notify("update", result);
|
|
16
|
-
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
}))
|
|
8
|
+
factory.addCustom("changeDashboard", (axios, payload: ChangeOrganisationDashboardDTO) => axios.put(ORGANISATION_DASHBOARD_URL(), payload)),
|
|
9
|
+
factory.addNotify()
|
|
20
10
|
));
|
|
21
11
|
|
|
22
|
-
export const useChangeDashboardOrganisation = ()
|
|
23
|
-
const service = OrganisationServiceFactory();
|
|
24
|
-
const subscribersIds: number[] = [];
|
|
25
|
-
|
|
26
|
-
const changing = ref(false);
|
|
27
|
-
const changed = ref<OrganisationDetails | null>(null);
|
|
28
|
-
|
|
29
|
-
onUnmounted(() => {
|
|
30
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
31
|
-
subscribersIds.length = 0;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const change = async (payload: ChangeOrganisationDashboardDTO) => {
|
|
35
|
-
changing.value = true;
|
|
36
|
-
try {
|
|
37
|
-
changed.value = await service.changeDashboard(payload);
|
|
38
|
-
}
|
|
39
|
-
finally {
|
|
40
|
-
changing.value = false;
|
|
41
|
-
}
|
|
42
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(changed)));
|
|
43
|
-
return changed;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
changing,
|
|
48
|
-
change,
|
|
49
|
-
changed
|
|
50
|
-
}
|
|
51
|
-
}
|
|
12
|
+
export const useChangeDashboardOrganisation = ComposableFactory.custom(OrganisationServiceFactory, OrganisationServiceFactory.changeDashboard);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { onUnmounted, ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import { CreateUserOrganisationDTO, UpdateUserOrganisationDTO, UserOrganisationDetails, UserOrganisationDetailsDTO, UserOrganisationFilters, UserOrganisationInfos, UserOrganisationInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
import { ComposableFactory,
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
6
4
|
import { USER_ORGANISATIONS_URL, USER_ORGANISATION_CURRENT_URL, USER_ORGANISATION_URL } from "../../config/urls";
|
|
7
5
|
|
|
@@ -11,24 +9,9 @@ const UserOrganisationServiceFactory = new ServiceFactory<UserOrganisationDetail
|
|
|
11
9
|
factory.addCreate<CreateUserOrganisationDTO>(USER_ORGANISATIONS_URL),
|
|
12
10
|
factory.addUpdate<UpdateUserOrganisationDTO>(USER_ORGANISATION_URL),
|
|
13
11
|
factory.addRemove(USER_ORGANISATION_URL),
|
|
14
|
-
factory.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const result = new UserOrganisationDetails(response.data);
|
|
18
|
-
|
|
19
|
-
notifyService.notify("update", result);
|
|
20
|
-
|
|
21
|
-
return result;
|
|
22
|
-
},
|
|
23
|
-
updateCurrent: async(payload: UpdateUserOrganisationDTO): Promise<UserOrganisationDetails> => {
|
|
24
|
-
const response = await ServiceFactory.http.post(USER_ORGANISATION_CURRENT_URL(), payload);
|
|
25
|
-
const result = new UserOrganisationDetails(response.data);
|
|
26
|
-
|
|
27
|
-
notifyService.notify("update", result);
|
|
28
|
-
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
}))
|
|
12
|
+
factory.addCustom("getCurrent", (axios) => axios.get(USER_ORGANISATION_CURRENT_URL())),
|
|
13
|
+
factory.addCustom("updateCurrent", (axios, payload: UpdateUserOrganisationDTO) => axios.post(USER_ORGANISATION_CURRENT_URL(), payload)),
|
|
14
|
+
factory.addNotify()
|
|
32
15
|
));
|
|
33
16
|
|
|
34
17
|
export const useUserOrganisation = ComposableFactory.get(UserOrganisationServiceFactory);
|
|
@@ -36,63 +19,5 @@ export const useUserOrganisations = ComposableFactory.getMany(UserOrganisationSe
|
|
|
36
19
|
export const useCreateUserOrganisation = ComposableFactory.create(UserOrganisationServiceFactory);
|
|
37
20
|
export const useUpdateUserOrganisation = ComposableFactory.update(UserOrganisationServiceFactory);
|
|
38
21
|
export const useRemoveUserOrganisation = ComposableFactory.remove(UserOrganisationServiceFactory);
|
|
39
|
-
export const useCurrentUserOrganisation = ()
|
|
40
|
-
|
|
41
|
-
const subscribersIds: number[] = [];
|
|
42
|
-
|
|
43
|
-
const fetching = ref(false);
|
|
44
|
-
const fetched = ref<UserOrganisationDetails | null>(null);
|
|
45
|
-
|
|
46
|
-
onUnmounted(() => {
|
|
47
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
48
|
-
subscribersIds.length = 0;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const fetch = async () => {
|
|
52
|
-
fetching.value = true;
|
|
53
|
-
try {
|
|
54
|
-
fetched.value = await service.getCurrent();
|
|
55
|
-
}
|
|
56
|
-
finally {
|
|
57
|
-
fetching.value = false;
|
|
58
|
-
}
|
|
59
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
60
|
-
return fetched;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
fetching,
|
|
65
|
-
fetch,
|
|
66
|
-
fetched
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export const useUpdateCurrentUserOrganisation = () => {
|
|
70
|
-
const service = UserOrganisationServiceFactory();
|
|
71
|
-
const subscribersIds: number[] = [];
|
|
72
|
-
|
|
73
|
-
const updating = ref(false);
|
|
74
|
-
const updated = ref<UserOrganisationDetails | null>(null);
|
|
75
|
-
|
|
76
|
-
onUnmounted(() => {
|
|
77
|
-
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
78
|
-
subscribersIds.length = 0;
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const update = async (payload: UpdateUserOrganisationDTO) => {
|
|
82
|
-
updating.value = true;
|
|
83
|
-
try {
|
|
84
|
-
updated.value = await service.updateCurrent(payload);
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
updating.value = false;
|
|
88
|
-
}
|
|
89
|
-
subscribersIds.push(service.subscribe("all", onEntityChanged(updated)));
|
|
90
|
-
return updated;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
updating,
|
|
95
|
-
update,
|
|
96
|
-
updated
|
|
97
|
-
}
|
|
98
|
-
}
|
|
22
|
+
export const useCurrentUserOrganisation = ComposableFactory.custom(UserOrganisationServiceFactory, UserOrganisationServiceFactory.getCurrent);
|
|
23
|
+
export const useUpdateCurrentUserOrganisation = ComposableFactory.custom(UserOrganisationServiceFactory, UserOrganisationServiceFactory.updateCurrent);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-core-services",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.53",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/bones-ui": "^0.0.
|
|
14
|
-
"@dative-gpi/foundation-core-domain": "0.0.
|
|
13
|
+
"@dative-gpi/bones-ui": "^0.0.67",
|
|
14
|
+
"@dative-gpi/foundation-core-domain": "0.0.53",
|
|
15
15
|
"@microsoft/signalr": "^8.0.0",
|
|
16
16
|
"vue": "^3.2.0",
|
|
17
17
|
"vue-router": "^4.2.5"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "4ecd4c47590cb49ab9f480e12202cde9af5396e1"
|
|
20
20
|
}
|