@tomei/media 0.8.8 → 0.8.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/package.json +1 -1
- package/src/base/base.medias.ts +210 -210
- package/src/base/base.repository.abstract.ts +28 -28
- package/src/base/base.repository.interface.ts +9 -9
- 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/database.ts +16 -16
- package/src/dto/external-media.dto.ts +49 -49
- package/src/dto/internal-medias.dto.ts +64 -64
- package/src/entities/medias.entity.ts +125 -125
- package/src/enum/index.ts +3 -3
- package/src/enum/medias.enum.ts +5 -5
- package/src/helpers/error.ts +12 -12
- package/src/helpers/index.ts +3 -3
- package/src/index.ts +24 -24
- package/src/interfaces/base.medias-attr.interface.ts +21 -21
- package/src/interfaces/medias.repository.interface.ts +4 -4
- package/src/medias.repository.ts +55 -55
- package/src/medias.ts +769 -769
- package/src/pipe/append-id.pipe.ts +15 -15
- package/src/pipe/validate-enum.pipe.ts +31 -31
- package/src/pipe/validate-id.pipe.ts +18 -18
- package/src/pipe/validate-search.pipe.ts +44 -44
- package/src/responses/deleted.response.ts +6 -6
- package/src/responses/pagination.response.ts +10 -10
- package/dist/base/base.medias.d.ts +0 -38
- package/dist/base/base.medias.js +0 -175
- package/dist/base/base.medias.js.map +0 -1
- package/dist/base/base.repository.abstract.d.ts +0 -12
- package/dist/base/base.repository.abstract.js +0 -22
- package/dist/base/base.repository.abstract.js.map +0 -1
- package/dist/base/base.repository.interface.d.ts +0 -9
- package/dist/base/base.repository.interface.js +0 -3
- package/dist/base/base.repository.interface.js.map +0 -1
- package/dist/common/common.module.d.ts +0 -2
- package/dist/common/common.module.js +0 -23
- package/dist/common/common.module.js.map +0 -1
- package/dist/common/common.service.d.ts +0 -13
- package/dist/common/common.service.js +0 -106
- package/dist/common/common.service.js.map +0 -1
- package/dist/common/dto/add-field-translation.dto.d.ts +0 -7
- package/dist/common/dto/add-field-translation.dto.js +0 -42
- package/dist/common/dto/add-field-translation.dto.js.map +0 -1
- package/dist/common/dto/get-media.dto.d.ts +0 -5
- package/dist/common/dto/get-media.dto.js +0 -29
- package/dist/common/dto/get-media.dto.js.map +0 -1
- package/dist/database.d.ts +0 -4
- package/dist/database.js +0 -16
- package/dist/database.js.map +0 -1
- package/dist/dto/external-media.dto.d.ts +0 -10
- package/dist/dto/external-media.dto.js +0 -70
- package/dist/dto/external-media.dto.js.map +0 -1
- package/dist/dto/internal-medias.dto.d.ts +0 -12
- package/dist/dto/internal-medias.dto.js +0 -87
- package/dist/dto/internal-medias.dto.js.map +0 -1
- package/dist/entities/medias.entity.d.ts +0 -23
- package/dist/entities/medias.entity.js +0 -160
- package/dist/entities/medias.entity.js.map +0 -1
- package/dist/enum/index.d.ts +0 -2
- package/dist/enum/index.js +0 -6
- package/dist/enum/index.js.map +0 -1
- package/dist/enum/medias.enum.d.ts +0 -5
- package/dist/enum/medias.enum.js +0 -10
- package/dist/enum/medias.enum.js.map +0 -1
- package/dist/helpers/error.d.ts +0 -1
- package/dist/helpers/error.js +0 -13
- package/dist/helpers/error.js.map +0 -1
- package/dist/helpers/index.d.ts +0 -2
- package/dist/helpers/index.js +0 -6
- package/dist/helpers/index.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/interfaces/base.medias-attr.interface.d.ts +0 -20
- package/dist/interfaces/base.medias-attr.interface.js +0 -3
- package/dist/interfaces/base.medias-attr.interface.js.map +0 -1
- package/dist/interfaces/medias.repository.interface.d.ts +0 -3
- package/dist/interfaces/medias.repository.interface.js +0 -3
- package/dist/interfaces/medias.repository.interface.js.map +0 -1
- package/dist/medias.d.ts +0 -65
- package/dist/medias.js +0 -564
- package/dist/medias.js.map +0 -1
- package/dist/medias.repository.d.ts +0 -8
- package/dist/medias.repository.js +0 -56
- package/dist/medias.repository.js.map +0 -1
- package/dist/pipe/append-id.pipe.d.ts +0 -6
- package/dist/pipe/append-id.pipe.js +0 -28
- package/dist/pipe/append-id.pipe.js.map +0 -1
- package/dist/pipe/validate-enum.pipe.d.ts +0 -6
- package/dist/pipe/validate-enum.pipe.js +0 -34
- package/dist/pipe/validate-enum.pipe.js.map +0 -1
- package/dist/pipe/validate-id.pipe.d.ts +0 -6
- package/dist/pipe/validate-id.pipe.js +0 -31
- package/dist/pipe/validate-id.pipe.js.map +0 -1
- package/dist/pipe/validate-search.pipe.d.ts +0 -7
- package/dist/pipe/validate-search.pipe.js +0 -46
- package/dist/pipe/validate-search.pipe.js.map +0 -1
- package/dist/responses/deleted.response.d.ts +0 -3
- package/dist/responses/deleted.response.js +0 -21
- package/dist/responses/deleted.response.js.map +0 -1
- package/dist/responses/pagination.response.d.ts +0 -5
- package/dist/responses/pagination.response.js +0 -26
- package/dist/responses/pagination.response.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HttpException,
|
|
3
|
-
Injectable,
|
|
4
|
-
InternalServerErrorException,
|
|
5
|
-
} from '@nestjs/common';
|
|
6
|
-
import { ConfigService } from '@nestjs/config';
|
|
7
|
-
import axios from 'axios';
|
|
8
|
-
import * as cuid from 'cuid';
|
|
9
|
-
import { omit, omitBy, keys, pick } from 'lodash';
|
|
10
|
-
import { AddFieldTranslationDto } from './dto/add-field-translation.dto';
|
|
11
|
-
import { GetMediaDto } from './dto/get-media.dto';
|
|
12
|
-
@Injectable()
|
|
13
|
-
export class CommonService {
|
|
14
|
-
private readonly commonApiUrl: string;
|
|
15
|
-
|
|
16
|
-
constructor(private configService: ConfigService) {
|
|
17
|
-
this.commonApiUrl = this.configService.get('COMMON_API_URL');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
handleAxiosError(err) {
|
|
21
|
-
if (err.response) {
|
|
22
|
-
throw new HttpException(err.response.data, err.response.status);
|
|
23
|
-
} else if (err.request) {
|
|
24
|
-
throw new HttpException(err.request, 500);
|
|
25
|
-
} else {
|
|
26
|
-
throw new InternalServerErrorException(err.message);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async addActivityHistory(record, entity, method) {
|
|
31
|
-
const activity =
|
|
32
|
-
method === 'create'
|
|
33
|
-
? 'Insert new'
|
|
34
|
-
: method === 'update'
|
|
35
|
-
? 'Update'
|
|
36
|
-
: 'Delete';
|
|
37
|
-
|
|
38
|
-
const filteredRecord = omit(record.EntityValueAfter, [
|
|
39
|
-
'CreatedById',
|
|
40
|
-
'CreatedAt',
|
|
41
|
-
'UpdatedById',
|
|
42
|
-
'UpdatedAt',
|
|
43
|
-
]);
|
|
44
|
-
|
|
45
|
-
const filteredRecordBefore = pick(
|
|
46
|
-
record.EntityValueBefore,
|
|
47
|
-
keys(filteredRecord),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const payload = {
|
|
51
|
-
Action: record.Action || (method === 'create' ? 'Insert' : activity),
|
|
52
|
-
Activity: record.Activity || `${activity} ${entity}`,
|
|
53
|
-
Description: record.Description || `${activity} details of ${entity}`,
|
|
54
|
-
EntityType: record?.EntityType || entity,
|
|
55
|
-
EntityValueBefore:
|
|
56
|
-
method === 'create'
|
|
57
|
-
? JSON.stringify({})
|
|
58
|
-
: method === 'update'
|
|
59
|
-
? filteredRecordBefore
|
|
60
|
-
: record.EntityValueBefore,
|
|
61
|
-
EntityValueAfter: JSON.stringify(filteredRecord),
|
|
62
|
-
PerformedById: record.PerformedById,
|
|
63
|
-
PerformedAt: record.PerformedAt || Date.now(),
|
|
64
|
-
EntityId: record.EntityId ? record.EntityId : cuid(),
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
const { data } = await axios.post(
|
|
69
|
-
`${this.commonApiUrl}/activity-histories`,
|
|
70
|
-
payload,
|
|
71
|
-
);
|
|
72
|
-
return data.EntityId;
|
|
73
|
-
} catch (err) {
|
|
74
|
-
this.handleAxiosError(err);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async getList(listName: string): Promise<[]> {
|
|
79
|
-
try {
|
|
80
|
-
const { data } = await axios.get(`${this.commonApiUrl}/lists/items`, {
|
|
81
|
-
params: { ListName: listName },
|
|
82
|
-
});
|
|
83
|
-
return data?.rows;
|
|
84
|
-
} catch (err) {
|
|
85
|
-
this.handleAxiosError(err);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async addFieldTranslation(payload: AddFieldTranslationDto) {
|
|
90
|
-
try {
|
|
91
|
-
await axios.post(`${this.commonApiUrl}/field-translations`, payload);
|
|
92
|
-
} catch (err) {
|
|
93
|
-
this.handleAxiosError(err);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async getMedia(query: GetMediaDto) {
|
|
98
|
-
try {
|
|
99
|
-
const { data } = await axios.get(`${this.commonApiUrl}/medias`, {
|
|
100
|
-
params: query,
|
|
101
|
-
});
|
|
102
|
-
return data?.rows;
|
|
103
|
-
} catch (err) {
|
|
104
|
-
this.handleAxiosError(err);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
HttpException,
|
|
3
|
+
Injectable,
|
|
4
|
+
InternalServerErrorException,
|
|
5
|
+
} from '@nestjs/common';
|
|
6
|
+
import { ConfigService } from '@nestjs/config';
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import * as cuid from 'cuid';
|
|
9
|
+
import { omit, omitBy, keys, pick } from 'lodash';
|
|
10
|
+
import { AddFieldTranslationDto } from './dto/add-field-translation.dto';
|
|
11
|
+
import { GetMediaDto } from './dto/get-media.dto';
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class CommonService {
|
|
14
|
+
private readonly commonApiUrl: string;
|
|
15
|
+
|
|
16
|
+
constructor(private configService: ConfigService) {
|
|
17
|
+
this.commonApiUrl = this.configService.get('COMMON_API_URL');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
handleAxiosError(err) {
|
|
21
|
+
if (err.response) {
|
|
22
|
+
throw new HttpException(err.response.data, err.response.status);
|
|
23
|
+
} else if (err.request) {
|
|
24
|
+
throw new HttpException(err.request, 500);
|
|
25
|
+
} else {
|
|
26
|
+
throw new InternalServerErrorException(err.message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async addActivityHistory(record, entity, method) {
|
|
31
|
+
const activity =
|
|
32
|
+
method === 'create'
|
|
33
|
+
? 'Insert new'
|
|
34
|
+
: method === 'update'
|
|
35
|
+
? 'Update'
|
|
36
|
+
: 'Delete';
|
|
37
|
+
|
|
38
|
+
const filteredRecord = omit(record.EntityValueAfter, [
|
|
39
|
+
'CreatedById',
|
|
40
|
+
'CreatedAt',
|
|
41
|
+
'UpdatedById',
|
|
42
|
+
'UpdatedAt',
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
const filteredRecordBefore = pick(
|
|
46
|
+
record.EntityValueBefore,
|
|
47
|
+
keys(filteredRecord),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const payload = {
|
|
51
|
+
Action: record.Action || (method === 'create' ? 'Insert' : activity),
|
|
52
|
+
Activity: record.Activity || `${activity} ${entity}`,
|
|
53
|
+
Description: record.Description || `${activity} details of ${entity}`,
|
|
54
|
+
EntityType: record?.EntityType || entity,
|
|
55
|
+
EntityValueBefore:
|
|
56
|
+
method === 'create'
|
|
57
|
+
? JSON.stringify({})
|
|
58
|
+
: method === 'update'
|
|
59
|
+
? filteredRecordBefore
|
|
60
|
+
: record.EntityValueBefore,
|
|
61
|
+
EntityValueAfter: JSON.stringify(filteredRecord),
|
|
62
|
+
PerformedById: record.PerformedById,
|
|
63
|
+
PerformedAt: record.PerformedAt || Date.now(),
|
|
64
|
+
EntityId: record.EntityId ? record.EntityId : cuid(),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const { data } = await axios.post(
|
|
69
|
+
`${this.commonApiUrl}/activity-histories`,
|
|
70
|
+
payload,
|
|
71
|
+
);
|
|
72
|
+
return data.EntityId;
|
|
73
|
+
} catch (err) {
|
|
74
|
+
this.handleAxiosError(err);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async getList(listName: string): Promise<[]> {
|
|
79
|
+
try {
|
|
80
|
+
const { data } = await axios.get(`${this.commonApiUrl}/lists/items`, {
|
|
81
|
+
params: { ListName: listName },
|
|
82
|
+
});
|
|
83
|
+
return data?.rows;
|
|
84
|
+
} catch (err) {
|
|
85
|
+
this.handleAxiosError(err);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async addFieldTranslation(payload: AddFieldTranslationDto) {
|
|
90
|
+
try {
|
|
91
|
+
await axios.post(`${this.commonApiUrl}/field-translations`, payload);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
this.handleAxiosError(err);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async getMedia(query: GetMediaDto) {
|
|
98
|
+
try {
|
|
99
|
+
const { data } = await axios.get(`${this.commonApiUrl}/medias`, {
|
|
100
|
+
params: query,
|
|
101
|
+
});
|
|
102
|
+
return data?.rows;
|
|
103
|
+
} catch (err) {
|
|
104
|
+
this.handleAxiosError(err);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { IsNotEmpty, IsString } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
export class AddFieldTranslationDto {
|
|
4
|
-
@IsNotEmpty()
|
|
5
|
-
@IsString()
|
|
6
|
-
ObjectTable: string;
|
|
7
|
-
|
|
8
|
-
@IsNotEmpty()
|
|
9
|
-
@IsString()
|
|
10
|
-
ObjectField: string;
|
|
11
|
-
|
|
12
|
-
@IsNotEmpty()
|
|
13
|
-
@IsString()
|
|
14
|
-
ObjectId: string;
|
|
15
|
-
|
|
16
|
-
@IsNotEmpty()
|
|
17
|
-
@IsString()
|
|
18
|
-
LanguageCode: string;
|
|
19
|
-
|
|
20
|
-
@IsNotEmpty()
|
|
21
|
-
@IsString()
|
|
22
|
-
Translation: string;
|
|
23
|
-
}
|
|
1
|
+
import { IsNotEmpty, IsString } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
export class AddFieldTranslationDto {
|
|
4
|
+
@IsNotEmpty()
|
|
5
|
+
@IsString()
|
|
6
|
+
ObjectTable: string;
|
|
7
|
+
|
|
8
|
+
@IsNotEmpty()
|
|
9
|
+
@IsString()
|
|
10
|
+
ObjectField: string;
|
|
11
|
+
|
|
12
|
+
@IsNotEmpty()
|
|
13
|
+
@IsString()
|
|
14
|
+
ObjectId: string;
|
|
15
|
+
|
|
16
|
+
@IsNotEmpty()
|
|
17
|
+
@IsString()
|
|
18
|
+
LanguageCode: string;
|
|
19
|
+
|
|
20
|
+
@IsNotEmpty()
|
|
21
|
+
@IsString()
|
|
22
|
+
Translation: string;
|
|
23
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IsString } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
export class GetMediaDto {
|
|
4
|
-
@IsString()
|
|
5
|
-
ObjectID?: string;
|
|
6
|
-
|
|
7
|
-
@IsString()
|
|
8
|
-
ObjectType?: string;
|
|
9
|
-
|
|
10
|
-
@IsString()
|
|
11
|
-
Title?: string;
|
|
12
|
-
}
|
|
1
|
+
import { IsString } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
export class GetMediaDto {
|
|
4
|
+
@IsString()
|
|
5
|
+
ObjectID?: string;
|
|
6
|
+
|
|
7
|
+
@IsString()
|
|
8
|
+
ObjectType?: string;
|
|
9
|
+
|
|
10
|
+
@IsString()
|
|
11
|
+
Title?: string;
|
|
12
|
+
}
|
package/src/database.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Sequelize, SequelizeOptions } from 'sequelize-typescript';
|
|
2
|
-
import { MediasModel } from './entities/medias.entity';
|
|
3
|
-
|
|
4
|
-
const sequelize: any = {};
|
|
5
|
-
|
|
6
|
-
function init(key: string, sequelizeOptions: SequelizeOptions) {
|
|
7
|
-
const s = new Sequelize(sequelizeOptions);
|
|
8
|
-
s.addModels([MediasModel]);
|
|
9
|
-
sequelize[key] = s;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function getConnection(key: string) {
|
|
13
|
-
return sequelize[key];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { init, getConnection };
|
|
1
|
+
import { Sequelize, SequelizeOptions } from 'sequelize-typescript';
|
|
2
|
+
import { MediasModel } from './entities/medias.entity';
|
|
3
|
+
|
|
4
|
+
const sequelize: any = {};
|
|
5
|
+
|
|
6
|
+
function init(key: string, sequelizeOptions: SequelizeOptions) {
|
|
7
|
+
const s = new Sequelize(sequelizeOptions);
|
|
8
|
+
s.addModels([MediasModel]);
|
|
9
|
+
sequelize[key] = s;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getConnection(key: string) {
|
|
13
|
+
return sequelize[key];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { init, getConnection };
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IsEnum, IsNotEmpty, IsString, MaxLength } from 'class-validator';
|
|
3
|
-
import { MediaType } from '../enum/medias.enum';
|
|
4
|
-
|
|
5
|
-
export class ExternalMediaDto {
|
|
6
|
-
@IsNotEmpty()
|
|
7
|
-
@IsString()
|
|
8
|
-
@MaxLength(30)
|
|
9
|
-
@ApiProperty({ type: String, description: 'ObjectID' })
|
|
10
|
-
ObjectId: string;
|
|
11
|
-
|
|
12
|
-
@IsNotEmpty()
|
|
13
|
-
@IsString()
|
|
14
|
-
@MaxLength(200)
|
|
15
|
-
@ApiProperty({ type: String, description: 'ObjectType' })
|
|
16
|
-
ObjectType: string;
|
|
17
|
-
|
|
18
|
-
@IsNotEmpty()
|
|
19
|
-
@ApiProperty({
|
|
20
|
-
type: String,
|
|
21
|
-
description: 'Enum either Photo, Video, Document',
|
|
22
|
-
})
|
|
23
|
-
@IsEnum(MediaType)
|
|
24
|
-
Type: MediaType;
|
|
25
|
-
|
|
26
|
-
@IsNotEmpty()
|
|
27
|
-
@IsString()
|
|
28
|
-
@MaxLength(200)
|
|
29
|
-
@ApiProperty({ type: String, description: 'URL whre the file stored' })
|
|
30
|
-
URL: string;
|
|
31
|
-
|
|
32
|
-
@IsNotEmpty()
|
|
33
|
-
@IsString()
|
|
34
|
-
@MaxLength(200)
|
|
35
|
-
@ApiProperty({ type: String, description: 'external source of the file' })
|
|
36
|
-
ExternalSource: string;
|
|
37
|
-
|
|
38
|
-
@IsNotEmpty()
|
|
39
|
-
@IsString()
|
|
40
|
-
@MaxLength(100)
|
|
41
|
-
@ApiProperty({ type: String, description: 'title of the media' })
|
|
42
|
-
Title: string;
|
|
43
|
-
|
|
44
|
-
@IsNotEmpty()
|
|
45
|
-
@IsString()
|
|
46
|
-
@MaxLength(1000)
|
|
47
|
-
@ApiProperty({ type: String, description: 'Description of the media' })
|
|
48
|
-
Description: string;
|
|
49
|
-
}
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsEnum, IsNotEmpty, IsString, MaxLength } from 'class-validator';
|
|
3
|
+
import { MediaType } from '../enum/medias.enum';
|
|
4
|
+
|
|
5
|
+
export class ExternalMediaDto {
|
|
6
|
+
@IsNotEmpty()
|
|
7
|
+
@IsString()
|
|
8
|
+
@MaxLength(30)
|
|
9
|
+
@ApiProperty({ type: String, description: 'ObjectID' })
|
|
10
|
+
ObjectId: string;
|
|
11
|
+
|
|
12
|
+
@IsNotEmpty()
|
|
13
|
+
@IsString()
|
|
14
|
+
@MaxLength(200)
|
|
15
|
+
@ApiProperty({ type: String, description: 'ObjectType' })
|
|
16
|
+
ObjectType: string;
|
|
17
|
+
|
|
18
|
+
@IsNotEmpty()
|
|
19
|
+
@ApiProperty({
|
|
20
|
+
type: String,
|
|
21
|
+
description: 'Enum either Photo, Video, Document',
|
|
22
|
+
})
|
|
23
|
+
@IsEnum(MediaType)
|
|
24
|
+
Type: MediaType;
|
|
25
|
+
|
|
26
|
+
@IsNotEmpty()
|
|
27
|
+
@IsString()
|
|
28
|
+
@MaxLength(200)
|
|
29
|
+
@ApiProperty({ type: String, description: 'URL whre the file stored' })
|
|
30
|
+
URL: string;
|
|
31
|
+
|
|
32
|
+
@IsNotEmpty()
|
|
33
|
+
@IsString()
|
|
34
|
+
@MaxLength(200)
|
|
35
|
+
@ApiProperty({ type: String, description: 'external source of the file' })
|
|
36
|
+
ExternalSource: string;
|
|
37
|
+
|
|
38
|
+
@IsNotEmpty()
|
|
39
|
+
@IsString()
|
|
40
|
+
@MaxLength(100)
|
|
41
|
+
@ApiProperty({ type: String, description: 'title of the media' })
|
|
42
|
+
Title: string;
|
|
43
|
+
|
|
44
|
+
@IsNotEmpty()
|
|
45
|
+
@IsString()
|
|
46
|
+
@MaxLength(1000)
|
|
47
|
+
@ApiProperty({ type: String, description: 'Description of the media' })
|
|
48
|
+
Description: string;
|
|
49
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IsEnum, IsNotEmpty, IsString, MaxLength } from 'class-validator';
|
|
3
|
-
import { MediaType } from '../enum/medias.enum';
|
|
4
|
-
|
|
5
|
-
export class InternalMediaDto {
|
|
6
|
-
@IsNotEmpty()
|
|
7
|
-
@IsString()
|
|
8
|
-
@MaxLength(30)
|
|
9
|
-
@ApiProperty({ type: String, description: 'ObjectID' })
|
|
10
|
-
ObjectId: string;
|
|
11
|
-
|
|
12
|
-
@IsNotEmpty()
|
|
13
|
-
@IsString()
|
|
14
|
-
@MaxLength(200)
|
|
15
|
-
@ApiProperty({ type: String, description: 'ObjectType' })
|
|
16
|
-
ObjectType: string;
|
|
17
|
-
|
|
18
|
-
@IsNotEmpty()
|
|
19
|
-
@ApiProperty({
|
|
20
|
-
type: String,
|
|
21
|
-
description: 'Enum either Photo, Video, Document',
|
|
22
|
-
})
|
|
23
|
-
@IsEnum(MediaType)
|
|
24
|
-
Type: MediaType;
|
|
25
|
-
|
|
26
|
-
@IsNotEmpty()
|
|
27
|
-
@IsString()
|
|
28
|
-
@MaxLength(200)
|
|
29
|
-
@ApiProperty({ type: String, description: 'file name without extension' })
|
|
30
|
-
FileName: string;
|
|
31
|
-
|
|
32
|
-
@IsNotEmpty()
|
|
33
|
-
@IsString()
|
|
34
|
-
@MaxLength(10)
|
|
35
|
-
@ApiProperty({ type: String, description: 'extention of file in jpg etc' })
|
|
36
|
-
FileExtension: string;
|
|
37
|
-
|
|
38
|
-
@ApiProperty({
|
|
39
|
-
type: String,
|
|
40
|
-
description: 'File stream buffer',
|
|
41
|
-
format: 'binary',
|
|
42
|
-
})
|
|
43
|
-
FileStream: any;
|
|
44
|
-
|
|
45
|
-
@IsNotEmpty()
|
|
46
|
-
@IsString()
|
|
47
|
-
@MaxLength(100)
|
|
48
|
-
@ApiProperty({ type: String, description: 'title of the media' })
|
|
49
|
-
Title: string;
|
|
50
|
-
|
|
51
|
-
@IsNotEmpty()
|
|
52
|
-
@IsString()
|
|
53
|
-
@MaxLength(1000)
|
|
54
|
-
@ApiProperty({ type: String, description: 'Description of the media' })
|
|
55
|
-
Description: string;
|
|
56
|
-
|
|
57
|
-
@IsNotEmpty()
|
|
58
|
-
@IsEnum(['N', 'Y'])
|
|
59
|
-
@ApiProperty({
|
|
60
|
-
type: String,
|
|
61
|
-
description: 'Option if media needed to be encryped : Y or N',
|
|
62
|
-
})
|
|
63
|
-
IsEncryptedYN: string;
|
|
64
|
-
}
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsEnum, IsNotEmpty, IsString, MaxLength } from 'class-validator';
|
|
3
|
+
import { MediaType } from '../enum/medias.enum';
|
|
4
|
+
|
|
5
|
+
export class InternalMediaDto {
|
|
6
|
+
@IsNotEmpty()
|
|
7
|
+
@IsString()
|
|
8
|
+
@MaxLength(30)
|
|
9
|
+
@ApiProperty({ type: String, description: 'ObjectID' })
|
|
10
|
+
ObjectId: string;
|
|
11
|
+
|
|
12
|
+
@IsNotEmpty()
|
|
13
|
+
@IsString()
|
|
14
|
+
@MaxLength(200)
|
|
15
|
+
@ApiProperty({ type: String, description: 'ObjectType' })
|
|
16
|
+
ObjectType: string;
|
|
17
|
+
|
|
18
|
+
@IsNotEmpty()
|
|
19
|
+
@ApiProperty({
|
|
20
|
+
type: String,
|
|
21
|
+
description: 'Enum either Photo, Video, Document',
|
|
22
|
+
})
|
|
23
|
+
@IsEnum(MediaType)
|
|
24
|
+
Type: MediaType;
|
|
25
|
+
|
|
26
|
+
@IsNotEmpty()
|
|
27
|
+
@IsString()
|
|
28
|
+
@MaxLength(200)
|
|
29
|
+
@ApiProperty({ type: String, description: 'file name without extension' })
|
|
30
|
+
FileName: string;
|
|
31
|
+
|
|
32
|
+
@IsNotEmpty()
|
|
33
|
+
@IsString()
|
|
34
|
+
@MaxLength(10)
|
|
35
|
+
@ApiProperty({ type: String, description: 'extention of file in jpg etc' })
|
|
36
|
+
FileExtension: string;
|
|
37
|
+
|
|
38
|
+
@ApiProperty({
|
|
39
|
+
type: String,
|
|
40
|
+
description: 'File stream buffer',
|
|
41
|
+
format: 'binary',
|
|
42
|
+
})
|
|
43
|
+
FileStream: any;
|
|
44
|
+
|
|
45
|
+
@IsNotEmpty()
|
|
46
|
+
@IsString()
|
|
47
|
+
@MaxLength(100)
|
|
48
|
+
@ApiProperty({ type: String, description: 'title of the media' })
|
|
49
|
+
Title: string;
|
|
50
|
+
|
|
51
|
+
@IsNotEmpty()
|
|
52
|
+
@IsString()
|
|
53
|
+
@MaxLength(1000)
|
|
54
|
+
@ApiProperty({ type: String, description: 'Description of the media' })
|
|
55
|
+
Description: string;
|
|
56
|
+
|
|
57
|
+
@IsNotEmpty()
|
|
58
|
+
@IsEnum(['N', 'Y'])
|
|
59
|
+
@ApiProperty({
|
|
60
|
+
type: String,
|
|
61
|
+
description: 'Option if media needed to be encryped : Y or N',
|
|
62
|
+
})
|
|
63
|
+
IsEncryptedYN: string;
|
|
64
|
+
}
|