2fas-server/internal/api/icons/domain/web_service.go

42 lines
890 B
Go
Raw Normal View History

2022-12-31 10:22:38 +01:00
package domain
import (
"fmt"
"github.com/google/uuid"
"gorm.io/datatypes"
"gorm.io/gorm"
)
type WebServiceAlreadyExistsError struct {
Name string
}
func (e WebServiceAlreadyExistsError) Error() string {
return fmt.Sprintf("Web service already exists: %s", e.Name)
}
type WebService struct {
gorm.Model
Id uuid.UUID `gorm:"primarykey"`
Name string
Description string
Issuers datatypes.JSON
Tags datatypes.JSON
IconsCollections datatypes.JSON
MatchRules datatypes.JSON
}
func (WebService) TableName() string {
return "web_services"
}
type WebServicesRepository interface {
Save(webService *WebService) error
Update(webService *WebService) error
Delete(webService *WebService) error
FindById(webService uuid.UUID) (*WebService, error)
FindByName(name string) (*WebService, error)
FindAll() []*WebService
}