Allow adding users to rooms

This commit is contained in:
2025-01-04 23:12:56 +01:00
parent c78a84e075
commit 2eadad9135
6 changed files with 189 additions and 14 deletions

View File

@@ -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) {

View File

@@ -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;"`
}