@servicelabsco/nestjs-utility-services 1.1.71 → 1.1.72
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.
@@ -8,12 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
9
9
|
exports.DocumentService = void 0;
|
10
10
|
const common_1 = require("@nestjs/common");
|
11
|
+
const typeorm_1 = require("typeorm");
|
11
12
|
const common_2 = require("../../common");
|
12
13
|
const document_entity_1 = require("../entities/document.entity");
|
13
14
|
let DocumentService = class DocumentService {
|
14
15
|
async getDocuments(query) {
|
15
16
|
return document_entity_1.DocumentEntity.find({
|
16
|
-
where: query,
|
17
|
+
where: Object.assign(Object.assign({}, query), { document_url: (0, typeorm_1.Not)((0, typeorm_1.IsNull)()) }),
|
17
18
|
});
|
18
19
|
}
|
19
20
|
async setDocument(source, file) {
|
@@ -21,13 +22,12 @@ let DocumentService = class DocumentService {
|
|
21
22
|
return;
|
22
23
|
if (!common_2.PlatformUtility.isValidUrl(file.document_url))
|
23
24
|
return;
|
24
|
-
let document;
|
25
|
+
let document = document_entity_1.DocumentEntity.create({ source_type: source.source_type, source_id: source.source_id });
|
25
26
|
if (file.id)
|
26
27
|
document = await document_entity_1.DocumentEntity.first(file.id);
|
27
|
-
document = document_entity_1.DocumentEntity.create({ source_type: source.source_type, source_id: source.source_id });
|
28
28
|
if (!(document.source_type === source.source_type && document.source_id === source.source_id))
|
29
29
|
throw new common_2.AccessException('you donot have access to this document');
|
30
|
-
if (!
|
30
|
+
if (!(document === null || document === void 0 ? void 0 : document.id))
|
31
31
|
document.document_url = file.document_url;
|
32
32
|
document.attributes = Object.assign(Object.assign(Object.assign({}, document.attributes), file.attributes), { comments: file.comments });
|
33
33
|
return document.save();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"document.service.js","sourceRoot":"","sources":["../../../src/system/services/document.service.ts"],"names":[],"mappings":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