VILLASweb-backend-go/user/model.go
smavros a50626fd2f Improvement of models:
- Added 'not null' tags
- Followed associations according to Mongoose schemas from the current
backend
2019-03-31 13:48:26 +02:00

26 lines
681 B
Go

package user
import (
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/file"
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/project"
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/simulation"
"github.com/jinzhu/gorm"
// TODO: we need also bcrypt
)
type User struct {
gorm.Model
Username string `gorm:"unique;not null"`
Password string `gorm:"not null"`
Mail string `gorm:"default:"`
Role string `gorm:"default:user"`
Projects []Project
Simulations []Simulaion
Files []File
}
// TODO: callback for verifying password
// TODO: execute before each user.save()
// TODO: execute before each user.delete()