Add String method to user model
This commit is contained in:
parent
af6aa5190f
commit
787908de2f
2 changed files with 4 additions and 4 deletions
|
@ -193,9 +193,9 @@ func (model *Participant) Create(db *Database, args map[string]string, w http.Re
|
|||
// Check if participant exists
|
||||
log.Printf("Check if participant %s already exists", participant)
|
||||
if user, err := participant.exists(db); err == nil && user != nil {
|
||||
if err := db._db.Where("user_id = ?", user.ID).Find(&participant).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// if err := db._db.Where("user_id = ?", user.ID).Find(&participant).Error; err != nil && err != gorm.ErrRecordNotFound {
|
||||
// return nil, err
|
||||
// }
|
||||
return nil, errors.ParticipantExists
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -25,7 +25,7 @@ var (
|
|||
func (model *User) GetID() uint { return model.ID }
|
||||
|
||||
func (model *User) String() string {
|
||||
return "" // Please implement this.
|
||||
return model.Username
|
||||
}
|
||||
|
||||
func genPassword() (string, error) {
|
||||
|
|
Loading…
Reference in a new issue