@dative-gpi/foundation-shared-services 0.0.53 → 0.0.54
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.
|
@@ -3,9 +3,8 @@ import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
|
3
3
|
|
|
4
4
|
import { APPLICATION_CURRENT_URL } from "../../config/urls";
|
|
5
5
|
|
|
6
|
-
const ApplicationServiceFactory =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
));
|
|
6
|
+
const ApplicationServiceFactory = {
|
|
7
|
+
...ServiceFactory.addCustom("getCurrent", (axios) => axios.get(APPLICATION_CURRENT_URL()), (dto: ApplicationDetailsDTO) => new ApplicationDetails(dto))
|
|
8
|
+
};
|
|
10
9
|
|
|
11
|
-
export const useCurrentApplication = ComposableFactory.custom(ApplicationServiceFactory
|
|
10
|
+
export const useCurrentApplication = ComposableFactory.custom(ApplicationServiceFactory.getCurrent);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
2
|
-
import { BlurHash } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
|
+
import { BlurHash, BlurHashDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
3
3
|
|
|
4
4
|
import { IMAGE_BLURHASH_URL } from "../../config/urls";
|
|
5
5
|
|
|
6
|
-
const ImageServiceFactory =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
));
|
|
6
|
+
const ImageServiceFactory = {
|
|
7
|
+
...ServiceFactory.addCustom("getBlurHash", (axios, imageId: string) => axios.get(IMAGE_BLURHASH_URL(imageId)), (dto: BlurHashDTO) => new BlurHash(dto))
|
|
8
|
+
};
|
|
10
9
|
|
|
11
|
-
export const useImageBlurHash = ComposableFactory.custom(ImageServiceFactory
|
|
10
|
+
export const useImageBlurHash = ComposableFactory.custom(ImageServiceFactory.getBlurHash);
|
|
@@ -1,41 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { TranslationInfos, TranslationInfosDTO, TranslationDetails, TranslationDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
|
-
import { ServiceFactory } from "@dative-gpi/bones-ui";
|
|
1
|
+
import { TranslationInfos, TranslationInfosDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
3
|
|
|
6
4
|
import { TRANSLATIONS_LANGUAGE_URL } from "../../config/urls";
|
|
7
5
|
|
|
8
|
-
const TranslationServiceFactory =
|
|
9
|
-
|
|
10
|
-
|
|
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 entities = ref<TranslationInfos[]>([]);
|
|
24
|
-
|
|
25
|
-
const getMany = async (languageCode: string) => {
|
|
26
|
-
fetching.value = true;
|
|
27
|
-
try {
|
|
28
|
-
entities.value = await service.getMany(languageCode);
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
fetching.value = false;
|
|
32
|
-
}
|
|
33
|
-
return entities;
|
|
34
|
-
}
|
|
6
|
+
const TranslationServiceFactory = {
|
|
7
|
+
...ServiceFactory.addCustom("getMany", (axios, languageCode: string) => axios.get(TRANSLATIONS_LANGUAGE_URL(languageCode)), (dtos: TranslationInfosDTO[]) => dtos.map(dto => new TranslationInfos(dto)))
|
|
8
|
+
};
|
|
35
9
|
|
|
36
|
-
|
|
37
|
-
fetching,
|
|
38
|
-
getMany,
|
|
39
|
-
entities
|
|
40
|
-
}
|
|
41
|
-
}
|
|
10
|
+
export const useTranslations = ComposableFactory.custom(TranslationServiceFactory.getMany);
|
|
@@ -4,10 +4,23 @@ import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
|
4
4
|
import { USER_CURRENT_URL } from "../../config/urls";
|
|
5
5
|
|
|
6
6
|
const UserServiceFactory = new ServiceFactory<UserDetailsDTO, UserDetails>("user", UserDetails).create(factory => factory.build(
|
|
7
|
-
|
|
8
|
-
factory.
|
|
9
|
-
|
|
7
|
+
ServiceFactory.addCustom("getCurrent", (axios) => axios.get(USER_CURRENT_URL()), (dto: UserDetailsDTO) => new UserDetails(dto)),
|
|
8
|
+
factory.addNotify(notify => ({
|
|
9
|
+
...ServiceFactory.addCustom("updateCurrent", (axios, payload: UpdateUserDTO) => axios.post(USER_CURRENT_URL(), payload), (dto: UserDetailsDTO) => {
|
|
10
|
+
const result = new UserDetails(dto);
|
|
11
|
+
notify.notify("update", result);
|
|
12
|
+
return result;
|
|
13
|
+
})
|
|
14
|
+
}))
|
|
10
15
|
));
|
|
11
16
|
|
|
12
|
-
export const
|
|
13
|
-
|
|
17
|
+
export const useTrackUser = ComposableFactory.track(UserServiceFactory);
|
|
18
|
+
|
|
19
|
+
export const useCurrentUser = ComposableFactory.custom(UserServiceFactory.getCurrent, () => {
|
|
20
|
+
const { track } = useTrackUser();
|
|
21
|
+
|
|
22
|
+
return (user) => {
|
|
23
|
+
track(user);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export const useUpdateCurrentUser = ComposableFactory.custom(UserServiceFactory.updateCurrent);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-services",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.54",
|
|
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-shared-domain": "0.0.
|
|
13
|
+
"@dative-gpi/bones-ui": "^0.0.70",
|
|
14
|
+
"@dative-gpi/foundation-shared-domain": "0.0.54",
|
|
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": "391503e595cd9d731fca14b5bb2d3a10b6efee95"
|
|
20
20
|
}
|