-
Notifications
You must be signed in to change notification settings - Fork 0
Create specification for technologies #12
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
5185c3f
44092ef
a2a4411
3cee248
0f72441
4dbe6fb
f5bbf77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| from flask_restplus import Namespace, Resource, fields | ||
|
|
||
| ns = Namespace('technologies', description='API for technologies used') | ||
|
|
||
| # Technology Model | ||
| technology = ns.model('Technology', { | ||
| 'id': fields.String( | ||
| readOnly=True, | ||
| required=True, | ||
| title='Identifier', | ||
| description='The unique id of the technology' | ||
| ), | ||
| 'tenant_id': fields.String( | ||
| required=True, | ||
| title='Tenant', | ||
| max_length=64, | ||
| description='The tenant this technology belongs to' | ||
| ), | ||
| 'name': fields.String( | ||
| required=True, | ||
| title='Name', | ||
| max_length=50, | ||
| description='Name of the technology' | ||
| ), | ||
| 'created_at': fields.Date( | ||
| title='Date', | ||
| description='Date of creation' | ||
| ), | ||
| 'created_by': fields.String( | ||
| required=True, | ||
| title='Type', | ||
Angeluz-07 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| max_length=30, | ||
Angeluz-07 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description='Id of user who first added this technology', | ||
| ), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, let's move these kinds of fields that are generated after creation, i.e. created_at, created_by, tenant_id, etc., to a model called
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those would be those ReadOnly fields |
||
| }) | ||
|
|
||
|
|
||
| @ns.route('') | ||
| class Technologies(Resource): | ||
| @ns.doc('list_technologies') | ||
| @ns.marshal_list_with(technology, code=200) | ||
|
||
| def get(self): | ||
| """List all technologies""" | ||
| return [], 200 | ||
|
|
||
| @ns.doc('create_technology') | ||
| @ns.expect(technology) | ||
| @ns.marshal_with(technology, code=201) | ||
| def post(self): | ||
| """Create a technology""" | ||
| return ns.payload, 201 | ||
|
|
||
|
|
||
| @ns.route('/<string:uid>') | ||
| @ns.response(404, 'Technology not found') | ||
| @ns.param('uid', 'The technology identifier') | ||
| class Technology(Resource): | ||
| @ns.doc('get_technology') | ||
| @ns.marshal_with(technology) | ||
| def get(self, uid): | ||
| """Retrieve a technology""" | ||
| return {} | ||
|
|
||
| @ns.doc('update_technology_status') | ||
| @ns.param('uid', 'The technology identifier') | ||
| @ns.expect(technology) | ||
| @ns.response(204, 'State of the technology successfully updated') | ||
| def post(self, uid): | ||
| """Updates a technology using form data""" | ||
| return ns.payload() | ||
|
|
||
| @ns.doc('put_technology') | ||
| @ns.expect(technology) | ||
| @ns.marshal_with(technology) | ||
| def put(self, uid): | ||
| """Create or replace a technology""" | ||
| return ns.payload() | ||
|
|
||
| @ns.doc('delete_technology') | ||
| @ns.response(204, 'Technology deleted successfully') | ||
| def delete(self, uid): | ||
| """Deletes a technology""" | ||
| return None, 204 | ||
Uh oh!
There was an error while loading. Please reload this page.