apollo-backend/internal/domain/subreddit.go

27 lines
489 B
Go
Raw Normal View History

2021-09-25 16:56:01 +00:00
package domain
import (
"context"
"strings"
)
type Subreddit struct {
2021-10-09 14:59:20 +00:00
ID int64
LastCheckedAt float64
2021-09-25 16:56:01 +00:00
// Reddit information
SubredditID string
Name string
}
func (sr *Subreddit) NormalizedName() string {
return strings.ToLower(sr.Name)
}
type SubredditRepository interface {
GetByID(ctx context.Context, id int64) (Subreddit, error)
GetByName(ctx context.Context, name string) (Subreddit, error)
CreateOrUpdate(ctx context.Context, sr *Subreddit) error
}