fix many to many relationship between users and simulations

This commit is contained in:
Sonja Happ 2019-06-03 14:30:15 +02:00
parent 6e84929ef9
commit 084d3ec8d8

View file

@ -17,10 +17,9 @@ type User struct {
// Role of user
Role string `gorm:"default:'user'"`
// Simulations to which user has access
Simulations []Simulation `gorm:"many2many:user_simulations"`
Simulations []*Simulation `gorm:"many2many:user_simulations"`
}
// Simulation data model
type Simulation struct {
// ID of simulation
@ -32,7 +31,7 @@ type Simulation struct {
// Start parameters of simulation as JSON string
StartParameters string
// Users that have access to the simulation
Users []User `gorm:"not null;many2many:user_simulations"`
Users []*User `gorm:"not null;many2many:user_simulations"`
// Models that belong to the simulation
Models []Model `gorm:"foreignkey:SimulationID"`
// Visualizations that belong to the simulation
@ -76,7 +75,6 @@ type Signal struct {
Direction string
}
// Simulator data model
type Simulator struct {
// ID of the simulator
@ -113,7 +111,6 @@ type Visualization struct {
Widgets []Widget `gorm:"foreignkey:VisualizationID"`
}
// Widget data model
type Widget struct {
// ID of widget
@ -146,7 +143,6 @@ type Widget struct {
Files []File `gorm:"foreignkey:WidgetID"`
}
// File data model
type File struct {
// ID of file