@tomei/media 0.4.7 → 0.4.9
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/.commitlintrc.json +22 -22
- package/.eslintrc.js +66 -66
- package/.husky/commit-msg +4 -4
- package/.husky/pre-commit +4 -4
- package/.prettierrc +4 -4
- package/.prettierrc copy +3 -3
- package/README.md +93 -93
- package/dist/common/common.module.js.map +1 -1
- package/dist/common/common.service.js.map +1 -1
- package/dist/common/dto/add-field-translation.dto.js.map +1 -1
- package/dist/common/dto/get-media.dto.js.map +1 -1
- package/dist/dto/external-media.dto.js.map +1 -1
- package/dist/dto/internal-medias.dto.js.map +1 -1
- package/dist/entities/medias.entity.d.ts +2 -0
- package/dist/entities/medias.entity.js +8 -0
- package/dist/entities/medias.entity.js.map +1 -1
- package/dist/interfaces/medias.repository.interface.d.ts +1 -1
- package/dist/medias.d.ts +1 -1
- package/dist/medias.js +41 -38
- package/dist/medias.js.map +1 -1
- package/dist/medias.repository.js.map +1 -1
- package/dist/pipe/append-id.pipe.js.map +1 -1
- package/dist/pipe/validate-id.pipe.js.map +1 -1
- package/dist/pipe/validate-search.pipe.js.map +1 -1
- package/dist/responses/deleted.response.js.map +1 -1
- package/dist/responses/pagination.response.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migration/0001-add-defaultyn-hiddenyn-to-media-table.js +36 -0
- package/migration/media-migration.js +82 -82
- package/package.json +74 -72
- package/src/base/base.medias.ts +209 -209
- package/src/common/common.module.ts +10 -10
- package/src/common/common.service.ts +107 -107
- package/src/common/dto/add-field-translation.dto.ts +23 -23
- package/src/common/dto/get-media.dto.ts +12 -12
- package/src/entities/medias.entity.ts +125 -124
- package/src/index.ts +22 -22
- package/src/medias.repository.ts +41 -41
- package/src/medias.ts +763 -701
- package/src/pipe/validate-search.pipe.ts +44 -44
- package/tsconfig.build.json +4 -4
- package/tslint.json +18 -18
- package/dist/base/index.d.ts +0 -2
- package/dist/base/index.js +0 -6
- package/dist/base/index.js.map +0 -1
- package/dist/common/common.service.spec.d.ts +0 -0
- package/dist/common/common.service.spec.js +0 -5
- package/dist/common/common.service.spec.js.map +0 -1
- package/dist/dto/medias.dto.d.ts +0 -12
- package/dist/dto/medias.dto.js +0 -88
- package/dist/dto/medias.dto.js.map +0 -1
- package/dist/entities/index.d.ts +0 -2
- package/dist/entities/index.js +0 -6
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/media.entity.d.ts +0 -21
- package/dist/entities/media.entity.js +0 -152
- package/dist/entities/media.entity.js.map +0 -1
- package/dist/interfaces/commonService.interface.d.ts +0 -17
- package/dist/interfaces/commonService.interface.js +0 -3
- package/dist/interfaces/commonService.interface.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -3
- package/dist/interfaces/index.js +0 -3
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/media.repository.interface.d.ts +0 -10
- package/dist/interfaces/media.repository.interface.js +0 -3
- package/dist/interfaces/media.repository.interface.js.map +0 -1
- package/dist/interfaces/medias-attr.interface.d.ts +0 -22
- package/dist/interfaces/medias-attr.interface.js +0 -3
- package/dist/interfaces/medias-attr.interface.js.map +0 -1
- package/dist/medias.controller copy.d.ts +0 -25
- package/dist/medias.controller copy.js +0 -225
- package/dist/medias.controller copy.js.map +0 -1
- package/dist/medias.controller.d.ts +0 -29
- package/dist/medias.controller.js +0 -120
- package/dist/medias.controller.js.map +0 -1
- package/dist/medias.controller.old.d.ts +0 -25
- package/dist/medias.controller.old.js +0 -225
- package/dist/medias.controller.old.js.map +0 -1
- package/dist/medias.module.d.ts +0 -2
- package/dist/medias.module.js +0 -32
- package/dist/medias.module.js.map +0 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BadRequestException,
|
|
3
|
-
Injectable,
|
|
4
|
-
// Logger,
|
|
5
|
-
PipeTransform,
|
|
6
|
-
} from '@nestjs/common';
|
|
7
|
-
|
|
8
|
-
@Injectable()
|
|
9
|
-
export class ValidateSearchPipe implements PipeTransform {
|
|
10
|
-
constructor(
|
|
11
|
-
private model: any,
|
|
12
|
-
private additionalAttributes: string[] = [],
|
|
13
|
-
) {}
|
|
14
|
-
|
|
15
|
-
transform(value: string) {
|
|
16
|
-
let search = {};
|
|
17
|
-
|
|
18
|
-
if (value) {
|
|
19
|
-
try {
|
|
20
|
-
search = JSON.parse(value);
|
|
21
|
-
} catch (err) {
|
|
22
|
-
throw new BadRequestException('Bad value for search.');
|
|
23
|
-
}
|
|
24
|
-
const attributes: string[] = [
|
|
25
|
-
...this.additionalAttributes,
|
|
26
|
-
...Object.keys(this.model.tableAttributes),
|
|
27
|
-
];
|
|
28
|
-
const searchAttributes: string[] = Object.keys(search);
|
|
29
|
-
const invalidKeys = searchAttributes.filter(
|
|
30
|
-
(attr) => !attributes.includes(attr),
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
if (invalidKeys.length > 0) {
|
|
34
|
-
throw new BadRequestException(
|
|
35
|
-
`${invalidKeys} ${
|
|
36
|
-
invalidKeys.length > 1 ? 'are invalid keys' : 'is an invalid key'
|
|
37
|
-
} for search query`,
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
BadRequestException,
|
|
3
|
+
Injectable,
|
|
4
|
+
// Logger,
|
|
5
|
+
PipeTransform,
|
|
6
|
+
} from '@nestjs/common';
|
|
7
|
+
|
|
8
|
+
@Injectable()
|
|
9
|
+
export class ValidateSearchPipe implements PipeTransform {
|
|
10
|
+
constructor(
|
|
11
|
+
private model: any,
|
|
12
|
+
private additionalAttributes: string[] = [],
|
|
13
|
+
) {}
|
|
14
|
+
|
|
15
|
+
transform(value: string) {
|
|
16
|
+
let search = {};
|
|
17
|
+
|
|
18
|
+
if (value) {
|
|
19
|
+
try {
|
|
20
|
+
search = JSON.parse(value);
|
|
21
|
+
} catch (err) {
|
|
22
|
+
throw new BadRequestException('Bad value for search.');
|
|
23
|
+
}
|
|
24
|
+
const attributes: string[] = [
|
|
25
|
+
...this.additionalAttributes,
|
|
26
|
+
...Object.keys(this.model.tableAttributes),
|
|
27
|
+
];
|
|
28
|
+
const searchAttributes: string[] = Object.keys(search);
|
|
29
|
+
const invalidKeys = searchAttributes.filter(
|
|
30
|
+
(attr) => !attributes.includes(attr),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
if (invalidKeys.length > 0) {
|
|
34
|
+
throw new BadRequestException(
|
|
35
|
+
`${invalidKeys} ${
|
|
36
|
+
invalidKeys.length > 1 ? 'are invalid keys' : 'is an invalid key'
|
|
37
|
+
} for search query`,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
}
|
package/tsconfig.build.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
|
4
|
+
}
|
package/tslint.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
{
|
|
2
|
-
"defaultSeverity": "error",
|
|
3
|
-
"extends": ["tslint:recommended"],
|
|
4
|
-
"jsRules": {
|
|
5
|
-
"no-unused-expression": true
|
|
6
|
-
},
|
|
7
|
-
"rules": {
|
|
8
|
-
"quotemark": [true, "single"],
|
|
9
|
-
"member-access": [false],
|
|
10
|
-
"ordered-imports": [false],
|
|
11
|
-
"max-line-length": [true, 150],
|
|
12
|
-
"member-ordering": [false],
|
|
13
|
-
"interface-name": [false],
|
|
14
|
-
"arrow-parens": false,
|
|
15
|
-
"object-literal-sort-keys": false
|
|
16
|
-
},
|
|
17
|
-
"rulesDirectory": []
|
|
18
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"defaultSeverity": "error",
|
|
3
|
+
"extends": ["tslint:recommended"],
|
|
4
|
+
"jsRules": {
|
|
5
|
+
"no-unused-expression": true
|
|
6
|
+
},
|
|
7
|
+
"rules": {
|
|
8
|
+
"quotemark": [true, "single"],
|
|
9
|
+
"member-access": [false],
|
|
10
|
+
"ordered-imports": [false],
|
|
11
|
+
"max-line-length": [true, 150],
|
|
12
|
+
"member-ordering": [false],
|
|
13
|
+
"interface-name": [false],
|
|
14
|
+
"arrow-parens": false,
|
|
15
|
+
"object-literal-sort-keys": false
|
|
16
|
+
},
|
|
17
|
+
"rulesDirectory": []
|
|
18
|
+
}
|
package/dist/base/index.d.ts
DELETED
package/dist/base/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseMedia = void 0;
|
|
4
|
-
const base_medias_1 = require("./base.medias");
|
|
5
|
-
Object.defineProperty(exports, "BaseMedia", { enumerable: true, get: function () { return base_medias_1.BaseMedia; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
package/dist/base/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAEjC,0FAFA,uBAAS,OAEA"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.service.spec.js","sourceRoot":"","sources":["../../src/common/common.service.spec.ts"],"names":[],"mappings":"AAGA,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAW7B,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAE7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/dto/medias.dto.d.ts
DELETED
|
@@ -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
|
-
}
|
package/dist/dto/medias.dto.js
DELETED
|
@@ -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,EAA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f,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"}
|
package/dist/entities/index.d.ts
DELETED
package/dist/entities/index.js
DELETED
|
@@ -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,6C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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"}
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commonService.interface.js","sourceRoot":"","sources":["../../src/interfaces/commonService.interface.ts"],"names":[],"mappings":""}
|
package/dist/interfaces/index.js
DELETED
|
@@ -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 +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 +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
|
-
}
|