|
@@ -10,6 +10,7 @@ import {AssociativeArray, Collection} from "~/types/data.d"
|
|
|
import models from "~/models/models";
|
|
import models from "~/models/models";
|
|
|
import {useAccessProfileStore} from "~/stores/accessProfile"
|
|
import {useAccessProfileStore} from "~/stores/accessProfile"
|
|
|
import * as _ from "lodash-es"
|
|
import * as _ from "lodash-es"
|
|
|
|
|
+import HydraNormalizer from "~/services/data/normalizer/hydraNormalizer";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Entity manager: make operations on the models defined with the Pinia-Orm library
|
|
* Entity manager: make operations on the models defined with the Pinia-Orm library
|
|
@@ -214,12 +215,12 @@ class EntityManager {
|
|
|
public async persist(model: typeof ApiModel, instance: ApiModel) {
|
|
public async persist(model: typeof ApiModel, instance: ApiModel) {
|
|
|
// Recast in case class definition has been "lost"
|
|
// Recast in case class definition has been "lost"
|
|
|
// TODO: attendre de voir si cette ligne est nécessaire
|
|
// TODO: attendre de voir si cette ligne est nécessaire
|
|
|
- // instance = this.cast(model, instance)
|
|
|
|
|
|
|
+ instance = this.cast(model, instance)
|
|
|
|
|
|
|
|
let url = UrlUtils.join('api', model.entity)
|
|
let url = UrlUtils.join('api', model.entity)
|
|
|
let response
|
|
let response
|
|
|
|
|
|
|
|
- const data: any = instance.$toJson()
|
|
|
|
|
|
|
+ const data: any = HydraNormalizer.normalizeEntity(instance)
|
|
|
|
|
|
|
|
if (!instance.isNew()) {
|
|
if (!instance.isNew()) {
|
|
|
url = UrlUtils.join(url, String(instance.id))
|
|
url = UrlUtils.join(url, String(instance.id))
|