mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
fix many to many relationship between users and simulations
This commit is contained in:
parent
6e84929ef9
commit
084d3ec8d8
1 changed files with 54 additions and 58 deletions
|
@ -17,10 +17,9 @@ type User struct {
|
||||||
// Role of user
|
// Role of user
|
||||||
Role string `gorm:"default:'user'"`
|
Role string `gorm:"default:'user'"`
|
||||||
// Simulations to which user has access
|
// Simulations to which user has access
|
||||||
Simulations []Simulation `gorm:"many2many:user_simulations"`
|
Simulations []*Simulation `gorm:"many2many:user_simulations"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Simulation data model
|
// Simulation data model
|
||||||
type Simulation struct {
|
type Simulation struct {
|
||||||
// ID of simulation
|
// ID of simulation
|
||||||
|
@ -32,7 +31,7 @@ type Simulation struct {
|
||||||
// Start parameters of simulation as JSON string
|
// Start parameters of simulation as JSON string
|
||||||
StartParameters string
|
StartParameters string
|
||||||
// Users that have access to the simulation
|
// 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 that belong to the simulation
|
||||||
Models []Model `gorm:"foreignkey:SimulationID"`
|
Models []Model `gorm:"foreignkey:SimulationID"`
|
||||||
// Visualizations that belong to the simulation
|
// Visualizations that belong to the simulation
|
||||||
|
@ -76,7 +75,6 @@ type Signal struct {
|
||||||
Direction string
|
Direction string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Simulator data model
|
// Simulator data model
|
||||||
type Simulator struct {
|
type Simulator struct {
|
||||||
// ID of the simulator
|
// ID of the simulator
|
||||||
|
@ -113,7 +111,6 @@ type Visualization struct {
|
||||||
Widgets []Widget `gorm:"foreignkey:VisualizationID"`
|
Widgets []Widget `gorm:"foreignkey:VisualizationID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Widget data model
|
// Widget data model
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
// ID of widget
|
// ID of widget
|
||||||
|
@ -146,7 +143,6 @@ type Widget struct {
|
||||||
Files []File `gorm:"foreignkey:WidgetID"`
|
Files []File `gorm:"foreignkey:WidgetID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// File data model
|
// File data model
|
||||||
type File struct {
|
type File struct {
|
||||||
// ID of file
|
// ID of file
|
||||||
|
|
Loading…
Add table
Reference in a new issue