1
2import { Controller, Get, Post, Body } from '@nestjs/common';
3import { CreateCatDto } from './dto/create-cat.dto';
4import { CatsService } from './cats.service';
5import { Cat } from './interfaces/cat.interface';
6
7@Controller('cats')
8export class CatsController {
9 constructor(private catsService: CatsService) {}
10
11 @Post()
12 async create(@Body() createCatDto: CreateCatDto) {
13 this.catsService.create(createCatDto);
14 }
15
16 @Get()
17 async findAll(): Promise<Cat[]> {
18 return this.catsService.findAll();
19 }
20}
1interface IUsers {
2 readonly user_id?: number
3 readonly email: string
4 readonly password: string
5 readonly active?: boolean
6 readonly created_at?: any
7 readonly updated_at?: any
8}
9
10class UsersDTO implements IUsers {
11 readonly user_id?: number
12 readonly email: string
13 readonly password: string
14 readonly active?: boolean
15 readonly created_at?: any
16 readonly updated_at?: any
17}