Files
juwan-backend/app/shop/rpc/internal/models/schema/shopplayers.go
T

36 lines
794 B
Go

package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// ShopPlayers holds the schema definition for the ShopPlayers entity.
type ShopPlayers struct {
ent.Schema
}
// Fields of the ShopPlayers.
func (ShopPlayers) Fields() []ent.Field {
return []ent.Field{
field.Int64("id").Immutable().Unique(),
field.Int64("shop_id"),
field.Int64("player_id"),
field.Bool("is_primary").Optional().Default(false),
field.Time("joined_at").Default(time.Now).Immutable(),
field.Time("left_at").Optional().Nillable(),
}
}
// Indexes of the ShopPlayers.
func (ShopPlayers) Indexes() []ent.Index {
return []ent.Index{
index.Fields("shop_id", "player_id").Unique(),
index.Fields("player_id"),
index.Fields("shop_id", "joined_at"),
}
}