11import { Elysia , t } from 'elysia'
22import { quoteService } from '@/src/module/quote/service'
3- import { createQuoteSchema , getQuoteSchema , updateQuoteSchema } from '@/src/module/quote/type'
3+ import { createQuoteSchema , queryQuoteSchema , updateQuoteSchema } from '@/src/module/quote/type'
44
55export const quote = new Elysia ( { prefix : '/quote' } )
66 . get (
@@ -9,7 +9,7 @@ export const quote = new Elysia({ prefix: '/quote' })
99 const response = await quoteService . getQuote ( params . id )
1010 return response
1111 } , {
12- params : getQuoteSchema ,
12+ params : queryQuoteSchema ,
1313 detail : {
1414 summary : 'Get a quote by id' ,
1515 description : 'Get a quote by id' ,
@@ -23,14 +23,27 @@ export const quote = new Elysia({ prefix: '/quote' })
2323 const response = await quoteService . updateQuote ( params . id , body . text )
2424 return response
2525 } , {
26- params : getQuoteSchema ,
26+ params : queryQuoteSchema ,
2727 body : updateQuoteSchema ,
2828 detail : {
2929 summary : 'Update a quote by id' ,
3030 description : 'Update a quote by id' ,
3131 tags : [ 'quote' ] ,
3232 }
3333 } )
34+ . delete (
35+ '/:id' ,
36+ async ( { params, cookie : { session } } ) => {
37+ const response = await quoteService . deleteQuote ( params . id )
38+ return response
39+ } , {
40+ params : queryQuoteSchema ,
41+ detail : {
42+ summary : 'Delete a quote by id' ,
43+ description : 'Delete a quote by id' ,
44+ tags : [ 'quote' ] ,
45+ }
46+ } )
3447 . get ( "/" , async ( { cookie : { session } } ) => {
3548 const response = await quoteService . getQuotes ( )
3649 return response
0 commit comments