27 lines
785 B
Go
27 lines
785 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
pb "datarush/pkg/api/competition"
|
|
)
|
|
|
|
type ListCompetitionsOptions struct {
|
|
Page int
|
|
PageSize int
|
|
State *pb.CompetitionState
|
|
IsParticipating *bool
|
|
SearchQuery *string
|
|
}
|
|
|
|
type CompetitionRepository interface {
|
|
Create(ctx context.Context, competition *pb.Competition) (*pb.Competition, error)
|
|
Get(ctx context.Context, id uuid.UUID) (*pb.Competition, error)
|
|
Update(ctx context.Context, competition *pb.Competition) (*pb.Competition, error)
|
|
Delete(ctx context.Context, id uuid.UUID) error
|
|
List(ctx context.Context, opts ListCompetitionsOptions) ([]*pb.Competition, int, error)
|
|
ChangeState(ctx context.Context, id uuid.UUID, state pb.CompetitionState) (*pb.Competition, error)
|
|
}
|