feat: 权限控制

This commit is contained in:
xiaojunnuo
2023-06-27 09:29:43 +08:00
parent fdc25dc0d7
commit 27a4c81c6d
37 changed files with 325 additions and 134 deletions
@@ -0,0 +1,29 @@
import {
ALL,
Body,
Controller,
Inject,
Post,
Provide,
} from '@midwayjs/decorator';
import { BaseController } from '../../../basic/base-controller';
import { Constants } from '../../../basic/constants';
import { UserService } from '../../authority/service/user-service';
import { UserEntity } from '../../authority/entity/user';
/**
*/
@Provide()
@Controller('/api/')
export class RegisterController extends BaseController {
@Inject()
userService: UserService;
@Post('/register', { summary: Constants.per.guest })
public async register(
@Body(ALL)
user: UserEntity
) {
const newUser = await this.userService.register(user);
return this.ok(newUser);
}
}