@tomei/media 0.6.13 → 0.6.14

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.
Files changed (61) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/nest-cli.json +18 -18
  3. package/package.json +9 -10
  4. package/src/base/base.medias.ts +208 -208
  5. package/src/base/base.repository.abstract.ts +28 -28
  6. package/src/base/base.repository.interface.ts +9 -9
  7. package/src/dto/external-media.dto.ts +49 -49
  8. package/src/dto/internal-medias.dto.ts +64 -64
  9. package/src/enum/index.ts +3 -3
  10. package/src/enum/medias.enum.ts +5 -5
  11. package/src/helpers/error.ts +12 -12
  12. package/src/helpers/index.ts +3 -3
  13. package/src/index.ts +24 -24
  14. package/src/interfaces/base.medias-attr.interface.ts +21 -21
  15. package/src/interfaces/medias.repository.interface.ts +4 -4
  16. package/src/medias.repository.ts +55 -55
  17. package/src/pipe/append-id.pipe.ts +15 -15
  18. package/src/pipe/validate-enum.pipe.ts +31 -31
  19. package/src/pipe/validate-id.pipe.ts +18 -18
  20. package/src/responses/deleted.response.ts +6 -6
  21. package/src/responses/pagination.response.ts +10 -10
  22. package/tsconfig.json +29 -29
  23. package/dist/base/index.d.ts +0 -2
  24. package/dist/base/index.js +0 -6
  25. package/dist/base/index.js.map +0 -1
  26. package/dist/common/common.service.spec.d.ts +0 -0
  27. package/dist/common/common.service.spec.js +0 -5
  28. package/dist/common/common.service.spec.js.map +0 -1
  29. package/dist/dto/medias.dto.d.ts +0 -12
  30. package/dist/dto/medias.dto.js +0 -88
  31. package/dist/dto/medias.dto.js.map +0 -1
  32. package/dist/entities/index.d.ts +0 -2
  33. package/dist/entities/index.js +0 -6
  34. package/dist/entities/index.js.map +0 -1
  35. package/dist/entities/media.entity.d.ts +0 -21
  36. package/dist/entities/media.entity.js +0 -152
  37. package/dist/entities/media.entity.js.map +0 -1
  38. package/dist/interfaces/commonService.interface.d.ts +0 -17
  39. package/dist/interfaces/commonService.interface.js +0 -3
  40. package/dist/interfaces/commonService.interface.js.map +0 -1
  41. package/dist/interfaces/index.d.ts +0 -3
  42. package/dist/interfaces/index.js +0 -3
  43. package/dist/interfaces/index.js.map +0 -1
  44. package/dist/interfaces/media.repository.interface.d.ts +0 -10
  45. package/dist/interfaces/media.repository.interface.js +0 -3
  46. package/dist/interfaces/media.repository.interface.js.map +0 -1
  47. package/dist/interfaces/medias-attr.interface.d.ts +0 -22
  48. package/dist/interfaces/medias-attr.interface.js +0 -3
  49. package/dist/interfaces/medias-attr.interface.js.map +0 -1
  50. package/dist/medias.controller copy.d.ts +0 -25
  51. package/dist/medias.controller copy.js +0 -225
  52. package/dist/medias.controller copy.js.map +0 -1
  53. package/dist/medias.controller.d.ts +0 -29
  54. package/dist/medias.controller.js +0 -120
  55. package/dist/medias.controller.js.map +0 -1
  56. package/dist/medias.controller.old.d.ts +0 -25
  57. package/dist/medias.controller.old.js +0 -225
  58. package/dist/medias.controller.old.js.map +0 -1
  59. package/dist/medias.module.d.ts +0 -2
  60. package/dist/medias.module.js +0 -32
  61. package/dist/medias.module.js.map +0 -1
