mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
feat: 权限控制
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
} from '@midwayjs/decorator';
|
||||
import { LoginService } from '../service/login-service';
|
||||
import { BaseController } from '../../../basic/base-controller';
|
||||
import { Constants } from '../../../basic/constants';
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -16,7 +17,7 @@ import { BaseController } from '../../../basic/base-controller';
|
||||
export class LoginController extends BaseController {
|
||||
@Inject()
|
||||
loginService: LoginService;
|
||||
@Post('/login')
|
||||
@Post('/login', { summary: Constants.per.guest })
|
||||
public async login(
|
||||
@Body(ALL)
|
||||
user
|
||||
@@ -25,7 +26,6 @@ export class LoginController extends BaseController {
|
||||
return this.ok(token);
|
||||
}
|
||||
|
||||
@Post('/logout')
|
||||
@Post('/logout', { summary: Constants.per.authOnly })
|
||||
public logout() {}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user