Added membership for users
This commit is contained in:
parent
acfe6b7d0c
commit
a7cd86962e
5 changed files with 238 additions and 28 deletions
|
|
@ -9,13 +9,15 @@ type User struct {
|
|||
}
|
||||
|
||||
type Member struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement:true"`
|
||||
PlanID uint
|
||||
Plan Plan
|
||||
Type string `gorm:"check:type in ('member','non-member')"`
|
||||
Name string `gorm:"check:type=='member' OR name IS NOT NULL" json:"name"`
|
||||
UserID string
|
||||
User User `gorm:"foreignKey:UserID"`
|
||||
ID uint `gorm:"primaryKey;autoIncrement:true" json:"-"`
|
||||
PlanID uint `json:"-"`
|
||||
Plan Plan `json:"-"`
|
||||
Type string `gorm:"check:type in ('user','non-user')" json:"type"`
|
||||
Name string `gorm:"check:type=='member' OR name IS NOT NULL" json:"name"`
|
||||
Status string `gorm:"check:status in ('pending','ready')" json:"status"`
|
||||
JoinCode string `gorm:"uniqueIndex;check:type=='non-member' OR join_code IS NOT NULL" json:"join_code,omitempty"`
|
||||
UserID string `json:"username"`
|
||||
User User `gorm:"foreignKey:UserID" json:"-"`
|
||||
}
|
||||
|
||||
// CREATE TABLE plans(id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING, owner STRING, FOREIGN KEY(owner) REFERENCES users(username))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue