@hedhog/admin 0.0.108 → 0.0.110
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin.module.d.ts.map +1 -1
- package/dist/admin.module.js +1 -6
- package/dist/admin.module.js.map +1 -1
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +6 -8
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/guards/auth.guard.js +2 -2
- package/dist/auth/guards/auth.guard.js.map +1 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -11
- package/dist/index.js.map +1 -1
- package/dist/menu/menu.controller.d.ts.map +1 -1
- package/dist/menu/menu.controller.js +4 -5
- package/dist/menu/menu.controller.js.map +1 -1
- package/dist/role/dto/create.dto.d.ts +1 -1
- package/dist/role/dto/create.dto.d.ts.map +1 -1
- package/dist/role/dto/create.dto.js +2 -2
- package/dist/role/dto/create.dto.js.map +1 -1
- package/dist/role/guards/role.guard.d.ts.map +1 -1
- package/dist/role/guards/role.guard.js +3 -4
- package/dist/role/guards/role.guard.js.map +1 -1
- package/dist/role/role.controller.js +3 -3
- package/dist/role/role.controller.js.map +1 -1
- package/dist/role/role.module.js +1 -1
- package/dist/role/role.module.js.map +1 -1
- package/dist/role/role.service.d.ts +1 -1
- package/dist/role/role.service.d.ts.map +1 -1
- package/dist/role/role.service.js +1 -1
- package/dist/role/role.service.js.map +1 -1
- package/dist/route/route.controller.js +3 -3
- package/dist/route/route.controller.js.map +1 -1
- package/dist/screen/screen.controller.js +3 -3
- package/dist/screen/screen.controller.js.map +1 -1
- package/dist/user/user.controller.js +2 -2
- package/dist/user/user.controller.js.map +1 -1
- package/hedhog.yaml +1 -328
- package/package.json +8 -6
- package/src/admin.module.ts +1 -6
- package/src/auth/auth.controller.ts +1 -3
- package/src/auth/guards/auth.guard.ts +1 -1
- package/src/index.ts +0 -14
- package/src/menu/menu.controller.ts +2 -3
- package/src/role/dto/create.dto.ts +1 -1
- package/src/role/guards/role.guard.ts +1 -2
- package/src/role/role.controller.ts +2 -2
- package/src/role/role.module.ts +1 -1
- package/src/role/role.service.ts +1 -1
- package/src/route/route.controller.ts +2 -2
- package/src/screen/screen.controller.ts +2 -2
- package/src/user/user.controller.ts +1 -1
- package/dist/auth/decorators/public.decorator.d.ts +0 -3
- package/dist/auth/decorators/public.decorator.d.ts.map +0 -1
- package/dist/auth/decorators/public.decorator.js +0 -8
- package/dist/auth/decorators/public.decorator.js.map +0 -1
- package/dist/auth/decorators/user.decorator.d.ts +0 -2
- package/dist/auth/decorators/user.decorator.d.ts.map +0 -1
- package/dist/auth/decorators/user.decorator.js +0 -12
- package/dist/auth/decorators/user.decorator.js.map +0 -1
- package/dist/dto/with-locale.dto.d.ts +0 -4
- package/dist/dto/with-locale.dto.d.ts.map +0 -1
- package/dist/dto/with-locale.dto.js +0 -23
- package/dist/dto/with-locale.dto.js.map +0 -1
- package/dist/locale/dto/create.dto.d.ts +0 -6
- package/dist/locale/dto/create.dto.d.ts.map +0 -1
- package/dist/locale/dto/create.dto.js +0 -29
- package/dist/locale/dto/create.dto.js.map +0 -1
- package/dist/locale/dto/delete.dto.d.ts +0 -4
- package/dist/locale/dto/delete.dto.d.ts.map +0 -1
- package/dist/locale/dto/delete.dto.js +0 -23
- package/dist/locale/dto/delete.dto.js.map +0 -1
- package/dist/locale/dto/set-enabled.dto.d.ts +0 -4
- package/dist/locale/dto/set-enabled.dto.d.ts.map +0 -1
- package/dist/locale/dto/set-enabled.dto.js +0 -24
- package/dist/locale/dto/set-enabled.dto.js.map +0 -1
- package/dist/locale/dto/update.dto.d.ts +0 -6
- package/dist/locale/dto/update.dto.d.ts.map +0 -1
- package/dist/locale/dto/update.dto.js +0 -32
- package/dist/locale/dto/update.dto.js.map +0 -1
- package/dist/locale/index.d.ts +0 -5
- package/dist/locale/index.d.ts.map +0 -1
- package/dist/locale/index.js +0 -21
- package/dist/locale/index.js.map +0 -1
- package/dist/locale/locale.controller.d.ts +0 -18
- package/dist/locale/locale.controller.d.ts.map +0 -1
- package/dist/locale/locale.controller.js +0 -127
- package/dist/locale/locale.controller.js.map +0 -1
- package/dist/locale/locale.decorator.d.ts +0 -2
- package/dist/locale/locale.decorator.d.ts.map +0 -1
- package/dist/locale/locale.decorator.js +0 -9
- package/dist/locale/locale.decorator.js.map +0 -1
- package/dist/locale/locale.middleware.d.ts +0 -10
- package/dist/locale/locale.middleware.d.ts.map +0 -1
- package/dist/locale/locale.middleware.js +0 -45
- package/dist/locale/locale.middleware.js.map +0 -1
- package/dist/locale/locale.module.d.ts +0 -5
- package/dist/locale/locale.module.d.ts.map +0 -1
- package/dist/locale/locale.module.js +0 -35
- package/dist/locale/locale.module.js.map +0 -1
- package/dist/locale/locale.service.d.ts +0 -32
- package/dist/locale/locale.service.d.ts.map +0 -1
- package/dist/locale/locale.service.js +0 -290
- package/dist/locale/locale.service.js.map +0 -1
- package/dist/locale/locale.service.spec.d.ts +0 -2
- package/dist/locale/locale.service.spec.d.ts.map +0 -1
- package/dist/locale/locale.service.spec.js +0 -174
- package/dist/locale/locale.service.spec.js.map +0 -1
- package/dist/role/decorators/role.decorator.d.ts +0 -3
- package/dist/role/decorators/role.decorator.d.ts.map +0 -1
- package/dist/role/decorators/role.decorator.js +0 -10
- package/dist/role/decorators/role.decorator.js.map +0 -1
- package/dist/setting/dto/create.dto.d.ts +0 -3
- package/dist/setting/dto/create.dto.d.ts.map +0 -1
- package/dist/setting/dto/create.dto.js +0 -7
- package/dist/setting/dto/create.dto.js.map +0 -1
- package/dist/setting/dto/setting-user.dto.d.ts +0 -4
- package/dist/setting/dto/setting-user.dto.d.ts.map +0 -1
- package/dist/setting/dto/setting-user.dto.js +0 -21
- package/dist/setting/dto/setting-user.dto.js.map +0 -1
- package/dist/setting/dto/setting.dto.d.ts +0 -9
- package/dist/setting/dto/setting.dto.d.ts.map +0 -1
- package/dist/setting/dto/setting.dto.js +0 -34
- package/dist/setting/dto/setting.dto.js.map +0 -1
- package/dist/setting/dto/update.dto.d.ts +0 -4
- package/dist/setting/dto/update.dto.d.ts.map +0 -1
- package/dist/setting/dto/update.dto.js +0 -8
- package/dist/setting/dto/update.dto.js.map +0 -1
- package/dist/setting/setting.controller.d.ts +0 -25
- package/dist/setting/setting.controller.d.ts.map +0 -1
- package/dist/setting/setting.controller.js +0 -150
- package/dist/setting/setting.controller.js.map +0 -1
- package/dist/setting/setting.module.d.ts +0 -3
- package/dist/setting/setting.module.d.ts.map +0 -1
- package/dist/setting/setting.module.js +0 -31
- package/dist/setting/setting.module.js.map +0 -1
- package/dist/setting/setting.service.d.ts +0 -31
- package/dist/setting/setting.service.d.ts.map +0 -1
- package/dist/setting/setting.service.js +0 -314
- package/dist/setting/setting.service.js.map +0 -1
- package/dist/setting/setting.service.spec.d.ts +0 -2
- package/dist/setting/setting.service.spec.d.ts.map +0 -1
- package/dist/setting/setting.service.spec.js +0 -162
- package/dist/setting/setting.service.spec.js.map +0 -1
- package/src/auth/decorators/public.decorator.ts +0 -4
- package/src/auth/decorators/user.decorator.ts +0 -17
- package/src/dto/with-locale.dto.ts +0 -8
- package/src/locale/dto/create.dto.ts +0 -12
- package/src/locale/dto/delete.dto.ts +0 -8
- package/src/locale/dto/set-enabled.dto.ts +0 -9
- package/src/locale/dto/update.dto.ts +0 -15
- package/src/locale/index.ts +0 -4
- package/src/locale/locale.controller.ts +0 -79
- package/src/locale/locale.decorator.ts +0 -8
- package/src/locale/locale.middleware.ts +0 -34
- package/src/locale/locale.module.ts +0 -23
- package/src/locale/locale.service.spec.ts +0 -193
- package/src/locale/locale.service.ts +0 -364
- package/src/role/decorators/role.decorator.ts +0 -7
- package/src/setting/dto/create.dto.ts +0 -1
- package/src/setting/dto/setting-user.dto.ts +0 -6
- package/src/setting/dto/setting.dto.ts +0 -17
- package/src/setting/dto/update.dto.ts +0 -3
- package/src/setting/setting.controller.ts +0 -100
- package/src/setting/setting.module.ts +0 -18
- package/src/setting/setting.service.spec.ts +0 -183
- package/src/setting/setting.service.ts +0 -384
@@ -1,25 +0,0 @@
|
|
1
|
-
import { DeleteDTO } from '../dto/delete.dto';
|
2
|
-
import { CreateDTO } from './dto/create.dto';
|
3
|
-
import { SettingUserDTO } from './dto/setting-user.dto';
|
4
|
-
import { SettingDTO } from './dto/setting.dto';
|
5
|
-
import { UpdateDTO } from './dto/update.dto';
|
6
|
-
import { SettingService } from './setting.service';
|
7
|
-
export declare class SettingsController {
|
8
|
-
private readonly settingService;
|
9
|
-
constructor(settingService: SettingService);
|
10
|
-
getSettingFromGroup(paginationParams: any, locale: any, slug: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
11
|
-
listSettingGroups(paginationParams: any, locale: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
12
|
-
listSettings(paginationParams: any, locale: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
13
|
-
show(settingId: number): Promise<any>;
|
14
|
-
create(data: CreateDTO): Promise<any>;
|
15
|
-
updateUserFromSlug(slug: string, { value }: SettingUserDTO, { id }: {
|
16
|
-
id: any;
|
17
|
-
}): Promise<any>;
|
18
|
-
updateFromSlug(slug: string, data: UpdateDTO): Promise<any>;
|
19
|
-
setManySettings(data: SettingDTO): Promise<{
|
20
|
-
success: boolean;
|
21
|
-
}>;
|
22
|
-
update(settingId: number, data: UpdateDTO): Promise<any>;
|
23
|
-
delete(data: DeleteDTO): Promise<any>;
|
24
|
-
}
|
25
|
-
//# sourceMappingURL=setting.controller.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"setting.controller.d.ts","sourceRoot":"","sources":["../../src/setting/setting.controller.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAEa,kBAAkB;IAG3B,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAI3C,mBAAmB,CACT,gBAAgB,KAAA,EACpB,MAAM,KAAA,EACD,IAAI,EAAE,MAAM;IAUvB,iBAAiB,CAAe,gBAAgB,KAAA,EAAY,MAAM,KAAA;IAKlE,YAAY,CAAe,gBAAgB,KAAA,EAAY,MAAM,KAAA;IAK7D,IAAI,CAAmC,SAAS,EAAE,MAAM;IAKxD,MAAM,CAAS,IAAI,EAAE,SAAS;IAK9B,kBAAkB,CACP,IAAI,EAAE,MAAM,EACnB,EAAE,KAAK,EAAE,EAAE,cAAc,EACzB,EAAE,EAAE,EAAE;;KAAA;IAMV,cAAc,CAAgB,IAAI,EAAE,MAAM,EAAU,IAAI,EAAE,SAAS;IAKnE,eAAe,CAAS,IAAI,EAAE,UAAU;;;IAKxC,MAAM,CACwB,SAAS,EAAE,MAAM,EAC3C,IAAI,EAAE,SAAS;IASnB,MAAM,CAAS,IAAI,EAAE,SAAS;CAGrC"}
|
@@ -1,150 +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.SettingsController = void 0;
|
16
|
-
const pagination_1 = require("@hedhog/pagination");
|
17
|
-
const common_1 = require("@nestjs/common");
|
18
|
-
const user_decorator_1 = require("../auth/decorators/user.decorator");
|
19
|
-
const delete_dto_1 = require("../dto/delete.dto");
|
20
|
-
const locale_1 = require("../locale");
|
21
|
-
const role_decorator_1 = require("../role/decorators/role.decorator");
|
22
|
-
const create_dto_1 = require("./dto/create.dto");
|
23
|
-
const setting_user_dto_1 = require("./dto/setting-user.dto");
|
24
|
-
const setting_dto_1 = require("./dto/setting.dto");
|
25
|
-
const update_dto_1 = require("./dto/update.dto");
|
26
|
-
const setting_service_1 = require("./setting.service");
|
27
|
-
let SettingsController = class SettingsController {
|
28
|
-
constructor(settingService) {
|
29
|
-
this.settingService = settingService;
|
30
|
-
}
|
31
|
-
async getSettingFromGroup(paginationParams, locale, slug) {
|
32
|
-
return this.settingService.getSettingFromGroup(locale, paginationParams, slug);
|
33
|
-
}
|
34
|
-
async listSettingGroups(paginationParams, locale) {
|
35
|
-
return this.settingService.listSettingGroups(locale, paginationParams);
|
36
|
-
}
|
37
|
-
async listSettings(paginationParams, locale) {
|
38
|
-
return this.settingService.listSettings(locale, paginationParams);
|
39
|
-
}
|
40
|
-
async show(settingId) {
|
41
|
-
return this.settingService.get(settingId);
|
42
|
-
}
|
43
|
-
async create(data) {
|
44
|
-
return this.settingService.create(data);
|
45
|
-
}
|
46
|
-
async updateUserFromSlug(slug, { value }, { id }) {
|
47
|
-
return this.settingService.setSettingUserValue(id, slug, value);
|
48
|
-
}
|
49
|
-
async updateFromSlug(slug, data) {
|
50
|
-
return this.settingService.updateFromSlug(slug, data);
|
51
|
-
}
|
52
|
-
async setManySettings(data) {
|
53
|
-
return this.settingService.setManySettings(data);
|
54
|
-
}
|
55
|
-
async update(settingId, data) {
|
56
|
-
return this.settingService.update({
|
57
|
-
id: settingId,
|
58
|
-
data,
|
59
|
-
});
|
60
|
-
}
|
61
|
-
async delete(data) {
|
62
|
-
return this.settingService.delete(data);
|
63
|
-
}
|
64
|
-
};
|
65
|
-
exports.SettingsController = SettingsController;
|
66
|
-
__decorate([
|
67
|
-
(0, common_1.Get)('group/:slug'),
|
68
|
-
__param(0, (0, pagination_1.Pagination)()),
|
69
|
-
__param(1, (0, locale_1.Locale)()),
|
70
|
-
__param(2, (0, common_1.Param)('slug')),
|
71
|
-
__metadata("design:type", Function),
|
72
|
-
__metadata("design:paramtypes", [Object, Object, String]),
|
73
|
-
__metadata("design:returntype", Promise)
|
74
|
-
], SettingsController.prototype, "getSettingFromGroup", null);
|
75
|
-
__decorate([
|
76
|
-
(0, common_1.Get)('group'),
|
77
|
-
__param(0, (0, pagination_1.Pagination)()),
|
78
|
-
__param(1, (0, locale_1.Locale)()),
|
79
|
-
__metadata("design:type", Function),
|
80
|
-
__metadata("design:paramtypes", [Object, Object]),
|
81
|
-
__metadata("design:returntype", Promise)
|
82
|
-
], SettingsController.prototype, "listSettingGroups", null);
|
83
|
-
__decorate([
|
84
|
-
(0, common_1.Get)(),
|
85
|
-
__param(0, (0, pagination_1.Pagination)()),
|
86
|
-
__param(1, (0, locale_1.Locale)()),
|
87
|
-
__metadata("design:type", Function),
|
88
|
-
__metadata("design:paramtypes", [Object, Object]),
|
89
|
-
__metadata("design:returntype", Promise)
|
90
|
-
], SettingsController.prototype, "listSettings", null);
|
91
|
-
__decorate([
|
92
|
-
(0, common_1.Get)(':settingId'),
|
93
|
-
__param(0, (0, common_1.Param)('settingId', common_1.ParseIntPipe)),
|
94
|
-
__metadata("design:type", Function),
|
95
|
-
__metadata("design:paramtypes", [Number]),
|
96
|
-
__metadata("design:returntype", Promise)
|
97
|
-
], SettingsController.prototype, "show", null);
|
98
|
-
__decorate([
|
99
|
-
(0, common_1.Post)(),
|
100
|
-
__param(0, (0, common_1.Body)()),
|
101
|
-
__metadata("design:type", Function),
|
102
|
-
__metadata("design:paramtypes", [create_dto_1.CreateDTO]),
|
103
|
-
__metadata("design:returntype", Promise)
|
104
|
-
], SettingsController.prototype, "create", null);
|
105
|
-
__decorate([
|
106
|
-
(0, common_1.Put)('user/:slug'),
|
107
|
-
__param(0, (0, common_1.Param)('slug')),
|
108
|
-
__param(1, (0, common_1.Body)()),
|
109
|
-
__param(2, (0, user_decorator_1.User)()),
|
110
|
-
__metadata("design:type", Function),
|
111
|
-
__metadata("design:paramtypes", [String, setting_user_dto_1.SettingUserDTO, Object]),
|
112
|
-
__metadata("design:returntype", Promise)
|
113
|
-
], SettingsController.prototype, "updateUserFromSlug", null);
|
114
|
-
__decorate([
|
115
|
-
(0, common_1.Put)(':slug'),
|
116
|
-
__param(0, (0, common_1.Param)('slug')),
|
117
|
-
__param(1, (0, common_1.Body)()),
|
118
|
-
__metadata("design:type", Function),
|
119
|
-
__metadata("design:paramtypes", [String, update_dto_1.UpdateDTO]),
|
120
|
-
__metadata("design:returntype", Promise)
|
121
|
-
], SettingsController.prototype, "updateFromSlug", null);
|
122
|
-
__decorate([
|
123
|
-
(0, common_1.Put)(),
|
124
|
-
__param(0, (0, common_1.Body)()),
|
125
|
-
__metadata("design:type", Function),
|
126
|
-
__metadata("design:paramtypes", [setting_dto_1.SettingDTO]),
|
127
|
-
__metadata("design:returntype", Promise)
|
128
|
-
], SettingsController.prototype, "setManySettings", null);
|
129
|
-
__decorate([
|
130
|
-
(0, common_1.Patch)(':settingId'),
|
131
|
-
__param(0, (0, common_1.Param)('settingId', common_1.ParseIntPipe)),
|
132
|
-
__param(1, (0, common_1.Body)()),
|
133
|
-
__metadata("design:type", Function),
|
134
|
-
__metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
|
135
|
-
__metadata("design:returntype", Promise)
|
136
|
-
], SettingsController.prototype, "update", null);
|
137
|
-
__decorate([
|
138
|
-
(0, common_1.Delete)(),
|
139
|
-
__param(0, (0, common_1.Body)()),
|
140
|
-
__metadata("design:type", Function),
|
141
|
-
__metadata("design:paramtypes", [delete_dto_1.DeleteDTO]),
|
142
|
-
__metadata("design:returntype", Promise)
|
143
|
-
], SettingsController.prototype, "delete", null);
|
144
|
-
exports.SettingsController = SettingsController = __decorate([
|
145
|
-
(0, role_decorator_1.Role)(),
|
146
|
-
(0, common_1.Controller)('setting'),
|
147
|
-
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => setting_service_1.SettingService))),
|
148
|
-
__metadata("design:paramtypes", [setting_service_1.SettingService])
|
149
|
-
], SettingsController);
|
150
|
-
//# sourceMappingURL=setting.controller.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"setting.controller.js","sourceRoot":"","sources":["../../src/setting/setting.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAgD;AAChD,2CAYwB;AACxB,sEAAyD;AACzD,kDAA8C;AAC9C,sCAAmC;AACnC,sEAAyD;AACzD,iDAA6C;AAC7C,6DAAwD;AACxD,mDAA+C;AAC/C,iDAA6C;AAC7C,uDAAmD;AAI5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YAEmB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAC9C,CAAC;IAGE,AAAN,KAAK,CAAC,mBAAmB,CACT,gBAAgB,EACpB,MAAM,EACD,IAAY;QAE3B,OAAO,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAC5C,MAAM,EACN,gBAAgB,EAChB,IAAI,CACL,CAAC;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,iBAAiB,CAAe,gBAAgB,EAAY,MAAM;QACtE,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACzE,CAAC;IAGK,AAAN,KAAK,CAAC,YAAY,CAAe,gBAAgB,EAAY,MAAM;QACjE,OAAO,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,EAAC,SAAS,CAAC;IAGjB,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gCAAc,CAAC,CAAC,CAAA;qCACR,gCAAc;GAHtC,kBAAkB,CAyE9B"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"setting.module.d.ts","sourceRoot":"","sources":["../../src/setting/setting.module.ts"],"names":[],"mappings":"AAOA,qBAUa,aAAa;CAAG"}
|
@@ -1,31 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
-
exports.SettingModule = void 0;
|
10
|
-
const pagination_1 = require("@hedhog/pagination");
|
11
|
-
const prisma_1 = require("@hedhog/prisma");
|
12
|
-
const common_1 = require("@nestjs/common");
|
13
|
-
const auth_module_1 = require("../auth/auth.module");
|
14
|
-
const setting_controller_1 = require("./setting.controller");
|
15
|
-
const setting_service_1 = require("./setting.service");
|
16
|
-
let SettingModule = class SettingModule {
|
17
|
-
};
|
18
|
-
exports.SettingModule = SettingModule;
|
19
|
-
exports.SettingModule = SettingModule = __decorate([
|
20
|
-
(0, common_1.Module)({
|
21
|
-
providers: [setting_service_1.SettingService],
|
22
|
-
exports: [setting_service_1.SettingService],
|
23
|
-
controllers: [setting_controller_1.SettingsController],
|
24
|
-
imports: [
|
25
|
-
(0, common_1.forwardRef)(() => auth_module_1.AuthModule),
|
26
|
-
(0, common_1.forwardRef)(() => prisma_1.PrismaModule),
|
27
|
-
(0, common_1.forwardRef)(() => pagination_1.PaginationModule),
|
28
|
-
],
|
29
|
-
})
|
30
|
-
], SettingModule);
|
31
|
-
//# sourceMappingURL=setting.module.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"setting.module.js","sourceRoot":"","sources":["../../src/setting/setting.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAsD;AACtD,2CAA8C;AAC9C,2CAAoD;AACpD,qDAAiD;AACjD,6DAA0D;AAC1D,uDAAmD;AAY5C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAVzB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,gCAAc,CAAC;QAC3B,OAAO,EAAE,CAAC,gCAAc,CAAC;QACzB,WAAW,EAAE,CAAC,uCAAkB,CAAC;QACjC,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6BAAgB,CAAC;SACnC;KACF,CAAC;GACW,aAAa,CAAG"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { FileService } from '@hedhog/file';
|
2
|
-
import { PaginationDTO, PaginationService } from '@hedhog/pagination';
|
3
|
-
import { PrismaService } from '@hedhog/prisma';
|
4
|
-
import { DeleteDTO } from '../dto/delete.dto';
|
5
|
-
import { CreateDTO } from './dto/create.dto';
|
6
|
-
import { SettingDTO } from './dto/setting.dto';
|
7
|
-
import { UpdateDTO } from './dto/update.dto';
|
8
|
-
export declare class SettingService {
|
9
|
-
private readonly prismaService;
|
10
|
-
private readonly paginationService;
|
11
|
-
private readonly fileService;
|
12
|
-
constructor(prismaService: PrismaService, paginationService: PaginationService, fileService: FileService);
|
13
|
-
updateAppearanceSettings(): Promise<void>;
|
14
|
-
setManySettings(data: SettingDTO): Promise<{
|
15
|
-
success: boolean;
|
16
|
-
}>;
|
17
|
-
getSettingFromGroup(locale: any, paginationParams: any, slug: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
18
|
-
listSettingGroups(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
19
|
-
listSettings(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
20
|
-
get(settingId: number): Promise<any>;
|
21
|
-
create({}: CreateDTO): Promise<any>;
|
22
|
-
update({ id, data }: {
|
23
|
-
id: number;
|
24
|
-
data: UpdateDTO;
|
25
|
-
}): Promise<any>;
|
26
|
-
updateFromSlug(slug: string, data: UpdateDTO): Promise<any>;
|
27
|
-
delete({ ids }: DeleteDTO): Promise<any>;
|
28
|
-
setSettingUserValue(user_id: number, slug: string, value: string): Promise<any>;
|
29
|
-
getSettingValues(slug: string | string[]): Promise<Record<string, any>>;
|
30
|
-
}
|
31
|
-
//# sourceMappingURL=setting.service.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"setting.service.d.ts","sourceRoot":"","sources":["../../src/setting/setting.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAQ/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAElC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAJX,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB,EAEpC,WAAW,EAAE,WAAW;IAGrC,wBAAwB;IAcxB,eAAe,CAAC,IAAI,EAAE,UAAU;;;IAoChC,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM;IAiEpE,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;IAqCjE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;IA0D5D,GAAG,CAAC,SAAS,EAAE,MAAM;IAMrB,MAAM,CAAC,EAAE,EAAE,SAAS;IAMpB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;IAiB5C,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;IAgBzB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAkDhE,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;CA6C/C"}
|
@@ -1,314 +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 updateAppearanceSettings() {
|
28
|
-
console.log({ updateAppearanceSettings: 'updateAppearanceSettings' });
|
29
|
-
const settings = await this.prismaService.setting.findMany({
|
30
|
-
where: {
|
31
|
-
setting_group: {
|
32
|
-
slug: 'appearance',
|
33
|
-
},
|
34
|
-
},
|
35
|
-
});
|
36
|
-
console.log({ settings });
|
37
|
-
}
|
38
|
-
async setManySettings(data) {
|
39
|
-
const transaction = [];
|
40
|
-
for (const { slug, value } of data.setting) {
|
41
|
-
transaction.push(this.prismaService.setting.updateMany({
|
42
|
-
where: {
|
43
|
-
slug,
|
44
|
-
},
|
45
|
-
data: {
|
46
|
-
value,
|
47
|
-
},
|
48
|
-
}));
|
49
|
-
}
|
50
|
-
await this.prismaService.$transaction(transaction);
|
51
|
-
const hasAppearance = await this.prismaService.setting.count({
|
52
|
-
where: {
|
53
|
-
slug: {
|
54
|
-
in: data.setting.map((setting) => setting.slug),
|
55
|
-
},
|
56
|
-
setting_group: {
|
57
|
-
slug: 'appearance',
|
58
|
-
},
|
59
|
-
},
|
60
|
-
});
|
61
|
-
if (hasAppearance) {
|
62
|
-
await this.updateAppearanceSettings();
|
63
|
-
}
|
64
|
-
return { success: true };
|
65
|
-
}
|
66
|
-
async getSettingFromGroup(locale, paginationParams, slug) {
|
67
|
-
const fields = ['slug', 'value'];
|
68
|
-
paginationParams.pageSize = 100;
|
69
|
-
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
70
|
-
const result = await this.paginationService.paginate(this.prismaService.setting, paginationParams, {
|
71
|
-
where: {
|
72
|
-
AND: {
|
73
|
-
setting_group: {
|
74
|
-
slug,
|
75
|
-
},
|
76
|
-
OR,
|
77
|
-
},
|
78
|
-
},
|
79
|
-
include: {
|
80
|
-
setting_group: {
|
81
|
-
include: {
|
82
|
-
setting_group_locale: {
|
83
|
-
where: {
|
84
|
-
locale: {
|
85
|
-
code: locale,
|
86
|
-
},
|
87
|
-
},
|
88
|
-
select: {
|
89
|
-
name: true,
|
90
|
-
description: true,
|
91
|
-
},
|
92
|
-
},
|
93
|
-
},
|
94
|
-
},
|
95
|
-
setting_locale: {
|
96
|
-
where: {
|
97
|
-
locale: {
|
98
|
-
code: locale,
|
99
|
-
},
|
100
|
-
},
|
101
|
-
select: {
|
102
|
-
name: true,
|
103
|
-
description: true,
|
104
|
-
},
|
105
|
-
},
|
106
|
-
},
|
107
|
-
}, 'setting_locale');
|
108
|
-
result.data = result.data.map((setting) => {
|
109
|
-
setting.setting_group = (0, utils_1.itemTranslations)('setting_group_locale', setting.setting_group);
|
110
|
-
return setting;
|
111
|
-
});
|
112
|
-
return result;
|
113
|
-
}
|
114
|
-
async listSettingGroups(locale, paginationParams) {
|
115
|
-
const fields = ['slug', 'icon'];
|
116
|
-
paginationParams.pageSize = 100;
|
117
|
-
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
118
|
-
const result = await this.paginationService.paginate(this.prismaService.setting_group, paginationParams, {
|
119
|
-
where: {
|
120
|
-
OR,
|
121
|
-
},
|
122
|
-
include: {
|
123
|
-
setting_group_locale: {
|
124
|
-
where: {
|
125
|
-
locale: {
|
126
|
-
code: locale,
|
127
|
-
},
|
128
|
-
},
|
129
|
-
select: {
|
130
|
-
name: true,
|
131
|
-
description: true,
|
132
|
-
},
|
133
|
-
},
|
134
|
-
},
|
135
|
-
}, 'setting_group_locale');
|
136
|
-
return result;
|
137
|
-
}
|
138
|
-
async listSettings(locale, paginationParams) {
|
139
|
-
const fields = ['slug', 'value'];
|
140
|
-
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
141
|
-
const result = await this.paginationService.paginate(this.prismaService.setting, paginationParams, {
|
142
|
-
where: {
|
143
|
-
OR,
|
144
|
-
},
|
145
|
-
include: {
|
146
|
-
setting_group: {
|
147
|
-
include: {
|
148
|
-
setting_group_locale: {
|
149
|
-
where: {
|
150
|
-
locale: {
|
151
|
-
code: locale,
|
152
|
-
},
|
153
|
-
},
|
154
|
-
select: {
|
155
|
-
name: true,
|
156
|
-
description: true,
|
157
|
-
},
|
158
|
-
},
|
159
|
-
},
|
160
|
-
},
|
161
|
-
setting_locale: {
|
162
|
-
where: {
|
163
|
-
locale: {
|
164
|
-
code: locale,
|
165
|
-
},
|
166
|
-
},
|
167
|
-
select: {
|
168
|
-
name: true,
|
169
|
-
description: true,
|
170
|
-
},
|
171
|
-
},
|
172
|
-
},
|
173
|
-
}, 'setting_locale');
|
174
|
-
result.data = result.data.map((setting) => {
|
175
|
-
setting.setting_group = (0, utils_1.itemTranslations)('setting_group_locale', setting.setting_group);
|
176
|
-
return setting;
|
177
|
-
});
|
178
|
-
return result;
|
179
|
-
}
|
180
|
-
async get(settingId) {
|
181
|
-
return this.prismaService.setting.findUnique({
|
182
|
-
where: { id: settingId },
|
183
|
-
});
|
184
|
-
}
|
185
|
-
async create({}) {
|
186
|
-
return this.prismaService.setting.create({
|
187
|
-
data: {},
|
188
|
-
});
|
189
|
-
}
|
190
|
-
async update({ id, data }) {
|
191
|
-
return this.prismaService.setting.update({
|
192
|
-
where: { id },
|
193
|
-
data,
|
194
|
-
});
|
195
|
-
}
|
196
|
-
async updateFromSlug(slug, data) {
|
197
|
-
const { id } = await this.prismaService.setting.findFirst({
|
198
|
-
where: {
|
199
|
-
slug,
|
200
|
-
},
|
201
|
-
});
|
202
|
-
if (!id) {
|
203
|
-
throw new common_1.BadRequestException(`Setting with slug ${slug} not found.`);
|
204
|
-
}
|
205
|
-
return this.update({
|
206
|
-
id,
|
207
|
-
data,
|
208
|
-
});
|
209
|
-
}
|
210
|
-
async delete({ ids }) {
|
211
|
-
if (ids == undefined || ids == null) {
|
212
|
-
throw new common_1.BadRequestException(`You must select at least one setting to delete.`);
|
213
|
-
}
|
214
|
-
return this.prismaService.setting.deleteMany({
|
215
|
-
where: {
|
216
|
-
id: {
|
217
|
-
in: ids,
|
218
|
-
},
|
219
|
-
},
|
220
|
-
});
|
221
|
-
}
|
222
|
-
async setSettingUserValue(user_id, slug, value) {
|
223
|
-
const user = await this.prismaService.user.findUnique({
|
224
|
-
where: {
|
225
|
-
id: user_id,
|
226
|
-
},
|
227
|
-
select: {
|
228
|
-
id: true,
|
229
|
-
},
|
230
|
-
});
|
231
|
-
if (!user) {
|
232
|
-
throw new common_1.BadRequestException(`User with id ${user_id} not found.`);
|
233
|
-
}
|
234
|
-
const setting = await this.prismaService.setting.findFirst({
|
235
|
-
where: {
|
236
|
-
slug,
|
237
|
-
user_override: true,
|
238
|
-
},
|
239
|
-
});
|
240
|
-
if (!setting) {
|
241
|
-
throw new common_1.BadRequestException(`Setting with slug ${slug} not found or user can not override.`);
|
242
|
-
}
|
243
|
-
return await this.prismaService.setting_user.upsert({
|
244
|
-
where: {
|
245
|
-
user_id_setting_id: {
|
246
|
-
setting_id: setting.id,
|
247
|
-
user_id: user.id,
|
248
|
-
},
|
249
|
-
},
|
250
|
-
create: {
|
251
|
-
setting_id: setting.id,
|
252
|
-
value,
|
253
|
-
user_id: user.id,
|
254
|
-
},
|
255
|
-
update: {
|
256
|
-
value,
|
257
|
-
},
|
258
|
-
select: {
|
259
|
-
setting_id: true,
|
260
|
-
user_id: true,
|
261
|
-
value: true,
|
262
|
-
},
|
263
|
-
});
|
264
|
-
}
|
265
|
-
async getSettingValues(slug) {
|
266
|
-
slug = Array.isArray(slug) ? slug : [slug];
|
267
|
-
let setting = await this.prismaService.setting.findMany({
|
268
|
-
where: {
|
269
|
-
slug: {
|
270
|
-
in: slug,
|
271
|
-
},
|
272
|
-
},
|
273
|
-
select: {
|
274
|
-
id: true,
|
275
|
-
value: true,
|
276
|
-
slug: true,
|
277
|
-
type: true,
|
278
|
-
user_override: true,
|
279
|
-
},
|
280
|
-
});
|
281
|
-
const slugUserOverride = setting.filter((setting) => setting.userOverride);
|
282
|
-
const settingUser = await this.prismaService.setting_user.findMany({
|
283
|
-
where: {
|
284
|
-
setting_id: {
|
285
|
-
in: slugUserOverride.map((setting) => setting.id),
|
286
|
-
},
|
287
|
-
},
|
288
|
-
select: {
|
289
|
-
value: true,
|
290
|
-
setting_id: true,
|
291
|
-
},
|
292
|
-
});
|
293
|
-
const data = {};
|
294
|
-
setting.forEach((setting) => {
|
295
|
-
data[setting.slug] = setting.value;
|
296
|
-
});
|
297
|
-
settingUser.forEach((setting) => {
|
298
|
-
data[slugUserOverride.find((s) => s.id === setting.setting_id).slug] =
|
299
|
-
setting.value;
|
300
|
-
});
|
301
|
-
return data;
|
302
|
-
}
|
303
|
-
};
|
304
|
-
exports.SettingService = SettingService;
|
305
|
-
exports.SettingService = SettingService = __decorate([
|
306
|
-
(0, common_1.Injectable)(),
|
307
|
-
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
|
308
|
-
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
|
309
|
-
__param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => file_1.FileService))),
|
310
|
-
__metadata("design:paramtypes", [prisma_1.PrismaService,
|
311
|
-
pagination_1.PaginationService,
|
312
|
-
file_1.FileService])
|
313
|
-
], SettingService);
|
314
|
-
//# sourceMappingURL=setting.service.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"setting.service.js","sourceRoot":"","sources":["../../src/setting/setting.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAA2C;AAC3C,mDAAsE;AACtE,2CAA+C;AAC/C,yCAAiD;AACjD,2CAKwB;AAOjB,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,aAA4B,EAE5B,iBAAoC,EAEpC,WAAwB;QAJxB,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;QAEpC,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAEJ,KAAK,CAAC,wBAAwB;QAC5B,OAAO,CAAC,GAAG,CAAC,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,CAAC,CAAC;QAEtE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC;YACzD,KAAK,EAAE;gBACL,aAAa,EAAE;oBACb,IAAI,EAAE,YAAY;iBACnB;aACF;SACF,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAAgB;QACpC,MAAM,WAAW,GAAG,EAAE,CAAC;QAEvB,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC3C,WAAW,CAAC,IAAI,CACd,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC;gBACpC,KAAK,EAAE;oBACL,IAAI;iBACL;gBACD,IAAI,EAAE;oBACJ,KAAK;iBACN;aACF,CAAC,CACH,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,CAAC,aAAa,CAAC,Y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