test manga
This commit is contained in:
77
ent/schema/manga.go
Normal file
77
ent/schema/manga.go
Normal file
@ -0,0 +1,77 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Game holds the schema definition for the Game entity.
|
||||
type Ma struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Ma) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
|
||||
field.String("password").
|
||||
NotEmpty().
|
||||
Immutable().
|
||||
Sensitive(),
|
||||
|
||||
field.String("token").
|
||||
Optional().
|
||||
Sensitive(),
|
||||
|
||||
field.Bool("limit").
|
||||
Default(false).
|
||||
Optional(),
|
||||
|
||||
field.Int("count").
|
||||
Optional(),
|
||||
|
||||
field.String("handle").
|
||||
Optional(),
|
||||
|
||||
field.String("text").
|
||||
Optional(),
|
||||
|
||||
field.String("did").
|
||||
Optional(),
|
||||
|
||||
field.String("avatar").
|
||||
Optional(),
|
||||
|
||||
field.String("cid").
|
||||
Optional(),
|
||||
|
||||
field.String("uri").
|
||||
Optional(),
|
||||
|
||||
field.String("rkey").
|
||||
Optional(),
|
||||
|
||||
field.String("bsky_url").
|
||||
Optional(),
|
||||
|
||||
field.Time("updated_at").
|
||||
Optional(),
|
||||
|
||||
field.Time("created_at").
|
||||
Immutable().
|
||||
Optional().
|
||||
Default(func() time.Time {
|
||||
return time.Now().In(jst)
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
func (Ma) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("owner", User.Type).
|
||||
Ref("ma").
|
||||
Unique().
|
||||
Required(),
|
||||
}
|
||||
}
|
@ -245,6 +245,7 @@ func (User) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("card", Card.Type),
|
||||
edge.To("ue", Ue.Type),
|
||||
edge.To("ma", Ma.Type),
|
||||
//Unique(),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user