Handle user creation upon registration.
This commit is contained in:
parent
79d2db3c1f
commit
8657380530
13 changed files with 201 additions and 46 deletions
|
|
@ -128,9 +128,19 @@ func (uc *UserCreate) check() error {
|
|||
if _, ok := uc.mutation.Username(); !ok {
|
||||
return &ValidationError{Name: "username", err: errors.New(`ent: missing required field "username"`)}
|
||||
}
|
||||
if v, ok := uc.mutation.Username(); ok {
|
||||
if err := user.UsernameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "username", err: fmt.Errorf(`ent: validator failed for field "username": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := uc.mutation.Password(); !ok {
|
||||
return &ValidationError{Name: "password", err: errors.New(`ent: missing required field "password"`)}
|
||||
}
|
||||
if v, ok := uc.mutation.Password(); ok {
|
||||
if err := user.PasswordValidator(v); err != nil {
|
||||
return &ValidationError{Name: "password", err: fmt.Errorf(`ent: validator failed for field "password": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := uc.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "created_at"`)}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue