44ns = Namespace ('activities' , description = 'API for activities' )
55
66# Activity Model
7- activity = ns .model ('Activity ' , {
7+ activity_input = ns .model ('ActivityInput ' , {
88 'name' : fields .String (
99 required = True ,
1010 title = 'Name' ,
2727}
2828activity_response_fields .update (audit_fields )
2929
30- activity_response = ns .inherit (
31- 'ActivityResponse ' ,
32- activity ,
30+ activity = ns .inherit (
31+ 'Activity ' ,
32+ activity_input ,
3333 activity_response_fields
3434)
3535
3636
3737@ns .route ('' )
3838class Activities (Resource ):
3939 @ns .doc ('list_activities' )
40- @ns .marshal_list_with (activity_response , code = 200 )
40+ @ns .marshal_list_with (activity , code = 200 )
4141 def get (self ):
4242 """List all available activities"""
4343 return []
4444
4545 @ns .doc ('create_activity' )
46- @ns .expect (activity )
47- @ns .marshal_with (activity_response , code = 201 )
46+ @ns .expect (activity_input )
47+ @ns .marshal_with (activity , code = 201 )
4848 @ns .response (400 , 'Invalid format of the attributes of the activity.' )
4949 def post (self ):
5050 """Create a single activity"""
@@ -56,7 +56,7 @@ def post(self):
5656@ns .param ('id' , 'The unique identifier of the activity' )
5757class Activity (Resource ):
5858 @ns .doc ('get_activity' )
59- @ns .marshal_with (activity_response )
59+ @ns .marshal_with (activity )
6060 def get (self , id ):
6161 """Retrieve all the data of a single activity"""
6262 return {}
@@ -69,8 +69,8 @@ def delete(self, id):
6969
7070 @ns .doc ('put_activity' )
7171 @ns .response (400 , 'Invalid format of the attributes of the activity.' )
72- @ns .expect (activity )
73- @ns .marshal_with (activity_response )
72+ @ns .expect (activity_input )
73+ @ns .marshal_with (activity )
7474 def put (self , id ):
7575 """Updates an activity"""
7676 return ns .payload
0 commit comments