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,64 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
)
|
||||
|
||||
var (
|
||||
// WithGlobalUniqueID sets the universal ids options to the migration.
|
||||
// If this option is enabled, ent migration will allocate a 1<<32 range
|
||||
// for the ids of each entity (table).
|
||||
// Note that this option cannot be applied on tables that already exist.
|
||||
WithGlobalUniqueID = schema.WithGlobalUniqueID
|
||||
// WithDropColumn sets the drop column option to the migration.
|
||||
// If this option is enabled, ent migration will drop old columns
|
||||
// that were used for both fields and edges. This defaults to false.
|
||||
WithDropColumn = schema.WithDropColumn
|
||||
// WithDropIndex sets the drop index option to the migration.
|
||||
// If this option is enabled, ent migration will drop old indexes
|
||||
// that were defined in the schema. This defaults to false.
|
||||
// Note that unique constraints are defined using `UNIQUE INDEX`,
|
||||
// and therefore, it's recommended to enable this option to get more
|
||||
// flexibility in the schema changes.
|
||||
WithDropIndex = schema.WithDropIndex
|
||||
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
|
||||
WithForeignKeys = schema.WithForeignKeys
|
||||
)
|
||||
|
||||
// Schema is the API for creating, migrating and dropping a schema.
|
||||
type Schema struct {
|
||||
drv dialect.Driver
|
||||
}
|
||||
|
||||
// NewSchema creates a new schema client.
|
||||
func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
|
||||
|
||||
// Create creates all schema resources.
|
||||
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
|
||||
return Create(ctx, s, Tables, opts...)
|
||||
}
|
||||
|
||||
// Create creates all table resources using the given schema driver.
|
||||
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
|
||||
migrate, err := schema.NewMigrate(s.drv, opts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ent/migrate: %w", err)
|
||||
}
|
||||
return migrate.Create(ctx, tables...)
|
||||
}
|
||||
|
||||
// WriteTo writes the schema changes to w instead of running them against the database.
|
||||
//
|
||||
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
|
||||
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
var (
|
||||
// OrderStateLogsColumns holds the columns for the "order_state_logs" table.
|
||||
OrderStateLogsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "order_id", Type: field.TypeInt64},
|
||||
{Name: "from_status", Type: field.TypeString, Nullable: true, Size: 30},
|
||||
{Name: "to_status", Type: field.TypeString, Size: 30},
|
||||
{Name: "action", Type: field.TypeString, Size: 50},
|
||||
{Name: "actor_id", Type: field.TypeInt64},
|
||||
{Name: "actor_role", Type: field.TypeString, Size: 20},
|
||||
{Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// OrderStateLogsTable holds the schema information for the "order_state_logs" table.
|
||||
OrderStateLogsTable = &schema.Table{
|
||||
Name: "order_state_logs",
|
||||
Columns: OrderStateLogsColumns,
|
||||
PrimaryKey: []*schema.Column{OrderStateLogsColumns[0]},
|
||||
}
|
||||
// OrdersColumns holds the columns for the "orders" table.
|
||||
OrdersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "consumer_id", Type: field.TypeInt64},
|
||||
{Name: "consumer_name", Type: field.TypeString, Size: 100},
|
||||
{Name: "player_id", Type: field.TypeInt64},
|
||||
{Name: "player_name", Type: field.TypeString, Size: 100},
|
||||
{Name: "shop_id", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "shop_name", Type: field.TypeString, Nullable: true, Size: 200},
|
||||
{Name: "service_snapshot", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
|
||||
{Name: "status", Type: field.TypeString, Size: 30, Default: "pending_payment"},
|
||||
{Name: "total_price", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "decimal(10,2)"}},
|
||||
{Name: "note", Type: field.TypeString, Nullable: true},
|
||||
{Name: "version", Type: field.TypeInt, Default: 1},
|
||||
{Name: "timeout_job_id", Type: field.TypeString, Nullable: true, Size: 100},
|
||||
{Name: "search_text", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "accepted_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "closed_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "completed_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "cancelled_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
}
|
||||
// OrdersTable holds the schema information for the "orders" table.
|
||||
OrdersTable = &schema.Table{
|
||||
Name: "orders",
|
||||
Columns: OrdersColumns,
|
||||
PrimaryKey: []*schema.Column{OrdersColumns[0]},
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
OrderStateLogsTable,
|
||||
OrdersTable,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
OrderStateLogsTable.Annotation = &entsql.Annotation{
|
||||
Table: "order_state_logs",
|
||||
}
|
||||
OrdersTable.Annotation = &entsql.Annotation{
|
||||
Table: "orders",
|
||||
}
|
||||
OrdersTable.Annotation.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",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user