feat: add notifications for renew certs #192

This commit is contained in:
0xJacky 2023-12-05 14:35:58 +08:00
parent ddb6cee153
commit 994b9087ae
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
45 changed files with 1971 additions and 594 deletions

View file

@ -34,6 +34,7 @@ func GenerateAllModel() []any {
Site{},
DnsCredential{},
Environment{},
Notification{},
}
}
@ -99,12 +100,8 @@ func OrderAndPaginate(c *gin.Context) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
sort := c.DefaultQuery("order", "desc")
sortBy := DefaultQuery(c, "sort_by", "")
if sortBy != "" {
order := fmt.Sprintf("`%s` %s", DefaultQuery(c, "sort_by", "id"), sort)
db = db.Order(order)
}
order := fmt.Sprintf("`%s` %s", DefaultQuery(c, "sort_by", "id"), sort)
db = db.Order(order)
page := cast.ToInt(c.Query("page"))
if page == 0 {

17
model/notification.go Normal file
View file

@ -0,0 +1,17 @@
package model
type NotificationType int
const (
NotificationError NotificationType = iota
NotificationWarning
NotificationInfo
NotificationSuccess
)
type Notification struct {
Model
Type NotificationType `json:"type"`
Title string `json:"title"`
Details string `json:"details"`
}