fix: some api bug
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/schema/field"
|
||||
@@ -17,7 +19,7 @@ type Wallet struct {
|
||||
// Fields of the Wallet.
|
||||
func (Wallet) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("user_id").Immutable().Unique(),
|
||||
field.Int64("id").StorageKey("user_id").Immutable().Unique(),
|
||||
field.Other("balance", decimal.Decimal{}).
|
||||
Default(defalutBalance).
|
||||
SchemaType(map[string]string{
|
||||
@@ -29,7 +31,7 @@ func (Wallet) Fields() []ent.Field {
|
||||
dialect.Postgres: "decimal(12,2)",
|
||||
}),
|
||||
field.Int("version").Default(1),
|
||||
field.Time("updated_at"),
|
||||
field.Time("updated_at").Default(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user