@loomcore/api 0.0.48 → 0.0.49
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.
|
@@ -406,21 +406,12 @@ export class GenericApiService {
|
|
|
406
406
|
this.auditForUpdate(userContext, preparedEntity);
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
+
if (!this.modelSpec?.fullSchema) {
|
|
410
|
+
throw new ServerError(`Cannot prepare entity: No model specification with schema provided for ${this.pluralResourceName}`);
|
|
411
|
+
}
|
|
409
412
|
let cleanedEntity = preparedEntity;
|
|
410
413
|
if (this.modelSpec) {
|
|
411
|
-
let entityId = null;
|
|
412
|
-
if (allowId) {
|
|
413
|
-
entityId = preparedEntity._id;
|
|
414
|
-
}
|
|
415
|
-
console.log(`preparedEntity is ${JSON.stringify(preparedEntity)}`);
|
|
416
414
|
cleanedEntity = this.modelSpec.decode(preparedEntity);
|
|
417
|
-
console.log(`cleanedEntity is ${JSON.stringify(cleanedEntity)}`);
|
|
418
|
-
if (allowId && entityId) {
|
|
419
|
-
cleanedEntity._id = entityId;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
if (!this.modelSpec?.fullSchema) {
|
|
423
|
-
throw new ServerError(`Cannot prepare entity: No model specification with schema provided for ${this.pluralResourceName}`);
|
|
424
415
|
}
|
|
425
416
|
return dbUtils.convertStringsToObjectIds(cleanedEntity, this.modelSpec.fullSchema);
|
|
426
417
|
}
|