File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -191,17 +191,21 @@ paths:
191191 properties :
192192 content :
193193 type : string
194- userid :
195- type : integer
196194 responses :
197195 201 :
198196 description : success
199197 content :
200198 application/json :
201199 schema :
202200 $ref : ' #/components/schemas/Post'
203- 400 :
204- description : fail
201+ 401 :
202+ description : Unauthorised
203+ content :
204+ application/json :
205+ schema :
206+ $ref : ' #/components/schemas/Error'
207+ ' 500 ' :
208+ description : Internal server error
205209 content :
206210 application/json :
207211 schema :
@@ -222,7 +226,13 @@ paths:
222226 schema :
223227 $ref : ' #/components/schemas/Posts'
224228 ' 401 ' :
225- description : fail
229+ description : Unauthorised
230+ content :
231+ application/json :
232+ schema :
233+ $ref : ' #/components/schemas/Error'
234+ ' 500 ' :
235+ description : Internal server error
226236 content :
227237 application/json :
228238 schema :
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ import Post from '../domain/post.js'
33import User from '../domain/user.js'
44
55export const create = async ( req , res ) => {
6- const { content, userid } = req . body
7- const user = await User . findById ( userid )
6+ const { content } = req . body
7+ const user = await User . findById ( req . user . id )
88
99 if ( ! content ) {
1010 return sendDataResponse ( res , 400 , { content : 'Must provide content' } )
You can’t perform that action at this time.
0 commit comments