mirror of
https://github.com/certd/certd.git
synced 2026-05-15 20:47:31 +08:00
30 lines
696 B
TypeScript
30 lines
696 B
TypeScript
|
|
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);
|
||
|
|
}
|
||
|
|
}
|