mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
33 lines
739 B
Go
33 lines
739 B
Go
package urlbuilders
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
)
|
|
|
|
type GroupURLBuilder struct {
|
|
BaseURL string
|
|
GroupID string
|
|
UpdatedAt string
|
|
}
|
|
|
|
func NewGroupURLBuilder(baseURL string, group *models.Group) GroupURLBuilder {
|
|
return GroupURLBuilder{
|
|
BaseURL: baseURL,
|
|
GroupID: strconv.Itoa(group.ID),
|
|
UpdatedAt: strconv.FormatInt(group.UpdatedAt.Unix(), 10),
|
|
}
|
|
}
|
|
|
|
func (b GroupURLBuilder) GetGroupFrontImageURL(hasImage bool) string {
|
|
url := b.BaseURL + "/group/" + b.GroupID + "/frontimage?t=" + b.UpdatedAt
|
|
if !hasImage {
|
|
url += "&default=true"
|
|
}
|
|
return url
|
|
}
|
|
|
|
func (b GroupURLBuilder) GetGroupBackImageURL() string {
|
|
return b.BaseURL + "/group/" + b.GroupID + "/backimage?t=" + b.UpdatedAt
|
|
}
|