models

package
v0.0.0-...-5bf7ce9 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash verifies if the given password matches the hash.

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hashes the given password using bcrypt.

Types

type Group

type Group struct {
	Name         string    `bson:"name" json:"name"`
	PasswordHash string    `bson:"password_hash" json:"-"`
	CreatedAt    time.Time `bson:"created_at" json:"created_at"`
}

Group represents a padel group context.

type Match

type Match struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	GroupName string             `bson:"group_name" json:"group_name"`
	Timestamp time.Time          `bson:"timestamp" json:"timestamp"`
	Status    string             `bson:"status" json:"status"` // "pending", "completed", "cancelled"
}

Match represents a single match played in a group.

type MatchDetail

type MatchDetail struct {
	MatchID    primitive.ObjectID   `bson:"match_id" json:"match_id"`
	Team1      []primitive.ObjectID `bson:"team1" json:"team1"`
	Team2      []primitive.ObjectID `bson:"team2" json:"team2"`
	ScoreTeam1 int                  `bson:"score_team1" json:"score_team1"`
	ScoreTeam2 int                  `bson:"score_team2" json:"score_team2"`
}

MatchDetail stores the details of a match (teams, scores).

type MatchResponse

type MatchResponse struct {
	ID         primitive.ObjectID `json:"id"`
	GroupName  string             `json:"group_name"`
	Timestamp  time.Time          `json:"timestamp"`
	Team1      []PlayerInfo       `json:"team1"`
	Team2      []PlayerInfo       `json:"team2"`
	ScoreTeam1 int                `json:"score_team1"`
	ScoreTeam2 int                `json:"score_team2"`
	Status     string             `json:"status"`
}

MatchResponse combines Match and MatchDetail with player names for API responses

type Player

type Player struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	GroupName string             `bson:"group_name" json:"group_name"`
	Name      string             `bson:"name" json:"name"`
}

Player represents a player within a group.

type PlayerInfo

type PlayerInfo struct {
	ID   primitive.ObjectID `json:"id"`
	Name string             `json:"name"`
}

PlayerInfo contains the essential player information for responses

Jump to

Keyboard shortcuts

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