import { GET , POST , PUT , DELETE , RestController } from '@libstack/server' ; import personService from '../services/PersonService' ; import { Request } from 'express' ; import { PersonResponse } from '../models/PersonModel' ; @ RestController ( '/v1/person' ) class PersonRouter { @ GET ( '/' ) async listPerson ( req ) { return personService . list ( req . query ) ; } @ GET ( '/:id' ) async findPerson ( { params } ) { return personService . get ( params . id ) ; } @ POST ( '/' ) async createPerson ( request ) { return personService . create ( request . body ) ; } @ PUT ( '/:id' ) async updatePerson ( request ) { return personService . update ( request . params . id , request . body ) ; } @ DELETE ( '/:id' ) async deletePerson ( request ) { await personService . deletePerson ( request . params . id ) ; } }