mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
remove file belongs to user relationship
This commit is contained in:
parent
3c6e76ce7c
commit
ababe1e315
3 changed files with 10 additions and 9 deletions
|
@ -162,9 +162,9 @@ func DummyPopulateDB(test_db *gorm.DB) {
|
||||||
checkErr(test_db.Model(&proj_A).Association("Simulation").Append(&simn_A).Error)
|
checkErr(test_db.Model(&proj_A).Association("Simulation").Append(&simn_A).Error)
|
||||||
checkErr(test_db.Model(&proj_B).Association("Simulation").Append(&simn_A).Error)
|
checkErr(test_db.Model(&proj_B).Association("Simulation").Append(&simn_A).Error)
|
||||||
|
|
||||||
// User HM File, File BT User
|
// User HM Files
|
||||||
checkErr(test_db.Model(&file_A).Association("User").Append(&usr_A).Error)
|
checkErr(test_db.Model(&usr_A).Association("Files").Append(&file_A).Error)
|
||||||
checkErr(test_db.Model(&file_B).Association("User").Append(&usr_A).Error)
|
checkErr(test_db.Model(&usr_A).Association("Files").Append(&file_B).Error)
|
||||||
|
|
||||||
// Simulation HM SimModel, SimModel BT Simulation
|
// Simulation HM SimModel, SimModel BT Simulation
|
||||||
checkErr(test_db.Model(&smo_A).Association("BelongsToSimulation").Append(&simn_A).Error)
|
checkErr(test_db.Model(&smo_A).Association("BelongsToSimulation").Append(&simn_A).Error)
|
||||||
|
|
|
@ -161,7 +161,7 @@ func TestDummyDBAssociations(t *testing.T) {
|
||||||
|
|
||||||
// File Associations
|
// File Associations
|
||||||
|
|
||||||
a.NoError(db.Model(&file).Association("User").Find(&usr).Error)
|
//a.NoError(db.Model(&file).Association("User").Find(&usr).Error)
|
||||||
a.EqualValues("User_A", usr.Username)
|
//a.EqualValues("User_A", usr.Username)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,9 @@ type File struct {
|
||||||
ImageWidth uint // only required in case file is an image
|
ImageWidth uint // only required in case file is an image
|
||||||
Date time.Time
|
Date time.Time
|
||||||
|
|
||||||
User User `gorm:"not null;association_autoupdate:false"`
|
//remove belongs to User relation
|
||||||
UserID uint `gorm:"not null"`
|
//User User `gorm:"not null;association_autoupdate:false"`
|
||||||
|
//UserID uint `gorm:"not null"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Project struct {
|
type Project struct {
|
||||||
|
@ -76,7 +77,7 @@ type SimulationModel struct {
|
||||||
BelongsToSimulator Simulator `gorm:"not null;association_autoupdate:false"`
|
BelongsToSimulator Simulator `gorm:"not null;association_autoupdate:false"`
|
||||||
BelongsToSimulatorID uint `gorm:"not null"`
|
BelongsToSimulatorID uint `gorm:"not null"`
|
||||||
//new in villasweb 2.0
|
//new in villasweb 2.0
|
||||||
Files []File `gorm:"association_autoupdate:false"`
|
Files []File `gorm:""`
|
||||||
|
|
||||||
// NOTE: order of signals is important
|
// NOTE: order of signals is important
|
||||||
OutputMapping []Signal `gorm:""`
|
OutputMapping []Signal `gorm:""`
|
||||||
|
@ -93,7 +94,7 @@ type User struct {
|
||||||
|
|
||||||
Projects []Project `gorm:"association_autoupdate:false"`
|
Projects []Project `gorm:"association_autoupdate:false"`
|
||||||
Simulations []Simulation `gorm:"association_autoupdate:false"`
|
Simulations []Simulation `gorm:"association_autoupdate:false"`
|
||||||
Files []File `gorm:"association_autoupdate:false"`
|
Files []File `gorm:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Visualization struct {
|
type Visualization struct {
|
||||||
|
|
Loading…
Add table
Reference in a new issue