File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ import {
17
17
iNewsSubmissionDTO ,
18
18
} from "customTypes/appDataTypes/newsTypes" ;
19
19
import { celebrate , Segments } from "celebrate" ;
20
- import { newsSubmissionBodySchema } from "validations/newsRouteSchemas" ;
20
+ import {
21
+ newsAnnotationBodySchema ,
22
+ newsSubmissionBodySchema ,
23
+ } from "validations/newsRouteSchemas" ;
21
24
import NewsService from "services/NewsService" ;
22
25
23
26
const route = Router ( ) ;
@@ -80,6 +83,9 @@ const newsRoute: RouteType = (apiRouter) => {
80
83
81
84
route . post (
82
85
"/annotate" ,
86
+ celebrate ( {
87
+ [ Segments . BODY ] : newsAnnotationBodySchema ,
88
+ } ) ,
83
89
async (
84
90
req : iRequest < iNewsAnnotationsInputDTO > ,
85
91
res : iResponse < null > ,
Original file line number Diff line number Diff line change @@ -11,4 +11,9 @@ const newsSubmissionBodySchema = Joi.object({
11
11
date : Joi . string ( ) . isoDate ( ) . required ( ) ,
12
12
} ) ;
13
13
14
- export { newsIdSchema , newsSubmissionBodySchema } ;
14
+ const newsAnnotationBodySchema = Joi . object ( {
15
+ newsId : Joi . string ( ) . uuid ( ) . required ( ) ,
16
+ annotations : Joi . array ( ) . items ( Joi . string ( ) . uuid ( ) ) . required ( ) . min ( 1 ) ,
17
+ } ) ;
18
+
19
+ export { newsIdSchema , newsSubmissionBodySchema , newsAnnotationBodySchema } ;
You can’t perform that action at this time.
0 commit comments