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',
|
method: 'PUT',
|
||||||
url: '/:wishlistId/item/:itemId',
|
url: '/:wishlistId/item/:itemId',
|
||||||
schema: {
|
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: {
|
response: {
|
||||||
204: {
|
204: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
|
id: { type: 'number' },
|
||||||
title: { type: 'string' },
|
title: { type: 'string' },
|
||||||
url: { type: 'string' },
|
url: { type: 'string' },
|
||||||
image: { type: 'string' },
|
image: { type: 'string' },
|
||||||
|
@ -28,6 +41,7 @@ export const updateItem = <RouteOptions>{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
handler: async (request: GetBySlugUrlTextRequest, reply: FastifyReply) => {
|
handler: async (request: GetBySlugUrlTextRequest, reply: FastifyReply) => {
|
||||||
|
request.log.debug(request.body)
|
||||||
const item = await wishlist.updateItem(
|
const item = await wishlist.updateItem(
|
||||||
Number(request.params.itemId),
|
Number(request.params.itemId),
|
||||||
request.body
|
request.body
|
||||||
|
|
Loading…
Add table
Reference in a new issue