@servicelabsco/nestjs-utility-services 1.1.62 → 1.1.63
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/platformUtility/dtos/index.d.ts +6 -5
- package/dist/platformUtility/dtos/index.js +6 -5
- package/dist/platformUtility/dtos/index.js.map +1 -1
- package/dist/platformUtility/dtos/source.column.dto.d.ts +4 -0
- package/dist/platformUtility/dtos/source.column.dto.js +29 -0
- package/dist/platformUtility/dtos/source.column.dto.js.map +1 -0
- package/dist/system/dtos/file.upload.dto.d.ts +7 -0
- package/dist/system/dtos/file.upload.dto.js +41 -0
- package/dist/system/dtos/file.upload.dto.js.map +1 -0
- package/dist/system/dtos/index.d.ts +1 -0
- package/dist/system/dtos/index.js +1 -0
- package/dist/system/dtos/index.js.map +1 -1
- package/dist/system/services/document.service.d.ts +5 -0
- package/dist/system/services/document.service.js +22 -0
- package/dist/system/services/document.service.js.map +1 -1
- package/package.json +1 -1
@@ -1,10 +1,11 @@
|
|
1
|
+
export * from './common.attributes.dto';
|
2
|
+
export * from './failed.bull.job.attributes.dto';
|
1
3
|
export * from './fcm.response.dto';
|
4
|
+
export * from './job.payload.dto';
|
5
|
+
export * from './mail.options.dto';
|
6
|
+
export * from './pending.bull.job.attributes.dto';
|
2
7
|
export * from './push.notification.response.dto';
|
3
8
|
export * from './push.notification.template.dto';
|
4
9
|
export * from './queue.options.dto';
|
5
|
-
export * from './mail.options.dto';
|
6
|
-
export * from './common.attributes.dto';
|
7
10
|
export * from './remote.raw.response.dto';
|
8
|
-
export * from './
|
9
|
-
export * from './pending.bull.job.attributes.dto';
|
10
|
-
export * from './job.payload.dto';
|
11
|
+
export * from './source.column.dto';
|
@@ -14,14 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./common.attributes.dto"), exports);
|
18
|
+
__exportStar(require("./failed.bull.job.attributes.dto"), exports);
|
17
19
|
__exportStar(require("./fcm.response.dto"), exports);
|
20
|
+
__exportStar(require("./job.payload.dto"), exports);
|
21
|
+
__exportStar(require("./mail.options.dto"), exports);
|
22
|
+
__exportStar(require("./pending.bull.job.attributes.dto"), exports);
|
18
23
|
__exportStar(require("./push.notification.response.dto"), exports);
|
19
24
|
__exportStar(require("./push.notification.template.dto"), exports);
|
20
25
|
__exportStar(require("./queue.options.dto"), exports);
|
21
|
-
__exportStar(require("./mail.options.dto"), exports);
|
22
|
-
__exportStar(require("./common.attributes.dto"), exports);
|
23
26
|
__exportStar(require("./remote.raw.response.dto"), exports);
|
24
|
-
__exportStar(require("./
|
25
|
-
__exportStar(require("./pending.bull.job.attributes.dto"), exports);
|
26
|
-
__exportStar(require("./job.payload.dto"), exports);
|
27
|
+
__exportStar(require("./source.column.dto"), exports);
|
27
28
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,mEAAiD;AACjD,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,oEAAkD;AAClD,mEAAiD;AACjD,mEAAiD;AACjD,sDAAoC;AACpC,4DAA0C;AAC1C,sDAAoC"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.SourceColumnDto = void 0;
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
14
|
+
const class_validator_1 = require("class-validator");
|
15
|
+
class SourceColumnDto {
|
16
|
+
}
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsNotEmpty)(),
|
19
|
+
(0, class_transformer_1.Expose)(),
|
20
|
+
__metadata("design:type", String)
|
21
|
+
], SourceColumnDto.prototype, "source_type", void 0);
|
22
|
+
__decorate([
|
23
|
+
(0, class_validator_1.IsNotEmpty)(),
|
24
|
+
(0, class_transformer_1.Expose)(),
|
25
|
+
(0, class_validator_1.IsPositive)(),
|
26
|
+
__metadata("design:type", Number)
|
27
|
+
], SourceColumnDto.prototype, "source_id", void 0);
|
28
|
+
exports.SourceColumnDto = SourceColumnDto;
|
29
|
+
//# sourceMappingURL=source.column.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"source.column.dto.js","sourceRoot":"","sources":["../../../src/platformUtility/dtos/source.column.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,qDAAyD;AAEzD,MAAa,eAAe;CAS3B;AARG;IAAC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAM,GAAE;;oDACW;AAEpB;IAAC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAM,GAAE;IACR,IAAA,4BAAU,GAAE;;kDACK;AARtB,0CASC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.FileUploadDto = void 0;
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
14
|
+
const class_validator_1 = require("class-validator");
|
15
|
+
const document_attributes_dto_1 = require("./document.attributes.dto");
|
16
|
+
class FileUploadDto {
|
17
|
+
}
|
18
|
+
__decorate([
|
19
|
+
(0, class_validator_1.IsOptional)(),
|
20
|
+
(0, class_validator_1.IsNumber)(),
|
21
|
+
__metadata("design:type", Number)
|
22
|
+
], FileUploadDto.prototype, "id", void 0);
|
23
|
+
__decorate([
|
24
|
+
(0, class_validator_1.IsNotEmpty)(),
|
25
|
+
(0, class_transformer_1.Expose)(),
|
26
|
+
__metadata("design:type", String)
|
27
|
+
], FileUploadDto.prototype, "document_url", void 0);
|
28
|
+
__decorate([
|
29
|
+
(0, class_validator_1.IsOptional)(),
|
30
|
+
(0, class_transformer_1.Expose)(),
|
31
|
+
__metadata("design:type", String)
|
32
|
+
], FileUploadDto.prototype, "comments", void 0);
|
33
|
+
__decorate([
|
34
|
+
(0, class_validator_1.IsOptional)(),
|
35
|
+
(0, class_transformer_1.Expose)(),
|
36
|
+
(0, class_transformer_1.Type)(() => document_attributes_dto_1.DocumentAttributesDto),
|
37
|
+
(0, class_validator_1.ValidateNested)(),
|
38
|
+
__metadata("design:type", document_attributes_dto_1.DocumentAttributesDto)
|
39
|
+
], FileUploadDto.prototype, "attributes", void 0);
|
40
|
+
exports.FileUploadDto = FileUploadDto;
|
41
|
+
//# sourceMappingURL=file.upload.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file.upload.dto.js","sourceRoot":"","sources":["../../../src/system/dtos/file.upload.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAiD;AACjD,qDAAmF;AACnF,uEAAkE;AAElE,MAAa,aAAa;CAkBzB;AAjBG;IAAC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;yCACC;AAEZ;IAAC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAM,GAAE;;mDACY;AAErB;IAAC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAM,GAAE;;+CACS;AAElB;IAAC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAM,GAAE;IACR,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,+CAAqB,CAAC;IACjC,IAAA,gCAAc,GAAE;8BACJ,+CAAqB;iDAAC;AAjBvC,sCAkBC"}
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./document.attributes.dto"), exports);
|
18
|
+
__exportStar(require("./file.upload.dto"), exports);
|
18
19
|
__exportStar(require("./file.upload.spec.dto"), exports);
|
19
20
|
__exportStar(require("./job.record.param.dto"), exports);
|
20
21
|
__exportStar(require("./local.file.s3.upload.dto"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,yDAAuC;AACvC,yDAAuC;AACvC,6DAA2C;AAC3C,sEAAoD;AACpD,6DAA2C;AAC3C,uEAAqD;AACrD,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,oDAAkC;AAClC,yDAAuC;AACvC,yDAAuC;AACvC,6DAA2C;AAC3C,sEAAoD;AACpD,6DAA2C;AAC3C,uEAAqD;AACrD,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C"}
|
@@ -1,7 +1,12 @@
|
|
1
|
+
import { SourceColumnDto } from '../../platformUtility/dtos/source.column.dto';
|
2
|
+
import { FileUploadDto } from '../dtos/file.upload.dto';
|
3
|
+
import { DocumentEntity } from '../entities/document.entity';
|
1
4
|
export declare class DocumentService {
|
2
5
|
getDocuments(query: {
|
3
6
|
source_type: string;
|
4
7
|
source_id: number;
|
5
8
|
type_id?: number;
|
6
9
|
}): Promise<any[]>;
|
10
|
+
setDocument(source: SourceColumnDto, file: FileUploadDto): Promise<DocumentEntity>;
|
11
|
+
setDocuments(source: SourceColumnDto, files: FileUploadDto[]): Promise<DocumentEntity[]>;
|
7
12
|
}
|
@@ -8,6 +8,7 @@ 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 common_2 = require("../../common");
|
11
12
|
const document_entity_1 = require("../entities/document.entity");
|
12
13
|
let DocumentService = class DocumentService {
|
13
14
|
async getDocuments(query) {
|
@@ -15,6 +16,27 @@ let DocumentService = class DocumentService {
|
|
15
16
|
where: query,
|
16
17
|
});
|
17
18
|
}
|
19
|
+
async setDocument(source, file) {
|
20
|
+
let document;
|
21
|
+
if (file.id)
|
22
|
+
document = await document_entity_1.DocumentEntity.first(file.id);
|
23
|
+
document = document_entity_1.DocumentEntity.create({ source_type: source.source_type, source_id: source.source_id });
|
24
|
+
if (!(document.source_type === source.source_type && document.source_id === source.source_id))
|
25
|
+
throw new common_2.AccessException('you donot have access to this document');
|
26
|
+
if (!file.id)
|
27
|
+
document.document_url = file.document_url;
|
28
|
+
document.attributes = Object.assign(Object.assign(Object.assign({}, document.attributes), { comments: file.comments }), file.attributes);
|
29
|
+
return document.save();
|
30
|
+
}
|
31
|
+
async setDocuments(source, files) {
|
32
|
+
const promises = [];
|
33
|
+
files.forEach((file) => {
|
34
|
+
promises.push(this.setDocument(source, file));
|
35
|
+
});
|
36
|
+
return Promise.all(promises).then((res) => {
|
37
|
+
return res;
|
38
|
+
});
|
39
|
+
}
|
18
40
|
};
|
19
41
|
DocumentService = __decorate([
|
20
42
|
(0, common_1.Injectable)()
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"document.service.js","sourceRoot":"","sources":["../../../src/system/services/document.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,iEAA6D;AAQtD,IAAM,eAAe,GAArB,MAAM,eAAe;IAQxB,KAAK,CAAC,YAAY,CAAC,KAAmE;QAClF,OAAO,gCAAc,CAAC,IAAI,CAAC;YACvB,KAAK,EAAE,KAAK;SACf,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;
|
1
|
+
{"version":3,"file":"document.service.js","sourceRoot":"","sources":["../../../src/system/services/document.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,yCAA+C;AAG/C,iEAA6D;AAQtD,IAAM,eAAe,GAArB,MAAM,eAAe;IAQxB,KAAK,CAAC,YAAY,CAAC,KAAmE;QAClF,OAAO,gCAAc,CAAC,IAAI,CAAC;YACvB,KAAK,EAAE,KAAK;SACf,CAAC,CAAC;IACP,CAAC;IASD,KAAK,CAAC,WAAW,CAAC,MAAuB,EAAE,IAAmB;QAC1D,IAAI,QAAwB,CAAC;QAE7B,I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