fix: some api bug
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// UserFollows holds the schema definition for the UserFollows entity.
|
||||
type UserFollows struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the UserFollows.
|
||||
func (UserFollows) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.Int64("follower_id"),
|
||||
field.Int64("followee_id"),
|
||||
field.Time("created_at").Immutable(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the UserFollows.
|
||||
func (UserFollows) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// UserPreferences holds the schema definition for the UserPreferences entity.
|
||||
type UserPreferences struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the UserPreferences.
|
||||
func (UserPreferences) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("user_id"),
|
||||
field.Bool("notification_order").Default(true),
|
||||
field.Bool("notification_community").Default(true),
|
||||
field.Bool("notification_system").Default(true),
|
||||
field.String("theme").Default("light"),
|
||||
field.String("language").Default("zh-CN"),
|
||||
field.Time("updated_at").Default(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the UserPreferences.
|
||||
func (UserPreferences) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"juwan-backend/pkg/types"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
@@ -26,16 +28,18 @@ func (Users) Fields() []ent.Field {
|
||||
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.String("nickname").Default(""),
|
||||
field.String("avatar").Default(""),
|
||||
field.String("bio").Default(""),
|
||||
field.String("current_role").Default("consumer").NotEmpty(),
|
||||
//field.Strings("verified_roles").Default([]string{"consumer"}),
|
||||
field.JSON("verificationStatus", VerificationStatusStruct{}).Optional(),
|
||||
field.Bool("is_admin").Default(false),
|
||||
field.Time("created_at").Default(time.Now),
|
||||
field.Time("updated_at").Default(time.Now),
|
||||
field.Time("deleted_at"),
|
||||
field.Time("deleted_at").Optional(),
|
||||
field.Other("verified_roles", types.TextArray{}).
|
||||
SchemaType(map[string]string{dialect.Postgres: "text[]"}).Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user