@tomei/media 0.4.9 → 0.5.0

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 (78) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.eslintrc.js +66 -66
  3. package/.husky/commit-msg +4 -4
  4. package/.husky/pre-commit +4 -4
  5. package/.prettierrc +4 -4
  6. package/.prettierrc copy +3 -3
  7. package/README.md +93 -93
  8. package/dist/base/base.medias.d.ts +2 -3
  9. package/dist/base/base.medias.js +9 -8
  10. package/dist/base/base.medias.js.map +1 -1
  11. package/dist/base/index.d.ts +2 -0
  12. package/dist/base/index.js +6 -0
  13. package/dist/base/index.js.map +1 -0
  14. package/dist/common/common.service.spec.d.ts +0 -0
  15. package/dist/common/common.service.spec.js +5 -0
  16. package/dist/common/common.service.spec.js.map +1 -0
  17. package/dist/database.d.ts +4 -0
  18. package/dist/database.js +16 -0
  19. package/dist/database.js.map +1 -0
  20. package/dist/dto/medias.dto.d.ts +12 -0
  21. package/dist/dto/medias.dto.js +88 -0
  22. package/dist/dto/medias.dto.js.map +1 -0
  23. package/dist/entities/index.d.ts +2 -0
  24. package/dist/entities/index.js +6 -0
  25. package/dist/entities/index.js.map +1 -0
  26. package/dist/entities/media.entity.d.ts +21 -0
  27. package/dist/entities/media.entity.js +152 -0
  28. package/dist/entities/media.entity.js.map +1 -0
  29. package/dist/index.d.ts +12 -11
  30. package/dist/index.js +3 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/interfaces/commonService.interface.d.ts +17 -0
  33. package/dist/interfaces/commonService.interface.js +3 -0
  34. package/dist/interfaces/commonService.interface.js.map +1 -0
  35. package/dist/interfaces/index.d.ts +3 -0
  36. package/dist/interfaces/index.js +3 -0
  37. package/dist/interfaces/index.js.map +1 -0
  38. package/dist/interfaces/media.repository.interface.d.ts +10 -0
  39. package/dist/interfaces/media.repository.interface.js +3 -0
  40. package/dist/interfaces/media.repository.interface.js.map +1 -0
  41. package/dist/interfaces/medias-attr.interface.d.ts +22 -0
  42. package/dist/interfaces/medias-attr.interface.js +3 -0
  43. package/dist/interfaces/medias-attr.interface.js.map +1 -0
  44. package/dist/medias.controller copy.d.ts +25 -0
  45. package/dist/medias.controller copy.js +225 -0
  46. package/dist/medias.controller copy.js.map +1 -0
  47. package/dist/medias.controller.d.ts +29 -0
  48. package/dist/medias.controller.js +120 -0
  49. package/dist/medias.controller.js.map +1 -0
  50. package/dist/medias.controller.old.d.ts +25 -0
  51. package/dist/medias.controller.old.js +225 -0
  52. package/dist/medias.controller.old.js.map +1 -0
  53. package/dist/medias.d.ts +3 -3
  54. package/dist/medias.js +4 -2
  55. package/dist/medias.js.map +1 -1
  56. package/dist/medias.module.d.ts +2 -0
  57. package/dist/medias.module.js +32 -0
  58. package/dist/medias.module.js.map +1 -0
  59. package/dist/medias.repository.d.ts +6 -14
  60. package/dist/medias.repository.js +46 -37
  61. package/dist/medias.repository.js.map +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/migration/0001-add-defaultyn-hiddenyn-to-media-table.js +36 -36
  64. package/migration/media-migration.js +82 -82
  65. package/package.json +75 -74
  66. package/src/base/base.medias.ts +33 -36
  67. package/src/common/common.module.ts +10 -10
  68. package/src/common/common.service.ts +107 -107
  69. package/src/common/dto/add-field-translation.dto.ts +23 -23
  70. package/src/common/dto/get-media.dto.ts +12 -12
  71. package/src/database.ts +16 -0
  72. package/src/entities/medias.entity.ts +125 -125
  73. package/src/index.ts +23 -22
  74. package/src/medias.repository.ts +43 -29
  75. package/src/medias.ts +4 -7
  76. package/src/pipe/validate-search.pipe.ts +44 -44
  77. package/tsconfig.build.json +4 -4
  78. package/tslint.json +18 -18
