import { Body , Controller , Get , Param , Patch , Post , UseGuards , } from '@nestjs/common' ; import { Observable } from 'rxjs' ; import { CharacterService } from './character.service' ; import { CharacterDTO , CharacterIdDTO , CharacterInsertDataDTO , CharacterUpdateDataDTO , } from './models' ; import { UserIdDTO } from '../auth/user/models' ; import { CookieGuard } from '../guards/cookie.guard' ; @ Controller ( 'character' ) export class CharactersController { constructor ( private readonly charactersService ) { } @ Get ( ':id' ) getCharacter ( @ Param ( ) charParams ) { return this . charactersService . getCharacterById ( charParams ) ; } @ Get ( 'user/:userId' ) getUserCharacters ( @ Param ( ) userParams ) { return this . charactersService . getCharactersByUserId ( userParams ) ; } @ UseGuards ( CookieGuard ) @ Post ( 'new' ) insertCharacter ( @ Body ( ) characterInsert ) { return this . charactersService . insertNewCharacter ( characterInsert ) ; } @ UseGuards ( CookieGuard ) @ Patch ( 'update' ) updateCharacter ( @ Body ( ) characterUpdate ) { return this . charactersService . updateCharacter ( characterUpdate ) ; } }