domain

package
v0.0.0-...-6c82b23 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	AuthToken       string       `db:"authToken"`
	UserId          uuid.UUID    `db:"userId"`
	AuthTokenExp    time.Time    `db:"authTokenExp"`
	SessionToken    string       `db:"sessionToken"`
	SessionTokenExp time.Time    `db:"sessionTokenExp"`
	AuthLvl         enum.AuthLvl `db:"authLvl"`
	LastUpdated     time.Time    `db:"lastUpdated"`
	Slug            string       `db:"slug"`
}

func (*Auth) GenerateSecureSessionToken

func (a *Auth) GenerateSecureSessionToken(len int)

func (*Auth) GenerateSecureToken

func (a *Auth) GenerateSecureToken(len int)

func (*Auth) ToDTO

func (a *Auth) ToDTO() dto.Auth

func (*Auth) ToModifiedDTO

func (a *Auth) ToModifiedDTO(token string) dto.Auth

ToModifiedDTO takes in a new token, which is an encrypted version of an auth struct. A modified Auth is what we will send to the client

type AuthRepository

type AuthRepository interface {
	CreateUser(dto.NewUser) (*NewUser, *errs.AppError)
	Login(*dto.Auth) (*Auth, *User, *errs.AppError)
	Authorize(*dto.Auth) (*Auth, *errs.AppError)
	AuthorizeChat(string, string) *errs.AppError
	VerifySlug(*dto.NewUser) error
}

type AuthRepositoryDB

type AuthRepositoryDB struct {
	// contains filtered or unexported fields
}

func NewAuthRepositoryDB

func NewAuthRepositoryDB(db *sqlx.DB) AuthRepositoryDB

func (AuthRepositoryDB) Authorize

func (db AuthRepositoryDB) Authorize(authDTO *dto.Auth) (*Auth, *errs.AppError)

func (AuthRepositoryDB) AuthorizeChat

func (db AuthRepositoryDB) AuthorizeChat(token, userId string) *errs.AppError

func (AuthRepositoryDB) CreateUser

func (db AuthRepositoryDB) CreateUser(userDTO dto.NewUser) (*NewUser, *errs.AppError)

func (AuthRepositoryDB) Login

func (db AuthRepositoryDB) Login(authDTO *dto.Auth) (*Auth, *User, *errs.AppError)

func (AuthRepositoryDB) VerifySlug

func (db AuthRepositoryDB) VerifySlug(userDTO *dto.NewUser) error

type Comment

type Comment struct {
	UUID             uuid.UUID  `db:"uuid"`
	UserId           uuid.UUID  `db:"userId"`
	Text             []byte     `db:"text"`
	CreatedAt        time.Time  `db:"createdAt"`
	ReplyToID        uuid.UUID  `db:"replyTo_uuid"`
	ReplyToUserId    uuid.UUID  `db:"replyTo_userId"`
	ReplyToText      []byte     `db:"replyTo_text"`
	ReplyToCreatedAt *time.Time `db:"replyTo_createdAt"`
}

func (Comment) ToDto

func (comment Comment) ToDto() dto.Comment

type CommentRepository

type CommentRepository interface {
	FindAllComments() ([]Comment, *errs.AppError)
	CreateComment(dto.Comment) (*Comment, *errs.AppError)
	DeleteComment(string) *errs.AppError
	FindCommentsAfter(string) ([]Comment, *errs.AppError)
}

type CommentRepositoryDb

type CommentRepositoryDb struct {
	// contains filtered or unexported fields
}

func NewCommentRepositoryDb

func NewCommentRepositoryDb(db *sqlx.DB) CommentRepositoryDb

func (CommentRepositoryDb) CreateComment

func (db CommentRepositoryDb) CreateComment(commentDTO dto.Comment) (*Comment, *errs.AppError)

func (CommentRepositoryDb) DeleteComment

func (db CommentRepositoryDb) DeleteComment(uuid string) *errs.AppError

func (CommentRepositoryDb) FindAllComments

func (db CommentRepositoryDb) FindAllComments() ([]Comment, *errs.AppError)

func (CommentRepositoryDb) FindCommentsAfter

func (db CommentRepositoryDb) FindCommentsAfter(commentId string) ([]Comment, *errs.AppError)

type Country

type Country struct {
	Name          string `db:"name"`
	Slug          string `db:"slug"`
	BandName      string `db:"bandName"`
	SongName      string `db:"songName"`
	Flag          string `db:"flag"`
	Participating bool   `db:"participating"`
}

func (Country) ToDto

func (c Country) ToDto() dto.Country

type CountryRepository

type CountryRepository interface {
	FindAllCountries() (*[]Country, *errs.AppError)
	FindOneCountry(string) (*Country, *errs.AppError)
	UpdateCountry(dto.Country) (*Country, *errs.AppError)
	FindParticipating() (*[]Country, *errs.AppError)
}

type CountryRepositoryDb

type CountryRepositoryDb struct {
	// contains filtered or unexported fields
}

func NewCountryRepositoryDb

func NewCountryRepositoryDb(db *sqlx.DB) CountryRepositoryDb

func (CountryRepositoryDb) FindAllCountries

