rez_core 4.0.245 → 4.0.246
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/dist/module/entity_json/service/entityJson.repository.d.ts +1 -1
- package/dist/module/entity_json/service/entityJson.repository.js +12 -1
- package/dist/module/entity_json/service/entityJson.repository.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/entity_json/service/entityJson.repository.ts +25 -4
|
@@ -3,5 +3,5 @@ import { EntityJson } from "../entity/entityJson.entity";
|
|
|
3
3
|
export declare class EntityJSONRepository {
|
|
4
4
|
private readonly entityJSONRepository;
|
|
5
5
|
constructor(entityJSONRepository: Repository<EntityJson>);
|
|
6
|
-
create(flatJson: Partial<EntityJson>): Promise<
|
|
6
|
+
create(flatJson: Partial<EntityJson>): Promise<EntityJson | null>;
|
|
7
7
|
}
|
|
@@ -22,7 +22,18 @@ let EntityJSONRepository = class EntityJSONRepository {
|
|
|
22
22
|
this.entityJSONRepository = entityJSONRepository;
|
|
23
23
|
}
|
|
24
24
|
async create(flatJson) {
|
|
25
|
-
|
|
25
|
+
const { entity_type, entity_id } = flatJson;
|
|
26
|
+
const existing = await this.entityJSONRepository.findOne({
|
|
27
|
+
where: { entity_type, entity_id },
|
|
28
|
+
});
|
|
29
|
+
if (existing) {
|
|
30
|
+
await this.entityJSONRepository.update(existing.id, flatJson);
|
|
31
|
+
return this.entityJSONRepository.findOne({
|
|
32
|
+
where: { id: existing.id },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const created = this.entityJSONRepository.create(flatJson);
|
|
36
|
+
return this.entityJSONRepository.save(created);
|
|
26
37
|
}
|
|
27
38
|
};
|
|
28
39
|
exports.EntityJSONRepository = EntityJSONRepository;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityJson.repository.js","sourceRoot":"","sources":["../../../../src/module/entity_json/service/entityJson.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AACrC,mEAAyD;AAKlD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,
|
|
1
|
+
{"version":3,"file":"entityJson.repository.js","sourceRoot":"","sources":["../../../../src/module/entity_json/service/entityJson.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AACrC,mEAAyD;AAKlD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YAEmB,oBAA4C;QAA5C,yBAAoB,GAApB,oBAAoB,CAAwB;IAC5D,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,QAA6B;QACxC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;QAG5C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;YACvD,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE;SAClC,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YAEb,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;YAG9D,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;gBACvC,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE;aAC3B,CAAC,CAAC;QACL,CAAC;QAGD,MAAM,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;CACF,CAAA;AA5BY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,8BAAU,CAAC,CAAA;qCACU,oBAAU;GAHxC,oBAAoB,CA4BhC"}
|