@dative-gpi/foundation-core-services 0.0.7 → 0.0.9
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/index.ts +2 -3
- package/composables/services/index.ts +2 -3
- package/composables/services/useActions.ts +11 -0
- package/composables/services/useAuthTokens.ts +1 -3
- package/composables/services/useComments.ts +13 -0
- package/composables/services/useLanguages.ts +1 -1
- package/composables/services/useOrganisations.ts +5 -10
- package/composables/services/usePermissions.ts +2 -2
- package/composables/services/useUserOrganisationDispositions.ts +76 -0
- package/composables/services/useUserOrganisations.ts +2 -2
- package/composables/services/useUsers.ts +5 -80
- package/composables/useCore.ts +28 -0
- package/composables/useOrganisationId.ts +7 -19
- package/config/literals/index.ts +0 -2
- package/config/urls/actions.ts +3 -0
- package/config/urls/alerts.ts +3 -3
- package/config/urls/articles.ts +3 -3
- package/config/urls/authTokens.ts +3 -3
- package/config/urls/base.ts +2 -3
- package/config/urls/comments.ts +4 -0
- package/config/urls/connectivityAlerts.ts +3 -3
- package/config/urls/customProperties.ts +1 -1
- package/config/urls/customPropertyValues.ts +1 -1
- package/config/urls/dataCategories.ts +2 -2
- package/config/urls/dataDefinitions.ts +2 -2
- package/config/urls/deviceConnectivities.ts +1 -1
- package/config/urls/deviceOrganisations.ts +2 -2
- package/config/urls/deviceStatuses.ts +1 -1
- package/config/urls/groups.ts +2 -2
- package/config/urls/images.ts +3 -3
- package/config/urls/index.ts +3 -4
- package/config/urls/languages.ts +2 -2
- package/config/urls/locations.ts +2 -2
- package/config/urls/manufacturers.ts +2 -2
- package/config/urls/models.ts +2 -2
- package/config/urls/organisationTypes.ts +2 -2
- package/config/urls/organisations.ts +2 -6
- package/config/urls/permissionCategories.ts +1 -1
- package/config/urls/permissions.ts +1 -1
- package/config/urls/roleOrganisationTypes.ts +2 -2
- package/config/urls/roleOrganisations.ts +2 -2
- package/config/urls/urlFactory.ts +2 -7
- package/config/urls/userOrganisationDispositions.ts +4 -0
- package/config/urls/userOrganisations.ts +3 -3
- package/config/urls/users.ts +3 -3
- package/package.json +4 -4
- package/composables/services/useApplications.ts +0 -47
- package/composables/services/useFamilies.ts +0 -13
- package/composables/services/useTimeZones.ts +0 -11
- package/composables/services/useTranslations.ts +0 -42
- package/composables/useLanguageCode.ts +0 -48
- package/composables/useTimeZone.ts +0 -75
- package/config/urls/applications.ts +0 -4
- package/config/urls/families.ts +0 -4
- package/config/urls/files.ts +0 -4
- package/config/urls/timeZones.ts +0 -3
- package/config/urls/translations.ts +0 -4
package/composables/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./useActions";
|
|
1
2
|
export * from "./useAlerts";
|
|
2
3
|
export * from "./useArticles";
|
|
3
4
|
export * from "./useAuthTokens";
|
|
@@ -9,7 +10,6 @@ export * from "./useDataDefinitions";
|
|
|
9
10
|
export * from "./useDeviceConnectivities";
|
|
10
11
|
export * from "./useDeviceOrganisations";
|
|
11
12
|
export * from "./useDeviceStatuses";
|
|
12
|
-
export * from "./useFamilies";
|
|
13
13
|
export * from "./useGroups";
|
|
14
14
|
export * from "./useLanguages";
|
|
15
15
|
export * from "./useLocations";
|
|
@@ -21,7 +21,6 @@ export * from "./usePermissionCategories";
|
|
|
21
21
|
export * from "./usePermissions";
|
|
22
22
|
export * from "./useRoleOrganisations";
|
|
23
23
|
export * from "./useRoleOrganisationTypes";
|
|
24
|
-
export * from "./
|
|
25
|
-
export * from "./useTranslations";
|
|
24
|
+
export * from "./useUserOrganisationDispositions";
|
|
26
25
|
export * from "./useUserOrganisations";
|
|
27
26
|
export * from "./useUsers";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionDetails, ActionDetailsDTO, ActionInfos, ActionInfosDTO } from "@dative-gpi/foundation-core-domain";
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
|
+
|
|
4
|
+
import { ACTIONS_URL } from "../../config/urls";
|
|
5
|
+
|
|
6
|
+
const ActionServiceFactory = new ServiceFactory<ActionDetailsDTO, ActionDetails>("action", ActionDetails).create(factory => factory.build(
|
|
7
|
+
factory.addGetMany<ActionInfosDTO, ActionInfos, string>(ACTIONS_URL, ActionInfos),
|
|
8
|
+
factory.addNotify()
|
|
9
|
+
));
|
|
10
|
+
|
|
11
|
+
export const useActions = ComposableFactory.getMany(ActionServiceFactory);
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { AuthTokenDetails, AuthTokenDetailsDTO, AuthTokenFilters, AuthTokenInfos, AuthTokenInfosDTO
|
|
1
|
+
import { AuthTokenDetails, AuthTokenDetailsDTO, AuthTokenFilters, AuthTokenInfos, AuthTokenInfosDTO } from "@dative-gpi/foundation-core-domain";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
3
|
|
|
4
4
|
import { AUTH_TOKENS_URL, AUTH_TOKEN_URL } from "../../config/urls";
|
|
5
5
|
|
|
6
6
|
const AuthTokenServiceFactory = new ServiceFactory<AuthTokenDetailsDTO, AuthTokenDetails>("authToken", AuthTokenDetails).create(factory => factory.build(
|
|
7
7
|
factory.addGetMany<AuthTokenInfosDTO, AuthTokenInfos, AuthTokenFilters>(AUTH_TOKENS_URL, AuthTokenInfos),
|
|
8
|
-
factory.addCreate<CreateAuthTokenDTO>(AUTH_TOKENS_URL),
|
|
9
8
|
factory.addRemove(AUTH_TOKEN_URL),
|
|
10
9
|
factory.addNotify()
|
|
11
10
|
));
|
|
12
11
|
|
|
13
12
|
export const useAuthTokens = ComposableFactory.getMany(AuthTokenServiceFactory);
|
|
14
|
-
export const useCreateAuthToken = ComposableFactory.create(AuthTokenServiceFactory);
|
|
15
13
|
export const useRemoveAuthToken = ComposableFactory.remove(AuthTokenServiceFactory);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CreateCommentDTO, CommentDetails, CommentDetailsDTO, CommentFilters, CommentInfos, CommentInfosDTO, UpdateCommentDTO } from "@dative-gpi/foundation-core-domain";
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
|
+
|
|
4
|
+
import { COMMENTS_URL, COMMENT_URL } from "../../config/urls";
|
|
5
|
+
|
|
6
|
+
const CommentServiceFactory = new ServiceFactory<CommentDetailsDTO, CommentDetails>("comment", CommentDetails)
|
|
7
|
+
.createComplete<CommentInfos, CommentInfosDTO, CreateCommentDTO, UpdateCommentDTO, CommentFilters>(COMMENTS_URL, COMMENT_URL, CommentInfos);
|
|
8
|
+
|
|
9
|
+
export const useComment = ComposableFactory.get(CommentServiceFactory);
|
|
10
|
+
export const useComments = ComposableFactory.getMany(CommentServiceFactory);
|
|
11
|
+
export const useCreateComment = ComposableFactory.create(CommentServiceFactory);
|
|
12
|
+
export const useUpdateComment = ComposableFactory.update(CommentServiceFactory);
|
|
13
|
+
export const useRemoveComment = ComposableFactory.remove(CommentServiceFactory);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageDetails, LanguageDetailsDTO, LanguageFilters, LanguageInfos, LanguageInfosDTO } from "@dative-gpi/foundation-
|
|
1
|
+
import { LanguageDetails, LanguageDetailsDTO, LanguageFilters, LanguageInfos, LanguageInfosDTO } from "@dative-gpi/foundation-shared-domain";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
3
|
|
|
4
4
|
import { LANGUAGES_URL, LANGUAGE_URL } from "../../config/urls";
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { Ref, onUnmounted, readonly, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { OrganisationDetails, OrganisationDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
4
|
+
import { ChangeOrganisationDashboardDTO } from "@dative-gpi/foundation-core-domain";
|
|
5
|
+
import { onEntityChanged , ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
6
|
|
|
6
|
-
import { ORGANISATION_DASHBOARD_URL
|
|
7
|
+
import { ORGANISATION_DASHBOARD_URL } from "../../config/urls";
|
|
7
8
|
|
|
8
9
|
const OrganisationServiceFactory = new ServiceFactory<OrganisationDetailsDTO, OrganisationDetails>("organisation", OrganisationDetails).create(factory => factory.build(
|
|
9
|
-
factory.addGet(ORGANISATION_URL),
|
|
10
|
-
factory.addGetMany<OrganisationInfosDTO, OrganisationInfos, OrganisationFilters>(ORGANISATIONS_URL, OrganisationInfos),
|
|
11
|
-
factory.addUpdate<UpdateOrganisationDTO>(ORGANISATION_URL),
|
|
12
10
|
factory.addNotify((notifyService) => ({
|
|
13
11
|
changeDashboard: async (payload: ChangeOrganisationDashboardDTO): Promise<OrganisationDetails> => {
|
|
14
|
-
const response = await ServiceFactory.http.put(ORGANISATION_DASHBOARD_URL, payload);
|
|
12
|
+
const response = await ServiceFactory.http.put(ORGANISATION_DASHBOARD_URL(), payload);
|
|
15
13
|
const result = new OrganisationDetails(response.data);
|
|
16
14
|
|
|
17
15
|
notifyService.notify("update", result);
|
|
@@ -21,9 +19,6 @@ const OrganisationServiceFactory = new ServiceFactory<OrganisationDetailsDTO, Or
|
|
|
21
19
|
}))
|
|
22
20
|
));
|
|
23
21
|
|
|
24
|
-
export const useOrganisation = ComposableFactory.get(OrganisationServiceFactory);
|
|
25
|
-
export const useOrganisations = ComposableFactory.getMany(OrganisationServiceFactory);
|
|
26
|
-
export const useUpdateOrganisation = ComposableFactory.update(OrganisationServiceFactory);
|
|
27
22
|
export const useChangeDashboardOrganisation = () => {
|
|
28
23
|
const service = OrganisationServiceFactory();
|
|
29
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref, readonly, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { PermissionDetails, PermissionDetailsDTO, PermissionInfos
|
|
3
|
+
import { PermissionDetails, PermissionDetailsDTO, PermissionInfos } from "@dative-gpi/foundation-shared-domain";
|
|
4
4
|
import { ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { PERMISSIONS_CURRENT_URL } from "../../config/urls";
|
|
@@ -8,7 +8,7 @@ import { PERMISSIONS_CURRENT_URL } from "../../config/urls";
|
|
|
8
8
|
const PermissionServiceFactory = new ServiceFactory<PermissionDetailsDTO, PermissionDetails>("permission", PermissionDetails).create(factory => factory.build(
|
|
9
9
|
factory.addNotify(() => ({
|
|
10
10
|
getCurrent: async (): Promise<PermissionInfos[]> => {
|
|
11
|
-
const response = await ServiceFactory.http.get(PERMISSIONS_CURRENT_URL);
|
|
11
|
+
const response = await ServiceFactory.http.get(PERMISSIONS_CURRENT_URL());
|
|
12
12
|
const result = response.data.map((dto: PermissionInfos) => new PermissionInfos(dto));
|
|
13
13
|
|
|
14
14
|
return result;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Ref, onUnmounted, readonly, ref } from "vue";
|
|
2
|
+
|
|
3
|
+
import { UpdateUserOrganisationDispositionDTO, UserOrganisationDispositionDetails, UserOrganisationDispositionDetailsDTO, UserOrganisationDispositionInfos, UserOrganisationDispositionInfosDTO } from "@dative-gpi/foundation-core-domain";
|
|
4
|
+
import { ComposableFactory, onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
+
|
|
6
|
+
import { USER_ORGANISATION_DISPOSITION_URL } from "../../config/urls";
|
|
7
|
+
|
|
8
|
+
const UserOrganisationDispositionServiceFactory = new ServiceFactory<UserOrganisationDispositionDetailsDTO, UserOrganisationDispositionDetails>("userOrganisationDisposition", UserOrganisationDispositionDetails).create(factory => factory.build(
|
|
9
|
+
factory.addNotify((notifyService) => ({
|
|
10
|
+
getTable: async (tableCode: string): Promise<UserOrganisationDispositionInfosDTO[]> => {
|
|
11
|
+
const response = await ServiceFactory.http.get(USER_ORGANISATION_DISPOSITION_URL(tableCode));
|
|
12
|
+
const result = response.data.map((dto: UserOrganisationDispositionInfosDTO) => new UserOrganisationDispositionInfos(dto));
|
|
13
|
+
|
|
14
|
+
notifyService.notify("update", result);
|
|
15
|
+
|
|
16
|
+
return result;
|
|
17
|
+
},
|
|
18
|
+
updateTable: async(tableCode: string, payload: UpdateUserOrganisationDispositionDTO[]): Promise<UserOrganisationDispositionInfosDTO[]> => {
|
|
19
|
+
const response = await ServiceFactory.http.post(USER_ORGANISATION_DISPOSITION_URL(tableCode), payload);
|
|
20
|
+
const result = response.data.map((dto: UserOrganisationDispositionInfosDTO) => new UserOrganisationDispositionInfos(dto));
|
|
21
|
+
|
|
22
|
+
notifyService.notify("update", result);
|
|
23
|
+
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
}))
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
export const useGetTable = () => {
|
|
30
|
+
const service = UserOrganisationDispositionServiceFactory();
|
|
31
|
+
|
|
32
|
+
const fetching = ref(false);
|
|
33
|
+
const fetched = ref<UserOrganisationDispositionInfos[]>([]) as Ref<UserOrganisationDispositionInfos[]>;
|
|
34
|
+
|
|
35
|
+
const fetch = async (tableCode: string) => {
|
|
36
|
+
fetching.value = true;
|
|
37
|
+
try {
|
|
38
|
+
fetched.value = await service.getTable(tableCode);
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
fetching.value = false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return readonly(fetched as Ref<UserOrganisationDispositionInfos[]>);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
fetching: readonly(fetching),
|
|
49
|
+
fetch,
|
|
50
|
+
fetched: readonly(fetched)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export const useUpdateTable = () => {
|
|
54
|
+
const service = UserOrganisationDispositionServiceFactory();
|
|
55
|
+
|
|
56
|
+
const updating = ref(false);
|
|
57
|
+
const updated = ref<UserOrganisationDispositionInfos[]>([]) as Ref<UserOrganisationDispositionInfos[]>;
|
|
58
|
+
|
|
59
|
+
const update = async (tableCode: string, payload: UpdateUserOrganisationDispositionDTO[]) => {
|
|
60
|
+
updating.value = true;
|
|
61
|
+
try {
|
|
62
|
+
updated.value = await service.updateTable(tableCode, payload);
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
updating.value = false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return readonly(updated as Ref<UserOrganisationDispositionInfos[]>);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
updating: readonly(updating),
|
|
73
|
+
update,
|
|
74
|
+
updated: readonly(updated)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -13,7 +13,7 @@ const UserOrganisationServiceFactory = new ServiceFactory<UserOrganisationDetail
|
|
|
13
13
|
factory.addRemove(USER_ORGANISATION_URL),
|
|
14
14
|
factory.addNotify((notifyService) => ({
|
|
15
15
|
getCurrent: async (): Promise<UserOrganisationDetails> => {
|
|
16
|
-
const response = await ServiceFactory.http.get(USER_ORGANISATION_CURRENT_URL);
|
|
16
|
+
const response = await ServiceFactory.http.get(USER_ORGANISATION_CURRENT_URL());
|
|
17
17
|
const result = new UserOrganisationDetails(response.data);
|
|
18
18
|
|
|
19
19
|
notifyService.notify("update", result);
|
|
@@ -21,7 +21,7 @@ const UserOrganisationServiceFactory = new ServiceFactory<UserOrganisationDetail
|
|
|
21
21
|
return result;
|
|
22
22
|
},
|
|
23
23
|
updateCurrent: async(payload: UpdateUserOrganisationDTO): Promise<UserOrganisationDetails> => {
|
|
24
|
-
const response = await ServiceFactory.http.post(USER_ORGANISATION_CURRENT_URL, payload);
|
|
24
|
+
const response = await ServiceFactory.http.post(USER_ORGANISATION_CURRENT_URL(), payload);
|
|
25
25
|
const result = new UserOrganisationDetails(response.data);
|
|
26
26
|
|
|
27
27
|
notifyService.notify("update", result);
|
|
@@ -1,90 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UpdateUserDTO, UserDetails, UserDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
import { ComposableFactory, onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
-
|
|
6
|
-
import { USERS_URL, USER_CURRENT_URL, USER_URL } from "../../config/urls";
|
|
4
|
+
import { USER_URL } from "../../config/urls";
|
|
7
5
|
|
|
8
6
|
const UserServiceFactory = new ServiceFactory<UserDetailsDTO, UserDetails>("user", UserDetails).create(factory => factory.build(
|
|
9
7
|
factory.addGet(USER_URL),
|
|
10
|
-
factory.addGetMany<UserInfosDTO, UserInfos, UserFilters>(USERS_URL, UserInfos),
|
|
11
8
|
factory.addUpdate<UpdateUserDTO>(USER_URL),
|
|
12
9
|
factory.addRemove(USER_URL),
|
|
13
|
-
factory.addNotify(
|
|
14
|
-
getCurrent: async (): Promise<UserDetails> => {
|
|
15
|
-
const response = await ServiceFactory.http.get(USER_CURRENT_URL);
|
|
16
|
-
const result = new UserDetails(response.data);
|
|
17
|
-
|
|
18
|
-
notifyService.notify("update", result);
|
|
19
|
-
|
|
20
|
-
return result;
|
|
21
|
-
},
|
|
22
|
-
updateCurrent: async(payload: UpdateUserDTO): Promise<UserDetails> => {
|
|
23
|
-
const response = await ServiceFactory.http.post(USER_CURRENT_URL, payload);
|
|
24
|
-
const result = new UserDetails(response.data);
|
|
25
|
-
|
|
26
|
-
notifyService.notify("update", result);
|
|
27
|
-
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
}))
|
|
10
|
+
factory.addNotify()
|
|
31
11
|
));
|
|
32
12
|
|
|
33
13
|
export const useUser = ComposableFactory.get(UserServiceFactory);
|
|
34
|
-
export const useUsers = ComposableFactory.getMany(UserServiceFactory);
|
|
35
14
|
export const useUpdateUser = ComposableFactory.update(UserServiceFactory);
|
|
36
|
-
export const useRemoveUser = ComposableFactory.remove(UserServiceFactory);
|
|
37
|
-
export const useCurrentUser = () => {
|
|
38
|
-
const service = UserServiceFactory();
|
|
39
|
-
|
|
40
|
-
const fetching = ref(false);
|
|
41
|
-
const fetched = ref<UserDetails | null>(null) as Ref<UserDetails | null>;
|
|
42
|
-
|
|
43
|
-
const fetch = async () => {
|
|
44
|
-
fetching.value = true;
|
|
45
|
-
try {
|
|
46
|
-
fetched.value = await service.getCurrent();
|
|
47
|
-
}
|
|
48
|
-
finally {
|
|
49
|
-
fetching.value = false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const subscriberId = service.subscribe("all", onEntityChanged(fetched))
|
|
53
|
-
onUnmounted(() => service.unsubscribe(subscriberId));
|
|
54
|
-
|
|
55
|
-
return readonly(fetched as Ref<UserDetails>);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
fetching: readonly(fetching),
|
|
60
|
-
fetch,
|
|
61
|
-
fetched: readonly(fetched)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export const useUpdateCurrentUser = () => {
|
|
65
|
-
const service = UserServiceFactory();
|
|
66
|
-
|
|
67
|
-
const updating = ref(false);
|
|
68
|
-
const updated = ref<UserDetails | null>(null) as Ref<UserDetails | null>;
|
|
69
|
-
|
|
70
|
-
const update = async (payload: UpdateUserDTO) => {
|
|
71
|
-
updating.value = true;
|
|
72
|
-
try {
|
|
73
|
-
updated.value = await service.updateCurrent(payload);
|
|
74
|
-
}
|
|
75
|
-
finally {
|
|
76
|
-
updating.value = false;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const subscriberId = service.subscribe("all", onEntityChanged(updated))
|
|
80
|
-
onUnmounted(() => service.unsubscribe(subscriberId));
|
|
81
|
-
|
|
82
|
-
return readonly(updated as Ref<UserDetails>);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
updating: readonly(updating),
|
|
87
|
-
update,
|
|
88
|
-
updated: readonly(updated)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
15
|
+
export const useRemoveUser = ComposableFactory.remove(UserServiceFactory);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { onMounted, ref } from "vue";
|
|
2
|
+
|
|
3
|
+
import { useOrganisationId } from "@dative-gpi/foundation-core-services/composables";
|
|
4
|
+
|
|
5
|
+
let called = false;
|
|
6
|
+
|
|
7
|
+
const ready = ref(false);
|
|
8
|
+
|
|
9
|
+
export function useCore() {
|
|
10
|
+
if (called) {
|
|
11
|
+
return {
|
|
12
|
+
ready
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
called = true;
|
|
17
|
+
|
|
18
|
+
const { ready: organisationIdReady } = useOrganisationId();
|
|
19
|
+
|
|
20
|
+
onMounted(async () => {
|
|
21
|
+
await organisationIdReady
|
|
22
|
+
ready.value = true;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
ready
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -1,31 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRouter } from "vue-router";
|
|
1
|
+
import { provide, ref, watch } from "vue";
|
|
3
2
|
|
|
4
|
-
import {
|
|
5
|
-
import { ORGANISATION_ID } from "../config/literals";
|
|
3
|
+
import { ORGANISATION_ID } from "@dative-gpi/foundation-core-services/config/literals";
|
|
6
4
|
|
|
7
5
|
let initialized = false;
|
|
8
6
|
|
|
9
7
|
const organisationId = ref<string | null>(null);
|
|
10
8
|
|
|
11
9
|
export const useOrganisationId = () => {
|
|
10
|
+
const setOrganisationId = (payload: string) => {
|
|
11
|
+
organisationId.value = payload;
|
|
12
|
+
};
|
|
13
|
+
|
|
12
14
|
if (!initialized) {
|
|
13
15
|
provide(ORGANISATION_ID, organisationId);
|
|
14
|
-
|
|
15
|
-
const router = useRouter();
|
|
16
|
-
|
|
17
|
-
watch(router.currentRoute, () => {
|
|
18
|
-
organisationId.value = router.currentRoute.value.params[ORGANISATION_ID] as string | null;
|
|
19
|
-
setOrganisationId(organisationId);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
onMounted(() => {
|
|
23
|
-
if (organisationId.value) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
organisationId.value = router.currentRoute.value.params[ORGANISATION_ID] as string | null;
|
|
27
|
-
setOrganisationId(organisationId);
|
|
28
|
-
});
|
|
29
16
|
}
|
|
30
17
|
|
|
31
18
|
initialized = true;
|
|
@@ -46,5 +33,6 @@ export const useOrganisationId = () => {
|
|
|
46
33
|
return {
|
|
47
34
|
ready,
|
|
48
35
|
organisationId,
|
|
36
|
+
setOrganisationId
|
|
49
37
|
};
|
|
50
38
|
}
|
package/config/literals/index.ts
CHANGED
package/config/urls/alerts.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CORE_URL, HUBS_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const ALERTS_URL = `${CORE_URL}/alerts`;
|
|
4
|
-
export const ALERT_URL = (alertId: string) => `${ALERTS_URL}/${encodeURIComponent(alertId)}`;
|
|
3
|
+
export const ALERTS_URL = () => `${CORE_URL()}/alerts`;
|
|
4
|
+
export const ALERT_URL = (alertId: string) => `${ALERTS_URL()}/${encodeURIComponent(alertId)}`;
|
|
5
5
|
|
|
6
|
-
export const ALERTS_HUB_URL = `${HUBS_URL}/alerts`;
|
|
6
|
+
export const ALERTS_HUB_URL = () => `${HUBS_URL()}/alerts`;
|
package/config/urls/articles.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const ARTICLES_URL = `${
|
|
4
|
-
export const ARTICLE_URL = (articleId: string) => `${ARTICLES_URL}/${encodeURIComponent(articleId)}`;
|
|
3
|
+
export const ARTICLES_URL = () => `${CORE_URL()}/articles`;
|
|
4
|
+
export const ARTICLE_URL = (articleId: string) => `${ARTICLES_URL()}/${encodeURIComponent(articleId)}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const AUTH_TOKENS_URL = `${
|
|
4
|
-
export const AUTH_TOKEN_URL = (authTokenId: string) => `${AUTH_TOKENS_URL}/${encodeURIComponent(authTokenId)}`;
|
|
3
|
+
export const AUTH_TOKENS_URL = () => `${CORE_URL()}/pats`;
|
|
4
|
+
export const AUTH_TOKEN_URL = (authTokenId: string) => `${AUTH_TOKENS_URL()}/${encodeURIComponent(authTokenId)}`;
|
package/config/urls/base.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { urlFactory } from "./urlFactory";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const HUBS_URL = urlFactory(organisationId => `/api/foundation/hubs/v1/organisations/${encodeURIComponent(organisationId)}`);
|
|
3
|
+
export const CORE_URL = urlFactory(organisationId => `/api/core/v1/organisations/${encodeURIComponent(organisationId)}`);
|
|
4
|
+
export const HUBS_URL = urlFactory(organisationId => `/api/hubs/v1/organisations/${encodeURIComponent(organisationId)}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CORE_URL, HUBS_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const CONNECTIVITY_ALERTS_URL = `${CORE_URL}/connectivity-alerts`;
|
|
4
|
-
export const CONNECTIVITY_ALERT_URL = (connectivityAlertId: string) => `${CONNECTIVITY_ALERTS_URL}/${encodeURIComponent(connectivityAlertId)}`;
|
|
3
|
+
export const CONNECTIVITY_ALERTS_URL = () => `${CORE_URL()}/connectivity-alerts`;
|
|
4
|
+
export const CONNECTIVITY_ALERT_URL = (connectivityAlertId: string) => `${CONNECTIVITY_ALERTS_URL()}/${encodeURIComponent(connectivityAlertId)}`;
|
|
5
5
|
|
|
6
|
-
export const CONNECTIVITY_ALERTS_HUB_URL = `${HUBS_URL}/connectivity-alerts`;
|
|
6
|
+
export const CONNECTIVITY_ALERTS_HUB_URL = () => `${HUBS_URL()}/connectivity-alerts`;
|
|
@@ -2,4 +2,4 @@ import { PropertyEntity } from "@dative-gpi/foundation-core-domain";
|
|
|
2
2
|
|
|
3
3
|
import { CORE_URL } from "./base";
|
|
4
4
|
|
|
5
|
-
export const CUSTOM_PROPERTY_VALUES_URL = (entity: PropertyEntity, entityId: string, code: string) => `${CORE_URL}/custom-property-values/${encodeURIComponent(entity)}/${encodeURIComponent(entityId)}/${encodeURIComponent(code)}`;
|
|
5
|
+
export const CUSTOM_PROPERTY_VALUES_URL = (entity: PropertyEntity, entityId: string, code: string) => `${CORE_URL()}/custom-property-values/${encodeURIComponent(entity)}/${encodeURIComponent(entityId)}/${encodeURIComponent(code)}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const DATA_CATEGORIES_URL = `${CORE_URL}/data-categories`;
|
|
4
|
-
export const DATA_CATEGORY_URL = (dataCategoryId: string) => `${DATA_CATEGORIES_URL}/${encodeURIComponent(dataCategoryId)}`;
|
|
3
|
+
export const DATA_CATEGORIES_URL = () => `${CORE_URL()}/data-categories`;
|
|
4
|
+
export const DATA_CATEGORY_URL = (dataCategoryId: string) => `${DATA_CATEGORIES_URL()}/${encodeURIComponent(dataCategoryId)}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const DATA_DEFINITIONS_URL = `${CORE_URL}/data-definitions`;
|
|
4
|
-
export const DATA_DEFINITION_URL = (dataDefinitionId: string) => `${DATA_DEFINITIONS_URL}/${encodeURIComponent(dataDefinitionId)}`;
|
|
3
|
+
export const DATA_DEFINITIONS_URL = () => `${CORE_URL()}/data-definitions`;
|
|
4
|
+
export const DATA_DEFINITION_URL = (dataDefinitionId: string) => `${DATA_DEFINITIONS_URL()}/${encodeURIComponent(dataDefinitionId)}`;
|
|
@@ -3,4 +3,4 @@ import { HUBS_URL } from "./base";
|
|
|
3
3
|
|
|
4
4
|
export const DEVICE_CONNECTIVITY_URL = (deviceOrganisationId: string) => `${DEVICE_ORGANISATION_URL(deviceOrganisationId)}/connectivity`;
|
|
5
5
|
|
|
6
|
-
export const DEVICE_CONNECTIVITIES_HUB_URL = `${HUBS_URL}/connectivities`;
|
|
6
|
+
export const DEVICE_CONNECTIVITIES_HUB_URL = () => `${HUBS_URL()}/connectivities`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const DEVICE_ORGANISATIONS_URL = `${CORE_URL}/device-organisations`;
|
|
4
|
-
export const DEVICE_ORGANISATION_URL = (deviceOrganisationId: string) => `${DEVICE_ORGANISATIONS_URL}/${encodeURIComponent(deviceOrganisationId)}`;
|
|
3
|
+
export const DEVICE_ORGANISATIONS_URL = () => `${CORE_URL()}/device-organisations`;
|
|
4
|
+
export const DEVICE_ORGANISATION_URL = (deviceOrganisationId: string) => `${DEVICE_ORGANISATIONS_URL()}/${encodeURIComponent(deviceOrganisationId)}`;
|
|
5
5
|
export const DEVICE_ORGANISATION_GROUP_URL = (deviceOrganisationId: string) => `${DEVICE_ORGANISATION_URL(deviceOrganisationId)}/group`;
|
|
6
6
|
export const DEVICE_ORGANISATION_LOCATION_URL = (deviceOrganisationId: string) => `${DEVICE_ORGANISATION_URL(deviceOrganisationId)}/location`;
|
|
@@ -3,4 +3,4 @@ import { HUBS_URL } from "./base";
|
|
|
3
3
|
|
|
4
4
|
export const DEVICE_STATUS_URL = (deviceOrganisationId: string) => `${DEVICE_ORGANISATION_URL(deviceOrganisationId)}/status`;
|
|
5
5
|
|
|
6
|
-
export const DEVICE_STATUSES_HUB_URL = `${HUBS_URL}/statuses`;
|
|
6
|
+
export const DEVICE_STATUSES_HUB_URL = () => `${HUBS_URL()}/statuses`;
|
package/config/urls/groups.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const GROUPS_URL = `${CORE_URL}/groups`;
|
|
4
|
-
export const GROUP_URL = (groupId: string) => `${GROUPS_URL}/${encodeURIComponent(groupId)}`;
|
|
3
|
+
export const GROUPS_URL = () => `${CORE_URL()}/groups`;
|
|
4
|
+
export const GROUP_URL = (groupId: string) => `${GROUPS_URL()}/${encodeURIComponent(groupId)}`;
|
package/config/urls/images.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const IMAGES_URL = `${CORE_URL}/images`;
|
|
4
|
-
export const IMAGE_RAW_URL = (imageId: string) => `${IMAGES_URL}/raw/${encodeURIComponent(imageId)}`;
|
|
5
|
-
export const IMAGE_THUMBNAIL_URL = (imageId: string) => `${IMAGES_URL}/thumbnail/${encodeURIComponent(imageId)}`
|
|
3
|
+
export const IMAGES_URL = () => `${CORE_URL()}/images`;
|
|
4
|
+
export const IMAGE_RAW_URL = (imageId: string) => `${IMAGES_URL()}/raw/${encodeURIComponent(imageId)}`;
|
|
5
|
+
export const IMAGE_THUMBNAIL_URL = (imageId: string) => `${IMAGES_URL()}/thumbnail/${encodeURIComponent(imageId)}`
|
package/config/urls/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export * from "./actions";
|
|
1
2
|
export * from "./alerts";
|
|
2
|
-
export * from "./applications";
|
|
3
3
|
export * from "./articles";
|
|
4
4
|
export * from "./authTokens";
|
|
5
|
+
export * from "./comments";
|
|
5
6
|
export * from "./connectivityAlerts";
|
|
6
7
|
export * from "./customProperties";
|
|
7
8
|
export * from "./customPropertyValues";
|
|
@@ -10,7 +11,6 @@ export * from "./dataDefinitions";
|
|
|
10
11
|
export * from "./deviceConnectivities";
|
|
11
12
|
export * from "./deviceOrganisations";
|
|
12
13
|
export * from "./deviceStatuses";
|
|
13
|
-
export * from "./families";
|
|
14
14
|
export * from "./groups";
|
|
15
15
|
export * from "./images";
|
|
16
16
|
export * from "./languages";
|
|
@@ -23,7 +23,6 @@ export * from "./permissionCategories";
|
|
|
23
23
|
export * from "./permissions";
|
|
24
24
|
export * from "./roleOrganisations";
|
|
25
25
|
export * from "./roleOrganisationTypes";
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./translations";
|
|
26
|
+
export * from "./userOrganisationDispositions";
|
|
28
27
|
export * from "./userOrganisations";
|
|
29
28
|
export * from "./users";
|
package/config/urls/languages.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const LANGUAGES_URL = `${CORE_URL}/languages`;
|
|
4
|
-
export const LANGUAGE_URL = (languageId: string) => `${LANGUAGES_URL}/${encodeURIComponent(languageId)}`;
|
|
3
|
+
export const LANGUAGES_URL = () => `${CORE_URL()}/languages`;
|
|
4
|
+
export const LANGUAGE_URL = (languageId: string) => `${LANGUAGES_URL()}/${encodeURIComponent(languageId)}`;
|
package/config/urls/locations.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const LOCATIONS_URL = `${CORE_URL}/locations`;
|
|
4
|
-
export const LOCATION_URL = (locationId: string) => `${LOCATIONS_URL}/${encodeURIComponent(locationId)}`;
|
|
3
|
+
export const LOCATIONS_URL = () => `${CORE_URL()}/locations`;
|
|
4
|
+
export const LOCATION_URL = (locationId: string) => `${LOCATIONS_URL()}/${encodeURIComponent(locationId)}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const MANUFACTURERS_URL = `${CORE_URL}/manufacturers`;
|
|
4
|
-
export const MANUFACTURER_URL = (manufacturerId: string) => `${MANUFACTURERS_URL}/${encodeURIComponent(manufacturerId)}`;
|
|
3
|
+
export const MANUFACTURERS_URL = () => `${CORE_URL()}/manufacturers`;
|
|
4
|
+
export const MANUFACTURER_URL = (manufacturerId: string) => `${MANUFACTURERS_URL()}/${encodeURIComponent(manufacturerId)}`;
|
package/config/urls/models.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const MODELS_URL = `${CORE_URL}/models`;
|
|
4
|
-
export const MODEL_URL = (modelId: string) => `${MODELS_URL}/${encodeURIComponent(modelId)}`;
|
|
3
|
+
export const MODELS_URL = () => `${CORE_URL()}/models`;
|
|
4
|
+
export const MODEL_URL = (modelId: string) => `${MODELS_URL()}/${encodeURIComponent(modelId)}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const ORGANISATION_TYPES_URL = `${CORE_URL}/organisation-types`;
|
|
4
|
-
export const ORGANISATION_TYPE_URL = (organisationTypeId: string) => `${ORGANISATION_TYPES_URL}/${encodeURIComponent(organisationTypeId)}`;
|
|
3
|
+
export const ORGANISATION_TYPES_URL = () => `${CORE_URL()}/organisation-types`;
|
|
4
|
+
export const ORGANISATION_TYPE_URL = (organisationTypeId: string) => `${ORGANISATION_TYPES_URL()}/${encodeURIComponent(organisationTypeId)}`;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GATEWAY_URL } from "./base";
|
|
1
|
+
import { CORE_URL } from "./base";
|
|
3
2
|
|
|
4
|
-
export const
|
|
5
|
-
export const ORGANISATION_URL = urlFactory(organisationId => `${ORGANISATIONS_URL}/${encodeURIComponent(organisationId)}`);
|
|
6
|
-
|
|
7
|
-
export const ORGANISATION_DASHBOARD_URL = `${ORGANISATION_URL()}/dashboard`;
|
|
3
|
+
export const ORGANISATION_DASHBOARD_URL = () => `${CORE_URL()}/dashboard`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const ROLE_ORGANISATION_TYPES_URL = `${CORE_URL}/role-organisation-types`;
|
|
4
|
-
export const ROLE_ORGANISATION_TYPE_URL = (roleOrganisationTypeId: string) => `${ROLE_ORGANISATION_TYPES_URL}/${encodeURIComponent(roleOrganisationTypeId)}`;
|
|
3
|
+
export const ROLE_ORGANISATION_TYPES_URL = () => `${CORE_URL()}/role-organisation-types`;
|
|
4
|
+
export const ROLE_ORGANISATION_TYPE_URL = (roleOrganisationTypeId: string) => `${ROLE_ORGANISATION_TYPES_URL()}/${encodeURIComponent(roleOrganisationTypeId)}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const ROLE_ORGANISATIONS_URL = `${CORE_URL}/role-organisations`;
|
|
4
|
-
export const ROLE_ORGANISATION_URL = (roleOrganisationId: string) => `${ROLE_ORGANISATIONS_URL}/${encodeURIComponent(roleOrganisationId)}`;
|
|
3
|
+
export const ROLE_ORGANISATIONS_URL = () => `${CORE_URL()}/role-organisations`;
|
|
4
|
+
export const ROLE_ORGANISATION_URL = (roleOrganisationId: string) => `${ROLE_ORGANISATIONS_URL()}/${encodeURIComponent(roleOrganisationId)}`;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useOrganisationId } from "../../composables/useOrganisationId";
|
|
2
2
|
|
|
3
|
-
const organisationId =
|
|
4
|
-
|
|
5
|
-
export function setOrganisationId(orgId: Ref<string | null>) {
|
|
6
|
-
organisationId.value = orgId.value;
|
|
7
|
-
}
|
|
3
|
+
const { organisationId } = useOrganisationId();
|
|
8
4
|
|
|
9
5
|
export function urlFactory(url: (orgId: string) => string) {
|
|
10
6
|
return () => {
|
|
11
7
|
if (!organisationId.value) {
|
|
12
8
|
throw new Error("OrganisationId is not set");
|
|
13
9
|
}
|
|
14
|
-
|
|
15
10
|
return url(organisationId.value);
|
|
16
11
|
}
|
|
17
12
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CORE_URL } from "./base";
|
|
2
|
+
|
|
3
|
+
export const USER_ORGANISATION_DISPOSITIONS_URL = () => `${CORE_URL()}/user-organisation-dispositions`;
|
|
4
|
+
export const USER_ORGANISATION_DISPOSITION_URL = (tableCode: string) => `${USER_ORGANISATION_DISPOSITIONS_URL()}/${encodeURIComponent(tableCode)}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const USER_ORGANISATIONS_URL = `${CORE_URL}/user-organisations`;
|
|
4
|
-
export const USER_ORGANISATION_URL = (userOrganisationId: string) => `${USER_ORGANISATIONS_URL}/${encodeURIComponent(userOrganisationId)}`;
|
|
5
|
-
export const USER_ORGANISATION_CURRENT_URL = `${USER_ORGANISATIONS_URL}/current`;
|
|
3
|
+
export const USER_ORGANISATIONS_URL = () => `${CORE_URL()}/user-organisations`;
|
|
4
|
+
export const USER_ORGANISATION_URL = (userOrganisationId: string) => `${USER_ORGANISATIONS_URL()}/${encodeURIComponent(userOrganisationId)}`;
|
|
5
|
+
export const USER_ORGANISATION_CURRENT_URL = () => `${USER_ORGANISATIONS_URL()}/current`;
|
package/config/urls/users.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CORE_URL } from "./base";
|
|
2
2
|
|
|
3
|
-
export const USERS_URL = `${CORE_URL}/users`;
|
|
4
|
-
export const USER_URL = (userId: string) => `${USERS_URL}/${encodeURIComponent(userId)}`;
|
|
5
|
-
export const USER_CURRENT_URL = `${USERS_URL}/current`;
|
|
3
|
+
export const USERS_URL = () => `${CORE_URL()}/users`;
|
|
4
|
+
export const USER_URL = (userId: string) => `${USERS_URL()}/${encodeURIComponent(userId)}`;
|
|
5
|
+
export const USER_CURRENT_URL = () => `${USERS_URL()}/current`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-core-services",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@dative-gpi/bones-ui": "^0.0.
|
|
13
|
-
"@dative-gpi/foundation-core-domain": "0.0.
|
|
12
|
+
"@dative-gpi/bones-ui": "^0.0.58",
|
|
13
|
+
"@dative-gpi/foundation-core-domain": "0.0.9",
|
|
14
14
|
"@microsoft/signalr": "^8.0.0",
|
|
15
15
|
"vue": "^3.2.0",
|
|
16
16
|
"vue-router": "^4.2.5"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "d079d93c7d8677f8269b97bc71820bc35dc46921"
|
|
19
19
|
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Ref, onUnmounted, readonly, ref } from "vue";
|
|
2
|
-
|
|
3
|
-
import { ApplicationDetails, ApplicationDetailsDTO } from "@dative-gpi/foundation-core-domain";
|
|
4
|
-
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
-
|
|
6
|
-
import { APPLICATION_CURRENT_URL } from "../../config/urls";
|
|
7
|
-
|
|
8
|
-
const ApplicationServiceFactory = new ServiceFactory<ApplicationDetailsDTO, ApplicationDetails>("application", ApplicationDetails).create(factory => factory.build(
|
|
9
|
-
factory.addNotify((notifyService) => ({
|
|
10
|
-
getCurrent: async (): Promise<ApplicationDetails> => {
|
|
11
|
-
const response = await ServiceFactory.http.get(APPLICATION_CURRENT_URL);
|
|
12
|
-
const result = new ApplicationDetails(response.data);
|
|
13
|
-
|
|
14
|
-
notifyService.notify("update", result);
|
|
15
|
-
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
}))
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
export const useCurrentApplication = () => {
|
|
22
|
-
const service = ApplicationServiceFactory();
|
|
23
|
-
|
|
24
|
-
const fetching = ref(false);
|
|
25
|
-
const fetched = ref<ApplicationDetails | null>(null) as Ref<ApplicationDetails | null>;
|
|
26
|
-
|
|
27
|
-
const fetch = async () => {
|
|
28
|
-
fetching.value = true;
|
|
29
|
-
try {
|
|
30
|
-
fetched.value = await service.getCurrent();
|
|
31
|
-
}
|
|
32
|
-
finally {
|
|
33
|
-
fetching.value = false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const subscriberId = service.subscribe("all", onEntityChanged(fetched))
|
|
37
|
-
onUnmounted(() => service.unsubscribe(subscriberId));
|
|
38
|
-
|
|
39
|
-
return readonly(fetched as Ref<ApplicationDetails>);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
fetching: readonly(fetching),
|
|
44
|
-
fetch,
|
|
45
|
-
fetched: readonly(fetched)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FamilyDetails, FamilyDetailsDTO, FamilyFilters, FamilyInfos, FamilyInfosDTO } from "@dative-gpi/foundation-core-domain";
|
|
2
|
-
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
|
-
|
|
4
|
-
import { FAMILIES_URL, FAMILY_URL } from "../../config/urls";
|
|
5
|
-
|
|
6
|
-
const FamilieserviceFactory = new ServiceFactory<FamilyDetailsDTO, FamilyDetails>("family", FamilyDetails).create(factory => factory.build(
|
|
7
|
-
factory.addGet(FAMILY_URL),
|
|
8
|
-
factory.addGetMany<FamilyInfosDTO, FamilyInfos, FamilyFilters>(FAMILIES_URL, FamilyInfos),
|
|
9
|
-
factory.addNotify()
|
|
10
|
-
));
|
|
11
|
-
|
|
12
|
-
export const useFamily = ComposableFactory.get(FamilieserviceFactory);
|
|
13
|
-
export const useFamilies = ComposableFactory.getMany(FamilieserviceFactory);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TimeZoneFilters, TimeZoneInfos, TimeZoneInfosDTO } from "@dative-gpi/foundation-core-domain";
|
|
2
|
-
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
|
-
|
|
4
|
-
import { TIME_ZONES_URL } from "../../config/urls";
|
|
5
|
-
|
|
6
|
-
const TimeZoneServiceFactory = new ServiceFactory<TimeZoneInfosDTO, TimeZoneInfos>("timeZone", TimeZoneInfos).create(factory => factory.build(
|
|
7
|
-
factory.addGetMany<TimeZoneInfosDTO, TimeZoneInfos, TimeZoneFilters>(TIME_ZONES_URL, TimeZoneInfos),
|
|
8
|
-
factory.addNotify()
|
|
9
|
-
));
|
|
10
|
-
|
|
11
|
-
export const useTimeZones = ComposableFactory.getMany(TimeZoneServiceFactory);
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Ref, readonly, ref } from "vue";
|
|
2
|
-
|
|
3
|
-
import { TranslationInfos, TranslationInfosDTO, TranslationDetails, TranslationDetailsDTO } from "@dative-gpi/foundation-core-domain";
|
|
4
|
-
import { ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
|
-
|
|
6
|
-
import { TRANSLATIONS_LANGUAGE_URL } from "../../config/urls";
|
|
7
|
-
|
|
8
|
-
const TranslationServiceFactory = new ServiceFactory<TranslationDetailsDTO, TranslationDetails>("translation", TranslationDetails).create(factory => factory.build(
|
|
9
|
-
factory.addNotify(() => ({
|
|
10
|
-
getMany: async (languageCode: string): Promise<TranslationInfos[]> => {
|
|
11
|
-
const response = await ServiceFactory.http.get(TRANSLATIONS_LANGUAGE_URL(languageCode));
|
|
12
|
-
const result = response.data.map((dto: TranslationInfosDTO) => new TranslationInfos(dto));
|
|
13
|
-
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
}))
|
|
17
|
-
));
|
|
18
|
-
|
|
19
|
-
export const useTranslations = () => {
|
|
20
|
-
const service = TranslationServiceFactory();
|
|
21
|
-
|
|
22
|
-
const fetching = ref(false);
|
|
23
|
-
const fetched = ref<TranslationInfos[] | null>(null) as Ref<TranslationInfos[] | null>;
|
|
24
|
-
|
|
25
|
-
const fetch = async (languageCode: string) => {
|
|
26
|
-
fetching.value = true;
|
|
27
|
-
try {
|
|
28
|
-
fetched.value = await service.getMany(languageCode);
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
fetching.value = false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return readonly(fetched as Ref<TranslationInfos[]>);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
fetching: readonly(fetching),
|
|
39
|
-
fetch,
|
|
40
|
-
fetched: readonly(fetched)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { onMounted, provide, ref, watch } from "vue";
|
|
2
|
-
|
|
3
|
-
import { LANGUAGE_CODE } from "../config/literals";
|
|
4
|
-
|
|
5
|
-
let initialized = false;
|
|
6
|
-
|
|
7
|
-
const languageCode = ref<string | null>(null);
|
|
8
|
-
|
|
9
|
-
export const useLanguageCode = () => {
|
|
10
|
-
const setLanguageCode = (payload: string) => {
|
|
11
|
-
localStorage.setItem(LANGUAGE_CODE, payload);
|
|
12
|
-
languageCode.value = payload;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
if (!initialized) {
|
|
16
|
-
provide(LANGUAGE_CODE, languageCode);
|
|
17
|
-
|
|
18
|
-
onMounted(() => {
|
|
19
|
-
if (languageCode.value) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (localStorage.getItem(LANGUAGE_CODE) != null) {
|
|
23
|
-
languageCode.value = localStorage.getItem(LANGUAGE_CODE);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
initialized = true;
|
|
29
|
-
|
|
30
|
-
const ready = new Promise((resolve) => {
|
|
31
|
-
if (languageCode.value) {
|
|
32
|
-
resolve(languageCode.value);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
watch(languageCode, () => {
|
|
36
|
-
if (languageCode.value) {
|
|
37
|
-
resolve(languageCode.value);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
ready,
|
|
45
|
-
languageCode,
|
|
46
|
-
setLanguageCode
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { onMounted, provide, ref, watch } from "vue";
|
|
2
|
-
|
|
3
|
-
import { TimeZoneInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
|
|
5
|
-
import { TIME_ZONE } from "../config/literals";
|
|
6
|
-
|
|
7
|
-
let initialized = false;
|
|
8
|
-
|
|
9
|
-
const timeZone = ref<TimeZoneInfos | null>(null);
|
|
10
|
-
|
|
11
|
-
const getLocalOffset = (): string => {
|
|
12
|
-
const timeZoneName = Intl.DateTimeFormat("ia", {
|
|
13
|
-
timeZoneName: "short",
|
|
14
|
-
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
15
|
-
}).formatToParts().find((i) => i.type === "timeZoneName")?.value ?? "";
|
|
16
|
-
|
|
17
|
-
const offset = timeZoneName.slice(3);
|
|
18
|
-
if (!offset) {
|
|
19
|
-
return "UTC ";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const matchData = offset.match(/([+-])(\d+)(?::(\d+))?/);
|
|
23
|
-
if (matchData) {
|
|
24
|
-
const [_, sign, hour, minute] = matchData;
|
|
25
|
-
return `UTC ${sign}${hour.padStart(2, "0")}:${(minute ?? "").padStart(2, "0")}:00`;
|
|
26
|
-
}
|
|
27
|
-
return "UTC ";
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const useTimeZone = () => {
|
|
31
|
-
const setTimeZone = (payload: TimeZoneInfos) => {
|
|
32
|
-
localStorage.setItem(TIME_ZONE, JSON.stringify(payload));
|
|
33
|
-
timeZone.value = payload;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
if (!initialized) {
|
|
37
|
-
provide(TIME_ZONE, timeZone);
|
|
38
|
-
|
|
39
|
-
onMounted(() => {
|
|
40
|
-
if (timeZone.value) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (localStorage.getItem(TIME_ZONE) != null) {
|
|
44
|
-
timeZone.value = JSON.parse(localStorage.getItem(TIME_ZONE)!) as TimeZoneInfos;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
setTimeZone(new TimeZoneInfos({
|
|
48
|
-
id: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
49
|
-
offset: getLocalOffset()
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
initialized = true;
|
|
56
|
-
|
|
57
|
-
const ready = new Promise((resolve) => {
|
|
58
|
-
if (timeZone.value) {
|
|
59
|
-
resolve(timeZone.value);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
watch(timeZone, () => {
|
|
63
|
-
if (timeZone.value) {
|
|
64
|
-
resolve(timeZone.value);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
ready,
|
|
72
|
-
timeZone,
|
|
73
|
-
setTimeZone
|
|
74
|
-
};
|
|
75
|
-
}
|
package/config/urls/families.ts
DELETED
package/config/urls/files.ts
DELETED
package/config/urls/timeZones.ts
DELETED