mirror of
https://github.com/certd/certd.git
synced 2026-07-28 23:57:41 +08:00
chore: 增加流水线,授权等文档
This commit is contained in:
@@ -13,28 +13,28 @@ export class EmailController extends BaseController {
|
||||
@Inject()
|
||||
emailService: EmailService;
|
||||
|
||||
@Post('/test', { description: Constants.per.authOnly })
|
||||
@Post('/test', { description: Constants.per.authOnly, summary: "测试邮件发送" })
|
||||
public async test(@Body('receiver') receiver) {
|
||||
const userId = super.getUserId();
|
||||
await this.emailService.test(userId, receiver);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
@Post('/list', { description: Constants.per.authOnly })
|
||||
@Post('/list', { description: Constants.per.authOnly, summary: "查询邮件列表" })
|
||||
public async list() {
|
||||
const userId = super.getUserId();
|
||||
const res = await this.emailService.list(userId);
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@Post('/add', { description: Constants.per.authOnly })
|
||||
@Post('/add', { description: Constants.per.authOnly, summary: "添加邮件" })
|
||||
public async add(@Body('email') email) {
|
||||
const userId = super.getUserId();
|
||||
await this.emailService.add(userId, email);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
@Post('/delete', { description: Constants.per.authOnly })
|
||||
@Post('/delete', { description: Constants.per.authOnly, summary: "删除邮件" })
|
||||
public async delete(@Body('email') email) {
|
||||
const userId = super.getUserId();
|
||||
await this.emailService.delete(userId, email);
|
||||
|
||||
@@ -21,7 +21,7 @@ export class MineController extends BaseController {
|
||||
passkeyService: PasskeyService;
|
||||
|
||||
|
||||
@Post('/info', { description: Constants.per.authOnly })
|
||||
@Post('/info', { description: Constants.per.authOnly, summary: "查询用户信息" })
|
||||
public async info() {
|
||||
const userId = this.getUserId();
|
||||
const user = await this.userService.info(userId);
|
||||
@@ -35,14 +35,14 @@ export class MineController extends BaseController {
|
||||
return this.ok(user);
|
||||
}
|
||||
|
||||
@Post('/changePassword', { description: Constants.per.authOnly })
|
||||
@Post('/changePassword', { description: Constants.per.authOnly, summary: "修改密码" })
|
||||
public async changePassword(@Body(ALL) body: any) {
|
||||
const userId = this.getUserId();
|
||||
await this.userService.changePassword(userId, body);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
@Post('/updateProfile', { description: Constants.per.authOnly })
|
||||
@Post('/updateProfile', { description: Constants.per.authOnly, summary: "更新用户资料" })
|
||||
public async updateProfile(@Body(ALL) body: any) {
|
||||
const userId = this.getUserId();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export class MinePasskeyController extends BaseController {
|
||||
@Inject()
|
||||
userService: UserService;
|
||||
|
||||
@Post('/generateRegistration', { description: Constants.per.authOnly })
|
||||
@Post('/generateRegistration', { description: Constants.per.authOnly, summary: "生成Passkey注册选项" })
|
||||
public async generateRegistration(
|
||||
@Body(ALL)
|
||||
body: any,
|
||||
@@ -41,7 +41,7 @@ export class MinePasskeyController extends BaseController {
|
||||
});
|
||||
}
|
||||
|
||||
@Post('/verifyRegistration', { description: Constants.per.authOnly })
|
||||
@Post('/verifyRegistration', { description: Constants.per.authOnly, summary: "验证Passkey注册" })
|
||||
public async verifyRegistration(
|
||||
@Body(ALL)
|
||||
body: any
|
||||
@@ -64,7 +64,7 @@ export class MinePasskeyController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@Post('/register', { description: Constants.per.authOnly })
|
||||
@Post('/register', { description: Constants.per.authOnly, summary: "注册Passkey" })
|
||||
public async registerPasskey(
|
||||
@Body(ALL)
|
||||
body: any
|
||||
@@ -86,7 +86,7 @@ export class MinePasskeyController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@Post('/list', { description: Constants.per.authOnly })
|
||||
@Post('/list', { description: Constants.per.authOnly, summary: "查询Passkey列表" })
|
||||
public async getPasskeys() {
|
||||
const userId = this.getUserId();
|
||||
const passkeys = await this.passkeyService.find({
|
||||
@@ -97,7 +97,7 @@ export class MinePasskeyController extends BaseController {
|
||||
return this.ok(passkeys);
|
||||
}
|
||||
|
||||
@Post('/unbind', { description: Constants.per.authOnly })
|
||||
@Post('/unbind', { description: Constants.per.authOnly, summary: "解绑Passkey" })
|
||||
public async unbindPasskey(@Body(ALL) body: any) {
|
||||
const userId = this.getUserId();
|
||||
const passkeyId = body.id;
|
||||
|
||||
@@ -21,14 +21,14 @@ export class UserTwoFactorSettingController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@Post("/get", { description: Constants.per.authOnly })
|
||||
@Post("/get", { description: Constants.per.authOnly, summary: "获取双因子认证设置" })
|
||||
async get() {
|
||||
const userId = this.getUserId();
|
||||
const setting = await this.service.getSetting<UserTwoFactorSetting>(userId,null, UserTwoFactorSetting);
|
||||
return this.ok(setting);
|
||||
}
|
||||
|
||||
@Post("/save", { description: Constants.per.authOnly })
|
||||
@Post("/save", { description: Constants.per.authOnly, summary: "保存双因子认证设置" })
|
||||
async save(@Body(ALL) bean: any) {
|
||||
if (!isPlus()) {
|
||||
throw new Error('本功能需要开通专业版')
|
||||
@@ -47,14 +47,14 @@ export class UserTwoFactorSettingController extends BaseController {
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
@Post("/authenticator/qrcode", { description: Constants.per.authOnly })
|
||||
@Post("/authenticator/qrcode", { description: Constants.per.authOnly, summary: "获取验证器二维码" })
|
||||
async authenticatorQrcode() {
|
||||
const userId = this.getUserId();
|
||||
const {qrcode,link,secret} = await this.twoFactorService.getAuthenticatorQrCode(userId);
|
||||
return this.ok({qrcode,link,secret});
|
||||
}
|
||||
|
||||
@Post("/authenticator/save", { description: Constants.per.authOnly })
|
||||
@Post("/authenticator/save", { description: Constants.per.authOnly, summary: "保存验证器设置" })
|
||||
async authenticatorSave(@Body(ALL) bean: any) {
|
||||
if (!isPlus()) {
|
||||
throw new Error('本功能需要开通专业版')
|
||||
@@ -67,7 +67,7 @@ export class UserTwoFactorSettingController extends BaseController {
|
||||
return this.ok();
|
||||
}
|
||||
|
||||
@Post("/authenticator/off", { description: Constants.per.authOnly })
|
||||
@Post("/authenticator/off", { description: Constants.per.authOnly, summary: "关闭验证器" })
|
||||
async authenticatorOff() {
|
||||
const userId = this.getUserId();
|
||||
await this.twoFactorService.offAuthenticator(userId);
|
||||
|
||||
@@ -20,65 +20,65 @@ export class UserSettingsController extends CrudController<UserSettingsService>
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Post('/page', { description: Constants.per.authOnly })
|
||||
@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 })
|
||||
@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 })
|
||||
@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 })
|
||||
@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 })
|
||||
@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 })
|
||||
@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 })
|
||||
@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 })
|
||||
@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);
|
||||
}
|
||||
@Post("/grant/get", { description: Constants.per.authOnly })
|
||||
@Post("/grant/get", { description: Constants.per.authOnly, summary: "获取授权设置" })
|
||||
async grantSettingsGet() {
|
||||
const userId = this.getUserId();
|
||||
const setting = await this.service.getSetting<UserGrantSetting>(userId, null, UserGrantSetting);
|
||||
return this.ok(setting);
|
||||
}
|
||||
|
||||
@Post("/grant/save", { description: Constants.per.authOnly })
|
||||
@Post("/grant/save", { description: Constants.per.authOnly, summary: "保存授权设置" })
|
||||
async grantSettingsSave(@Body(ALL) bean: UserGrantSetting) {
|
||||
if (!isPlus()) {
|
||||
throw new Error('本功能需要开通专业版')
|
||||
|
||||
Reference in New Issue
Block a user