feat: list customer by id
This commit is contained in:
parent
e76650bfce
commit
239582b472
1 changed files with 8 additions and 0 deletions
|
|
@ -82,6 +82,14 @@ export class CustomerController extends Controller {
|
|||
};
|
||||
}
|
||||
|
||||
@Get("{customerId}")
|
||||
async getById(@Path() customerId: string) {
|
||||
const record = await prisma.customer.findFirst({ where: { id: customerId } });
|
||||
if (!record)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Customer cannot be found.", "data_not_found");
|
||||
return record;
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Request() req: RequestWithUser, @Body() body: CustomerCreate) {
|
||||
const record = await prisma.customer.create({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue