From ea2f6e7dc148c8a703ca89d49def875d93c6d1e5 Mon Sep 17 00:00:00 2001 From: Benny Samir Hierl Date: Wed, 2 Feb 2022 20:19:41 +0100 Subject: [PATCH] add schema fpr update interface Signed-off-by: Benny Samir Hierl --- src/api/routes/wishlist/update.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/api/routes/wishlist/update.ts b/src/api/routes/wishlist/update.ts index 5265bcf..a8775fe 100644 --- a/src/api/routes/wishlist/update.ts +++ b/src/api/routes/wishlist/update.ts @@ -12,10 +12,23 @@ export const updateItem = { 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 = { }, }, handler: async (request: GetBySlugUrlTextRequest, reply: FastifyReply) => { + request.log.debug(request.body) const item = await wishlist.updateItem( Number(request.params.itemId), request.body