-
Notifications
You must be signed in to change notification settings - Fork 18
/
setting.controller.js
219 lines (219 loc) · 8.05 KB
/
setting.controller.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const typescript_rest_1 = require("typescript-rest");
const typescript_rest_swagger_1 = require("typescript-rest-swagger");
const setting_service_1 = require("./setting.service");
const setting_dto_1 = require("./dto/setting.dto");
const interceptor_1 = require("../../interceptor/interceptor");
/**
* 设置管理接口.
*/
let SettingController = class SettingController {
constructor(service = new setting_service_1.SettingService()) {
this.service = service;
}
/**
* 获取设置管理界面配置信息.
*/
getConfig() {
return __awaiter(this, void 0, void 0, function* () {
return this.service.getAppearance();
});
}
/**
* 按分组获取多个设置项
* @param keys 设置项key的集合
*/
getSettingsByName(name) {
return __awaiter(this, void 0, void 0, function* () {
return this.service.getSettingsByName(name);
});
}
/**
* 更新设置项
* @param entry 设置项实体
*/
updateSettingsByName(name, entry) {
return __awaiter(this, void 0, void 0, function* () {
return this.service.updateSettingsByName(name, entry);
});
}
/**
* 通过Key获取设置项目
* @param key 键名
*/
getSettingsByKey(key) {
return __awaiter(this, void 0, void 0, function* () {
return this.service.getSettingsByKey(key);
});
}
/**
* 查询设置项
* @param keyword 关键词
* @param value 键
*/
search(keyword, value) {
return __awaiter(this, void 0, void 0, function* () {
return this.search(keyword, value);
});
}
/**
* 创建设置项
* @param entry 设置项实体
*/
create(entry) {
return __awaiter(this, void 0, void 0, function* () {
return this.service.create(entry);
});
}
/**
* 更新设置项
* @param entry 设置项实体
*/
update(entry) {
return __awaiter(this, void 0, void 0, function* () {
return this.service.update(entry);
});
}
/**
* 分页查询设置项
* @param keyword 关键词
* @param page 第几页
* @param size 页大小
* @param sort 排序
*/
query(keyword, page, size, sort) {
return __awaiter(this, void 0, void 0, function* () {
return this.service.query(keyword, page, size, sort);
});
}
/**
* 按编号获取设置项
* @param id 键
*/
get(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.service.get(id);
});
}
/**
* 删除设置项
* @param id 键
*/
remove(id) {
return __awaiter(this, void 0, void 0, function* () {
return this.service.remove(id);
});
}
};
__decorate([
typescript_rest_1.Context,
__metadata("design:type", typescript_rest_1.ServiceContext)
], SettingController.prototype, "context", void 0);
__decorate([
typescript_rest_1.Path('config'),
typescript_rest_1.GET,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], SettingController.prototype, "getConfig", null);
__decorate([
typescript_rest_1.Path('name/:name'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.PathParam('name')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "getSettingsByName", null);
__decorate([
typescript_rest_1.PUT,
typescript_rest_1.Path('name/:name'),
__param(0, typescript_rest_1.PathParam('name')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, setting_dto_1.SettingsGroup]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "updateSettingsByName", null);
__decorate([
typescript_rest_1.Path('key/:key'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.PathParam('key')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "getSettingsByKey", null);
__decorate([
typescript_rest_1.Path('search'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.QueryParam('keyword')),
__param(1, typescript_rest_1.QueryParam('value')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "search", null);
__decorate([
typescript_rest_1.POST,
__metadata("design:type", Function),
__metadata("design:paramtypes", [setting_dto_1.CreateSettingDto]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "create", null);
__decorate([
typescript_rest_1.PUT,
__metadata("design:type", Function),
__metadata("design:paramtypes", [setting_dto_1.EditSettingDto]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "update", null);
__decorate([
typescript_rest_1.Path('query'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.QueryParam('keyword')),
__param(1, typescript_rest_1.QueryParam('page')),
__param(2, typescript_rest_1.QueryParam('size')),
__param(3, typescript_rest_1.QueryParam('sort')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Number, Number, String]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "query", null);
__decorate([
typescript_rest_1.Path(':id'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "get", null);
__decorate([
typescript_rest_1.Path(':id'),
typescript_rest_1.DELETE,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], SettingController.prototype, "remove", null);
SettingController = __decorate([
typescript_rest_swagger_1.Tags('core'),
typescript_rest_1.Path('/api/setting'),
typescript_rest_1.Preprocessor(interceptor_1.interceptor),
__metadata("design:paramtypes", [Object])
], SettingController);
exports.SettingController = SettingController;
//# sourceMappingURL=setting.controller.js.map