cds-web/models/user.go
2022-10-09 02:15:25 +02:00

35 lines
917 B
Go

package models
import "go.mongodb.org/mongo-driver/bson/primitive"
type User struct {
Id primitive.ObjectID `bson:"_id", omitempty`
Banned bool `bson:banned`
BlackLister bool `bson:"blacklisted"`
Experience uint `bson:"experience"`
//LastBuy string `bson:"lastBuy,omitempty"`
Level uint `bson:"level"`
Money uint `bson:"money"`
MoneyLimit uint `bson:"moneyLimit"`
DiscordId string `bson:"userId,omitempty"`
SteamId string `bson:"steamId,omitempty"`
DiscordName string `bson:"username,omitempty"`
}
func NewUser() *User {
return &User{primitive.NewObjectID(), false, false, 0, 0, 0, 0, "", "", ""}
}
func NewUserDiscord(id string, name string) *User {
ret := NewUser()
ret.DiscordId = id
ret.DiscordName = name
return ret
}
func NewUserSteam(id string) *User {
ret := NewUser()
ret.SteamId = id
return ret
}