@hedhog/admin 0.0.109 → 0.0.111

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/dist/admin.module.d.ts.map +1 -1
  2. package/dist/admin.module.js +0 -3
  3. package/dist/admin.module.js.map +1 -1
  4. package/dist/auth/auth.controller.d.ts.map +1 -1
  5. package/dist/auth/auth.controller.js +1 -2
  6. package/dist/auth/auth.controller.js.map +1 -1
  7. package/dist/index.d.ts +0 -2
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +0 -3
  10. package/dist/index.js.map +1 -1
  11. package/dist/menu/menu.controller.d.ts.map +1 -1
  12. package/dist/menu/menu.controller.js +1 -2
  13. package/dist/menu/menu.controller.js.map +1 -1
  14. package/dist/role/dto/create.dto.d.ts +1 -1
  15. package/dist/role/dto/create.dto.d.ts.map +1 -1
  16. package/dist/role/dto/create.dto.js +2 -2
  17. package/dist/role/dto/create.dto.js.map +1 -1
  18. package/hedhog.yaml +48 -307
  19. package/package.json +3 -3
  20. package/src/admin.module.ts +0 -3
  21. package/src/auth/auth.controller.ts +1 -2
  22. package/src/index.ts +0 -4
  23. package/src/menu/menu.controller.ts +1 -2
  24. package/src/role/dto/create.dto.ts +1 -1
  25. package/dist/auth/decorators/user.decorator.d.ts +0 -2
  26. package/dist/auth/decorators/user.decorator.d.ts.map +0 -1
  27. package/dist/auth/decorators/user.decorator.js +0 -12
  28. package/dist/auth/decorators/user.decorator.js.map +0 -1
  29. package/dist/dto/with-locale.dto.d.ts +0 -4
  30. package/dist/dto/with-locale.dto.d.ts.map +0 -1
  31. package/dist/dto/with-locale.dto.js +0 -23
  32. package/dist/dto/with-locale.dto.js.map +0 -1
  33. package/dist/setting/dto/create.dto.d.ts +0 -3
  34. package/dist/setting/dto/create.dto.d.ts.map +0 -1
  35. package/dist/setting/dto/create.dto.js +0 -7
  36. package/dist/setting/dto/create.dto.js.map +0 -1
  37. package/dist/setting/dto/setting-user.dto.d.ts +0 -4
  38. package/dist/setting/dto/setting-user.dto.d.ts.map +0 -1
  39. package/dist/setting/dto/setting-user.dto.js +0 -21
  40. package/dist/setting/dto/setting-user.dto.js.map +0 -1
  41. package/dist/setting/dto/setting.dto.d.ts +0 -9
  42. package/dist/setting/dto/setting.dto.d.ts.map +0 -1
  43. package/dist/setting/dto/setting.dto.js +0 -34
  44. package/dist/setting/dto/setting.dto.js.map +0 -1
  45. package/dist/setting/dto/update.dto.d.ts +0 -4
  46. package/dist/setting/dto/update.dto.d.ts.map +0 -1
  47. package/dist/setting/dto/update.dto.js +0 -8
  48. package/dist/setting/dto/update.dto.js.map +0 -1
  49. package/dist/setting/setting.controller.d.ts +0 -26
  50. package/dist/setting/setting.controller.d.ts.map +0 -1
  51. package/dist/setting/setting.controller.js +0 -161
  52. package/dist/setting/setting.controller.js.map +0 -1
  53. package/dist/setting/setting.module.d.ts +0 -3
  54. package/dist/setting/setting.module.d.ts.map +0 -1
  55. package/dist/setting/setting.module.js +0 -33
  56. package/dist/setting/setting.module.js.map +0 -1
  57. package/dist/setting/setting.service.d.ts +0 -33
  58. package/dist/setting/setting.service.d.ts.map +0 -1
  59. package/dist/setting/setting.service.js +0 -377
  60. package/dist/setting/setting.service.js.map +0 -1
  61. package/dist/setting/setting.service.spec.d.ts +0 -2
  62. package/dist/setting/setting.service.spec.d.ts.map +0 -1
  63. package/dist/setting/setting.service.spec.js +0 -162
  64. package/dist/setting/setting.service.spec.js.map +0 -1
  65. package/src/auth/decorators/user.decorator.ts +0 -17
  66. package/src/dto/with-locale.dto.ts +0 -8
  67. package/src/setting/dto/create.dto.ts +0 -1
  68. package/src/setting/dto/setting-user.dto.ts +0 -6
  69. package/src/setting/dto/setting.dto.ts +0 -17
  70. package/src/setting/dto/update.dto.ts +0 -3
  71. package/src/setting/setting.controller.ts +0 -107
  72. package/src/setting/setting.module.ts +0 -20
  73. package/src/setting/setting.service.spec.ts +0 -183
  74. package/src/setting/setting.service.ts +0 -457