func (db CountryRepositoryDb) FindAllCountries() (*[]Country, *errs.AppError)

func (CountryRepositoryDb) FindOneCountry

func (db CountryRepositoryDb) FindOneCountry(slug string) (*Country, *errs.AppError)

func (CountryRepositoryDb) FindParticipating

func (db CountryRepositoryDb) FindParticipating() (*[]Country, *errs.AppError)

func (CountryRepositoryDb) UpdateCountry

func (db CountryRepositoryDb) UpdateCountry(countryDTO dto.Country) (*Country, *errs.AppError)

type NewUser

type NewUser struct {
	UUID  uuid.UUID `db:"uuid"`
	Name  string    `db:"name"`
	Slug  string    `db:"slug"`
	Token string    `db:"authToken"`
}

func (*NewUser) ToDTO

func (user *NewUser) ToDTO() *dto.NewUser

type Result

type Result struct {
	CountrySlug string `db:"countrySlug"`
	Costume     int    `db:"costume_total"`
	Song        int    `db:"song_total"`
	Performance int    `db:"performance_total"`
	Props       int    `db:"props_total"`
	Total       int    `db:"total"`
}

func (Result) ToDto

func (r Result) ToDto() dto.Result

type User

type User struct {
	UUID    uuid.UUID    `db:"uuid"`
	AuthLvl enum.AuthLvl `db:"authLvl"`
	Name    string       `db:"name"`
	Slug    string       `db:"slug"`
	Icon    string       `db:"icon"`
}

func (User) ToDto

func (user User) ToDto() dto.User

type UserRepository

type UserRepository interface {
	FindAllUsers() ([]User, *errs.AppError)
	FindOneUser(string) (*User, *errs.AppError)
	DeleteUser(string) *errs.AppError
	FindRegisteredUsers() (*[]NewUser, *errs.AppError)
	UpdateUser(dto.User) (*User, *dto.Comment, *errs.AppError)
	UpdateUserImage(avatarDTO dto.UserAvatar, img *dto.CroppedImage) (*User, *dto.Comment, *errs.AppError)
}

type UserRepositoryDb

type UserRepositoryDb struct {
	// contains filtered or unexported fields
}

func NewUserRepositoryDb

func NewUserRepositoryDb(db *sqlx.DB) UserRepositoryDb

func (UserRepositoryDb) DeleteUser

func (db UserRepositoryDb) DeleteUser(slug string) *errs.AppError

func (UserRepositoryDb) FindAllUsers

func (db UserRepositoryDb) FindAllUsers() ([]User, *errs.AppError)

func (UserRepositoryDb) FindOneUser

func (db UserRepositoryDb) FindOneUser(slug string) (*User, *errs.AppError)

func (UserRepositoryDb) FindRegisteredUsers

func (db UserRepositoryDb) FindRegisteredUsers() (*[]NewUser, *errs.AppError)

func (UserRepositoryDb) UpdateUser

func (db UserRepositoryDb) UpdateUser(userDTO dto.User) (*User, *dto.Comment, *errs.AppError)

func (UserRepositoryDb) UpdateUserImage

func (db UserRepositoryDb) UpdateUserImage(avatarDTO dto.UserAvatar, img *dto.CroppedImage) (*User, *dto.Comment, *errs.AppError)

type Vote

type Vote struct {
	UserId      uuid.UUID `db:"userId"`
	CountrySlug string    `db:"countrySlug"`
	Costume     uint8     `db:"costume"`
	Song        uint8     `db:"song"`
	Performance uint8     `db:"performance"`
	Props       uint8     `db:"props"`
}

func (Vote) ToDto

func (vote Vote) ToDto() dto.Vote

type VoteRepository

type VoteRepository interface {
	CreateVote(dto.Vote) (*Vote, *errs.AppError)
	UpdateVote(dto.VoteSingle) (*Vote, *errs.AppError)
	GetVoteByUserAndCountry(uuid.UUID, string) (*Vote, *errs.AppError)
	GetResults() (*[]Result, *errs.AppError)
	GetResultsByUser(userId string) (*[]Result, *errs.AppError)
}

type VoteRepositoryDb

type VoteRepositoryDb struct {
	// contains filtered or unexported fields
}

func NewVoteRepositoryDb

func NewVoteRepositoryDb(db *sqlx.DB) VoteRepositoryDb

func (VoteRepositoryDb) CreateVote

func (db VoteRepositoryDb) CreateVote(voteDTO dto.Vote) (*Vote, *errs.AppError)

func (VoteRepositoryDb) GetResults

func (db VoteRepositoryDb) GetResults() (*[]Result, *errs.AppError)

func (VoteRepositoryDb) GetResultsByUser

func (db VoteRepositoryDb) GetResultsByUser(userId string) (*[]Result, *errs.AppError)

func (VoteRepositoryDb) GetVoteByUserAndCountry

func (db VoteRepositoryDb) GetVoteByUserAndCountry(userId uuid.UUID, countrySlug string) (*Vote, *errs.AppError)

func (VoteRepositoryDb) UpdateVote

func (db VoteRepositoryDb) UpdateVote(voteDTO dto.VoteSingle) (*Vote, *errs.AppError)

Jump to

Keyboard shortcuts

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