forked from mtusi2026/mtusi2026lab2
feat: add basic auth
This commit is contained in:
@@ -6,8 +6,8 @@ import {
|
||||
Post,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '../common/auth/auth.guard';
|
||||
import { CurrentUser } from '../common/auth/current-user.decorator';
|
||||
import { AuthGuard } from '../auth/auth.guard';
|
||||
import { CurrentUser } from '../auth/current-user.decorator';
|
||||
import { User } from '../common/domain';
|
||||
import { CreateUserDto } from './dto/create-user.dto';
|
||||
import { toUserResponse, UserResponse } from './dto/user.response';
|
||||
@@ -20,7 +20,11 @@ export class UsersController {
|
||||
@Post()
|
||||
@HttpCode(201)
|
||||
async create(@Body() dto: CreateUserDto): Promise<UserResponse> {
|
||||
const user = await this.users.register(dto.username, dto.display_name);
|
||||
const user = await this.users.register(
|
||||
dto.username,
|
||||
dto.display_name,
|
||||
dto.password,
|
||||
);
|
||||
return toUserResponse(user);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user