mirror of
https://github.com/ThisIsBenny/wishlist-app.git
synced 2025-06-07 05:57:41 +00:00
add schema fpr update interface
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
8272237d50
commit
ea2f6e7dc1
1 changed files with 14 additions and 0 deletions
|
@ -12,10 +12,23 @@ export const updateItem = <RouteOptions>{
|
|||
method: 'PUT',
|
||||
url: '/:wishlistId/item/:itemId',
|
||||
schema: {
|
||||
body: {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
title: { type: 'string' },
|
||||
url: { type: 'string' },
|
||||
image: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
comment: { type: 'string' },
|
||||
bought: { type: 'boolean' },
|
||||
},
|
||||
},
|
||||
response: {
|
||||
204: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'number' },
|
||||
title: { type: 'string' },
|
||||
url: { type: 'string' },
|
||||
image: { type: 'string' },
|
||||
|
@ -28,6 +41,7 @@ export const updateItem = <RouteOptions>{
|
|||
},
|
||||
},
|
||||
handler: async (request: GetBySlugUrlTextRequest, reply: FastifyReply) => {
|
||||
request.log.debug(request.body)
|
||||
const item = await wishlist.updateItem(
|
||||
Number(request.params.itemId),
|
||||
request.body
|
||||
|
|
Loading…
Add table
Reference in a new issue