diff --git a/requirements/prod.txt b/requirements/prod.txt index 7467484a..77e31ee6 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -22,6 +22,7 @@ Faker==4.0.2 Flask-Script==2.0.6 # SQL database (MS SQL) +pyodbc==4.0.30 flask_sqlalchemy==2.4.1 # Handling requests diff --git a/time_tracker_api/api.py b/time_tracker_api/api.py index 6b8fb8d0..be464e5d 100644 --- a/time_tracker_api/api.py +++ b/time_tracker_api/api.py @@ -58,10 +58,6 @@ api.add_namespace(activities_namespace.ns) -from time_tracker_api.technologies import technologies_namespace - -api.add_namespace(technologies_namespace.ns) - from time_tracker_api.time_entries import time_entries_namespace api.add_namespace(time_entries_namespace.ns) diff --git a/time_tracker_api/technologies/technologies_namespace.py b/time_tracker_api/technologies/technologies_namespace.py deleted file mode 100644 index 22b470c8..00000000 --- a/time_tracker_api/technologies/technologies_namespace.py +++ /dev/null @@ -1,71 +0,0 @@ -from faker import Faker -from flask_restplus import Namespace, Resource, fields - -from time_tracker_api.api import audit_fields - -faker = Faker() - -ns = Namespace('technologies', description='API for technologies used') - -# Technology Model -technology_input = ns.model('TechnologyInput', { - 'name': fields.String( - required=True, - title='Name', - max_length=50, - description='Name of the technology', - example=faker.word(['Java', 'Python', 'Elixir']) - ), -}) - -technology_response_fields = { - 'id': fields.String( - readOnly=True, - required=True, - title='Identifier', - description='The unique identifier', - example=faker.random_int(1, 9999), - ), -} -technology_response_fields.update(audit_fields) - -technology = ns.inherit( - 'Technology', - technology_input, - technology_response_fields -) - - -@ns.route('') -class Technologies(Resource): - @ns.doc('list_technologies') - @ns.marshal_list_with(technology, code=200) - def get(self): - return [], 200 - - @ns.doc('create_technology') - @ns.expect(technology_input) - @ns.marshal_with(technology, code=201) - def post(self): - return ns.payload, 201 - - -@ns.route('/') -@ns.response(404, 'Technology not found') -@ns.param('id', 'The technology identifier') -class Technology(Resource): - @ns.doc('get_technology') - @ns.marshal_with(technology) - def get(self, id): - return {} - - @ns.doc('put_technology') - @ns.expect(technology_input) - @ns.marshal_with(technology) - def put(self, id): - return ns.payload() - - @ns.doc('delete_technology') - @ns.response(204, 'Technology deleted successfully') - def delete(self, id): - return None, 204 diff --git a/time_tracker_api/time_entries/time_entries_namespace.py b/time_tracker_api/time_entries/time_entries_namespace.py index c65623d2..ec2e1163 100644 --- a/time_tracker_api/time_entries/time_entries_namespace.py +++ b/time_tracker_api/time_entries/time_entries_namespace.py @@ -23,11 +23,18 @@ description='The id of the selected activity', example=faker.random_int(1, 9999), ), - 'technologies': fields.String( - required=True, - title='Technologies', - max_length=64, - description='Canonical names of the used technologies during this period', + 'technologies': fields.List( + fields.String( + required=True, + title='Technologies', + max_length=64, + description='Technology names used in this time-entry', + ), + example=faker.words( + 3, + ['java', 'elixir', 'python', 'docker'], + unique=True + ) ), 'description': fields.String( title='Comments',