Skip to content

Commit f4f2fb8

Browse files
committed
Apply code review suggestions
1 parent 25255c4 commit f4f2fb8

File tree

2 files changed

+63
-44
lines changed

2 files changed

+63
-44
lines changed

time_tracker_api/activities/activities_api.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,28 @@
44

55
# Activity Model
66
activity = ns.model('Activity', {
7-
'id': fields.String(readOnly=True, required=True, title='Identifier',
8-
description='The unique id of the activity'),
9-
'name': fields.String(required=True, title='Name', max_length=50,
10-
description='Canonical name of the activity'),
11-
'description': fields.String(title='Description',
12-
description='Comments about the activity'),
13-
'tenant_id': fields.String(required=True, title='Tenant', max_length=64,
14-
description='The tenant this belongs to')
7+
'id': fields.String(
8+
readOnly=True,
9+
required=True,
10+
title='Identifier',
11+
description='The unique id of the activity'),
12+
'name': fields.String(
13+
required=True,
14+
title='Name',
15+
max_length=50,
16+
description='Canonical name of the activity'),
17+
'description': fields.String(
18+
title='Description',
19+
description='Comments about the activity'),
20+
'tenant_id': fields.String(
21+
required=True,
22+
title='Tenant',
23+
max_length=64,
24+
description='The tenant this belongs to'),
1525
})
1626

1727

18-
@ns.route('/')
28+
@ns.route('')
1929
class Activities(Resource):
2030
@ns.doc('list_activities')
2131
@ns.marshal_list_with(activity, code=200)

time_tracker_api/time_entries/time_entry_api.py

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,48 @@
44

55
# TimeEntry Model
66
time_entry = ns.model('TimeEntry', {
7-
'id': fields.String(readOnly=True,
8-
required=True,
9-
title='Identifier',
10-
description='The unique id of the time entry'),
11-
'project_id': fields.String(required=True,
12-
title='Project',
13-
max_length=64,
14-
description='The id of the selected project'),
15-
'activity_id': fields.String(required=False,
16-
title='Activity',
17-
max_length=64,
18-
description='The id of the selected activity'),
19-
'technologies': fields.String(required=True,
20-
title='Technologies',
21-
max_length=64,
22-
description='Canonical names of the used technologies during this period'),
23-
'description': fields.String(title='Comments',
24-
description='Comments about the time entry'),
25-
'start_date': fields.DateTime(required=True,
26-
title='Start date',
27-
description='When the user started doing this activity'),
28-
'end_date': fields.DateTime(required=True,
29-
title='End date',
30-
description='When the user ended doing this activity'),
7+
'id': fields.String(
8+
readOnly=True,
9+
required=True,
10+
title='Identifier',
11+
description='The unique id of the time entry'),
12+
'project_id': fields.String(
13+
required=True,
14+
title='Project',
15+
max_length=64,
16+
description='The id of the selected project'),
17+
'activity_id': fields.String(
18+
required=False,
19+
title='Activity',
20+
max_length=64,
21+
description='The id of the selected activity'),
22+
'technologies': fields.String(
23+
required=True,
24+
title='Technologies',
25+
max_length=64,
26+
description='Canonical names of the used technologies during this period'),
27+
'description': fields.String(
28+
title='Comments',
29+
description='Comments about the time entry'),
30+
'start_date': fields.DateTime(
31+
required=True,
32+
title='Start date',
33+
description='When the user started doing this activity'),
34+
'end_date': fields.DateTime(
35+
required=True,
36+
title='End date',
37+
description='When the user ended doing this activity'),
3138

32-
'user_id': fields.String(required=True,
33-
title='Tenant',
34-
max_length=64,
35-
description='The user who created this time entry'),
36-
'tenant_id': fields.String(required=True,
37-
title='Tenant',
38-
max_length=64,
39-
description='The tenant this time entry belongs to'),
39+
'user_id': fields.String(
40+
required=True,
41+
title='Tenant',
42+
max_length=64,
43+
description='The user who created this time entry'),
44+
'tenant_id': fields.String(
45+
required=True,
46+
title='Tenant',
47+
max_length=64,
48+
description='The tenant this time entry belongs to'),
4049
})
4150

4251
time_entry_response = ns.inherit('TimeEntryResponse', time_entry, {
@@ -46,7 +55,7 @@
4655
})
4756

4857

49-
@ns.route('/')
58+
@ns.route('')
5059
class TimeEntries(Resource):
5160
@ns.doc('list_time_entries')
5261
@ns.marshal_list_with(time_entry_response, code=200)
@@ -88,7 +97,7 @@ def put(self, id):
8897
return ns.payload
8998

9099

91-
@ns.route('/stop/<string:id>')
100+
@ns.route('<string:id>/stop')
92101
@ns.response(404, 'Running time entry not found')
93102
@ns.param('id', 'The unique identifier of a running time entry')
94103
class StopTimeEntry(Resource):
@@ -99,7 +108,7 @@ def post(self, id):
99108
return None, 204
100109

101110

102-
@ns.route('/continue/<string:id>')
111+
@ns.route('<string:id>/continue')
103112
@ns.response(404, 'Stopped time entry not found')
104113
@ns.param('id', 'The unique identifier of a stopped time entry')
105114
class ContinueTimeEntry(Resource):

0 commit comments

Comments
 (0)