@@ -1,377 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.SettingService = void 0;
16
- const file_1 = require("@hedhog/file");
17
- const pagination_1 = require("@hedhog/pagination");
18
- const prisma_1 = require("@hedhog/prisma");
19
- const utils_1 = require("@hedhog/utils");
20
- const common_1 = require("@nestjs/common");
21
- let SettingService = class SettingService {
22
- constructor(prismaService, paginationService, fileService) {
23
- this.prismaService = prismaService;
24
- this.paginationService = paginationService;
25
- this.fileService = fileService;
26
- }
27
- async getAppearanceCSS(res) {
28
- const fileCSS = await this.fileService.readStream(`appearance/theme.css`);
29
- res.setHeader('Content-Type', 'text/css');
30
- return fileCSS.pipe(res);
31
- }
32
- async updateAppearanceSettings() {
33
- console.log({ updateAppearanceSettings: 'updateAppearanceSettings' });
34
- const settings = await this.prismaService.setting.findMany({
35
- where: {
36
- setting_group: {
37
- slug: 'appearance',
38
- },
39
- },
40
- });
41
- await this.fileService.uploadFromString('appearance', 'theme.css', `
42
- @layer base {
43
- :root {
44
- --background: 0 0% 100%;
45
- --foreground: 20 14.3% 4.1%;
46
- --card: 0 0% 100%;
47
- --card-foreground: 20 14.3% 4.1%;
48
- --popover: 0 0% 100%;
49
- --popover-foreground: 20 14.3% 4.1%;
50
- --primary: 24.6 95% 53.1%;
51
- --primary-foreground: 60 9.1% 97.8%;
52
- --secondary: 60 4.8% 95.9%;
53
- --secondary-foreground: 24 9.8% 10%;
54
- --muted: 60 4.8% 95.9%;
55
- --muted-foreground: 25 5.3% 44.7%;
56
- --accent: 60 4.8% 95.9%;
57
- --accent-foreground: 24 9.8% 10%;
58
- --destructive: 0 84.2% 60.2%;
59
- --destructive-foreground: 60 9.1% 97.8%;
60
- --border: 20 5.9% 90%;
61
- --input: 20 5.9% 90%;
62
- --ring: 24.6 95% 53.1%;
63
- --radius: 0.5rem;
64
- --chart-1: 12 76% 61%;
65
- --chart-2: 173 58% 39%;
66
- --chart-3: 197 37% 24%;
67
- --chart-4: 43 74% 66%;
68
- --chart-5: 27 87% 67%;
69
- }
70
-
71
- .dark {
72
- --background: 20 14.3% 4.1%;
73
- --foreground: 60 9.1% 97.8%;
74
- --card: 20 14.3% 4.1%;
75
- --card-foreground: 60 9.1% 97.8%;
76
- --popover: 20 14.3% 4.1%;
77
- --popover-foreground: 60 9.1% 97.8%;
78
- --primary: 20.5 90.2% 48.2%;
79
- --primary-foreground: 60 9.1% 97.8%;
80
- --secondary: 12 6.5% 15.1%;
81
- --secondary-foreground: 60 9.1% 97.8%;
82
- --muted: 12 6.5% 15.1%;
83
- --muted-foreground: 24 5.4% 63.9%;
84
- --accent: 12 6.5% 15.1%;
85
- --accent-foreground: 60 9.1% 97.8%;
86
- --destructive: 0 72.2% 50.6%;
87
- --destructive-foreground: 60 9.1% 97.8%;
88
- --border: 12 6.5% 15.1%;
89
- --input: 12 6.5% 15.1%;
90
- --ring: 20.5 90.2% 48.2%;
91
- --chart-1: 220 70% 50%;
92
- --chart-2: 160 60% 45%;
93
- --chart-3: 30 80% 55%;
94
- --chart-4: 280 65% 60%;
95
- --chart-5: 340 75% 55%;
96
- }
97
- }
98
- `, 'text/css');
99
- console.log({ settings });
100
- }
101
- async setManySettings(data) {
102
- const transaction = [];
103
- for (const { slug, value } of data.setting) {
104
- transaction.push(this.prismaService.setting.updateMany({
105
- where: {
106
- slug,
107
- },
108
- data: {
109
- value,
110
- },
111
- }));
112
- }
113
- await this.prismaService.$transaction(transaction);
114
- const hasAppearance = await this.prismaService.setting.count({
115
- where: {
116
- slug: {
117
- in: data.setting.map((setting) => setting.slug),
118
- },
119
- setting_group: {
120
- slug: 'appearance',
121
- },
122
- },
123
- });
124
- if (hasAppearance) {
125
- await this.updateAppearanceSettings();
126
- }
127
- return { success: true };
128
- }
129
- async getSettingFromGroup(locale, paginationParams, slug) {
130
- const fields = ['slug', 'value'];
131
- paginationParams.pageSize = 100;
132
- const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
133
- const result = await this.paginationService.paginate(this.prismaService.setting, paginationParams, {
134
- where: {
135
- AND: {
136
- setting_group: {
137
- slug,
138
- },
139
- OR,
140
- },
141
- },
142
- include: {
143
- setting_group: {
144
- include: {
145
- setting_group_locale: {
146
- where: {
147
- locale: {
148
- code: locale,
149
- },
150
- },
151
- select: {
152
- name: true,
153
- description: true,
154
- },
155
- },
156
- },
157
- },
158
- setting_locale: {
159
- where: {
160
- locale: {
161
- code: locale,
162
- },
163
- },
164
- select: {
165
- name: true,
166
- description: true,
167
- },
168
- },
169
- },
170
- }, 'setting_locale');
171
- result.data = result.data.map((setting) => {
172
- setting.setting_group = (0, utils_1.itemTranslations)('setting_group_locale', setting.setting_group);
173
- return setting;
174
- });
175
- return result;
176
- }
177
- async listSettingGroups(locale, paginationParams) {
178
- const fields = ['slug', 'icon'];
179
- paginationParams.pageSize = 100;
180
- const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
181
- const result = await this.paginationService.paginate(this.prismaService.setting_group, paginationParams, {
182
- where: {
183
- OR,
184
- },
185
- include: {
186
- setting_group_locale: {
187
- where: {
188
- locale: {
189
- code: locale,
190
- },
191
- },
192
- select: {
193
- name: true,
194
- description: true,
195
- },
196
- },
197
- },
198
- }, 'setting_group_locale');
199
- return result;
200
- }
201
- async listSettings(locale, paginationParams) {
202
- const fields = ['slug', 'value'];
203
- const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
204
- const result = await this.paginationService.paginate(this.prismaService.setting, paginationParams, {
205
- where: {
206
- OR,
207
- },
208
- include: {
209
- setting_group: {
210
- include: {
211
- setting_group_locale: {
212
- where: {
213
- locale: {
214
- code: locale,
215
- },
216
- },
217
- select: {
218
- name: true,
219
- description: true,
220
- },
221
- },
222
- },
223
- },
224
- setting_locale: {
225
- where: {
226
- locale: {
227
- code: locale,
228
- },
229
- },
230
- select: {
231
- name: true,
232
- description: true,
233
- },
234
- },
235
- },
236
- }, 'setting_locale');
237
- result.data = result.data.map((setting) => {
238
- setting.setting_group = (0, utils_1.itemTranslations)('setting_group_locale', setting.setting_group);
239
- return setting;
240
- });
241
- return result;
242
- }
243
- async get(settingId) {
244
- return this.prismaService.setting.findUnique({
245
- where: { id: settingId },
246
- });
247
- }
248
- async create({}) {
249
- return this.prismaService.setting.create({
250
- data: {},
251
- });
252
- }
253
- async update({ id, data }) {
254
- return this.prismaService.setting.update({
255
- where: { id },
256
- data,
257
- });
258
- }
259
- async updateFromSlug(slug, data) {
260
- const { id } = await this.prismaService.setting.findFirst({
261
- where: {
262
- slug,
263
- },
264
- });
265
- if (!id) {
266
- throw new common_1.BadRequestException(`Setting with slug ${slug} not found.`);
267
- }
268
- return this.update({
269
- id,
270
- data,
271
- });
272
- }
273
- async delete({ ids }) {
274
- if (ids == undefined || ids == null) {
275
- throw new common_1.BadRequestException(`You must select at least one setting to delete.`);
276
- }
277
- return this.prismaService.setting.deleteMany({
278
- where: {
279
- id: {
280
- in: ids,
281
- },
282
- },
283
- });
284
- }
285
- async setSettingUserValue(user_id, slug, value) {
286
- const user = await this.prismaService.user.findUnique({
287
- where: {
288
- id: user_id,
289
- },
290
- select: {
291
- id: true,
292
- },
293
- });
294
- if (!user) {
295
- throw new common_1.BadRequestException(`User with id ${user_id} not found.`);
296
- }
297
- const setting = await this.prismaService.setting.findFirst({
298
- where: {
299
- slug,
300
- user_override: true,
301
- },
302
- });
303
- if (!setting) {
304
- throw new common_1.BadRequestException(`Setting with slug ${slug} not found or user can not override.`);
305
- }
306
- return await this.prismaService.setting_user.upsert({
307
- where: {
308
- user_id_setting_id: {
309
- setting_id: setting.id,
310
- user_id: user.id,
311
- },
312
- },
313
- create: {
314
- setting_id: setting.id,
315
- value,
316
- user_id: user.id,
317
- },
318
- update: {
319
- value,
320
- },
321
- select: {
322
- setting_id: true,
323
- user_id: true,
324
- value: true,
325
- },
326
- });
327
- }
328
- async getSettingValues(slug) {
329
- slug = Array.isArray(slug) ? slug : [slug];
330
- let setting = await this.prismaService.setting.findMany({
331
- where: {
332
- slug: {
333
- in: slug,
334
- },
335
- },
336
- select: {
337
- id: true,
338
- value: true,
339
- slug: true,
340
- type: true,
341
- user_override: true,
342
- },
343
- });
344
- const slugUserOverride = setting.filter((setting) => setting.userOverride);
345
- const settingUser = await this.prismaService.setting_user.findMany({
346
- where: {
347
- setting_id: {
348
- in: slugUserOverride.map((setting) => setting.id),
349
- },
350
- },
351
- select: {
352
- value: true,
353
- setting_id: true,
354
- },
355
- });
356
- const data = {};
357
- setting.forEach((setting) => {
358
- data[setting.slug] = setting.value;
359
- });
360
- settingUser.forEach((setting) => {
361
- data[slugUserOverride.find((s) => s.id === setting.setting_id).slug] =
362
- setting.value;
363
- });
364
- return data;
365
- }
366
- };
367
- exports.SettingService = SettingService;
368
- exports.SettingService = SettingService = __decorate([
369
- (0, common_1.Injectable)(),
370
- __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
371
- __param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
372
- __param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => file_1.FileService))),
373
- __metadata("design:paramtypes", [prisma_1.PrismaService,
374
- pagination_1.PaginationService,
375
- file_1.FileService])
376
- ], SettingService);
377
- //# sourceMappingURL=setting.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setting.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;CACF,CAAA;AAvbY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;IAE3C,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,kBAAW,CAAC,CAAC,CAAA;qCAHN,sBAAa;QAET,8BAAiB;QAEvB,kBAAW;GAPhC,cAAc,CAub1B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=setting.service.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setting.service.spec.d.ts","sourceRoot":"","sources":["../../src/setting/setting.service.spec.ts"],"names":[],"mappings":""}
@@ -1,162 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const pagination_1 = require("@hedhog/pagination");
4
- const prisma_1 = require("@hedhog/prisma");
5
- const common_1 = require("@nestjs/common");
6
- const testing_1 = require("@nestjs/testing");
7
- const setting_service_1 = require("./setting.service");
8
- describe('SettingService', () => {
9
- let service;
10
- let prismaService;
11
- // let paginationService: PaginationService;
12
- beforeEach(async () => {
13
- const module = await testing_1.Test.createTestingModule({
14
- providers: [
15
- setting_service_1.SettingService,
16
- {
17
- provide: prisma_1.PrismaService,
18
- useValue: {
19
- setting: {
20
- findUnique: jest.fn(),
21
- create: jest.fn(),
22
- update: jest.fn(),
23
- deleteMany: jest.fn(),
24
- },
25
- createInsensitiveSearch: jest.fn(),
26
- },
27
- },
28
- {
29
- provide: pagination_1.PaginationService,
30
- useValue: {
31
- paginate: jest.fn(),
32
- },
33
- },
34
- ],
35
- }).compile();
36
- service = module.get(setting_service_1.SettingService);
37
- prismaService = module.get(prisma_1.PrismaService);
38
- // paginationService = module.get<PaginationService>(PaginationService);
39
- });
40
- it('should be defined', () => {
41
- expect(service).toBeDefined();
42
- });
43
- /* describe('getSettings', () => {
44
- it('should return paginated setting', async () => {
45
- const paginationParams: PaginationDTO = {
46
- page: 1,
47
- pageSize: 10,
48
- search: '',
49
- sortField: '',
50
- sortOrder: PageOrderDirection.Asc,
51
- fields: '',
52
- };
53
-
54
- const mockPaginatedData = {
55
- data: [],
56
- total: 10,
57
- lastPage: 1,
58
- page: 1,
59
- prev: 0,
60
- next: 2,
61
- pageSize: 10,
62
- };
63
-
64
- jest.spyOn(prismaService, 'createInsensitiveSearch').mockReturnValue([]);
65
- jest
66
- .spyOn(paginationService, 'paginate')
67
- .mockResolvedValue(mockPaginatedData);
68
-
69
- const result = await service.getSettings(paginationParams);
70
-
71
- expect(prismaService.createInsensitiveSearch).toHaveBeenCalledWith(
72
- ['name'],
73
- paginationParams,
74
- );
75
- expect(paginationService.paginate).toHaveBeenCalledWith(
76
- prismaService.setting,
77
- paginationParams,
78
- { where: { OR: [] } },
79
- );
80
- expect(result).toEqual(mockPaginatedData);
81
- });
82
- });*/
83
- describe('get', () => {
84
- it('should return a specific setting by ID', async () => {
85
- const mockSetting = {
86
- id: 1,
87
- name: 'Test Setting',
88
- created_at: new Date(),
89
- updated_at: new Date(),
90
- };
91
- jest
92
- .spyOn(prismaService.setting, 'findUnique')
93
- .mockResolvedValue(mockSetting);
94
- const result = await service.get(1);
95
- expect(prismaService.setting.findUnique).toHaveBeenCalledWith({
96
- where: { id: 1 },
97
- });
98
- expect(result).toEqual(mockSetting);
99
- });
100
- });
101
- /*
102
- describe('create', () => {
103
- it('should create a new setting', async () => {
104
- const createDTO: CreateDTO = { name: 'New Setting' };
105
- const mockSetting = {
106
- id: 1,
107
- name: 'Test Setting',
108
- created_at: new Date(),
109
- updated_at: new Date(),
110
- };
111
-
112
- jest
113
- .spyOn(prismaService.setting, 'create')
114
- .mockResolvedValue(mockSetting);
115
-
116
- const result = await service.create(createDTO);
117
-
118
- expect(prismaService.setting.create).toHaveBeenCalledWith({
119
- data: { name: createDTO.name },
120
- });
121
- expect(result).toEqual(mockSetting);
122
- });
123
- });*/
124
- describe('update', () => {
125
- it('should update an existing setting', async () => {
126
- const updateDTO = { name: 'Updated Setting' };
127
- const updateInput = { id: 1, data: updateDTO };
128
- const mockSetting = {
129
- id: 1,
130
- name: 'Update Setting',
131
- created_at: new Date(),
132
- updated_at: new Date(),
133
- };
134
- jest
135
- .spyOn(prismaService.setting, 'update')
136
- .mockResolvedValue(mockSetting);
137
- const result = await service.update(updateInput);
138
- expect(prismaService.setting.update).toHaveBeenCalledWith({
139
- where: { id: updateInput.id },
140
- data: updateInput.data,
141
- });
142
- expect(result).toEqual(mockSetting);
143
- });
144
- });
145
- describe('delete', () => {
146
- it('should throw an error if no ids are provided', async () => {
147
- const deleteDTO = { ids: null };
148
- await expect(service.delete(deleteDTO)).rejects.toThrow(new common_1.BadRequestException(`You must select at least one setting to delete.`));
149
- });
150
- it('should delete setting by ids', async () => {
151
- const deleteDTO = { ids: [1, 2] };
152
- jest
153
- .spyOn(prismaService.setting, 'deleteMany')
154
- .mockResolvedValue({ count: 2 });
155
- await service.delete(deleteDTO);
156
- expect(prismaService.setting.deleteMany).toHaveBeenCalledWith({
157
- where: { id: { in: deleteDTO.ids } },
158
- });
159
- });
160
- });
161
- });
162
- //# sourceMappingURL=setting.service.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setting.service.spec.js","sourceRoot":"","sources":["../../src/setting/setting.service.spec.ts"],"names":[],"mappings":";;AAAA,mDAAuD;AACvD,2CAA+C;AAC/C,2CAAqD;AACrD,6CAAsD;AAGtD,uDAAmD;AAEnD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,OAAuB,CAAC;IAC5B,IAAI,aAA4B,CAAC;IACjC,4CAA4C;IAE5C,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB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H,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;YAC5D,MAAM,SAAS,GAAc,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAE3C,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CACrD,IAAI,4BAAmB,CACrB,iDAAiD,CAClD,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;YAC5C,MAAM,SAAS,GAAc,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YAE7C,IAAI;iBACD,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC;iBAC1C,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;YAEnC,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAEhC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;gBAC5D,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,GAAG,EAAE,EAAE;aACrC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import {
2
- createParamDecorator,
3
- ExecutionContext,
4
- UnauthorizedException,
5
- } from '@nestjs/common';
6
-
7
- export const User = createParamDecorator(
8
- (field: string | null = null, ctx: ExecutionContext) => {
9
- const request = ctx.switchToHttp().getRequest();
10
-
11
- if (!request.auth || !request.auth.user) {
12
- throw new UnauthorizedException(`User is not authenticated`);
13
- }
14
-
15
- return field ? request.auth.user[field] : request.auth.user;
16
- },
17
- );
@@ -1,8 +0,0 @@
1
- import { IsObject, IsOptional, ValidateNested } from 'class-validator';
2
-
3
- export class WithLocaleDTO {
4
- @IsOptional()
5
- @IsObject()
6
- @ValidateNested({ each: true })
7
- locale: Record<string, Record<string, string>>;
8
- }
@@ -1 +0,0 @@
1
- export class CreateDTO {}
@@ -1,6 +0,0 @@
1
- import { IsString } from 'class-validator';
2
-
3
- export class SettingUserDTO {
4
- @IsString()
5
- value: string;
6
- }
@@ -1,17 +0,0 @@
1
- import { Type } from 'class-transformer';
2
- import { IsArray, IsString, ValidateNested } from 'class-validator';
3
-
4
- class Setting {
5
- @IsString()
6
- slug: string;
7
-
8
- @IsString()
9
- value: string;
10
- }
11
-
12
- export class SettingDTO {
13
- @IsArray()
14
- @ValidateNested({ each: true })
15
- @Type(() => Setting)
16
- setting: Setting[];
17
- }
@@ -1,3 +0,0 @@
1
- import { CreateDTO } from './create.dto';
2
-
3
- export class UpdateDTO extends CreateDTO {}