Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Salamander - API
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
Herman Andersen Dyrkorn
Salamander - API
Merge requests
!51
Resolve "cleanup and documentation"
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Resolve "cleanup and documentation"
48-cleanup-and-documentation
into
master
Overview
0
Commits
2
Pipelines
0
Changes
12
Merged
Resolve "cleanup and documentation"
Herman Andersen Dyrkorn
requested to merge
48-cleanup-and-documentation
into
master
Jun 11, 2021
Overview
0
Commits
2
Pipelines
0
Changes
12
Closes
#48 (closed)
Edited
Jun 11, 2021
by
Herman Andersen Dyrkorn
0
0
Merge request reports
Compare
master
version 1
0c7eb4f4
Jun 11, 2021
master (base)
and
latest version
latest version
88f7e32e
2 commits,
Jun 11, 2021
version 1
0c7eb4f4
1 commit,
Jun 11, 2021
12 files
+
81
−
16
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
12
api/endpoints/editsalamander.py
+
8
−
2
View file @ 88f7e32e
Edit in single-file editor
Open in Web IDE
Show full file
@@ -12,6 +12,13 @@ from path_constants import _ACCESS_DATABASE
from
image_encoder.image_encoder
import
*
import
cv2
"""
Endpoint for editing salamanders.
GET: Gets a specific salamanders original and processed image, and all its data.
PUT: Edits a specific salamander with new data like sex, species, location etc.
DELETE: Deletes a specific salamander from the system.
"""
class
EditSalamander
(
Resource
):
decorators
=
[
limiter
.
limit
(
"
60/minute
"
)]
@@ -41,7 +48,6 @@ class EditSalamander(Resource):
height
,
width
,
_
=
image
.
shape
desired_long_side
=
320
scaling_factor
=
1
if
width
>
height
:
scaling_factor
=
desired_long_side
/
width
@@ -145,7 +151,7 @@ class EditSalamander(Resource):
if
"
location
"
in
data
and
"
new_location
"
in
data
and
"
new_sex
"
in
data
and
"
new_species
"
in
data
:
if
data
[
'
location
'
]
!=
data
[
'
new_location
'
]
or
salamander
.
sex
!=
data
[
'
new_sex
'
]
or
salamander
.
species
!=
data
[
'
new_species
'
]:
'
new_sex
'
]
or
salamander
.
species
!=
data
[
'
new_species
'
]:
salamander_path
=
os
.
path
.
join
(
"
images
"
,
data
[
'
location
'
],
salamander
.
species
,
salamander
.
sex
,
str
(
salamander
.
id
))
new_path_to_images
=
os
.
path
.
join
(
"
images
"
,
data
[
'
new_location
'
],
data
[
'
new_species
'
],
Loading