@@ -0,0 +1,88 @@
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
@@ -0,0 +1 @@
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,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uCACnD;AAMd;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,IAAI,CAAC;IACf,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;;6CACnD;AAQpB;IANC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAW,EAAC;QACX,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,gDAAgD;KAC9D,CAAC;;+CACoB;AA3DxB,4BA4DC"}
@@ -0,0 +1,2 @@
1
+ import { MediaModel } from './media.entity';
2
+ export { MediaModel };
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAEnC,2FAFA,yBAAU,OAEA"}
@@ -0,0 +1,21 @@
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
+ }
@@ -0,0 +1,152 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.entity.js","sourceRoot":"","sources":["../../src/entities/media.entity.ts"],"names":[],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E,4BAA4B;KAC1C,CAAC;IACD,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;+CACT;AAOpB;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,IAAI,IAAI,EAAE;QACnB,WAAW,EAAE,wCAAwC;KACtD,CAAC;IACD,gCAAS;8BACC,IAAI;6CAAC;AAOhB;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,kCAAkC;QAC3C,WAAW,EAAE,4BAA4B;KAC1C,CAAC;IACD,IAAA,6BAAM,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;+CACT;AAhHT,UAAU;IADtB,IAAA,4BAAK,EAAC,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;GAC5D,UAAU,CAiHtB;AAjHY,gCAAU"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { MediasRepository } from "./medias.repository";
2
- import { MediasModel } from "./entities/medias.entity";
3
- import { Medias } from "./medias";
4
- import { CommonModule } from "./common/common.module";
5
- import { CommonService } from "./common/common.service";
6
- import { ExternalMediaDto } from "./dto/external-media.dto";
7
- import { InternalMediaDto } from "./dto/internal-medias.dto";
8
- import { MediaType } from "./enum";
9
- import { IBaseMediasAttr } from "./interfaces/base.medias-attr.interface";
10
- import { IMediasRepository } from "./interfaces/medias.repository.interface";
11
- export { MediasRepository, MediasModel, Medias, CommonModule, CommonService, ExternalMediaDto, InternalMediaDto, MediaType, IBaseMediasAttr, IMediasRepository, };
1
+ import { MediasRepository } from './medias.repository';
2
+ import { MediasModel } from './entities/medias.entity';
3
+ import { Medias } from './medias';
4
+ import { CommonModule } from './common/common.module';
5
+ import { CommonService } from './common/common.service';
6
+ import { ExternalMediaDto } from './dto/external-media.dto';
7
+ import { InternalMediaDto } from './dto/internal-medias.dto';
8
+ import { MediaType } from './enum';
9
+ import { IBaseMediasAttr } from './interfaces/base.medias-attr.interface';
10
+ import { IMediasRepository } from './interfaces/medias.repository.interface';
11
+ import * as MediaDb from './database';
12
+ export { MediasRepository, MediasModel, Medias, CommonModule, CommonService, ExternalMediaDto, InternalMediaDto, MediaType, IBaseMediasAttr, IMediasRepository, MediaDb, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MediaType = exports.InternalMediaDto = exports.ExternalMediaDto = exports.CommonService = exports.CommonModule = exports.Medias = exports.MediasModel = exports.MediasRepository = void 0;
3
+ exports.MediaDb = exports.MediaType = exports.InternalMediaDto = exports.ExternalMediaDto = exports.CommonService = exports.CommonModule = exports.Medias = exports.MediasModel = exports.MediasRepository = void 0;
4
4
  const medias_repository_1 = require("./medias.repository");
5
5
  Object.defineProperty(exports, "MediasRepository", { enumerable: true, get: function () { return medias_repository_1.MediasRepository; } });
6
6
  const medias_entity_1 = require("./entities/medias.entity");
@@ -17,4 +17,6 @@ const internal_medias_dto_1 = require("./dto/internal-medias.dto");
17
17
  Object.defineProperty(exports, "InternalMediaDto", { enumerable: true, get: function () { return internal_medias_dto_1.InternalMediaDto; } });
18
18
  const enum_1 = require("./enum");
19
19
  Object.defineProperty(exports, "MediaType", { enumerable: true, get: function () { return enum_1.MediaType; } });
20
+ const MediaDb = require("./database");
21
+ exports.MediaDb = MediaDb;
20
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AAYnD,iGAZK,oCAAgB,OAYL;AAXpB,4DAAuD;AAYnD,4FAZK,2BAAW,OAYL;AAXf,qCAAkC;AAY9B,uFAZK,eAAM,OAYL;AAXV,0DAAsD;AAYlD,6FAZK,4BAAY,OAYL;AAXhB,4DAAwD;AAYpD,8FAZK,8BAAa,OAYL;AAXjB,iEAA4D;AAYxD,iGAZK,qCAAgB,OAYL;AAXpB,mEAA6D;AAYzD,iGAZK,sCAAgB,OAYL;AAXpB,iCAAmC;AAY/B,0FAZK,gBAAS,OAYL"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AAYrD,iGAZO,oCAAgB,OAYP;AAXlB,4DAAuD;AAYrD,4FAZO,2BAAW,OAYP;AAXb,qCAAkC;AAYhC,uFAZO,eAAM,OAYP;AAXR,0DAAsD;AAYpD,6FAZO,4BAAY,OAYP;AAXd,4DAAwD;AAYtD,8FAZO,8BAAa,OAYP;AAXf,iEAA4D;AAY1D,iGAZO,qCAAgB,OAYP;AAXlB,mEAA6D;AAY3D,iGAZO,sCAAgB,OAYP;AAXlB,iCAAmC;AAYjC,0FAZO,gBAAS,OAYP;AATX,sCAAsC;AAYpC,0BAAO"}
@@ -0,0 +1,17 @@
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 {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=commonService.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commonService.interface.js","sourceRoot":"","sources":["../../src/interfaces/commonService.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { IBaseMediaAttr } from './base.medias-attr.interface';
2
+ import { IMediaRepository } from './media.repository.interface';
3
+ export { IMediaRepository, IBaseMediaAttr };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=media.repository.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.repository.interface.js","sourceRoot":"","sources":["../../src/interfaces/media.repository.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=medias-attr.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"medias-attr.interface.js","sourceRoot":"","sources":["../../src/interfaces/medias-attr.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
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
+ }