Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
IDATG2204-Group10-Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frederik Simonsen
IDATG2204-Group10-Project
Commits
51b17bb0
Commit
51b17bb0
authored
3 years ago
by
Matias Nordli
Browse files
Options
Downloads
Patches
Plain Diff
/pick_up_shipment request complete
parent
30bbe153
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
endpoint/transporter.py
+24
-2
24 additions, 2 deletions
endpoint/transporter.py
with
24 additions
and
2 deletions
endpoint/transporter.py
+
24
−
2
View file @
51b17bb0
...
...
@@ -11,7 +11,7 @@ app.config['MYSQL_DB']="ski_equipment_factory"
mysql
=
MySQL
(
app
)
#Transporter function, work in progress
@app.route
(
'
/get_shipment_stat
us_info
'
,
methods
=
[
'
GET
'
])
@app.route
(
'
/get_shipment_stat
e
'
,
methods
=
[
'
GET
'
])
def
get_shipment_ready
():
if
request
.
method
==
'
GET
'
:
...
...
@@ -28,6 +28,28 @@ def get_shipment_ready():
cur
.
close
()
return
jsonify
(
shipment_ready
),
200
#Change shipment state to 'picked up'
@app.route
(
'
/pick_up_shipment
'
,
methods
=
[
'
PUT
'
])
def
pick_up_shipment
():
if
request
.
method
==
'
PUT
'
:
data
=
request
.
get_json
()
shipment_number
=
data
[
'
shipment_number
'
]
cur
=
mysql
.
connection
.
cursor
()
pickUp
=
cur
.
execute
(
"
UPDATE `shipment` SET state=
'
picked up
'
WHERE shipment_number=%s
"
,(
shipment_number
,))
mysql
.
connection
.
commit
()
if
pickUp
>
0
:
pickUp
=
cur
.
fetchall
()
else
:
return
jsonify
(
"
No shipments matching requested number or shipment is already picked up.
"
),
404
order
=
cur
.
execute
(
"
SELECT * FROM `shipment` WHERE `shipment_number`=%s
"
,(
shipment_number
,))
order
=
cur
.
fetchall
()
cur
.
close
()
return
jsonify
(
order
),
200
if
__name__
==
'
__main__
'
:
app
.
run
(
debug
=
True
)
\ No newline at end of file
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