auth services implmented
This commit is contained in:
@@ -6,39 +6,17 @@ import {
|
||||
Delete,
|
||||
Param,
|
||||
Body,
|
||||
HttpCode,
|
||||
} from '@nestjs/common';
|
||||
import { UsersService } from './users.service';
|
||||
import { User } from '@prisma/client';
|
||||
|
||||
@Controller('users')
|
||||
export class UsersController {
|
||||
constructor(private usersService: UsersService) {}
|
||||
|
||||
@Get()
|
||||
async findAll(): Promise<User[]> {
|
||||
return this.usersService.findAll();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async findOne(@Param('id') id: string): Promise<User | null> {
|
||||
return this.usersService.findOne(Number(id));
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Body() data: { name: string; email: string }): Promise<User> {
|
||||
return this.usersService.create(data);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
async update(
|
||||
@Param('id') id: string,
|
||||
@Body() data: Partial<{ name: string; email: string }>,
|
||||
): Promise<User> {
|
||||
return this.usersService.update(Number(id), data);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
async remove(@Param('id') id: string): Promise<User> {
|
||||
return this.usersService.remove(Number(id));
|
||||
@Post('filter')
|
||||
@HttpCode(200)
|
||||
async filterUsers(@Body() query: any) {
|
||||
return this.usersService.findWithPagination(query);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user