add: user accomplished
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Users holds the schema definition for the Users entity.
|
||||
type Users struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
type VerificationStatusStruct struct {
|
||||
Player string `json:"player" validate:"oneof:pending rejected approved"`
|
||||
Owner string `json:"owner" validate:"oneof:pending rejected approved"`
|
||||
Consumer string `json:"consumer" validate:"oneof:pending rejected approved"`
|
||||
}
|
||||
|
||||
// Fields of the Users.
|
||||
func (Users) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Unique().Immutable(),
|
||||
field.String("username").Unique(),
|
||||
field.String("password_hash"),
|
||||
field.String("email").Unique(),
|
||||
field.String("phone").Unique(),
|
||||
field.String("nickname"),
|
||||
field.String("avatar"),
|
||||
field.String("bio"),
|
||||
field.String("current_role"),
|
||||
field.Strings("verified_roles"),
|
||||
field.JSON("verificationStatus", VerificationStatusStruct{}),
|
||||
field.Bool("is_admin").Default(false),
|
||||
field.Time("created_at").Default(time.Now),
|
||||
field.Time("updated_at").Default(time.Now),
|
||||
field.Time("deleted_at"),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Users.
|
||||
func (Users) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user