You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/app/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
type WebsiteGroupService struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w WebsiteGroupService) CreateGroup(create dto.WebSiteGroupCreate) error {
|
|
|
|
return websiteGroupRepo.Create(&model.WebSiteGroup{
|
|
|
|
Name: create.Name,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w WebsiteGroupService) GetGroups() ([]model.WebSiteGroup, error) {
|
|
|
|
return websiteGroupRepo.GetBy()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w WebsiteGroupService) UpdateGroup(update dto.WebSiteGroupUpdate) error {
|
|
|
|
return websiteGroupRepo.Save(&model.WebSiteGroup{
|
|
|
|
BaseModel: model.BaseModel{
|
|
|
|
ID: update.ID,
|
|
|
|
},
|
|
|
|
Name: update.Name,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w WebsiteGroupService) DeleteGroup(id uint) error {
|
|
|
|
return websiteGroupRepo.DeleteBy(commonRepo.WithByID(id))
|
|
|
|
}
|