@tomei/media 0.4.3 → 0.4.4
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/base/base.medias.d.ts +38 -38
- package/dist/base/base.medias.js +169 -169
- package/dist/base/base.repository.abstract.d.ts +12 -12
- package/dist/base/base.repository.abstract.js +21 -21
- package/dist/base/base.repository.interface.d.ts +9 -9
- package/dist/base/base.repository.interface.js +2 -2
- package/dist/base/index.d.ts +2 -0
- package/dist/base/index.js +6 -0
- package/dist/base/index.js.map +1 -0
- package/dist/common/common.module.d.ts +2 -2
- package/dist/common/common.module.js +22 -22
- package/dist/common/common.service.d.ts +13 -13
- package/dist/common/common.service.js +105 -107
- package/dist/common/common.service.js.map +1 -1
- package/dist/common/common.service.spec.d.ts +0 -0
- package/dist/common/common.service.spec.js +5 -0
- package/dist/common/common.service.spec.js.map +1 -0
- package/dist/common/dto/add-field-translation.dto.d.ts +7 -7
- package/dist/common/dto/add-field-translation.dto.js +41 -41
- package/dist/common/dto/get-media.dto.d.ts +5 -5
- package/dist/common/dto/get-media.dto.js +28 -28
- package/dist/dto/external-media.dto.d.ts +10 -10
- package/dist/dto/external-media.dto.js +69 -69
- package/dist/dto/internal-medias.dto.d.ts +12 -12
- package/dist/dto/internal-medias.dto.js +86 -86
- package/dist/dto/medias.dto.d.ts +12 -0
- package/dist/dto/medias.dto.js +88 -0
- package/dist/dto/medias.dto.js.map +1 -0
- package/dist/entities/index.d.ts +2 -0
- package/dist/entities/index.js +6 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/media.entity.d.ts +21 -0
- package/dist/entities/media.entity.js +152 -0
- package/dist/entities/media.entity.js.map +1 -0
- package/dist/entities/medias.entity.d.ts +21 -21
- package/dist/entities/medias.entity.js +151 -151
- package/dist/enum/index.d.ts +2 -2
- package/dist/enum/index.js +5 -5
- package/dist/enum/medias.enum.d.ts +5 -5
- package/dist/enum/medias.enum.js +9 -9
- package/dist/helpers/error.d.ts +1 -1
- package/dist/helpers/error.js +13 -13
- package/dist/helpers/index.d.ts +2 -2
- package/dist/helpers/index.js +5 -5
- package/dist/index.d.ts +11 -11
- package/dist/index.js +19 -19
- package/dist/interfaces/base.medias-attr.interface.d.ts +20 -20
- package/dist/interfaces/base.medias-attr.interface.js +2 -2
- package/dist/interfaces/commonService.interface.d.ts +17 -0
- package/dist/interfaces/commonService.interface.js +3 -0
- package/dist/interfaces/commonService.interface.js.map +1 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/media.repository.interface.d.ts +10 -0
- package/dist/interfaces/media.repository.interface.js +3 -0
- package/dist/interfaces/media.repository.interface.js.map +1 -0
- package/dist/interfaces/medias-attr.interface.d.ts +22 -0
- package/dist/interfaces/medias-attr.interface.js +3 -0
- package/dist/interfaces/medias-attr.interface.js.map +1 -0
- package/dist/interfaces/medias.repository.interface.d.ts +3 -3
- package/dist/interfaces/medias.repository.interface.js +2 -2
- package/dist/medias.controller copy.d.ts +25 -0
- package/dist/medias.controller copy.js +225 -0
- package/dist/medias.controller copy.js.map +1 -0
- package/dist/medias.controller.d.ts +29 -25
- package/dist/medias.controller.js +119 -224
- package/dist/medias.controller.js.map +1 -1
- package/dist/medias.controller.old.d.ts +25 -0
- package/dist/medias.controller.old.js +225 -0
- package/dist/medias.controller.old.js.map +1 -0
- package/dist/medias.d.ts +62 -62
- package/dist/medias.js +515 -515
- package/dist/medias.module.d.ts +2 -2
- package/dist/medias.module.js +31 -34
- package/dist/medias.module.js.map +1 -1
- package/dist/medias.repository.d.ts +16 -16
- package/dist/medias.repository.js +46 -46
- package/dist/pipe/append-id.pipe.d.ts +6 -6
- package/dist/pipe/append-id.pipe.js +27 -27
- package/dist/pipe/validate-enum.pipe.d.ts +6 -6
- package/dist/pipe/validate-enum.pipe.js +33 -33
- package/dist/pipe/validate-id.pipe.d.ts +6 -6
- package/dist/pipe/validate-id.pipe.js +30 -30
- package/dist/pipe/validate-search.pipe.d.ts +7 -7
- package/dist/pipe/validate-search.pipe.js +45 -45
- package/dist/responses/deleted.response.d.ts +3 -3
- package/dist/responses/deleted.response.js +20 -20
- package/dist/responses/pagination.response.d.ts +5 -5
- package/dist/responses/pagination.response.js +25 -25
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migration/media-migration.js +82 -82
- package/package.json +72 -72
- package/src/base/base.medias.ts +209 -209
- package/src/common/common.module.ts +10 -10
- package/src/common/common.service.ts +107 -109
- package/src/common/dto/add-field-translation.dto.ts +23 -23
- package/src/common/dto/get-media.dto.ts +12 -12
- package/src/index.ts +22 -22
- package/src/medias.repository.ts +41 -41
- package/src/medias.ts +701 -701
- package/src/pipe/validate-search.pipe.ts +44 -44
- package/tsconfig.build.json +4 -4
- package/tslint.json +18 -18
package/dist/base/base.medias.js
CHANGED
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseMedias = void 0;
|
|
4
|
-
const cuid = require("cuid");
|
|
5
|
-
const common_1 = require("@nestjs/common");
|
|
6
|
-
class BaseMedias {
|
|
7
|
-
constructor(mediasRepository, media) {
|
|
8
|
-
this.mediasRepository = mediasRepository;
|
|
9
|
-
if (media) {
|
|
10
|
-
this.init(media);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
init(media) {
|
|
14
|
-
this.MediaId = media.MediaId ? media.MediaId : cuid();
|
|
15
|
-
this.ObjectId = media.ObjectId;
|
|
16
|
-
this.ObjectType = media.ObjectType;
|
|
17
|
-
this.Title = media.Title;
|
|
18
|
-
this.Description = media.Description;
|
|
19
|
-
this.Type = media.Type;
|
|
20
|
-
this.IsExternalYN = media.IsExternalYN;
|
|
21
|
-
this.ExternalSource = media.ExternalSource;
|
|
22
|
-
this.IsEncryptedYN = media.IsEncryptedYN;
|
|
23
|
-
this.FileName = media.FileName;
|
|
24
|
-
this.FileExtension = media.FileExtension;
|
|
25
|
-
this.URL =
|
|
26
|
-
media.URL && media.IsExternalYN === 'Y'
|
|
27
|
-
? media.URL
|
|
28
|
-
: this.createSaveLocation();
|
|
29
|
-
this.FilePath =
|
|
30
|
-
media.FilePath && media.IsExternalYN === 'Y'
|
|
31
|
-
? media.FilePath
|
|
32
|
-
: this.createFilePath();
|
|
33
|
-
this.CreatedById = media.CreatedById;
|
|
34
|
-
this.CreatedAt = media.CreatedAt;
|
|
35
|
-
this.UpdatedById = media.UpdatedById;
|
|
36
|
-
this.UpdatedAt = media.UpdatedAt;
|
|
37
|
-
}
|
|
38
|
-
createSaveLocation() {
|
|
39
|
-
try {
|
|
40
|
-
const mediaFileStorageType = process.env.MEDIA_STORAGE_TYPE;
|
|
41
|
-
let basePath;
|
|
42
|
-
if (mediaFileStorageType === 'local') {
|
|
43
|
-
basePath = process.env.MEDIA_LOCAL_STORAGE_PATH;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
basePath = process.env.MEDIA_AZUREBLOB_CONTAINER_NAME;
|
|
47
|
-
}
|
|
48
|
-
if (!basePath) {
|
|
49
|
-
throw new common_1.BadRequestException('MEDIA_LOCAL_STORAGE_PATH and or MEDIA_AZUREBLOB_CONTAINER_NAME not found.');
|
|
50
|
-
}
|
|
51
|
-
return basePath + `/${this.ObjectType}/${this.ObjectId}`;
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
createFilePath() {
|
|
58
|
-
try {
|
|
59
|
-
const fileLocation = this.createSaveLocation();
|
|
60
|
-
return `${fileLocation}/${this.FileName}.${this.FileExtension}`;
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async create(options) {
|
|
67
|
-
try {
|
|
68
|
-
return this.mediasRepository.create({
|
|
69
|
-
MediaId: this.MediaId,
|
|
70
|
-
ObjectId: this.ObjectId,
|
|
71
|
-
ObjectType: this.ObjectType,
|
|
72
|
-
Title: this.Title,
|
|
73
|
-
Description: this.Description,
|
|
74
|
-
Type: this.Type,
|
|
75
|
-
IsExternalYN: this.IsExternalYN,
|
|
76
|
-
ExternalSource: this.ExternalSource,
|
|
77
|
-
IsEncryptedYN: this.IsEncryptedYN,
|
|
78
|
-
FileName: this.FileName,
|
|
79
|
-
FileExtension: this.FileExtension,
|
|
80
|
-
FilePath: this.FilePath,
|
|
81
|
-
URL: this.URL,
|
|
82
|
-
CreatedById: this.CreatedById,
|
|
83
|
-
CreatedAt: this.CreatedAt,
|
|
84
|
-
UpdatedById: this.UpdatedById,
|
|
85
|
-
UpdatedAt: this.UpdatedAt,
|
|
86
|
-
}, options);
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
throw error;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async update(options) {
|
|
93
|
-
try {
|
|
94
|
-
const media = await this.mediasRepository.findOne({
|
|
95
|
-
where: {
|
|
96
|
-
MediaId: this.MediaId,
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
if (!media) {
|
|
100
|
-
throw new common_1.BadRequestException('Media not found.');
|
|
101
|
-
}
|
|
102
|
-
return await media.update({
|
|
103
|
-
MediaId: this.MediaId,
|
|
104
|
-
ObjectId: this.ObjectId,
|
|
105
|
-
ObjectType: this.ObjectType,
|
|
106
|
-
Title: this.Title,
|
|
107
|
-
Description: this.Description,
|
|
108
|
-
Type: this.Type,
|
|
109
|
-
IsExternalYN: this.IsExternalYN,
|
|
110
|
-
ExternalSource: this.ExternalSource,
|
|
111
|
-
IsEncryptedYN: this.IsEncryptedYN,
|
|
112
|
-
FileName: this.FileName,
|
|
113
|
-
FileExtension: this.FileExtension,
|
|
114
|
-
FilePath: this.FilePath,
|
|
115
|
-
URL: this.URL,
|
|
116
|
-
CreatedById: this.CreatedById,
|
|
117
|
-
CreatedAt: this.CreatedAt,
|
|
118
|
-
UpdatedById: this.UpdatedById,
|
|
119
|
-
UpdatedAt: this.UpdatedAt,
|
|
120
|
-
}, options);
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
throw error;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
async delete(options) {
|
|
127
|
-
try {
|
|
128
|
-
const media = await this.mediasRepository.findOne({
|
|
129
|
-
where: {
|
|
130
|
-
MediaId: this.MediaId,
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
const data = Object.assign({}, media.get({ plain: true }));
|
|
134
|
-
if (!media) {
|
|
135
|
-
throw new common_1.BadRequestException('Media not found.');
|
|
136
|
-
}
|
|
137
|
-
await media.destroy(options);
|
|
138
|
-
return data;
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
async findAll(options) {
|
|
145
|
-
try {
|
|
146
|
-
return this.mediasRepository.findAll(options);
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
throw error;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
async findAllWithPagination(options) {
|
|
153
|
-
try {
|
|
154
|
-
return this.mediasRepository.findAllWithPagination(options);
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
throw error;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
async findOne(options) {
|
|
161
|
-
try {
|
|
162
|
-
return this.mediasRepository.findOne(options);
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
throw error;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
exports.BaseMedias = BaseMedias;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseMedias = void 0;
|
|
4
|
+
const cuid = require("cuid");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
class BaseMedias {
|
|
7
|
+
constructor(mediasRepository, media) {
|
|
8
|
+
this.mediasRepository = mediasRepository;
|
|
9
|
+
if (media) {
|
|
10
|
+
this.init(media);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
init(media) {
|
|
14
|
+
this.MediaId = media.MediaId ? media.MediaId : cuid();
|
|
15
|
+
this.ObjectId = media.ObjectId;
|
|
16
|
+
this.ObjectType = media.ObjectType;
|
|
17
|
+
this.Title = media.Title;
|
|
18
|
+
this.Description = media.Description;
|
|
19
|
+
this.Type = media.Type;
|
|
20
|
+
this.IsExternalYN = media.IsExternalYN;
|
|
21
|
+
this.ExternalSource = media.ExternalSource;
|
|
22
|
+
this.IsEncryptedYN = media.IsEncryptedYN;
|
|
23
|
+
this.FileName = media.FileName;
|
|
24
|
+
this.FileExtension = media.FileExtension;
|
|
25
|
+
this.URL =
|
|
26
|
+
media.URL && media.IsExternalYN === 'Y'
|
|
27
|
+
? media.URL
|
|
28
|
+
: this.createSaveLocation();
|
|
29
|
+
this.FilePath =
|
|
30
|
+
media.FilePath && media.IsExternalYN === 'Y'
|
|
31
|
+
? media.FilePath
|
|
32
|
+
: this.createFilePath();
|
|
33
|
+
this.CreatedById = media.CreatedById;
|
|
34
|
+
this.CreatedAt = media.CreatedAt;
|
|
35
|
+
this.UpdatedById = media.UpdatedById;
|
|
36
|
+
this.UpdatedAt = media.UpdatedAt;
|
|
37
|
+
}
|
|
38
|
+
createSaveLocation() {
|
|
39
|
+
try {
|
|
40
|
+
const mediaFileStorageType = process.env.MEDIA_STORAGE_TYPE;
|
|
41
|
+
let basePath;
|
|
42
|
+
if (mediaFileStorageType === 'local') {
|
|
43
|
+
basePath = process.env.MEDIA_LOCAL_STORAGE_PATH;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
basePath = process.env.MEDIA_AZUREBLOB_CONTAINER_NAME;
|
|
47
|
+
}
|
|
48
|
+
if (!basePath) {
|
|
49
|
+
throw new common_1.BadRequestException('MEDIA_LOCAL_STORAGE_PATH and or MEDIA_AZUREBLOB_CONTAINER_NAME not found.');
|
|
50
|
+
}
|
|
51
|
+
return basePath + `/${this.ObjectType}/${this.ObjectId}`;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
createFilePath() {
|
|
58
|
+
try {
|
|
59
|
+
const fileLocation = this.createSaveLocation();
|
|
60
|
+
return `${fileLocation}/${this.FileName}.${this.FileExtension}`;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async create(options) {
|
|
67
|
+
try {
|
|
68
|
+
return this.mediasRepository.create({
|
|
69
|
+
MediaId: this.MediaId,
|
|
70
|
+
ObjectId: this.ObjectId,
|
|
71
|
+
ObjectType: this.ObjectType,
|
|
72
|
+
Title: this.Title,
|
|
73
|
+
Description: this.Description,
|
|
74
|
+
Type: this.Type,
|
|
75
|
+
IsExternalYN: this.IsExternalYN,
|
|
76
|
+
ExternalSource: this.ExternalSource,
|
|
77
|
+
IsEncryptedYN: this.IsEncryptedYN,
|
|
78
|
+
FileName: this.FileName,
|
|
79
|
+
FileExtension: this.FileExtension,
|
|
80
|
+
FilePath: this.FilePath,
|
|
81
|
+
URL: this.URL,
|
|
82
|
+
CreatedById: this.CreatedById,
|
|
83
|
+
CreatedAt: this.CreatedAt,
|
|
84
|
+
UpdatedById: this.UpdatedById,
|
|
85
|
+
UpdatedAt: this.UpdatedAt,
|
|
86
|
+
}, options);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async update(options) {
|
|
93
|
+
try {
|
|
94
|
+
const media = await this.mediasRepository.findOne({
|
|
95
|
+
where: {
|
|
96
|
+
MediaId: this.MediaId,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
if (!media) {
|
|
100
|
+
throw new common_1.BadRequestException('Media not found.');
|
|
101
|
+
}
|
|
102
|
+
return await media.update({
|
|
103
|
+
MediaId: this.MediaId,
|
|
104
|
+
ObjectId: this.ObjectId,
|
|
105
|
+
ObjectType: this.ObjectType,
|
|
106
|
+
Title: this.Title,
|
|
107
|
+
Description: this.Description,
|
|
108
|
+
Type: this.Type,
|
|
109
|
+
IsExternalYN: this.IsExternalYN,
|
|
110
|
+
ExternalSource: this.ExternalSource,
|
|
111
|
+
IsEncryptedYN: this.IsEncryptedYN,
|
|
112
|
+
FileName: this.FileName,
|
|
113
|
+
FileExtension: this.FileExtension,
|
|
114
|
+
FilePath: this.FilePath,
|
|
115
|
+
URL: this.URL,
|
|
116
|
+
CreatedById: this.CreatedById,
|
|
117
|
+
CreatedAt: this.CreatedAt,
|
|
118
|
+
UpdatedById: this.UpdatedById,
|
|
119
|
+
UpdatedAt: this.UpdatedAt,
|
|
120
|
+
}, options);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async delete(options) {
|
|
127
|
+
try {
|
|
128
|
+
const media = await this.mediasRepository.findOne({
|
|
129
|
+
where: {
|
|
130
|
+
MediaId: this.MediaId,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
const data = Object.assign({}, media.get({ plain: true }));
|
|
134
|
+
if (!media) {
|
|
135
|
+
throw new common_1.BadRequestException('Media not found.');
|
|
136
|
+
}
|
|
137
|
+
await media.destroy(options);
|
|
138
|
+
return data;
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async findAll(options) {
|
|
145
|
+
try {
|
|
146
|
+
return this.mediasRepository.findAll(options);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async findAllWithPagination(options) {
|
|
153
|
+
try {
|
|
154
|
+
return this.mediasRepository.findAllWithPagination(options);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async findOne(options) {
|
|
161
|
+
try {
|
|
162
|
+
return this.mediasRepository.findOne(options);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.BaseMedias = BaseMedias;
|
|
170
170
|
//# sourceMappingURL=base.medias.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IBaseRepository } from './base.repository.interface';
|
|
2
|
-
export declare abstract class BaseRepository<T> implements IBaseRepository<T> {
|
|
3
|
-
private model;
|
|
4
|
-
protected constructor(model: any);
|
|
5
|
-
create(data: any, options?: any): Promise<void | T>;
|
|
6
|
-
findAll(options: any): Promise<T[]>;
|
|
7
|
-
findAllWithPagination(options: any): Promise<{
|
|
8
|
-
count: number;
|
|
9
|
-
rows: T[];
|
|
10
|
-
}>;
|
|
11
|
-
findOne(options: any): Promise<T>;
|
|
12
|
-
}
|
|
1
|
+
import { IBaseRepository } from './base.repository.interface';
|
|
2
|
+
export declare abstract class BaseRepository<T> implements IBaseRepository<T> {
|
|
3
|
+
private model;
|
|
4
|
+
protected constructor(model: any);
|
|
5
|
+
create(data: any, options?: any): Promise<void | T>;
|
|
6
|
+
findAll(options: any): Promise<T[]>;
|
|
7
|
+
findAllWithPagination(options: any): Promise<{
|
|
8
|
+
count: number;
|
|
9
|
+
rows: T[];
|
|
10
|
+
}>;
|
|
11
|
+
findOne(options: any): Promise<T>;
|
|
12
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseRepository = void 0;
|
|
4
|
-
class BaseRepository {
|
|
5
|
-
constructor(model) {
|
|
6
|
-
this.model = model;
|
|
7
|
-
}
|
|
8
|
-
async create(data, options) {
|
|
9
|
-
return this.model.create(data, options);
|
|
10
|
-
}
|
|
11
|
-
async findAll(options) {
|
|
12
|
-
return this.model.findAll(options);
|
|
13
|
-
}
|
|
14
|
-
async findAllWithPagination(options) {
|
|
15
|
-
return this.model.findAndCountAll(options);
|
|
16
|
-
}
|
|
17
|
-
async findOne(options) {
|
|
18
|
-
return this.model.findOne(options);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.BaseRepository = BaseRepository;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseRepository = void 0;
|
|
4
|
+
class BaseRepository {
|
|
5
|
+
constructor(model) {
|
|
6
|
+
this.model = model;
|
|
7
|
+
}
|
|
8
|
+
async create(data, options) {
|
|
9
|
+
return this.model.create(data, options);
|
|
10
|
+
}
|
|
11
|
+
async findAll(options) {
|
|
12
|
+
return this.model.findAll(options);
|
|
13
|
+
}
|
|
14
|
+
async findAllWithPagination(options) {
|
|
15
|
+
return this.model.findAndCountAll(options);
|
|
16
|
+
}
|
|
17
|
+
async findOne(options) {
|
|
18
|
+
return this.model.findOne(options);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.BaseRepository = BaseRepository;
|
|
22
22
|
//# sourceMappingURL=base.repository.abstract.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export interface IBaseRepository<T> {
|
|
2
|
-
create(data: T | any, options?: any): Promise<T> | any;
|
|
3
|
-
findAll(options: any): Promise<T[]>;
|
|
4
|
-
findAllWithPagination(options: any): Promise<{
|
|
5
|
-
count: number;
|
|
6
|
-
rows: T[];
|
|
7
|
-
}>;
|
|
8
|
-
findOne(options: any): Promise<T>;
|
|
9
|
-
}
|
|
1
|
+
export interface IBaseRepository<T> {
|
|
2
|
+
create(data: T | any, options?: any): Promise<T> | any;
|
|
3
|
+
findAll(options: any): Promise<T[]>;
|
|
4
|
+
findAllWithPagination(options: any): Promise<{
|
|
5
|
+
count: number;
|
|
6
|
+
rows: T[];
|
|
7
|
+
}>;
|
|
8
|
+
findOne(options: any): Promise<T>;
|
|
9
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=base.repository.interface.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAEjC,0FAFA,uBAAS,OAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class CommonModule {
|
|
2
|
-
}
|
|
1
|
+
export declare class CommonModule {
|
|
2
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.CommonModule = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const config_1 = require("@nestjs/config");
|
|
12
|
-
const common_service_1 = require("./common.service");
|
|
13
|
-
let CommonModule = class CommonModule {
|
|
14
|
-
};
|
|
15
|
-
CommonModule = __decorate([
|
|
16
|
-
(0, common_1.Module)({
|
|
17
|
-
providers: [common_service_1.CommonService],
|
|
18
|
-
imports: [config_1.ConfigModule],
|
|
19
|
-
exports: [common_service_1.CommonService],
|
|
20
|
-
})
|
|
21
|
-
], CommonModule);
|
|
22
|
-
exports.CommonModule = CommonModule;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CommonModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const config_1 = require("@nestjs/config");
|
|
12
|
+
const common_service_1 = require("./common.service");
|
|
13
|
+
let CommonModule = class CommonModule {
|
|
14
|
+
};
|
|
15
|
+
CommonModule = __decorate([
|
|
16
|
+
(0, common_1.Module)({
|
|
17
|
+
providers: [common_service_1.CommonService],
|
|
18
|
+
imports: [config_1.ConfigModule],
|
|
19
|
+
exports: [common_service_1.CommonService],
|
|
20
|
+
})
|
|
21
|
+
], CommonModule);
|
|
22
|
+
exports.CommonModule = CommonModule;
|
|
23
23
|
//# sourceMappingURL=common.module.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
import { AddFieldTranslationDto } from './dto/add-field-translation.dto';
|
|
3
|
-
import { GetMediaDto } from './dto/get-media.dto';
|
|
4
|
-
export declare class CommonService {
|
|
5
|
-
private configService;
|
|
6
|
-
private readonly commonApiUrl;
|
|
7
|
-
constructor(configService: ConfigService);
|
|
8
|
-
handleAxiosError(err: any): void;
|
|
9
|
-
addActivityHistory(record: any, entity: any, method: any): Promise<any>;
|
|
10
|
-
getList(listName: string): Promise<[]>;
|
|
11
|
-
addFieldTranslation(payload: AddFieldTranslationDto): Promise<void>;
|
|
12
|
-
getMedia(query: GetMediaDto): Promise<any>;
|
|
13
|
-
}
|
|
1
|
+
import { ConfigService } from '@nestjs/config';
|
|
2
|
+
import { AddFieldTranslationDto } from './dto/add-field-translation.dto';
|
|
3
|
+
import { GetMediaDto } from './dto/get-media.dto';
|
|
4
|
+
export declare class CommonService {
|
|
5
|
+
private configService;
|
|
6
|
+
private readonly commonApiUrl;
|
|
7
|
+
constructor(configService: ConfigService);
|
|
8
|
+
handleAxiosError(err: any): void;
|
|
9
|
+
addActivityHistory(record: any, entity: any, method: any): Promise<any>;
|
|
10
|
+
getList(listName: string): Promise<[]>;
|
|
11
|
+
addFieldTranslation(payload: AddFieldTranslationDto): Promise<void>;
|
|
12
|
+
getMedia(query: GetMediaDto): Promise<any>;
|
|
13
|
+
}
|