Skip to content
Snippets Groups Projects
Verified Commit e2c31c1e authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: remove unused function

parent 6e262fee
No related branches found
No related tags found
No related merge requests found
......@@ -288,44 +288,6 @@ func (api *API) DeleteFileOfShow(c *gin.Context) {
c.JSON(http.StatusNoContent, nil)
}
// ReadUsageOfFile lists playlists referring to the file.
//
// @Summary List referring playlists
// @Description Lists playlists referring to the file.
// @Produce json
// @Param id path int true "ID of the file"
// @Success 200 {object} FileUsageListing
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/files/{id}/usage [get]
func (api *API) ReadUsageOfFile(c *gin.Context) {
fileID, err := idFromString(c.Param("file-id"))
if err != nil {
c.JSON(http.StatusBadRequest, ErrorResponse{Error: "invalid file-id: " + err.Error()})
return
}
// with this we are actively subverting the checks performed in api.store.GetFileUsage
showID, err := api.store.GetFileShowID(fileID)
if err != nil {
c.JSON(http.StatusBadRequest, ErrorResponse{Error: "wrong file-id: " + err.Error()})
return
}
if authorized, _ := authorizeRequestForShow(c, showID); !authorized {
return
}
result := FileUsageListing{}
if result.Usage.Playlists, err = api.store.GetFileUsage(showID, fileID); err != nil {
sendError(c, err)
return
}
c.JSON(http.StatusOK, result)
}
// ReadLogsOfFile retrieves import logs of the file.
//
// @Summary Retrieve import logs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment