44
55# TimeEntry Model
66time_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' ),
31-
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' ),
7+ 'id' : fields .String (
8+ readOnly = True ,
9+ required = True ,
10+ title = 'Identifier' ,
11+ description = 'The unique id of the time entry' ,
12+ ),
13+ 'project_id' : fields .String (
14+ required = True ,
15+ title = 'Project' ,
16+ max_length = 64 ,
17+ description = 'The id of the selected project' ,
18+ ),
19+ 'activity_id' : fields .String (
20+ required = False ,
21+ title = 'Activity' ,
22+ max_length = 64 ,
23+ description = 'The id of the selected activity' ,
24+ ),
25+ 'technologies' : fields .String (
26+ required = True ,
27+ title = 'Technologies' ,
28+ max_length = 64 ,
29+ description = 'Canonical names of the used technologies during this period' ,
30+ ),
31+ 'description' : fields .String (
32+ title = 'Comments' ,
33+ description = 'Comments about the time entry'
34+ ),
35+ 'start_date' : fields .DateTime (
36+ required = True ,
37+ title = 'Start date' ,
38+ description = 'When the user started doing this activity' ,
39+ ),
40+ 'end_date' : fields .DateTime (
41+ required = True ,
42+ title = 'End date' ,
43+ description = 'When the user ended doing this activity' ,
44+ ),
4045})
4146
4247time_entry_response = ns .inherit ('TimeEntryResponse' , time_entry , {
43- 'running' : fields .Boolean (title = 'Is it running?' ,
44- description = 'Whether this time entry is currently running '
45- 'or not' ),
48+ 'running' : fields .Boolean (
49+ title = 'Is it running?' ,
50+ description = 'Whether this time entry is currently running or not'
51+ ),
52+ 'created_at' : fields .Date (
53+ title = 'Created' ,
54+ description = 'Date of creation'
55+ ),
56+ 'created_by' : fields .String (
57+ required = True ,
58+ title = 'Creator' ,
59+ max_length = 64 ,
60+ description = 'User that created it' ,
61+ ),
62+ 'tenant_id' : fields .String (
63+ required = True ,
64+ title = 'Tenant' ,
65+ max_length = 64 ,
66+ description = 'The tenant this belongs to' ,
67+ ),
4668})
4769
4870
49- @ns .route ('/ ' )
71+ @ns .route ('' )
5072class TimeEntries (Resource ):
5173 @ns .doc ('list_time_entries' )
5274 @ns .marshal_list_with (time_entry_response , code = 200 )
@@ -88,7 +110,7 @@ def put(self, id):
88110 return ns .payload
89111
90112
91- @ns .route ('/stop/ <string:id>' )
113+ @ns .route ('<string:id>/stop ' )
92114@ns .response (404 , 'Running time entry not found' )
93115@ns .param ('id' , 'The unique identifier of a running time entry' )
94116class StopTimeEntry (Resource ):
@@ -99,7 +121,7 @@ def post(self, id):
99121 return None , 204
100122
101123
102- @ns .route ('/continue/ <string:id>' )
124+ @ns .route ('<string:id>/continue ' )
103125@ns .response (404 , 'Stopped time entry not found' )
104126@ns .param ('id' , 'The unique identifier of a stopped time entry' )
105127class ContinueTimeEntry (Resource ):
0 commit comments