Skip to content

Commit 84144a9

Browse files
committed
Fix - rename uid to uid in some files, fix name file
1 parent cfedacc commit 84144a9

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed
File renamed without changes.

time_tracker_api/projects/projects_model.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ def __init__(self):
1010
def get_all(self):
1111
return self.projects
1212

13-
def get(self, uid):
13+
def get(self, id):
1414
for project in self.projects:
15-
if project.get('uid') == uid:
15+
if project.get('id') == id:
1616
return project
17-
raise MissingResource("Project '%s' not found" % uid)
17+
raise MissingResource("Project '%s' not found" % id)
1818

1919
def create(self, project):
2020
self.counter += 1
21-
project['uid'] = str(self.counter)
21+
project['id'] = str(self.counter)
2222
self.projects.append(project)
2323
return project
2424

25-
def update(self, uid, data):
26-
project = self.get(uid)
25+
def update(self, id, data):
26+
project = self.get(id)
2727
if project:
2828
project.update(data)
2929
return project
3030
else:
31-
raise MissingResource("Project '%s' not found" % uid)
31+
raise MissingResource("Project '%s' not found" % id)
3232

33-
def delete(self, uid):
34-
if uid:
35-
project = self.get(uid)
33+
def delete(self, id):
34+
if id:
35+
project = self.get(id)
3636
self.projects.remove(project)
3737

3838
def flush(self):

time_tracker_api/projects/projects_namespace.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,24 @@ def post(self):
7373
help='Is the project active?')
7474

7575

76-
@ns.route('/<string:uid>')
76+
@ns.route('/<string:id>')
7777
@ns.response(404, 'Project not found')
78-
@ns.param('uid', 'The project identifier')
78+
@ns.param('id', 'The project identifier')
7979
class Project(Resource):
8080
@ns.doc('get_project')
8181
@ns.marshal_with(project)
82-
def get(self, uid):
82+
def get(self, id):
8383
"""Retrieve a project"""
84-
return project_dao.get(uid)
84+
return project_dao.get(id)
8585

8686
@ns.doc('update_project_status')
8787
@ns.expect(project)
8888
@ns.response(204, 'State of the project successfully updated')
89-
def post(self, uid):
89+
def post(self, id):
9090
"""Updates a project using form data"""
9191
try:
9292
update_data = project_update_parser.parse_args()
93-
return project_dao.update(uid, update_data), 200
93+
return project_dao.update(id, update_data), 200
9494
except ValueError:
9595
abort(code=400)
9696
except MissingResource as e:
@@ -99,13 +99,13 @@ def post(self, uid):
9999
@ns.doc('put_project')
100100
@ns.expect(project_input)
101101
@ns.marshal_with(project)
102-
def put(self, uid):
102+
def put(self, id):
103103
"""Create or replace a project"""
104-
return project_dao.update(uid, ns.payload)
104+
return project_dao.update(id, ns.payload)
105105

106106
@ns.doc('delete_project')
107107
@ns.response(204, 'Project deleted successfully')
108-
def delete(self, uid):
108+
def delete(self, id):
109109
"""Deletes a project"""
110-
project_dao.delete(uid)
110+
project_dao.delete(id)
111111
return None, 204

time_tracker_api/technologies/technologies_namespace.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,25 @@ def post(self):
5151
return ns.payload, 201
5252

5353

54-
@ns.route('/<string:uid>')
54+
@ns.route('/<string:id>')
5555
@ns.response(404, 'Technology not found')
56-
@ns.param('uid', 'The technology identifier')
56+
@ns.param('id', 'The technology identifier')
5757
class Technology(Resource):
5858
@ns.doc('get_technology')
5959
@ns.marshal_with(technology)
60-
def get(self, uid):
60+
def get(self, id):
6161
"""Retrieve a technology"""
6262
return {}
6363

6464
@ns.doc('put_technology')
6565
@ns.expect(technology_input)
6666
@ns.marshal_with(technology)
67-
def put(self, uid):
67+
def put(self, id):
6868
"""Updates a technology"""
6969
return ns.payload()
7070

7171
@ns.doc('delete_technology')
7272
@ns.response(204, 'Technology deleted successfully')
73-
def delete(self, uid):
73+
def delete(self, id):
7474
"""Deletes a technology"""
7575
return None, 204

0 commit comments

Comments
 (0)