cds-web/models/user.go

35 lines
1 KiB
Go
Raw Normal View History

2022-10-09 02:15:25 +02:00
package models
import "go.mongodb.org/mongo-driver/bson/primitive"
type User struct {
Id primitive.ObjectID `bson:"_id" json:"id", omitempty`
Banned bool `bson:"banned" json:"banned"`
BlackLister bool `bson:"blacklisted" json:"blacklisted"`
Experience uint `bson:"experience" json:"experience"`
2022-10-09 02:15:25 +02:00
//LastBuy string `bson:"lastBuy,omitempty"`
Level uint `bson:"level" json:"level"`
Money uint `bson:"money" json:"money"`
MoneyLimit uint `bson:"moneyLimit" json:"moneylimit"`
DiscordId string `bson:"userId,omitempty" json:"userid"`
SteamId string `bson:"steamId,omitempty" json:"steamid"`
DiscordName string `bson:"username,omitempty" json:"discordname"`
2022-10-09 02:15:25 +02:00
}
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
}