fix: api descript
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// ShopInvitations holds the schema definition for the ShopInvitations entity.
|
||||
type ShopInvitations struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Annotations of the ShopInvitations.
|
||||
func (ShopInvitations) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{
|
||||
Table: "shop_invitations",
|
||||
Checks: map[string]string{
|
||||
"chk_invitation_status": "status IN ('pending', 'accepted', 'rejected', 'cancelled')",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Fields of the ShopInvitations.
|
||||
func (ShopInvitations) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.Int64("shop_id"),
|
||||
field.Int64("player_id"),
|
||||
field.String("status").MaxLen(20).Default("pending"),
|
||||
field.Int64("invited_by"),
|
||||
field.Time("created_at").Default(time.Now).Immutable(),
|
||||
field.Time("responded_at").Optional().Nillable(),
|
||||
}
|
||||
}
|
||||
|
||||
// Indexes of the ShopInvitations.
|
||||
func (ShopInvitations) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("shop_id"),
|
||||
index.Fields("player_id"),
|
||||
index.Fields("player_id", "status", "created_at"),
|
||||
index.Fields("shop_id", "status", "created_at"),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the ShopInvitations.
|
||||
func (ShopInvitations) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user