mirror of
https://github.com/teamhanko/hanko.git
synced 2025-10-27 06:06:54 +08:00
25 lines
667 B
Go
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
|
|
}
|