chore: format

This commit is contained in:
xiaojunnuo
2026-05-31 01:41:33 +08:00
parent acd440106b
commit 4b57a0d729
557 changed files with 12530 additions and 14039 deletions
@@ -10,8 +10,8 @@ import { ApiTags } from "@midwayjs/swagger";
/**
*/
@Provide()
@Controller('/api/user/settings')
@ApiTags(['mine'])
@Controller("/api/user/settings")
@ApiTags(["mine"])
export class UserSettingsController extends CrudController<UserSettingsService> {
@Inject()
service: UserSettingsService;
@@ -20,54 +20,54 @@ export class UserSettingsController extends CrudController<UserSettingsService>
return this.service;
}
@Post('/page', { description: Constants.per.authOnly, summary: "查询用户设置分页列表" })
@Post("/page", { description: Constants.per.authOnly, summary: "查询用户设置分页列表" })
async page(@Body(ALL) body) {
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.page(body);
}
@Post('/list', { description: Constants.per.authOnly, summary: "查询用户设置列表" })
@Post("/list", { description: Constants.per.authOnly, summary: "查询用户设置列表" })
async list(@Body(ALL) body) {
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}
@Post('/add', { description: Constants.per.authOnly, summary: "添加用户设置" })
@Post("/add", { description: Constants.per.authOnly, summary: "添加用户设置" })
async add(@Body(ALL) bean) {
bean.userId = this.getUserId();
return super.add(bean);
}
@Post('/update', { description: Constants.per.authOnly, summary: "更新用户设置" })
@Post("/update", { description: Constants.per.authOnly, summary: "更新用户设置" })
async update(@Body(ALL) bean) {
await this.service.checkUserId(bean.id, this.getUserId());
delete bean.userId;
return super.update(bean);
}
@Post('/info', { description: Constants.per.authOnly, summary: "查询用户设置详情" })
async info(@Query('id') id: number) {
@Post("/info", { description: Constants.per.authOnly, summary: "查询用户设置详情" })
async info(@Query("id") id: number) {
await this.service.checkUserId(id, this.getUserId());
return super.info(id);
}
@Post('/delete', { description: Constants.per.authOnly, summary: "删除用户设置" })
async delete(@Query('id') id: number) {
@Post("/delete", { description: Constants.per.authOnly, summary: "删除用户设置" })
async delete(@Query("id") id: number) {
await this.service.checkUserId(id, this.getUserId());
return super.delete(id);
}
@Post('/save', { description: Constants.per.authOnly, summary: "保存用户设置" })
@Post("/save", { description: Constants.per.authOnly, summary: "保存用户设置" })
async save(@Body(ALL) bean: UserSettingsEntity) {
bean.userId = this.getUserId();
await this.service.save(bean);
return this.ok({});
}
@Post('/get', { description: Constants.per.authOnly, summary: "获取用户设置" })
async get(@Query('key') key: string) {
const {projectId,userId} = await this.getProjectUserIdRead();
@Post("/get", { description: Constants.per.authOnly, summary: "获取用户设置" })
async get(@Query("key") key: string) {
const { projectId, userId } = await this.getProjectUserIdRead();
const entity = await this.service.getByKey(key, userId, projectId);
return this.ok(entity);
}
@@ -81,14 +81,13 @@ export class UserSettingsController extends CrudController<UserSettingsService>
@Post("/grant/save", { description: Constants.per.authOnly, summary: "保存授权设置" })
async grantSettingsSave(@Body(ALL) bean: UserGrantSetting) {
if (!isPlus()) {
throw new Error('本功能需要开通Certd专业版')
throw new Error("本功能需要开通Certd专业版");
}
const userId = this.getUserId();
const setting = new UserGrantSetting();
merge(setting, bean);
await this.service.saveSetting(userId,null, setting);
await this.service.saveSetting(userId, null, setting);
return this.ok({});
}
}