Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
AURA
tank
Commits
f22f40f2
Verified
Commit
f22f40f2
authored
1 year ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
feat: remove nestes routes
parent
ca99f1f3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/v1/api.go
+4
-33
4 additions, 33 deletions
api/v1/api.go
api/v1/files.go
+0
-2
0 additions, 2 deletions
api/v1/files.go
api/v1/playlists.go
+0
-75
0 additions, 75 deletions
api/v1/playlists.go
with
4 additions
and
110 deletions
api/v1/api.go
+
4
−
33
View file @
f22f40f2
...
...
@@ -80,37 +80,7 @@ func InstallHTTPHandler(r *gin.RouterGroup, st *store.Store, im *importer.Import
shows
.
GET
(
""
,
api
.
ListShows
)
shows
.
POST
(
":show-id"
,
api
.
CreateShow
)
shows
.
DELETE
(
":show-id"
,
api
.
DeleteShow
)
// deprecated -> /imports
shows
.
GET
(
":show-id/imports"
,
api
.
ListImportsOfShow
)
// Show/Files: deprecated -> /files
deprecated
:=
shows
.
Group
(
":show-id/files"
)
{
deprecated
.
GET
(
""
,
api
.
ListFilesOfShow
)
deprecated
.
POST
(
""
,
api
.
CreateFileForShow
)
deprecated
.
GET
(
":file-id"
,
api
.
ReadFileOfShow
)
deprecated
.
PATCH
(
":file-id"
,
api
.
PatchFileOfShow
)
deprecated
.
DELETE
(
":file-id"
,
api
.
DeleteFileOfShow
)
deprecated
.
GET
(
":file-id/usage"
,
api
.
ReadUsageOfFile
)
deprecated
.
GET
(
":file-id/logs"
,
api
.
ReadLogsOfFile
)
deprecated
.
GET
(
":file-id/import"
,
api
.
ReadImportOfFile
)
deprecated
.
DELETE
(
":file-id/import"
,
api
.
CancelImportOfFile
)
// TODO: distignuish between flow.js and simple upload using the content type?!?
deprecated
.
PUT
(
":file-id/upload"
,
api
.
UploadFileSimple
)
deprecated
.
POST
(
":file-id/upload"
,
api
.
UploadFileFlowJS
)
deprecated
.
GET
(
":file-id/upload"
,
api
.
TestFileFlowJS
)
}
// Show/Playlists: deprecated -> /playlists
deprecated2
:=
shows
.
Group
(
":show-id/playlists"
)
{
deprecated2
.
GET
(
""
,
api
.
ListPlaylistsOfShow
)
deprecated2
.
POST
(
""
,
api
.
CreatePlaylistForShow
)
deprecated2
.
GET
(
":playlist-id"
,
api
.
ReadPlaylistOfShow
)
deprecated2
.
PUT
(
":playlist-id"
,
api
.
UpdatePlaylistOfShow
)
deprecated2
.
DELETE
(
":playlist-id"
,
api
.
DeletePlaylistOfShow
)
}
}
imports
:=
r
.
Group
(
"imports"
)
...
...
@@ -120,9 +90,9 @@ func InstallHTTPHandler(r *gin.RouterGroup, st *store.Store, im *importer.Import
playlists
:=
r
.
Group
(
"playlists"
)
{
playlists
.
GET
(
""
,
api
.
ListPlaylists
)
// behaves like ListPlaylistsOfShow with ?showID
playlists
.
GET
(
""
,
api
.
ListPlaylists
)
playlists
.
POST
(
""
,
api
.
CreatePlaylistForShow
)
playlists
.
GET
(
":playlist-id"
,
api
.
ReadPlaylist
)
// behaves like ReadPlaylistOfShow with ?showID
playlists
.
GET
(
":playlist-id"
,
api
.
ReadPlaylist
)
playlists
.
PUT
(
":playlist-id"
,
api
.
UpdatePlaylistOfShow
)
playlists
.
DELETE
(
":playlist-id"
,
api
.
DeletePlaylistOfShow
)
}
...
...
@@ -138,6 +108,7 @@ func InstallHTTPHandler(r *gin.RouterGroup, st *store.Store, im *importer.Import
files
.
GET
(
":file-id/logs"
,
api
.
ReadLogsOfFile
)
files
.
GET
(
":file-id/import"
,
api
.
ReadImportOfFile
)
files
.
DELETE
(
":file-id/import"
,
api
.
CancelImportOfFile
)
// TODO: distinguish between flow.js and simple upload using the content type?!?
files
.
PUT
(
":file-id/upload"
,
api
.
UploadFileSimple
)
files
.
POST
(
":file-id/upload"
,
api
.
UploadFileFlowJS
)
files
.
GET
(
":file-id/upload"
,
api
.
TestFileFlowJS
)
...
...
This diff is collapsed.
Click to expand it.
api/v1/files.go
+
0
−
2
View file @
f22f40f2
...
...
@@ -300,8 +300,6 @@ func (api *API) DeleteFileOfShow(c *gin.Context) {
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/files/{id}/usage [get]
//
// TODO: remove this together with nested routes
func
(
api
*
API
)
ReadUsageOfFile
(
c
*
gin
.
Context
)
{
fileID
,
err
:=
idFromString
(
c
.
Param
(
"file-id"
))
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
api/v1/playlists.go
+
0
−
75
View file @
f22f40f2
...
...
@@ -25,43 +25,6 @@ import (
"net/http"
)
// ListPlaylistsOfShow lists playlists.
//
// @Summary List playlists
// @Description Lists playlists of show.
// @Produce json
// @Param showId query int true "ID of the show"
// @Param limit query int false "Limit number of results"
// @Param offset query int false "Start listing from offset"
// @Success 200 {object} PlaylistsListing
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/playlists [get]
//
// TODO: remove together with nested routes
func
(
api
*
API
)
ListPlaylistsOfShow
(
c
*
gin
.
Context
)
{
showID
,
err
:=
getShowID
(
c
)
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusBadRequest
,
ErrorResponse
{
Error
:
"invalid showId: "
+
err
.
Error
()})
}
if
authorized
,
_
:=
authorizeRequestForShow
(
c
,
showID
);
!
authorized
{
return
}
offset
,
limit
,
ok
:=
getPaginationParameter
(
c
)
if
!
ok
{
return
}
playlists
,
err
:=
api
.
store
.
ListPlaylists
(
showID
,
offset
,
limit
)
if
err
!=
nil
{
sendError
(
c
,
err
)
return
}
c
.
JSON
(
http
.
StatusOK
,
PlaylistsListing
{
playlists
})
}
// CreatePlaylistForShow creates a new playlist.
//
// @Summary Create playlist
...
...
@@ -93,44 +56,6 @@ func (api *API) CreatePlaylistForShow(c *gin.Context) {
c
.
JSON
(
http
.
StatusCreated
,
playlist
)
}
// ReadPlaylistOfShow retrieves a playlist of a show.
//
// @Summary Retrieve playlist
// @Description Retrieves a playlist of a show.
// @Produce json
// @Param showId query int true "ID of the show"
// @Param id path int true "ID of the playlist"
// @Success 200 {object} store.Playlist
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/playlists/{id} [get]
//
// TODO: remove this together with nested routes
func
(
api
*
API
)
ReadPlaylistOfShow
(
c
*
gin
.
Context
)
{
showID
,
err
:=
getShowID
(
c
)
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusBadRequest
,
ErrorResponse
{
Error
:
"invalid showId: "
+
err
.
Error
()})
return
}
if
authorized
,
_
:=
authorizeRequestForShow
(
c
,
showID
);
!
authorized
{
return
}
id
,
err
:=
idFromString
(
c
.
Param
(
"playlist-id"
))
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusBadRequest
,
ErrorResponse
{
Error
:
"invalid playlist-id: "
+
err
.
Error
()})
return
}
playlist
,
err
:=
api
.
store
.
GetPlaylist
(
showID
,
id
)
if
err
!=
nil
{
sendError
(
c
,
err
)
return
}
c
.
JSON
(
http
.
StatusOK
,
playlist
)
}
// UpdatePlaylistOfShow updates a playlist of a show.
//
// @Summary Update playlist
...
...
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