Skip to content

feat: site category #657

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 7 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/certificate/acme_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

func GetAcmeUser(c *gin.Context) {
u := query.AcmeUser
id := cast.ToInt(c.Param("id"))
id := cast.ToUint64(c.Param("id"))
user, err := u.FirstByID(id)
if err != nil {
api.ErrHandler(c, err)
Expand Down Expand Up @@ -79,7 +79,7 @@ func RecoverAcmeUser(c *gin.Context) {
}

func RegisterAcmeUser(c *gin.Context) {
id := cast.ToInt(c.Param("id"))
id := cast.ToUint64(c.Param("id"))
u := query.AcmeUser
user, err := u.FirstByID(id)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions api/certificate/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func GetCertList(c *gin.Context) {
func GetCert(c *gin.Context) {
q := query.Cert

certModel, err := q.FirstByID(cast.ToInt(c.Param("id")))
certModel, err := q.FirstByID(cast.ToUint64(c.Param("id")))

if err != nil {
api.ErrHandler(c, err)
Expand All @@ -89,9 +89,9 @@ type certJson struct {
SSLCertificateKey string `json:"ssl_certificate_key" binding:"omitempty,privatekey"`
KeyType certcrypto.KeyType `json:"key_type" binding:"omitempty,auto_cert_key_type"`
ChallengeMethod string `json:"challenge_method"`
DnsCredentialID int `json:"dns_credential_id"`
ACMEUserID int `json:"acme_user_id"`
SyncNodeIds []int `json:"sync_node_ids"`
DnsCredentialID uint64 `json:"dns_credential_id"`
ACMEUserID uint64 `json:"acme_user_id"`
SyncNodeIds []uint64 `json:"sync_node_ids"`
}

func AddCert(c *gin.Context) {
Expand Down Expand Up @@ -141,7 +141,7 @@ func AddCert(c *gin.Context) {
}

func ModifyCert(c *gin.Context) {
id := cast.ToInt(c.Param("id"))
id := cast.ToUint64(c.Param("id"))

var json certJson

Expand Down
4 changes: 2 additions & 2 deletions api/certificate/dns_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func GetDnsCredential(c *gin.Context) {
id := cast.ToInt(c.Param("id"))
id := cast.ToUint64(c.Param("id"))

d := query.DnsCredential

Expand Down Expand Up @@ -70,7 +70,7 @@ func AddDnsCredential(c *gin.Context) {
}

func EditDnsCredential(c *gin.Context) {
id := cast.ToInt(c.Param("id"))
id := cast.ToUint64(c.Param("id"))

var json DnsCredentialManageJson
if !api.BindAndValid(c, &json) {
Expand Down
4 changes: 2 additions & 2 deletions api/cluster/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func GetEnvironment(c *gin.Context) {
id := cast.ToInt(c.Param("id"))
id := cast.ToUint64(c.Param("id"))

envQuery := query.Environment

Expand Down Expand Up @@ -67,7 +67,7 @@ func EditEnvironment(c *gin.Context) {
}

func DeleteEnvironment(c *gin.Context) {
id := cast.ToInt(c.Param("id"))
id := cast.ToUint64(c.Param("id"))
envQuery := query.Environment

env, err := envQuery.FirstByID(id)
Expand Down
2 changes: 1 addition & 1 deletion api/cluster/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ func InitRouter(r *gin.RouterGroup) {
// Environment
r.GET("environments", GetEnvironmentList)
r.POST("environments/load_from_settings", LoadEnvironmentFromSettings)
envGroup := r.Group("environment")
envGroup := r.Group("environments")
{
envGroup.GET("/:id", GetEnvironment)
envGroup.POST("", AddEnvironment)
Expand Down
10 changes: 5 additions & 5 deletions api/config/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (

func AddConfig(c *gin.Context) {
var json struct {
Name string `json:"name" binding:"required"`
NewFilepath string `json:"new_filepath" binding:"required"`
Content string `json:"content"`
Overwrite bool `json:"overwrite"`
SyncNodeIds []int `json:"sync_node_ids"`
Name string `json:"name" binding:"required"`
NewFilepath string `json:"new_filepath" binding:"required"`
Content string `json:"content"`
Overwrite bool `json:"overwrite"`
SyncNodeIds []uint64 `json:"sync_node_ids"`
}

if !api.BindAndValid(c, &json) {
Expand Down
4 changes: 2 additions & 2 deletions api/config/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

type APIConfigResp struct {
config.Config
SyncNodeIds []int `json:"sync_node_ids" gorm:"serializer:json"`
SyncOverwrite bool `json:"sync_overwrite"`
SyncNodeIds []uint64 `json:"sync_node_ids" gorm:"serializer:json"`
SyncOverwrite bool `json:"sync_overwrite"`
}

func GetConfig(c *gin.Context) {
Expand Down
12 changes: 6 additions & 6 deletions api/config/modify.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ type EditConfigJson struct {
func EditConfig(c *gin.Context) {
name := c.Param("name")
var json struct {
Name string `json:"name" binding:"required"`
Filepath string `json:"filepath" binding:"required"`
NewFilepath string `json:"new_filepath" binding:"required"`
Content string `json:"content"`
SyncOverwrite bool `json:"sync_overwrite"`
SyncNodeIds []int `json:"sync_node_ids"`
Name string `json:"name" binding:"required"`
Filepath string `json:"filepath" binding:"required"`
NewFilepath string `json:"new_filepath" binding:"required"`
Content string `json:"content"`
SyncOverwrite bool `json:"sync_overwrite"`
SyncNodeIds []uint64 `json:"sync_node_ids"`
}
if !api.BindAndValid(c, &json) {
return
Expand Down
8 changes: 4 additions & 4 deletions api/config/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (

func Rename(c *gin.Context) {
var json struct {
BasePath string `json:"base_path"`
OrigName string `json:"orig_name"`
NewName string `json:"new_name"`
SyncNodeIds []int `json:"sync_node_ids" gorm:"serializer:json"`
BasePath string `json:"base_path"`
OrigName string `json:"orig_name"`
NewName string `json:"new_name"`
SyncNodeIds []uint64 `json:"sync_node_ids" gorm:"serializer:json"`
}
if !api.BindAndValid(c, &json) {
return
Expand Down
6 changes: 3 additions & 3 deletions api/config/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ func InitRouter(r *gin.RouterGroup) {
r.GET("config_base_path", GetBasePath)

r.GET("configs", GetConfigs)
r.GET("config/*name", GetConfig)
r.POST("config", AddConfig)
r.POST("config/*name", EditConfig)
r.GET("configs/*name", GetConfig)
r.POST("configs", AddConfig)
r.POST("configs/*name", EditConfig)

o := r.Group("", middleware.RequireSecureSession())
{
Expand Down
2 changes: 1 addition & 1 deletion api/notification/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func Get(c *gin.Context) {
n := query.Notification

id := cast.ToInt(c.Param("id"))
id := cast.ToUint64(c.Param("id"))

data, err := n.FirstByID(id)

Expand Down
4 changes: 2 additions & 2 deletions api/notification/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "github.com/gin-gonic/gin"

func InitRouter(r *gin.RouterGroup) {
r.GET("notifications", GetList)
r.GET("notification/:id", Get)
r.DELETE("notification/:id", Destroy)
r.GET("notifications/:id", Get)
r.DELETE("notifications/:id", Destroy)
r.DELETE("notifications", DestroyAll)
}
2 changes: 1 addition & 1 deletion api/sites/auto_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func AddDomainToAutoCert(c *gin.Context) {
name := c.Param("name")

var json struct {
DnsCredentialID int `json:"dns_credential_id"`
DnsCredentialID uint64 `json:"dns_credential_id"`
ChallengeMethod string `json:"challenge_method"`
Domains []string `json:"domains"`
KeyType certcrypto.KeyType `json:"key_type"`
Expand Down
2 changes: 1 addition & 1 deletion api/sites/category.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func GetCategory(c *gin.Context) {

cosy.Core[model.SiteCategory](c).Get()
}

func GetCategoryList(c *gin.Context) {
Expand Down
Loading
Loading