Refactor: Remove deprecated gRPC service files and implement new API structure
- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`. - Added new API server implementations for objectstory, player, and shop services. - Introduced configuration files for new APIs in `etc/*.yaml`. - Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`. - Removed unused user update handler and user API files. - Added utility functions for context management and HTTP header parsing. - Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
// Orders holds the schema definition for the Orders entity.
|
||||
type Orders struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Annotations of the Orders.
|
||||
func (Orders) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{
|
||||
Table: "orders",
|
||||
Checks: map[string]string{
|
||||
"chk_order_status": "status IN ('pending_payment', 'pending_accept', 'in_progress', 'pending_close', 'pending_review', 'disputed', 'completed', 'cancelled')",
|
||||
"chk_price_positive": "total_price > 0",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Fields of the Orders.
|
||||
func (Orders) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.Int64("consumer_id"),
|
||||
field.String("consumer_name").MaxLen(100),
|
||||
field.Int64("player_id"),
|
||||
field.String("player_name").MaxLen(100),
|
||||
field.Int64("shop_id").Optional().Nillable(),
|
||||
field.String("shop_name").Optional().Nillable().MaxLen(200),
|
||||
field.JSON("service_snapshot", map[string]any{}).
|
||||
SchemaType(map[string]string{dialect.Postgres: "jsonb"}),
|
||||
field.String("status").Default("pending_payment").MaxLen(30),
|
||||
field.Other("total_price", decimal.Decimal{}).
|
||||
SchemaType(map[string]string{dialect.Postgres: "decimal(10,2)"}),
|
||||
field.String("note").Optional().Nillable(),
|
||||
field.Int("version").Default(1),
|
||||
field.String("timeout_job_id").Optional().Nillable().MaxLen(100),
|
||||
field.String("search_text").Optional().Nillable(),
|
||||
field.Time("created_at").Default(time.Now).Immutable(),
|
||||
field.Time("accepted_at").Optional().Nillable(),
|
||||
field.Time("closed_at").Optional().Nillable(),
|
||||
field.Time("completed_at").Optional().Nillable(),
|
||||
field.Time("cancelled_at").Optional().Nillable(),
|
||||
field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Orders.
|
||||
func (Orders) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user