import {
    Body,
    Controller,
    Delete,
    Get,
    Param,
    Post,
    ParseIntPipe,
    Render,
} from '@nestjs/common';
import { UsersService } from "./users.service";
import { Users } from './users.entity';
import { AddUsersDto } from './dto/add-users.dto'

@Controller('Users')
export class UsersController {
    constructor(private readonly usersService: UsersService) { }

    @Post()
    add(@Body() addUsersDto: AddUsersDto): Promise<Users> {
        return this.usersService.add(addUsersDto);
    }

    @Get()
    findAll(): Promise<Users[]> {
        return this.usersService.findAll();
    }

    @Get(':id')
    findOne(@Param('id', ParseIntPipe) id: number): Promise<Users> {
        return this.usersService.findOne(id);
    }

    @Delete(':id')
    delete(@Param('id') id: number): Promise<void> {
        return this.usersService.delete(id);
    }

}