mirror of
https://github.com/certd/certd.git
synced 2026-04-23 11:37:23 +08:00
chore:
This commit is contained in:
@@ -39,14 +39,18 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
|
||||
@Post('/add', { summary: Constants.per.authOnly })
|
||||
async add(@Body(ALL) bean: any) {
|
||||
bean.userId = this.getUserId();
|
||||
return await super.add(bean);
|
||||
const res = await this.service.add(bean);
|
||||
await this.service.check(res.id);
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@Post('/update', { summary: Constants.per.authOnly })
|
||||
async update(@Body(ALL) bean) {
|
||||
await this.service.checkUserId(bean.id, this.getUserId());
|
||||
delete bean.userId;
|
||||
return await super.update(bean);
|
||||
await this.service.update(bean);
|
||||
await this.service.check(bean.id);
|
||||
return this.ok();
|
||||
}
|
||||
@Post('/info', { summary: Constants.per.authOnly })
|
||||
async info(@Query('id') id: number) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { CrudController } from '@certd/lib-server';
|
||||
import { RoleService } from '../../../modules/sys/authority/service/role-service.js';
|
||||
import { PermissionService } from '../../../modules/sys/authority/service/permission-service.js';
|
||||
import { Constants } from '@certd/lib-server';
|
||||
import { In } from 'typeorm';
|
||||
|
||||
/**
|
||||
* 系统用户
|
||||
@@ -23,6 +24,24 @@ export class UserController extends CrudController<UserService> {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Post('/getSimpleUserByIds', { summary: 'sys:auth:user:add' })
|
||||
async getSimpleUserByIds(@Body('ids') ids: number[]) {
|
||||
const users = await this.service.find({
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nickName: true,
|
||||
mobile: true,
|
||||
phoneCode: true,
|
||||
},
|
||||
where: {
|
||||
id: In(ids),
|
||||
},
|
||||
});
|
||||
|
||||
return this.ok(users);
|
||||
}
|
||||
|
||||
@Post('/page', { summary: 'sys:auth:user:view' })
|
||||
async page(
|
||||
@Body(ALL)
|
||||
|
||||
Reference in New Issue
Block a user