Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
group9_cw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arya, Navin Chandra C (PG/T - Comp Sci & Elec Eng)
group9_cw
Commits
1c8d044f
Commit
1c8d044f
authored
1 year ago
by
Arya, Navin Chandra C (PG/T - Comp Sci & Elec Eng)
Browse files
Options
Downloads
Patches
Plain Diff
code updated for bike service
parent
5455293a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
microservices/bikes_service/main.py
+15
-2
15 additions, 2 deletions
microservices/bikes_service/main.py
microservices/my_ride.db
+0
-0
0 additions, 0 deletions
microservices/my_ride.db
with
15 additions
and
2 deletions
microservices/bikes_service/main.py
+
15
−
2
View file @
1c8d044f
...
...
@@ -56,6 +56,18 @@ class Bike(BaseModel):
last_maintenance_date
:
str
maintenance_history
:
str
class
BikeResponse
(
BaseModel
):
id
:
int
model
:
str
status
:
Optional
[
str
]
location
:
str
condition
:
str
price_per_hour
:
float
last_maintenance_date
:
str
maintenance_history
:
str
# Routes
@app.post
(
"
/bikes/
"
,
response_model
=
Bike
)
async
def
create_bike
(
bike
:
Bike
):
...
...
@@ -72,13 +84,14 @@ async def create_bike(bike: Bike):
@app.get
(
"
/bikes/
"
,
response_model
=
List
[
Bike
])
@app.get
(
"
/bikes/
"
,
response_model
=
List
[
Bike
Response
])
async
def
read_bikes
():
cursor
.
execute
(
'
SELECT * FROM Bikes
'
)
bikes
=
cursor
.
fetchall
()
bike_objects
=
[]
for
bike
in
bikes
:
bike_obj
=
Bike
(
bike_obj
=
BikeResponse
(
id
=
bike
[
0
],
model
=
bike
[
1
],
status
=
bike
[
2
],
location
=
bike
[
3
],
...
...
This diff is collapsed.
Click to expand it.
microservices/my_ride.db
+
0
−
0
View file @
1c8d044f
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment