Fixed lint errors after refactor (#806)

* removed git diff from swagger check script

* updated swagger docs

* removed ununsed calls
This commit is contained in:
Felipe Martin 2023-12-28 18:37:19 +01:00 committed by GitHub
parent cc7c75116d
commit cf7301c78f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 28 deletions

View file

@ -150,7 +150,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Bookmark"
"$ref": "#/definitions/model.BookmarkDTO"
}
},
"403": {
@ -294,16 +294,18 @@ const docTemplate = `{
}
}
},
"model.Bookmark": {
"model.BookmarkDTO": {
"type": "object",
"properties": {
"author": {
"type": "string"
},
"create_archive": {
"description": "TODO: migrate outside the DTO",
"type": "boolean"
},
"create_ebook": {
"description": "TODO: migrate outside the DTO",
"type": "boolean"
},
"excerpt": {

View file

@ -139,7 +139,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Bookmark"
"$ref": "#/definitions/model.BookmarkDTO"
}
},
"403": {
@ -283,16 +283,18 @@
}
}
},
"model.Bookmark": {
"model.BookmarkDTO": {
"type": "object",
"properties": {
"author": {
"type": "string"
},
"create_archive": {
"description": "TODO: migrate outside the DTO",
"type": "boolean"
},
"create_ebook": {
"description": "TODO: migrate outside the DTO",
"type": "boolean"
},
"excerpt": {

View file

@ -57,13 +57,15 @@ definitions:
username:
type: string
type: object
model.Bookmark:
model.BookmarkDTO:
properties:
author:
type: string
create_archive:
description: 'TODO: migrate outside the DTO'
type: boolean
create_ebook:
description: 'TODO: migrate outside the DTO'
type: boolean
excerpt:
type: string
@ -210,7 +212,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/model.Bookmark'
$ref: '#/definitions/model.BookmarkDTO'
"403":
description: Token not provided/invalid
summary: Update Cache and Ebook on server.

View file

@ -202,7 +202,7 @@ func (r *BookmarksAPIRoutes) deleteHandler(c *gin.Context) {
// @securityDefinitions.apikey ApiKeyAuth
// @Param payload body updateCachePayload true "Update Cache Payload"`
// @Produce json
// @Success 200 {object} model.Bookmark
// @Success 200 {object} model.BookmarkDTO
// @Failure 403 {object} nil "Token not provided/invalid"
// @Router /api/v1/bookmarks/cache [put]
func (r *BookmarksAPIRoutes) updateCache(c *gin.Context) {

View file

@ -4,28 +4,10 @@ import (
"html/template"
"io"
"net"
"net/http"
nurl "net/url"
"os"
"syscall"
)
func createRedirectURL(newPath, previousPath string) string {
urlQueries := nurl.Values{}
urlQueries.Set("dst", previousPath)
redirectURL, _ := nurl.Parse(newPath)
redirectURL.RawQuery = urlQueries.Encode()
return redirectURL.String()
}
func redirectPage(w http.ResponseWriter, r *http.Request, url string) {
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Expires", "0")
http.Redirect(w, r, url, http.StatusMovedPermanently)
}
func FileExists(filePath string) bool {
info, err := os.Stat(filePath)
return err == nil && !info.IsDir()

View file

@ -12,7 +12,6 @@ fi
# Check if the git tree for CWD is clean
if [ -n "$(git status docs/swagger --porcelain)" ]; then
echo "❌ git tree is not clean. Please commit all changes before running this script."
git diff
exit 1
fi
@ -20,7 +19,6 @@ fi
make swag-fmt
if [ -n "$(git status docs/swagger --porcelain)" ]; then
echo "❌ swag comments are not formatted. Please run 'make swag-fmt' and commit the changes."
git diff
git checkout -- docs/swagger
exit 1
fi
@ -29,7 +27,6 @@ fi
make swagger
if [ -n "$(git status docs/swagger --porcelain)" ]; then
echo "❌ swagger documentation not updated, please run 'make swagger' and commit the changes."
git diff
git checkout -- docs/swagger
exit 1
fi