|
|
@@ -1,14 +1,15 @@
|
|
|
-import ApiRequestService from "./apiRequestService";
|
|
|
-import {Repository, useRepo} from "pinia-orm";
|
|
|
-import UrlUtils from "~/services/utils/urlUtils";
|
|
|
-import HydraDenormalizer from "./normalizer/hydraDenormalizer";
|
|
|
-import ApiModel from "~/models/ApiModel";
|
|
|
-import ApiResource from "~/models/ApiResource";
|
|
|
-import {MyProfile} from "~/models/Access/MyProfile";
|
|
|
-import {v4 as uuid4} from 'uuid';
|
|
|
-import {AssociativeArray, Collection} from "~/types/data.d";
|
|
|
+import ApiRequestService from "./apiRequestService"
|
|
|
+import {Repository, useRepo} from "pinia-orm"
|
|
|
+import UrlUtils from "~/services/utils/urlUtils"
|
|
|
+import HydraDenormalizer from "./normalizer/hydraDenormalizer"
|
|
|
+import ApiModel from "~/models/ApiModel"
|
|
|
+import ApiResource from "~/models/ApiResource"
|
|
|
+import {MyProfile} from "~/models/Access/MyProfile"
|
|
|
+import {v4 as uuid4} from 'uuid'
|
|
|
+import {AssociativeArray, Collection} from "~/types/data.d"
|
|
|
import models from "~/models/models";
|
|
|
-import {useAccessProfileStore} from "~/stores/accessProfile";
|
|
|
+import {useAccessProfileStore} from "~/stores/accessProfile"
|
|
|
+import _ from "lodash"
|
|
|
|
|
|
/**
|
|
|
* Entity manager: make operations on the models defined with the Pinia-Orm library
|
|
|
@@ -32,6 +33,7 @@ class EntityManager {
|
|
|
* @param model
|
|
|
*/
|
|
|
public getRepository(model: typeof ApiResource): Repository<ApiResource> {
|
|
|
+ // TODO: voir si possible de passer par une injection de dépendance plutôt que par un use
|
|
|
return useRepo(model)
|
|
|
}
|
|
|
|
|
|
@@ -334,7 +336,7 @@ class EntityManager {
|
|
|
const repository = this.getRepository(model)
|
|
|
|
|
|
// Clone and prefix id
|
|
|
- const clone = useCloneDeep(entity)
|
|
|
+ const clone = _.cloneDeep(entity)
|
|
|
clone.id = this.CLONE_PREFIX + clone.id
|
|
|
|
|
|
repository.save(clone)
|