feat: 添加数据库资产、命令拦截器、授权资产等功能,修复GitHub Actions工作流
This commit is contained in:
@@ -3,6 +3,7 @@ package repository
|
||||
import (
|
||||
"context"
|
||||
|
||||
"next-terminal/server/common"
|
||||
"next-terminal/server/model"
|
||||
)
|
||||
|
||||
@@ -18,7 +19,8 @@ func (r websiteRepository) FindAll(c context.Context) (o []model.Website, err er
|
||||
}
|
||||
|
||||
func (r websiteRepository) Find(c context.Context, pageIndex, pageSize int, keyword string) (o []model.WebsiteForPage, total int64, err error) {
|
||||
db := r.GetDB(c).Table("websites").Select("id,name,enabled,target_url,target_host,target_port,domain,status,status_text,created,group_id,sort")
|
||||
db := r.GetDB(c).Table("websites").Select(`id,name,enabled,target_url,target_host,target_port,domain,status,status_text,
|
||||
strftime('%s', created) * 1000 as created,group_id,sort`)
|
||||
dbCounter := r.GetDB(c).Table("websites")
|
||||
|
||||
if len(keyword) > 0 {
|
||||
@@ -39,6 +41,7 @@ func (r websiteRepository) Find(c context.Context, pageIndex, pageSize int, keyw
|
||||
}
|
||||
|
||||
func (r websiteRepository) Create(c context.Context, o *model.Website) error {
|
||||
o.Created = common.NowJsonTime()
|
||||
return r.GetDB(c).Create(o).Error
|
||||
}
|
||||
|
||||
@@ -55,3 +58,8 @@ func (r websiteRepository) FindById(c context.Context, id string) (o model.Websi
|
||||
err = r.GetDB(c).Where("id = ?", id).First(&o).Error
|
||||
return
|
||||
}
|
||||
|
||||
func (r websiteRepository) Count(c context.Context) (total int64, err error) {
|
||||
err = r.GetDB(c).Model(&model.Website{}).Count(&total).Error
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user