Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirari04 committed May 13, 2024
2 parents a921e8c + 8052e96 commit c390f23
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This project is a cms for hosting your videos.

## Documentation

Follow the documentation to setup VideoCMS: [https://videocms-docs.vercel.app/](https://videocms-docs.vercel.app/)

## Screenshots
Expand Down
2 changes: 1 addition & 1 deletion controllers/CreateTagController.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func CreateTagController(c echo.Context) error {
return c.String(status, err.Error())
}

status, dbTag, err := logic.CreateTag(validator.Name, validator.FileID, c.Get("UserID").(uint))
status, dbTag, err := logic.CreateTag(validator.Name, validator.LinkId, c.Get("UserID").(uint))

if err != nil {
return c.String(status, err.Error())
Expand Down
5 changes: 5 additions & 0 deletions controllers/CreateWebPageController.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"ch/kirari04/videocms/helpers"
"ch/kirari04/videocms/inits"
"ch/kirari04/videocms/models"
"fmt"
"log"
"net/http"

Expand All @@ -28,6 +29,10 @@ func CreateWebPage(c echo.Context) error {
return c.String(http.StatusBadRequest, "Path already used")
}

if validatus.Path[len(validatus.Path)-1] != '/' {
validatus.Path = fmt.Sprintf("%s/", validatus.Path)
}

webPage := models.WebPage{
Path: validatus.Path,
Title: validatus.Title,
Expand Down
2 changes: 1 addition & 1 deletion controllers/DeleteTagController.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func DeleteTagController(c echo.Context) error {
return c.String(status, err.Error())
}

status, err := logic.DeleteTag(validator.TagID, validator.FileID, c.Get("UserID").(uint))
status, err := logic.DeleteTag(validator.TagId, validator.LinkId, c.Get("UserID").(uint))

if err != nil {
return c.String(status, err.Error())
Expand Down
6 changes: 3 additions & 3 deletions models/Tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ type TagLinks struct {

type TagCreateValidation struct {
Name string `validate:"required,min=1,max=120" json:"Name" form:"Name"`
FileID uint `validate:"required,number" json:"FileID" form:"FileID"`
LinkId uint `validate:"required,number" json:"LinkId" form:"LinkId"`
}

type TagDeleteValidation struct {
TagID uint `validate:"required,number" json:"TagID" form:"TagID"`
FileID uint `validate:"required,number" json:"FileID" form:"FileID"`
TagId uint `validate:"required,number" json:"TagId" form:"TagId"`
LinkId uint `validate:"required,number" json:"LinkId" form:"LinkId"`
}
6 changes: 3 additions & 3 deletions models/WebPage.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ type WebPage struct {
}

type WebPageCreateValidation struct {
Path string `validate:"required,dirpath,min=2,max=50"`
Path string `validate:"required,min=2,max=50"`
Title string `validate:"required,min=2,max=128"`
Html string `validate:"required,min=0,max=50000"`
ListInFooter *bool `validate:"required,boolean"`
}

type WebPageUpdateValidation struct {
WebPageID uint `validate:"required,number"`
Path string `validate:"required,dirpath,min=2,max=50"`
Path string `validate:"required,min=2,max=50"`
Title string `validate:"required,min=2,max=128"`
Html string `validate:"required,min=0,max=50000"`
ListInFooter *bool `validate:"required,boolean"`
Expand All @@ -28,5 +28,5 @@ type WebPageDeleteValidation struct {
}

type WebPageGetValidation struct {
Path string `validate:"required,dirpath,min=2,max=50" query:"Path"`
Path string `validate:"required,min=2,max=50" query:"Path"`
}
2 changes: 1 addition & 1 deletion routes/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func Api() {
protectedApi.GET("/servers", controllers.ListServers, middlewares.IsAdmin())

protectedApi.GET("/pages", controllers.ListWebPage, middlewares.IsAdmin())
protectedApi.GET("/page", controllers.CreateWebPage, middlewares.IsAdmin())
protectedApi.POST("/page", controllers.CreateWebPage, middlewares.IsAdmin())
protectedApi.PUT("/page", controllers.UpdateWebPage, middlewares.IsAdmin())
protectedApi.DELETE("/page", controllers.DeleteWebPage, middlewares.IsAdmin())

Expand Down

0 comments on commit c390f23

Please sign in to comment.