[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
42
backend/ent/schema/user.go
Normal file
42
backend/ent/schema/user.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"time"
|
||||
)
|
||||
|
||||
// User holds the schema definition for the User entity.
|
||||
type User struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the User.
|
||||
func (User) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("email").
|
||||
Unique().
|
||||
NotEmpty(),
|
||||
field.String("password_hash").
|
||||
Sensitive().
|
||||
NotEmpty(),
|
||||
field.Enum("status").
|
||||
Values("active", "inactive", "banned").
|
||||
Default("active"),
|
||||
field.Time("created_at").
|
||||
Default(time.Now),
|
||||
field.Time("updated_at").
|
||||
Default(time.Now).
|
||||
UpdateDefault(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the User.
|
||||
func (User) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("roles", Role.Type),
|
||||
edge.To("contributors", Contributor.Type),
|
||||
edge.To("media", Media.Type),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue