Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fahrtenbuch
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWP WS21_22 - Fahrtenbuch
Team Einhorn
fahrtenbuch
Commits
bbd21e2f
Commit
bbd21e2f
authored
3 years ago
by
Alexander Rudolph
Browse files
Options
Downloads
Patches
Plain Diff
adapt boat route for the right error codes
parent
f5fa8077
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
server/src/controllers/boat.controllers.ts
+6
-0
6 additions, 0 deletions
server/src/controllers/boat.controllers.ts
server/src/routes/boat.routes.ts
+3
-3
3 additions, 3 deletions
server/src/routes/boat.routes.ts
with
9 additions
and
3 deletions
server/src/controllers/boat.controllers.ts
+
6
−
0
View file @
bbd21e2f
...
...
@@ -158,6 +158,9 @@ const getBoatOverview = async (req: Request, res: Response) => {
};
const
lock
=
async
(
req
:
Request
,
res
:
Response
)
=>
{
if
(
!
await
Boat
.
findByPk
(
req
.
params
.
id
))
{
return
res
.
status
(
404
).
json
({
success
:
false
,
error
:
"
boatIdNotFound
"
});
}
await
Boat
.
update
({
status
:
1
,
},
{
...
...
@@ -171,6 +174,9 @@ const lock = async (req: Request, res: Response) => {
});
};
const
unlock
=
async
(
req
:
Request
,
res
:
Response
)
=>
{
if
(
!
await
Boat
.
findByPk
(
req
.
params
.
id
))
{
return
res
.
status
(
404
).
json
({
success
:
false
,
error
:
"
boatIdNotFound
"
});
}
await
Boat
.
update
({
status
:
0
,
},
{
...
...
This diff is collapsed.
Click to expand it.
server/src/routes/boat.routes.ts
+
3
−
3
View file @
bbd21e2f
...
...
@@ -37,9 +37,9 @@ boatsRouter.post(
//update boat by id
boatsRouter
.
patch
(
"
/api/boat/:id/
"
,
body
(
"
name
"
).
not
().
isEmpty
(),
body
(
"
boattype
"
).
not
().
isEmpty
(),
body
(
"
status
"
).
not
().
isEmpty
(),
body
(
"
name
"
).
if
(
body
(
"
name
"
).
exists
()).
not
().
isEmpty
(),
body
(
"
boattype
"
).
if
(
body
(
"
boattype
"
).
exists
()).
not
().
isEmpty
(),
body
(
"
status
"
).
if
(
body
(
"
status
"
).
exists
()).
not
().
isEmpty
(),
handleValidationResult
,
validateToken
,
isCoord
,
...
...
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