Skip to content

Commit

Permalink
Merge pull request #47 from vantage-ola/backend
Browse files Browse the repository at this point in the history
Backend
  • Loading branch information
vantage-ola authored Jul 3, 2024
2 parents e2b77f1 + 40b9e52 commit 90fbeee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tracknow/backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Laptime(db.Model):
youtube_link = db.Column(db.String(255), nullable=True) # youtube link or evidence.
comment = db.Column(db.String(500), nullable=True)
# TODO Add date time.

def __repr__(self):
return f'<Laptime {self.time}>'

Expand All @@ -56,5 +57,6 @@ def to_dict(self):
'simracing': self.simracing,
'platform': self.platform,
'youtube_link': self.youtube_link,
'comment': self.comment
'comment': self.comment,
'by': self.user.username if self.user else None
}
4 changes: 3 additions & 1 deletion tracknow/backend/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ def get_user_laptime(id):
# Global - get all laptimes posted around the world.
@routes.route('/api/v1/laptimes', methods=['GET'])
def get_laptimes():
laptimes = Laptime.query.filter_by().all()
# TODO introduce randomness, recently added
laptimes = Laptime.query.all() #Laptime.query.filter_by().all()

return jsonify([lt.to_dict() for lt in laptimes]), 200

# Global - get one user laptime selected.
Expand Down
5 changes: 4 additions & 1 deletion tracknow/backend/static/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"basePath": "/api/v1",
"schemes": [
"http"
"https"
],
"paths": {
"/hello": {
Expand Down Expand Up @@ -538,6 +538,9 @@
},
"comment": {
"type": "string"
},
"by": {
"type": "string"
}
}
}
Expand Down

0 comments on commit 90fbeee

Please sign in to comment.