Files
hanko/backend/persistence/models/password_credential.go
2022-06-09 14:36:00 +02:00

25 lines
667 B
Go

package models
import (
"github.com/gobuffalo/pop/v6"
"github.com/gobuffalo/validate/v3"
"github.com/gobuffalo/validate/v3/validators"
"github.com/gofrs/uuid"
"time"
)
type PasswordCredential struct {
ID uuid.UUID `db:"id"`
UserId uuid.UUID `db:"user_id"`
Password string `db:"password"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
func (password *PasswordCredential) Validate(tx *pop.Connection) (*validate.Errors, error) {
return validate.Validate(
&validators.StringIsPresent{Name: "Password", Field: password.Password},
&validators.UUIDIsPresent{Name: "UserId", Field: password.UserId},
), nil
}