|
6 | 6 |
|
7 | 7 | from commons.data_access_layer.cosmos_db import current_datetime, datetime_str |
8 | 8 | from commons.data_access_layer.database import COMMENTS_MAX_LENGTH |
9 | | -from time_tracker_api.api import common_fields |
| 9 | +from time_tracker_api.api import common_fields, UUID_REGEX |
10 | 10 | from time_tracker_api.time_entries.time_entries_model import create_dao |
11 | 11 |
|
12 | 12 | faker = Faker() |
|
19 | 19 | title='Project', |
20 | 20 | required=True, |
21 | 21 | description='The id of the selected project', |
| 22 | + pattern=UUID_REGEX, |
22 | 23 | example=faker.uuid4(), |
23 | 24 | ), |
| 25 | + 'start_date': fields.DateTime( |
| 26 | + dt_format='iso8601', |
| 27 | + title='Start date', |
| 28 | + required=True, |
| 29 | + description='When the user started doing this activity', |
| 30 | + example=datetime_str(current_datetime() - timedelta(days=1)), |
| 31 | + ), |
24 | 32 | 'activity_id': fields.String( |
25 | 33 | title='Activity', |
26 | | - required=True, |
| 34 | + required=False, |
27 | 35 | description='The id of the selected activity', |
| 36 | + pattern=UUID_REGEX, |
28 | 37 | example=faker.uuid4(), |
29 | 38 | ), |
30 | 39 | 'description': fields.String( |
|
34 | 43 | example=faker.paragraph(nb_sentences=2), |
35 | 44 | max_length=COMMENTS_MAX_LENGTH, |
36 | 45 | ), |
37 | | - 'start_date': fields.DateTime( |
38 | | - dt_format='iso8601', |
39 | | - title='Start date', |
40 | | - required=True, |
41 | | - description='When the user started doing this activity', |
42 | | - example=datetime_str(current_datetime() - timedelta(days=1)), |
43 | | - ), |
44 | 46 | 'end_date': fields.DateTime( |
45 | 47 | dt_format='iso8601', |
46 | 48 | title='End date', |
|
50 | 52 | ), |
51 | 53 | 'uri': fields.String( |
52 | 54 | title='Uniform Resource identifier', |
53 | | - description='Either identifier or locator', |
| 55 | + description='Either identifier or locator of a resource in the Internet that helps to understand' |
| 56 | + ' what this time entry was about. For example, A Jira ticket, a Github issue, a Google document.', |
| 57 | + required=False, |
54 | 58 | example=faker.random_element([ |
55 | 59 | 'https://github.com/ioet/time-tracker-backend/issues/51', |
56 | 60 | '#54', |
|
75 | 79 | }) |
76 | 80 |
|
77 | 81 | time_entry_response_fields = { |
78 | | - 'id': fields.String( |
79 | | - readOnly=True, |
80 | | - title='Identifier', |
81 | | - description='The unique identifier', |
82 | | - example=faker.uuid4(), |
83 | | - ), |
84 | 82 | 'running': fields.Boolean( |
85 | 83 | readOnly=True, |
86 | 84 | title='Is it running?', |
87 | 85 | description='Whether this time entry is currently running or not', |
88 | 86 | example=faker.boolean(), |
89 | 87 | ), |
90 | | - 'tenant_id': fields.String( |
91 | | - required=True, |
92 | | - readOnly=True, |
93 | | - title='Identifier of Tenant', |
94 | | - description='Tenant this project belongs to', |
95 | | - example=faker.uuid4(), |
96 | | - ), |
97 | 88 | 'owner_id': fields.String( |
98 | 89 | required=True, |
99 | 90 | readOnly=True, |
|
0 commit comments