Allow adding users to rooms
This commit is contained in:
@@ -11,8 +11,9 @@ type Room struct {
|
||||
Address string `json:"address"`
|
||||
Website string `json:"website"`
|
||||
Capacity int `json:"capacity"`
|
||||
IsPublic bool `json:"isPublic" gorm:"default:false"`
|
||||
IsPublic bool `json:"isPublic" gorm:"default:true"`
|
||||
Admins []User `gorm:"many2many:room_admins;"`
|
||||
Users []User `gorm:"many2many:room_users;"`
|
||||
}
|
||||
|
||||
func NewRoom(ctx *gin.Context) (Room, error) {
|
||||
|
||||
@@ -9,4 +9,5 @@ type User struct {
|
||||
Name string `json:"name" binding:"required" gorm:"unique;not null"`
|
||||
Password string `json:"password" binding:"required" gorm:"not null"`
|
||||
Email string `json:"email" binding:"required,email" gorm:"unique;not null"`
|
||||
OwnedRooms []Room `gorm:"many2many:room_admins;"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user