@@ -1,12 +0,0 @@
1
- import { MediaType } from '../enum/medias.enum';
2
- export declare class MediaDto {
3
- ObjectId: string;
4
- ObjectType: string;
5
- Type: MediaType;
6
- FileName: string;
7
- FileExtension: string;
8
- FileStream: any;
9
- Title: string;
10
- Description: string;
11
- IsEncryptedYN: string;
12
- }
@@ -1,88 +0,0 @@
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.MediaDto = void 0;
13
- const swagger_1 = require("@nestjs/swagger");
14
- const class_validator_1 = require("class-validator");
15
- const medias_enum_1 = require("../enum/medias.enum");
16
- class MediaDto {
17
- }
18
- __decorate([
19
- (0, class_validator_1.IsNotEmpty)(),
20
- (0, class_validator_1.IsString)(),
21
- (0, class_validator_1.MaxLength)(30),
22
- (0, swagger_1.ApiProperty)({ type: String, description: 'ObjectID' }),
23
- __metadata("design:type", String)
24
- ], MediaDto.prototype, "ObjectId", void 0);
25
- __decorate([
26
- (0, class_validator_1.IsNotEmpty)(),
27
- (0, class_validator_1.IsString)(),
28
- (0, class_validator_1.MaxLength)(200),
29
- (0, swagger_1.ApiProperty)({ type: String, description: 'ObjectType' }),
30
- __metadata("design:type", String)
31
- ], MediaDto.prototype, "ObjectType", void 0);
32
- __decorate([
33
- (0, class_validator_1.IsNotEmpty)(),
34
- (0, swagger_1.ApiProperty)({
35
- type: String,
36
- description: 'Enum either Photo, Video, Document',
37
- }),
38
- (0, class_validator_1.IsEnum)(medias_enum_1.MediaType),
39
- __metadata("design:type", String)
40
- ], MediaDto.prototype, "Type", void 0);
41
- __decorate([
42
- (0, class_validator_1.IsNotEmpty)(),
43
- (0, class_validator_1.IsString)(),
44
- (0, class_validator_1.MaxLength)(200),
45
- (0, swagger_1.ApiProperty)({ type: String, description: 'file name without extension' }),
46
- __metadata("design:type", String)
47
- ], MediaDto.prototype, "FileName", void 0);
48
- __decorate([
49
- (0, class_validator_1.IsNotEmpty)(),
50
- (0, class_validator_1.IsString)(),
51
- (0, class_validator_1.MaxLength)(10),
52
- (0, swagger_1.ApiProperty)({ type: String, description: 'extention of file in jpg etc' }),
53
- __metadata("design:type", String)
54
- ], MediaDto.prototype, "FileExtension", void 0);
55
- __decorate([
56
- (0, class_validator_1.IsNotEmpty)(),
57
- (0, swagger_1.ApiProperty)({
58
- type: String,
59
- description: 'File stream buffer',
60
- format: 'binary',
61
- }),
62
- __metadata("design:type", Object)
63
- ], MediaDto.prototype, "FileStream", void 0);
64
- __decorate([
65
- (0, class_validator_1.IsNotEmpty)(),
66
- (0, class_validator_1.IsString)(),
67
- (0, class_validator_1.MaxLength)(100),
68
- (0, swagger_1.ApiProperty)({ type: String, description: 'title of the media' }),
69
- __metadata("design:type", String)
70
- ], MediaDto.prototype, "Title", void 0);
71
- __decorate([
72
- (0, class_validator_1.IsNotEmpty)(),
73
- (0, class_validator_1.IsString)(),
74
- (0, class_validator_1.MaxLength)(1000),
75
- (0, swagger_1.ApiProperty)({ type: String, description: 'Description of the media' }),
76
- __metadata("design:type", String)
77
- ], MediaDto.prototype, "Description", void 0);
78
- __decorate([
79
- (0, class_validator_1.IsNotEmpty)(),
80
- (0, class_validator_1.IsBoolean)(),
81
- (0, swagger_1.ApiProperty)({
82
- type: String,
83
- description: 'Option if media needed to be encryped : Y or N',
84
- }),
85
- __metadata("design:type", String)
86
- ], MediaDto.prototype, "IsEncryptedYN", void 0);
87
- exports.MediaDto = MediaDto;
88
- //# sourceMappingURL=medias.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"medias.dto.js","sourceRoot":"","sources":["../../src/dto/medias.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAMyB;AACzB,qDAAgD;AAEhD,MAAa,QAAQ;CA4DpB;AAvDC;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,EAAE,CAAC;IACb,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;0CACtC;AAMjB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,GAAG,CAAC;IACd,IAAA,qBA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ACX,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,gDAAgD;KAC9D,CAAC;;+CACoB;AA3DxB,4BA4DC"}
@@ -1,2 +0,0 @@
1
- import { MediaModel } from './media.entity';
2
- export { MediaModel };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MediaModel = void 0;
4
- const media_entity_1 = require("./media.entity");
5
- Object.defineProperty(exports, "MediaModel", { enumerable: true, get: function () { return media_entity_1.MediaModel; } });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAEnC,2FAFA,yBAAU,OAEA"}
@@ -1,21 +0,0 @@
1
- import { Model } from 'sequelize-typescript';
2
- import { MediaType } from '../enum/medias.enum';
3
- export declare class MediaModel extends Model {
4
- MediaId: string;
5
- ObjectId: string;
6
- ObjectType: string;
7
- Title: string;
8
- Description: string;
9
- Type: MediaType;
10
- IsExternalYN: string;
11
- ExternalSource: string;
12
- IsEncryptedYN: string;
13
- FileName: string;
14
- FileExtension: string;
15
- FilePath: string;
16
- URL: string;
17
- CreatedAt: Date;
18
- CreatedById: string;
19
- UpdatedAt: Date;
20
- UpdatedById: string;
21
- }
@@ -1,152 +0,0 @@
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.MediaModel = void 0;
13
- const swagger_1 = require("@nestjs/swagger");
14
- const sequelize_typescript_1 = require("sequelize-typescript");
15
- const medias_enum_1 = require("../enum/medias.enum");
16
- let MediaModel = class MediaModel extends sequelize_typescript_1.Model {
17
- };
18
- __decorate([
19
- (0, sequelize_typescript_1.Column)({
20
- primaryKey: true,
21
- allowNull: false,
22
- }),
23
- (0, swagger_1.ApiProperty)({ type: String, description: 'MediaID' }),
24
- __metadata("design:type", String)
25
- ], MediaModel.prototype, "MediaId", void 0);
26
- __decorate([
27
- (0, sequelize_typescript_1.Column)({
28
- allowNull: false,
29
- }),
30
- (0, swagger_1.ApiProperty)({ type: String, description: 'ObjectID' }),
31
- __metadata("design:type", String)
32
- ], MediaModel.prototype, "ObjectId", void 0);
33
- __decorate([
34
- (0, sequelize_typescript_1.Column)({
35
- allowNull: false,
36
- }),
37
- (0, swagger_1.ApiProperty)({ type: String, description: 'ObjectType' }),
38
- __metadata("design:type", String)
39
- ], MediaModel.prototype, "ObjectType", void 0);
40
- __decorate([
41
- (0, sequelize_typescript_1.Column)({
42
- allowNull: true,
43
- }),
44
- (0, swagger_1.ApiProperty)({ type: String, description: 'title of the media' }),
45
- __metadata("design:type", String)
46
- ], MediaModel.prototype, "Title", void 0);
47
- __decorate([
48
- (0, sequelize_typescript_1.Column)({
49
- allowNull: true,
50
- }),
51
- (0, swagger_1.ApiProperty)({ type: String, description: 'Description of the media' }),
52
- __metadata("design:type", String)
53
- ], MediaModel.prototype, "Description", void 0);
54
- __decorate([
55
- (0, sequelize_typescript_1.Column)({
56
- allowNull: false,
57
- }),
58
- (0, swagger_1.ApiProperty)({
59
- type: String,
60
- description: 'Enum either Photo, Video, Document',
61
- }),
62
- __metadata("design:type", String)
63
- ], MediaModel.prototype, "Type", void 0);
64
- __decorate([
65
- (0, sequelize_typescript_1.Column)({
66
- allowNull: false,
67
- }),
68
- (0, swagger_1.ApiProperty)({ type: String, description: 'isExternal either Y, N' }),
69
- __metadata("design:type", String)
70
- ], MediaModel.prototype, "IsExternalYN", void 0);
71
- __decorate([
72
- (0, sequelize_typescript_1.Column)({
73
- allowNull: true,
74
- }),
75
- (0, swagger_1.ApiProperty)({ type: String, description: 'External surce for the file' }),
76
- __metadata("design:type", String)
77
- ], MediaModel.prototype, "ExternalSource", void 0);
78
- __decorate([
79
- (0, sequelize_typescript_1.Column)({
80
- allowNull: false,
81
- }),
82
- (0, swagger_1.ApiProperty)({ type: String, description: 'isExternal either Y, N' }),
83
- __metadata("design:type", String)
84
- ], MediaModel.prototype, "IsEncryptedYN", void 0);
85
- __decorate([
86
- (0, sequelize_typescript_1.Column)({
87
- allowNull: true,
88
- }),
89
- (0, swagger_1.ApiProperty)({ type: String, description: 'file name without extension' }),
90
- __metadata("design:type", String)
91
- ], MediaModel.prototype, "FileName", void 0);
92
- __decorate([
93
- (0, sequelize_typescript_1.Column)({
94
- allowNull: true,
95
- }),
96
- (0, swagger_1.ApiProperty)({ type: String, description: 'extention of file in jpg etc' }),
97
- __metadata("design:type", String)
98
- ], MediaModel.prototype, "FileExtension", void 0);
99
- __decorate([
100
- (0, sequelize_typescript_1.Column)({
101
- allowNull: true,
102
- }),
103
- (0, swagger_1.ApiProperty)({
104
- type: String,
105
- description: 'location on the media in term of path',
106
- }),
107
- __metadata("design:type", String)
108
- ], MediaModel.prototype, "FilePath", void 0);
109
- __decorate([
110
- (0, sequelize_typescript_1.Column)({
111
- allowNull: true,
112
- }),
113
- (0, swagger_1.ApiProperty)({ type: String, description: 'URl of the media' }),
114
- __metadata("design:type", String)
115
- ], MediaModel.prototype, "URL", void 0);
116
- __decorate([
117
- (0, swagger_1.ApiProperty)({
118
- example: new Date(),
119
- description: 'Timestamp for data creation.',
120
- }),
121
- sequelize_typescript_1.CreatedAt,
122
- __metadata("design:type", Date)
123
- ], MediaModel.prototype, "CreatedAt", void 0);
124
- __decorate([
125
- (0, swagger_1.ApiProperty)({
126
- example: '138140891dd211b288d34bc7b4312a49',
127
- description: 'The CreatedById for Media.',
128
- }),
129
- (0, sequelize_typescript_1.Column)({ allowNull: false }),
130
- __metadata("design:type", String)
131
- ], MediaModel.prototype, "CreatedById", void 0);
132
- __decorate([
133
- (0, swagger_1.ApiProperty)({
134
- example: new Date(),
135
- description: 'Timestamp for latest data modification',
136
- }),
137
- sequelize_typescript_1.UpdatedAt,
138
- __metadata("design:type", Date)
139
- ], MediaModel.prototype, "UpdatedAt", void 0);
140
- __decorate([
141
- (0, swagger_1.ApiProperty)({
142
- example: '138140891dd211b288d34bc7b4312a49',
143
- description: 'The UpdatedById for Media.',
144
- }),
145
- (0, sequelize_typescript_1.Column)({ allowNull: false }),
146
- __metadata("design:type", String)
147
- ], MediaModel.prototype, "UpdatedById", void 0);
148
- MediaModel = __decorate([
149
- (0, sequelize_typescript_1.Table)({ tableName: 'common_Media', createdAt: false, updatedAt: false })
150
- ], MediaModel);
151
- exports.MediaModel = MediaModel;
152
- //# sourceMappingURL=media.entity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"media.entity.js","sourceRoot":"","sources":["../../src/entities/media.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,+DAM8B;AAC9B,qDAAgD;AAGhD,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,4BAAK;CAiHpC,CAAA;AA3GC;IALC,IAAA,6BAAM,EAAC;QACN,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;KACjB,CAAC;IACD,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;;2CACtC;AAMhB;IAJC,IAAA,6BAAM,EAAC;QACN,SAAS,EAAE,KAAK;KACjB,CAAC;IACD,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;4CACtC;AAMjB;IAJC,IAAA,6B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AAK,EAAE,CAAC;GAC5D,UAAU,CAiHtB;AAjHY,gCAAU"}
@@ -1,17 +0,0 @@
1
- import { HttpException, InternalServerErrorException } from "@nestjs/common";
2
- declare type Record = {
3
- Action: 'Add' | 'Update' | 'Delete';
4
- Activity: string;
5
- Description: string;
6
- EntityId: string;
7
- EntityValueBefore: string;
8
- EntityValueAfter: string;
9
- PerformedById: string;
10
- PerformedAt: Date;
11
- };
12
- export interface ICommonservices {
13
- commonApiUrl: string;
14
- handleAxiosError(err: any): HttpException | InternalServerErrorException;
15
- addActivityHistory(record: Record, entity: string, method: 'create' | 'update' | 'delete'): Promise<void>;
16
- }
17
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=commonService.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commonService.interface.js","sourceRoot":"","sources":["../../src/interfaces/commonService.interface.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import { IBaseMediaAttr } from './base.medias-attr.interface';
2
- import { IMediaRepository } from './media.repository.interface';
3
- export { IMediaRepository, IBaseMediaAttr };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import { MediaModel } from '../entities';
2
- export interface IMediaRepository {
3
- create(data: MediaModel | any, options?: any): Promise<MediaModel>;
4
- findAll(options: any): Promise<MediaModel[]>;
5
- findAllWithPagination(options: any): Promise<{
6
- count: number;
7
- rows: MediaModel[];
8
- }>;
9
- findOne(options: any): Promise<MediaModel>;
10
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=media.repository.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"media.repository.interface.js","sourceRoot":"","sources":["../../src/interfaces/media.repository.interface.ts"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- import { MediasStatus } from 'src/enum/appointment.enum';
2
- export interface IAppointmentSlotGroupAttr {
3
- SlotGroupId: string;
4
- Name: string;
5
- Description: string;
6
- RelatedObjectType: string;
7
- RelatedObjectId: string;
8
- Status: MediasStatus;
9
- CreatedById: string;
10
- CreatedAt: Date;
11
- UpdatedById: string;
12
- UpdatedAt: Date;
13
- }
14
- export interface IAppointmentSlotGroupUpdateAttr {
15
- Name: string;
16
- Description: string;
17
- RelatedObjectType: string;
18
- RelatedObjectId: string;
19
- Status: MediasStatus;
20
- UpdatedById: string;
21
- UpdatedAt: Date;
22
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=medias-attr.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"medias-attr.interface.js","sourceRoot":"","sources":["../../src/interfaces/medias-attr.interface.ts"],"names":[],"mappings":""}
@@ -1,25 +0,0 @@
1
- /// <reference types="multer" />
2
- import { StreamableFile } from '@nestjs/common';
3
- import { CommonService } from './common/common.service';
4
- import { ExternalMediaDto } from './dto/external-media.dto';
5
- import { InternalMediaDto } from './dto/internal-medias.dto';
6
- import { MediasModel } from './entities/medias.entity';
7
- import { IBaseMediasAttr } from './interfaces/base.medias-attr.interface';
8
- import { IMediasRepository } from './interfaces/medias.repository.interface';
9
- import { Response } from 'express';
10
- export declare class MediasController {
11
- private readonly mediaRepository;
12
- private readonly commonService;
13
- constructor(mediaRepository: IMediasRepository, commonService: CommonService);
14
- createInternal(fileStream: Express.Multer.File, createMedia: InternalMediaDto): Promise<MediasModel>;
15
- createExternal(createMedia: ExternalMediaDto): Promise<IBaseMediasAttr>;
16
- findAll(rows: number, page: number, search: string): Promise<{
17
- count: number;
18
- rows: MediasModel[];
19
- }>;
20
- findOne(id: string): Promise<MediasModel>;
21
- getFile(id: string, res: Response): Promise<StreamableFile>;
22
- delete(id: string): Promise<any>;
23
- updateExternal(id: string, updatedMedia: ExternalMediaDto): Promise<void>;
24
- updateInternal(fileStream: Express.Multer.File, id: string, updatedMedia: InternalMediaDto): Promise<IBaseMediasAttr>;
25
- }
@@ -1,225 +0,0 @@
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
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var __rest = (this && this.__rest) || function (s, e) {
15
- var t = {};
16
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17
- t[p] = s[p];
18
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
19
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
20
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
21
- t[p[i]] = s[p[i]];
22
- }
23
- return t;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.MediasController = void 0;
27
- const common_1 = require("@nestjs/common");
28
- const platform_express_1 = require("@nestjs/platform-express");
29
- const swagger_1 = require("@nestjs/swagger");
30
- const cuid = require("cuid");
31
- const common_service_1 = require("./common/common.service");
32
- const validate_search_pipe_1 = require("./pipe/validate-search.pipe");
33
- const external_media_dto_1 = require("./dto/external-media.dto");
34
- const internal_medias_dto_1 = require("./dto/internal-medias.dto");
35
- const medias_entity_1 = require("./entities/medias.entity");
36
- const medias_1 = require("./medias");
37
- const sequelize_1 = require("sequelize");
38
- const validate_id_pipe_1 = require("./pipe/validate-id.pipe");
39
- let MediasController = class MediasController {
40
- constructor(mediaRepository, commonService) {
41
- this.mediaRepository = mediaRepository;
42
- this.commonService = commonService;
43
- }
44
- async createInternal(fileStream, createMedia) {
45
- try {
46
- const mediaAttr = Object.assign(Object.assign({}, createMedia), { MediaId: cuid(), IsExternalYN: 'N', ExternalSource: '', URL: '', FilePath: '', CreatedAt: new Date(), UpdatedAt: new Date(), CreatedById: 'test_user', UpdatedById: 'test_user' });
47
- const media = new medias_1.Medias(this.mediaRepository, this.commonService, mediaAttr);
48
- const createdData = await media.createMedias(false, fileStream);
49
- return createdData;
50
- }
51
- catch (error) {
52
- throw error;
53
- }
54
- }
55
- async createExternal(createMedia) {
56
- const mediaAttr = Object.assign(Object.assign({}, createMedia), { MediaId: cuid(), IsExternalYN: 'Y', CreatedAt: new Date(), UpdatedAt: new Date(), IsEncryptedYN: 'N', FilePath: '', FileName: '', FileExtension: '', CreatedById: 'test_user', UpdatedById: 'test_user' });
57
- const media = new medias_1.Medias(this.mediaRepository, this.commonService, mediaAttr);
58
- await media.createMedias(true);
59
- return mediaAttr;
60
- }
61
- async findAll(rows, page, search) {
62
- let searchObj;
63
- try {
64
- searchObj = search ? JSON.parse(search) : {};
65
- }
66
- catch (err) {
67
- throw new common_1.BadRequestException('Bad value for search.');
68
- }
69
- const mediaFilter = __rest(searchObj, []);
70
- const queryObj = {};
71
- Object.entries(mediaFilter).forEach(([key, value]) => {
72
- queryObj[key] = {
73
- [sequelize_1.Op.substring]: value,
74
- };
75
- });
76
- const offset = rows * (page - 1);
77
- const options = {
78
- order: [['CreatedAt', 'DESC']],
79
- limit: rows,
80
- offset: offset,
81
- where: queryObj,
82
- distinct: true,
83
- };
84
- const media = new medias_1.Medias(this.mediaRepository, this.commonService);
85
- return media.findAllWithPagination(options);
86
- }
87
- async findOne(id) {
88
- const media = new medias_1.Medias(this.mediaRepository, this.commonService);
89
- const file = await media.findOne({ where: { MediaId: id } });
90
- return file;
91
- }
92
- async getFile(id, res) {
93
- let media = new medias_1.Medias(this.mediaRepository, this.commonService);
94
- const mediaData = await media.findOne({ where: { MediaId: id } });
95
- media = new medias_1.Medias(this.mediaRepository, this.commonService, Object.assign({}, mediaData.get({ plain: true })));
96
- const fileBuffer = await media.getFile();
97
- res.set({
98
- 'Content-Type': 'application/octet-stream',
99
- 'Content-Disposition': `attachment; filename=${mediaData.FileName}.${mediaData.FileExtension}`,
100
- 'Content-Length': fileBuffer.length,
101
- });
102
- return new common_1.StreamableFile(fileBuffer);
103
- }
104
- async delete(id) {
105
- try {
106
- let media = new medias_1.Medias(this.mediaRepository, this.commonService);
107
- const mediaData = await media.findOne({ where: { MediaId: id } });
108
- const mediaAttr = Object.assign(Object.assign({}, mediaData.get({ plain: true })), { UpdatedAt: new Date(), UpdatedById: 'test_user' });
109
- media = new medias_1.Medias(this.mediaRepository, this.commonService, mediaAttr);
110
- return await media.delete();
111
- }
112
- catch (error) {
113
- throw error;
114
- }
115
- }
116
- async updateExternal(id, updatedMedia) {
117
- let media = new medias_1.Medias(this.mediaRepository, this.commonService);
118
- const mediaData = await media.findOne({ where: { MediaId: id } });
119
- const mediaAttr = Object.assign(Object.assign(Object.assign({}, mediaData.get({ plain: true })), updatedMedia), { UpdatedAt: new Date(), UpdatedById: 'test_user' });
120
- media = new medias_1.Medias(this.mediaRepository, this.commonService, mediaAttr);
121
- await media.updateMedias(true);
122
- }
123
- async updateInternal(fileStream, id, updatedMedia) {
124
- try {
125
- let media = new medias_1.Medias(this.mediaRepository, this.commonService);
126
- const mediaData = await media.findOne({ where: { MediaId: id } });
127
- const mediaAttr = Object.assign(Object.assign(Object.assign({}, mediaData.get({ plain: true })), updatedMedia), { UpdatedAt: new Date(), UpdatedById: 'test_user' });
128
- media = new medias_1.Medias(this.mediaRepository, this.commonService, mediaAttr);
129
- await media.updateMedias(false, fileStream);
130
- return mediaAttr;
131
- }
132
- catch (error) {
133
- throw error;
134
- }
135
- }
136
- };
137
- __decorate([
138
- (0, common_1.Post)('internal'),
139
- (0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)('FileStream')),
140
- __param(0, (0, common_1.UploadedFile)()),
141
- __param(1, (0, common_1.Body)()),
142
- __metadata("design:type", Function),
143
- __metadata("design:paramtypes", [Object, internal_medias_dto_1.InternalMediaDto]),
144
- __metadata("design:returntype", Promise)
145
- ], MediasController.prototype, "createInternal", null);
146
- __decorate([
147
- (0, common_1.Post)('/external'),
148
- __param(0, (0, common_1.Body)()),
149
- __metadata("design:type", Function),
150
- __metadata("design:paramtypes", [external_media_dto_1.ExternalMediaDto]),
151
- __metadata("design:returntype", Promise)
152
- ], MediasController.prototype, "createExternal", null);
153
- __decorate([
154
- (0, common_1.Get)(),
155
- (0, swagger_1.ApiOperation)({
156
- summary: 'Get all Medias',
157
- }),
158
- (0, swagger_1.ApiOkResponse)({
159
- description: 'Paginanted Medias',
160
- }),
161
- __param(0, (0, common_1.Query)('rows', new common_1.DefaultValuePipe(10), common_1.ParseIntPipe)),
162
- __param(1, (0, common_1.Query)('page', new common_1.DefaultValuePipe(1), common_1.ParseIntPipe)),
163
- __param(2, (0, common_1.Query)('search', new validate_search_pipe_1.ValidateSearchPipe(medias_entity_1.MediasModel, ['ObjectId', 'ObjectType', 'Title']))),
164
- __metadata("design:type", Function),
165
- __metadata("design:paramtypes", [Number, Number, String]),
166
- __metadata("design:returntype", Promise)
167
- ], MediasController.prototype, "findAll", null);
168
- __decorate([
169
- (0, common_1.Get)('/:id'),
170
- (0, swagger_1.ApiOperation)({ summary: 'Get media by MediaId' }),
171
- (0, swagger_1.ApiOkResponse)({
172
- description: 'The found media',
173
- type: medias_entity_1.MediasModel,
174
- }),
175
- __param(0, (0, common_1.Param)('id', new validate_id_pipe_1.ValidateIdPipe())),
176
- __metadata("design:type", Function),
177
- __metadata("design:paramtypes", [String]),
178
- __metadata("design:returntype", Promise)
179
- ], MediasController.prototype, "findOne", null);
180
- __decorate([
181
- (0, common_1.Get)('/:id/file'),
182
- (0, swagger_1.ApiOperation)({ summary: 'Get media file by MediaId' }),
183
- (0, swagger_1.ApiOkResponse)({
184
- description: 'filestream',
185
- type: Buffer,
186
- }),
187
- __param(0, (0, common_1.Param)('id', new validate_id_pipe_1.ValidateIdPipe())),
188
- __param(1, (0, common_1.Res)({ passthrough: true })),
189
- __metadata("design:type", Function),
190
- __metadata("design:paramtypes", [String, Object]),
191
- __metadata("design:returntype", Promise)
192
- ], MediasController.prototype, "getFile", null);
193
- __decorate([
194
- (0, common_1.Delete)('/:id'),
195
- (0, swagger_1.ApiOperation)({ summary: 'Delete media by MediaId' }),
196
- __param(0, (0, common_1.Param)('id', new validate_id_pipe_1.ValidateIdPipe())),
197
- __metadata("design:type", Function),
198
- __metadata("design:paramtypes", [String]),
199
- __metadata("design:returntype", Promise)
200
- ], MediasController.prototype, "delete", null);
201
- __decorate([
202
- (0, common_1.Put)('/external/:id'),
203
- __param(0, (0, common_1.Param)('id', new validate_id_pipe_1.ValidateIdPipe())),
204
- __param(1, (0, common_1.Body)()),
205
- __metadata("design:type", Function),
206
- __metadata("design:paramtypes", [String, external_media_dto_1.ExternalMediaDto]),
207
- __metadata("design:returntype", Promise)
208
- ], MediasController.prototype, "updateExternal", null);
209
- __decorate([
210
- (0, common_1.Put)('/internal/:id'),
211
- (0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)('FileStream')),
212
- __param(0, (0, common_1.UploadedFile)()),
213
- __param(1, (0, common_1.Param)('id', new validate_id_pipe_1.ValidateIdPipe())),
214
- __param(2, (0, common_1.Body)()),
215
- __metadata("design:type", Function),
216
- __metadata("design:paramtypes", [Object, String, internal_medias_dto_1.InternalMediaDto]),
217
- __metadata("design:returntype", Promise)
218
- ], MediasController.prototype, "updateInternal", null);
219
- MediasController = __decorate([
220
- (0, common_1.Controller)('medias'),
221
- __param(0, (0, common_1.Inject)('MediasRepository')),
222
- __metadata("design:paramtypes", [Object, common_service_1.CommonService])
223
- ], MediasController);
224
- exports.MediasController = MediasController;
225
- //# sourceMappingURL=medias.controller%20copy.js.map