-
Notifications
You must be signed in to change notification settings - Fork 0
Add examples in flask - restplus models #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
cfedacc
84144a9
6cbb933
09adcb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ pytest==5.2.0 | |
|
|
||
| # Mocking | ||
| pytest-mock==2.0.0 | ||
| Faker==4.0.2 | ||
|
|
||
| # Coverage | ||
| coverage==4.5.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| from flask_restplus import fields, Resource, Namespace | ||
| from time_tracker_api.api import audit_fields | ||
| from time_tracker_api import database | ||
| from faker import Faker | ||
|
|
||
| faker = Faker() | ||
|
|
||
| ns = Namespace('time-entries', description='API for time entries') | ||
|
|
||
|
|
@@ -11,12 +14,14 @@ | |
| title='Project', | ||
| max_length=64, | ||
| description='The id of the selected project', | ||
| example=faker.uuid4() | ||
|
||
| ), | ||
| 'activity_id': fields.String( | ||
| required=False, | ||
| title='Activity', | ||
| max_length=64, | ||
| description='The id of the selected activity', | ||
| example=faker.uuid4() | ||
| ), | ||
| 'technologies': fields.String( | ||
| required=True, | ||
|
|
@@ -26,17 +31,20 @@ | |
| ), | ||
| 'description': fields.String( | ||
| title='Comments', | ||
| description='Comments about the time entry' | ||
| description='Comments about the time entry', | ||
| example=faker.paragraph() | ||
| ), | ||
| 'start_date': fields.DateTime( | ||
| required=True, | ||
| title='Start date', | ||
| description='When the user started doing this activity', | ||
| example=faker.iso8601(end_datetime=None) | ||
| ), | ||
| 'end_date': fields.DateTime( | ||
| required=True, | ||
| title='End date', | ||
| description='When the user ended doing this activity', | ||
| example=faker.iso8601(end_datetime=None) | ||
| ), | ||
| }) | ||
|
|
||
|
|
@@ -46,11 +54,13 @@ | |
| required=True, | ||
| title='Identifier', | ||
| description='The unique identifier', | ||
| example=faker.uuid4() | ||
| ), | ||
| 'running': fields.Boolean( | ||
| readOnly=True, | ||
| title='Is it running?', | ||
| description='Whether this time entry is currently running or not' | ||
| description='Whether this time entry is currently running or not', | ||
| example=faker.boolean() | ||
|
||
| ), | ||
| } | ||
| time_entry_response_fields.update(audit_fields) | ||
|
|
@@ -64,6 +74,7 @@ | |
|
|
||
| model = database.create('time-entries') | ||
|
|
||
|
|
||
| @ns.route('') | ||
| class TimeEntries(Resource): | ||
| @ns.doc('list_time_entries') | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add trailing comas