domain

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChallengeTypeBool   = "bool"
	ChallengeTimeFormat = "2006-01-02"
	LocaleRu            = "ru"
	LocaleEn            = "en"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Badge

type Badge struct {
	ID     int // probably not needed
	UserID uuid.UUID
	Type   string
	Active bool
	Meta   map[string]interface{}
}

type Challenge

type Challenge struct {
	ID             uuid.UUID
	AuthorID       uuid.UUID
	Type           string
	Content        string
	Description    string
	Outcome        *bool
	Published      bool
	StartTime      time.Time
	EndTime        time.Time
	Predictions    []*Prediction
	Proofs         []*Proof
	UserPrediction *Prediction
}

func (*Challenge) AllowDetailsEdit

func (ch *Challenge) AllowDetailsEdit() bool

func (*Challenge) AllowOutcomeEdit

func (ch *Challenge) AllowOutcomeEdit() bool

func (*Challenge) AllowShowVotes added in v0.0.3

func (ch *Challenge) AllowShowVotes() bool

func (*Challenge) AllowVoting

func (ch *Challenge) AllowVoting() bool

func (*Challenge) EditURL

func (ch *Challenge) EditURL() string

func (*Challenge) EndStr

func (ch *Challenge) EndStr() string

func (*Challenge) Finished

func (ch *Challenge) Finished() bool

func (*Challenge) HasOutcome

func (ch *Challenge) HasOutcome() bool

func (*Challenge) HasOutcomeAndTrue

func (ch *Challenge) HasOutcomeAndTrue() bool

func (*Challenge) HasProofs

func (ch *Challenge) HasProofs() bool

func (*Challenge) PercFalse

func (ch *Challenge) PercFalse() int

func (*Challenge) PercTrue

func (ch *Challenge) PercTrue() int

func (*Challenge) StartStr

func (ch *Challenge) StartStr() string

func (*Challenge) Started

func (ch *Challenge) Started() bool

func (*Challenge) URL

func (ch *Challenge) URL() string

func (*Challenge) Votes

func (ch *Challenge) Votes() int

func (*Challenge) VotesFalse

func (ch *Challenge) VotesFalse() int

func (*Challenge) VotesTrue

func (ch *Challenge) VotesTrue() int

type CreateChallengeArgs

type CreateChallengeArgs struct {
	Type        string    `json:"type"`
	Content     string    `json:"content"`
	Description string    `json:"description"`
	StartTime   string    `json:"startTime"`
	EndTime     string    `json:"endTime"`
	Published   bool      `json:"published"`
	TimeLayout  string    `json:"timeLayout"`
	Outcome     *bool     `json:"outcome"`
	AuthorID    uuid.UUID `json:"authorID"`
}

func (*CreateChallengeArgs) GetEndTime

func (a *CreateChallengeArgs) GetEndTime() (time.Time, error)

func (*CreateChallengeArgs) GetStartEndTime

func (a *CreateChallengeArgs) GetStartEndTime() (time.Time, time.Time, error)

func (*CreateChallengeArgs) GetStartTime

func (a *CreateChallengeArgs) GetStartTime() (time.Time, error)

func (*CreateChallengeArgs) Validate

func (a *CreateChallengeArgs) Validate() error

type CreatePredictionFromPresetArgs

type CreatePredictionFromPresetArgs struct {
	UserEmail        string `json:"userEmail"`
	ChallengeContent string `json:"challengeContent"`
	Prognosis        bool   `json:"prognosis"`
}

type FilterChallengesArgs

type FilterChallengesArgs struct {
	UserID      uuid.UUID
	AuthorID    uuid.UUID
	Unvoted     bool
	Ongoing     bool
	Pending     bool
	Unpublished bool
	Finished    bool
	Limit       int
	Offset      int
}

func (*FilterChallengesArgs) Validate

func (a *FilterChallengesArgs) Validate(requireUser bool) error

type Prediction

type Prediction struct {
	ID          uuid.UUID
	UserID      uuid.UUID
	ChallengeID uuid.UUID
	Prognosis   bool
	Meta        map[string]interface{}
}

type Proof

type Proof struct {
	ID          uuid.UUID
	ChallengeID uuid.UUID
	Content     string
	Link        string
	Meta        map[string]interface{}
}

type SystemSymmary

type SystemSymmary struct {
	ID                 int
	Users              int
	Challenges         int
	OngoingChallenges  int
	FinishedChallenges int
	Predictions        int
	CreateTime         time.Time
}

type User

type User struct {
	ID           uuid.UUID
	Name         string
	Email        string
	Admin        bool
	Picture      string
	Password     string
	PasswordHash string
	Locale       string
	Meta         map[string]interface{}
}

type UserSession

type UserSession struct {
	ID           int    // probably uuid not needed here, sessions are temporary anyways
	SID          string // code to identify the session
	UserID       uuid.UUID
	IP           string
	UserAgent    string
	CreateTime   time.Time
	UpdateTime   time.Time
	LastActivity time.Time
	Meta         map[string]interface{}
	Active       bool
}

type UserSummary

type UserSummary struct {
	UserID               uuid.UUID
	CorrectPredictions   int
	IncorrectPredictions int
	UnknownPredictions   int
}

func (*UserSummary) PercCorrect

func (us *UserSummary) PercCorrect() int

func (*UserSummary) PercIncorrect

func (us *UserSummary) PercIncorrect() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL