Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
teknikattan-scoring-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tddd96-grupp1
teknikattan-scoring-system
Commits
8053980f
Commit
8053980f
authored
4 years ago
by
Josef Olsson
Browse files
Options
Downloads
Patches
Plain Diff
Comment team API
parent
517bdfff
No related branches found
No related tags found
1 merge request
!130
Resolve "Comment apis"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/app/apis/slides.py
+1
-1
1 addition, 1 deletion
server/app/apis/slides.py
server/app/apis/teams.py
+23
-8
23 additions, 8 deletions
server/app/apis/teams.py
with
24 additions
and
9 deletions
server/app/apis/slides.py
+
1
−
1
View file @
8053980f
...
...
@@ -26,7 +26,7 @@ slide_parser_edit.add_argument("background_image_id", default=sentinel, type=int
class
SlidesList
(
Resource
):
@protect_route
(
allowed_roles
=
[
"
*
"
])
def
get
(
self
,
competition_id
):
"""
Gets the all slides
to
the specified competition.
"""
"""
Gets the all slides
from
the specified competition.
"""
items
=
dbc
.
get
.
slide_list
(
competition_id
)
return
list_response
(
list_schema
.
dump
(
items
))
...
...
This diff is collapsed.
Click to expand it.
server/app/apis/teams.py
+
23
−
8
View file @
8053980f
"""
All API calls concerning question alternatives.
Default route: /api/competitions/<competition_id>/teams
"""
import
app.core.http_codes
as
codes
import
app.database.controller
as
dbc
from
app.apis
import
item_response
,
list_response
,
protect_route
from
app.core.dto
import
TeamDTO
from
flask_restx
import
Resource
,
reqparse
from
app.core.parsers
import
sentinel
from
flask_restx
import
Resource
,
reqparse
api
=
TeamDTO
.
api
schema
=
TeamDTO
.
schema
...
...
@@ -21,11 +26,15 @@ team_parser_edit.add_argument("name", type=str, default=sentinel, location="json
class
TeamsList
(
Resource
):
@protect_route
(
allowed_roles
=
[
"
*
"
])
def
get
(
self
,
competition_id
):
"""
Gets the all teams to the specified competition.
"""
items
=
dbc
.
get
.
team_list
(
competition_id
)
return
list_response
(
list_schema
.
dump
(
items
))
@protect_route
(
allowed_roles
=
[
"
*
"
])
def
post
(
self
,
competition_id
):
"""
Posts a new team to the specified competition.
"""
args
=
team_parser_add
.
parse_args
(
strict
=
True
)
item_team
=
dbc
.
add
.
team
(
args
[
"
name
"
],
competition_id
)
return
item_response
(
schema
.
dump
(
item_team
))
...
...
@@ -36,18 +45,15 @@ class TeamsList(Resource):
class
Teams
(
Resource
):
@protect_route
(
allowed_roles
=
[
"
*
"
])
def
get
(
self
,
competition_id
,
team_id
):
"""
Gets the specified team.
"""
item
=
dbc
.
get
.
team
(
competition_id
,
team_id
)
return
item_response
(
schema
.
dump
(
item
))
@protect_route
(
allowed_roles
=
[
"
*
"
])
def
delete
(
self
,
competition_id
,
team_id
):
item_team
=
dbc
.
get
.
team
(
competition_id
,
team_id
)
dbc
.
delete
.
team
(
item_team
)
return
{},
codes
.
NO_CONTENT
@protect_route
(
allowed_roles
=
[
"
*
"
])
def
put
(
self
,
competition_id
,
team_id
):
"""
Edits the specified team using the provided arguments.
"""
args
=
team_parser_edit
.
parse_args
(
strict
=
True
)
name
=
args
.
get
(
"
name
"
)
...
...
@@ -55,3 +61,12 @@ class Teams(Resource):
item_team
=
dbc
.
edit
.
default
(
item_team
,
name
=
name
,
competition_id
=
competition_id
)
return
item_response
(
schema
.
dump
(
item_team
))
@protect_route
(
allowed_roles
=
[
"
*
"
])
def
delete
(
self
,
competition_id
,
team_id
):
"""
Deletes the specified team.
"""
item_team
=
dbc
.
get
.
team
(
competition_id
,
team_id
)
dbc
.
delete
.
team
(
item_team
)
return
{},
codes
.
NO_CONTENT
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