Add authentication, styling needs to be fixed
# Conflicts: # starter/ent/runtime.go # starter/go.mod # starter/go.sum # starter/routes/routing.go
This commit is contained in:
+15
-27
@@ -6,11 +6,11 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.gorlug.de/code/ersteller/starter/ent/user"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"git.gorlug.de/code/ersteller/starter/ent/user"
|
||||
)
|
||||
|
||||
// UserCreate is the builder for creating a User entity.
|
||||
@@ -54,24 +54,16 @@ func (_c *UserCreate) SetEmail(v string) *UserCreate {
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableEmail sets the "email" field if the given value is not nil.
|
||||
func (_c *UserCreate) SetNillableEmail(v *string) *UserCreate {
|
||||
if v != nil {
|
||||
_c.SetEmail(*v)
|
||||
}
|
||||
// SetPasswordHash sets the "password_hash" field.
|
||||
func (_c *UserCreate) SetPasswordHash(v string) *UserCreate {
|
||||
_c.mutation.SetPasswordHash(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetPassword sets the "password" field.
|
||||
func (_c *UserCreate) SetPassword(v string) *UserCreate {
|
||||
_c.mutation.SetPassword(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillablePassword sets the "password" field if the given value is not nil.
|
||||
func (_c *UserCreate) SetNillablePassword(v *string) *UserCreate {
|
||||
// SetNillablePasswordHash sets the "password_hash" field if the given value is not nil.
|
||||
func (_c *UserCreate) SetNillablePasswordHash(v *string) *UserCreate {
|
||||
if v != nil {
|
||||
_c.SetPassword(*v)
|
||||
_c.SetPasswordHash(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
@@ -119,13 +111,9 @@ func (_c *UserCreate) defaults() {
|
||||
v := user.DefaultUpdatedAt()
|
||||
_c.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
if _, ok := _c.mutation.Email(); !ok {
|
||||
v := user.DefaultEmail
|
||||
_c.mutation.SetEmail(v)
|
||||
}
|
||||
if _, ok := _c.mutation.Password(); !ok {
|
||||
v := user.DefaultPassword
|
||||
_c.mutation.SetPassword(v)
|
||||
if _, ok := _c.mutation.PasswordHash(); !ok {
|
||||
v := user.DefaultPasswordHash
|
||||
_c.mutation.SetPasswordHash(v)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,8 +128,8 @@ func (_c *UserCreate) check() error {
|
||||
if _, ok := _c.mutation.Email(); !ok {
|
||||
return &ValidationError{Name: "email", err: errors.New(`ent: missing required field "User.email"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Password(); !ok {
|
||||
return &ValidationError{Name: "password", err: errors.New(`ent: missing required field "User.password"`)}
|
||||
if _, ok := _c.mutation.PasswordHash(); !ok {
|
||||
return &ValidationError{Name: "password_hash", err: errors.New(`ent: missing required field "User.password_hash"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -181,9 +169,9 @@ func (_c *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(user.FieldEmail, field.TypeString, value)
|
||||
_node.Email = value
|
||||
}
|
||||
if value, ok := _c.mutation.Password(); ok {
|
||||
_spec.SetField(user.FieldPassword, field.TypeString, value)
|
||||
_node.Password = value
|
||||
if value, ok := _c.mutation.PasswordHash(); ok {
|
||||
_spec.SetField(user.FieldPasswordHash, field.TypeString, value)
|
||||
_node.PasswordHash = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user