From 2d45d7e3cbf850d95ceb4db634ef3d70b560d1fa Mon Sep 17 00:00:00 2001 From: zetaloop Date: Wed, 22 Apr 2026 22:28:41 +0800 Subject: [PATCH] refactor: remove redundant name fields from order service --- app/order/api/internal/handler/routes.go | 2 +- .../internal/logic/order/createOrderLogic.go | 9 - app/order/api/internal/logic/order/helpers.go | 3 - .../api/internal/logic/order/reorderLogic.go | 5 - app/order/api/internal/types/types.go | 29 +- .../rpc/internal/logic/addOrdersLogic.go | 5 - app/order/rpc/internal/logic/common.go | 5 - .../rpc/internal/logic/searchOrdersLogic.go | 9 - .../rpc/internal/logic/updateOrdersLogic.go | 9 - .../rpc/internal/models/migrate/schema.go | 3 - app/order/rpc/internal/models/mutation.go | 183 +----------- app/order/rpc/internal/models/orders.go | 38 +-- .../rpc/internal/models/orders/orders.go | 30 -- app/order/rpc/internal/models/orders/where.go | 220 --------------- .../rpc/internal/models/orders_create.go | 59 ---- .../rpc/internal/models/orders_update.go | 150 ---------- app/order/rpc/internal/models/runtime.go | 22 +- .../rpc/internal/models/schema/orders.go | 3 - app/order/rpc/pb/order.pb.go | 264 +++++------------- desc/api/order.api | 181 ++++++------ desc/rpc/order.proto | 12 - 21 files changed, 179 insertions(+), 1062 deletions(-) diff --git a/app/order/api/internal/handler/routes.go b/app/order/api/internal/handler/routes.go index 656bd3b..197ece0 100644 --- a/app/order/api/internal/handler/routes.go +++ b/app/order/api/internal/handler/routes.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.9.2 +// goctl 1.10.1 package handler diff --git a/app/order/api/internal/logic/order/createOrderLogic.go b/app/order/api/internal/logic/order/createOrderLogic.go index a7489cc..4ec8e9b 100644 --- a/app/order/api/internal/logic/order/createOrderLogic.go +++ b/app/order/api/internal/logic/order/createOrderLogic.go @@ -83,20 +83,12 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq) (resp *types.C return nil, err } - consumerName := strconv.FormatInt(consumerID, 10) - playerName := strconv.FormatInt(playerID, 10) - shopName := "" - if req.ShopId > 0 { - shopName = strconv.FormatInt(req.ShopId, 10) - } now := time.Now().Unix() status := "pending_payment" addReq := &orderservice.AddOrdersReq{ ConsumerId: consumerID, - ConsumerName: consumerName, PlayerId: playerID, - PlayerName: playerName, ServiceSnapshot: string(snapshotBytes), Status: &status, TotalPrice: totalPriceStr, @@ -105,7 +97,6 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq) (resp *types.C } if req.ShopId > 0 { addReq.ShopId = &req.ShopId - addReq.ShopName = &shopName } if req.Note != "" { addReq.Note = &req.Note diff --git a/app/order/api/internal/logic/order/helpers.go b/app/order/api/internal/logic/order/helpers.go index 804ca4a..da3d14e 100644 --- a/app/order/api/internal/logic/order/helpers.go +++ b/app/order/api/internal/logic/order/helpers.go @@ -41,11 +41,8 @@ func toAPIOrder(in *orderservice.Orders) types.Order { order = types.Order{ Id: in.GetId(), ConsumerId: in.GetConsumerId(), - ConsumerName: in.GetConsumerName(), PlayerId: playerID, - PlayerName: in.GetPlayerName(), ShopId: in.GetShopId(), - ShopName: in.GetShopName(), Service: service, Status: in.GetStatus(), TotalPrice: totalPrice, diff --git a/app/order/api/internal/logic/order/reorderLogic.go b/app/order/api/internal/logic/order/reorderLogic.go index 01b913b..e40c51b 100644 --- a/app/order/api/internal/logic/order/reorderLogic.go +++ b/app/order/api/internal/logic/order/reorderLogic.go @@ -46,9 +46,7 @@ func (l *ReorderLogic) Reorder(req *types.PathId) (resp *types.CreateOrderResp, addReq := &orderservice.AddOrdersReq{ ConsumerId: oldOrder.GetConsumerId(), - ConsumerName: oldOrder.GetConsumerName(), PlayerId: oldOrder.GetPlayerId(), - PlayerName: oldOrder.GetPlayerName(), ServiceSnapshot: oldOrder.GetServiceSnapshot(), Status: &status, TotalPrice: oldOrder.GetTotalPrice(), @@ -59,9 +57,6 @@ func (l *ReorderLogic) Reorder(req *types.PathId) (resp *types.CreateOrderResp, if oldOrder.ShopId != nil { addReq.ShopId = oldOrder.ShopId } - if oldOrder.ShopName != nil { - addReq.ShopName = oldOrder.ShopName - } if oldOrder.Note != nil { addReq.Note = oldOrder.Note } diff --git a/app/order/api/internal/types/types.go b/app/order/api/internal/types/types.go index aa3bb76..44788c7 100644 --- a/app/order/api/internal/types/types.go +++ b/app/order/api/internal/types/types.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.9.2 +// goctl 1.10.1 package types @@ -20,25 +20,22 @@ type EmptyResp struct { } type Order struct { - Id int64 `json:"id"` - ConsumerId int64 `json:"consumerId"` - ConsumerName string `json:"consumerName"` - PlayerId string `json:"playerId"` - PlayerName string `json:"playerName"` - ShopId int64 `json:"shopId,optional"` - ShopName string `json:"shopName,optional"` - Service PlayerService `json:"service"` - Status string `json:"status"` - TotalPrice float64 `json:"totalPrice"` - Note string `json:"note,optional"` - CreatedAt string `json:"createdAt"` - AcceptedAt string `json:"acceptedAt,optional"` - CompletedAt string `json:"completedAt,optional"` + Id int64 `json:"id"` + ConsumerId int64 `json:"consumerId"` + PlayerId string `json:"playerId"` + ShopId int64 `json:"shopId,optional"` + Service PlayerService `json:"service"` + Status string `json:"status"` + TotalPrice float64 `json:"totalPrice"` + Note string `json:"note,optional"` + CreatedAt string `json:"createdAt"` + AcceptedAt string `json:"acceptedAt,optional"` + CompletedAt string `json:"completedAt,optional"` } type OrderListReq struct { PageReq - Role string `form:"role"` + Role string `form:"role"` // consumer, player, owner Status string `form:"status,optional"` } diff --git a/app/order/rpc/internal/logic/addOrdersLogic.go b/app/order/rpc/internal/logic/addOrdersLogic.go index 2dcaf5b..ccdcb64 100644 --- a/app/order/rpc/internal/logic/addOrdersLogic.go +++ b/app/order/rpc/internal/logic/addOrdersLogic.go @@ -49,18 +49,13 @@ func (l *AddOrdersLogic) AddOrders(in *pb.AddOrdersReq) (*pb.AddOrdersResp, erro creator := l.svcCtx.OrderModelsRW.Orders.Create(). SetID(orderID). SetConsumerID(in.ConsumerId). - SetConsumerName(in.ConsumerName). SetPlayerID(in.PlayerId). - SetPlayerName(in.PlayerName). SetServiceSnapshot(serviceSnapshot). SetTotalPrice(totalPrice) if in.ShopId != nil { creator = creator.SetShopID(*in.ShopId) } - if in.ShopName != nil { - creator = creator.SetShopName(*in.ShopName) - } if in.Status != nil && *in.Status != "" { creator = creator.SetStatus(*in.Status) } diff --git a/app/order/rpc/internal/logic/common.go b/app/order/rpc/internal/logic/common.go index a2ea950..3d9e5b1 100644 --- a/app/order/rpc/internal/logic/common.go +++ b/app/order/rpc/internal/logic/common.go @@ -53,9 +53,7 @@ func toPBOrder(item *models.Orders) *pb.Orders { result := &pb.Orders{ Id: item.ID, ConsumerId: item.ConsumerID, - ConsumerName: item.ConsumerName, PlayerId: item.PlayerID, - PlayerName: item.PlayerName, ServiceSnapshot: serviceSnapshot, Status: item.Status, TotalPrice: item.TotalPrice.String(), @@ -67,9 +65,6 @@ func toPBOrder(item *models.Orders) *pb.Orders { if item.ShopID != nil { result.ShopId = item.ShopID } - if item.ShopName != nil { - result.ShopName = item.ShopName - } if item.Note != nil { result.Note = item.Note } diff --git a/app/order/rpc/internal/logic/searchOrdersLogic.go b/app/order/rpc/internal/logic/searchOrdersLogic.go index 69cbf42..beb44a1 100644 --- a/app/order/rpc/internal/logic/searchOrdersLogic.go +++ b/app/order/rpc/internal/logic/searchOrdersLogic.go @@ -42,21 +42,12 @@ func (l *SearchOrdersLogic) SearchOrders(in *pb.SearchOrdersReq) (*pb.SearchOrde if in.ConsumerId != nil { preds = append(preds, orders.ConsumerIDEQ(*in.ConsumerId)) } - if in.ConsumerName != nil && *in.ConsumerName != "" { - preds = append(preds, orders.ConsumerNameContainsFold(*in.ConsumerName)) - } if in.PlayerId != nil { preds = append(preds, orders.PlayerIDEQ(*in.PlayerId)) } - if in.PlayerName != nil && *in.PlayerName != "" { - preds = append(preds, orders.PlayerNameContainsFold(*in.PlayerName)) - } if in.ShopId != nil { preds = append(preds, orders.ShopIDEQ(*in.ShopId)) } - if in.ShopName != nil && *in.ShopName != "" { - preds = append(preds, orders.ShopNameContainsFold(*in.ShopName)) - } if in.Status != nil && *in.Status != "" { preds = append(preds, orders.StatusEQ(*in.Status)) } diff --git a/app/order/rpc/internal/logic/updateOrdersLogic.go b/app/order/rpc/internal/logic/updateOrdersLogic.go index 195db6a..0c09598 100644 --- a/app/order/rpc/internal/logic/updateOrdersLogic.go +++ b/app/order/rpc/internal/logic/updateOrdersLogic.go @@ -32,21 +32,12 @@ func (l *UpdateOrdersLogic) UpdateOrders(in *pb.UpdateOrdersReq) (*pb.UpdateOrde if in.ConsumerId != nil { updater = updater.SetConsumerID(*in.ConsumerId) } - if in.ConsumerName != nil { - updater = updater.SetConsumerName(*in.ConsumerName) - } if in.PlayerId != nil { updater = updater.SetPlayerID(*in.PlayerId) } - if in.PlayerName != nil { - updater = updater.SetPlayerName(*in.PlayerName) - } if in.ShopId != nil { updater = updater.SetShopID(*in.ShopId) } - if in.ShopName != nil { - updater = updater.SetShopName(*in.ShopName) - } if in.ServiceSnapshot != nil { snapshot, err := parseJSONMap(*in.ServiceSnapshot) if err != nil { diff --git a/app/order/rpc/internal/models/migrate/schema.go b/app/order/rpc/internal/models/migrate/schema.go index 332c0c7..1a5b741 100644 --- a/app/order/rpc/internal/models/migrate/schema.go +++ b/app/order/rpc/internal/models/migrate/schema.go @@ -31,11 +31,8 @@ var ( 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)"}}, diff --git a/app/order/rpc/internal/models/mutation.go b/app/order/rpc/internal/models/mutation.go index a0048ec..96cce00 100644 --- a/app/order/rpc/internal/models/mutation.go +++ b/app/order/rpc/internal/models/mutation.go @@ -858,13 +858,10 @@ type OrdersMutation struct { id *int64 consumer_id *int64 addconsumer_id *int64 - consumer_name *string player_id *int64 addplayer_id *int64 - player_name *string shop_id *int64 addshop_id *int64 - shop_name *string service_snapshot *map[string]interface{} status *string total_price *decimal.Decimal @@ -1045,42 +1042,6 @@ func (m *OrdersMutation) ResetConsumerID() { m.addconsumer_id = nil } -// SetConsumerName sets the "consumer_name" field. -func (m *OrdersMutation) SetConsumerName(s string) { - m.consumer_name = &s -} - -// ConsumerName returns the value of the "consumer_name" field in the mutation. -func (m *OrdersMutation) ConsumerName() (r string, exists bool) { - v := m.consumer_name - if v == nil { - return - } - return *v, true -} - -// OldConsumerName returns the old "consumer_name" field's value of the Orders entity. -// If the Orders object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *OrdersMutation) OldConsumerName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldConsumerName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldConsumerName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldConsumerName: %w", err) - } - return oldValue.ConsumerName, nil -} - -// ResetConsumerName resets all changes to the "consumer_name" field. -func (m *OrdersMutation) ResetConsumerName() { - m.consumer_name = nil -} - // SetPlayerID sets the "player_id" field. func (m *OrdersMutation) SetPlayerID(i int64) { m.player_id = &i @@ -1137,42 +1098,6 @@ func (m *OrdersMutation) ResetPlayerID() { m.addplayer_id = nil } -// SetPlayerName sets the "player_name" field. -func (m *OrdersMutation) SetPlayerName(s string) { - m.player_name = &s -} - -// PlayerName returns the value of the "player_name" field in the mutation. -func (m *OrdersMutation) PlayerName() (r string, exists bool) { - v := m.player_name - if v == nil { - return - } - return *v, true -} - -// OldPlayerName returns the old "player_name" field's value of the Orders entity. -// If the Orders object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *OrdersMutation) OldPlayerName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldPlayerName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldPlayerName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldPlayerName: %w", err) - } - return oldValue.PlayerName, nil -} - -// ResetPlayerName resets all changes to the "player_name" field. -func (m *OrdersMutation) ResetPlayerName() { - m.player_name = nil -} - // SetShopID sets the "shop_id" field. func (m *OrdersMutation) SetShopID(i int64) { m.shop_id = &i @@ -1243,55 +1168,6 @@ func (m *OrdersMutation) ResetShopID() { delete(m.clearedFields, orders.FieldShopID) } -// SetShopName sets the "shop_name" field. -func (m *OrdersMutation) SetShopName(s string) { - m.shop_name = &s -} - -// ShopName returns the value of the "shop_name" field in the mutation. -func (m *OrdersMutation) ShopName() (r string, exists bool) { - v := m.shop_name - if v == nil { - return - } - return *v, true -} - -// OldShopName returns the old "shop_name" field's value of the Orders entity. -// If the Orders object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *OrdersMutation) OldShopName(ctx context.Context) (v *string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldShopName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldShopName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldShopName: %w", err) - } - return oldValue.ShopName, nil -} - -// ClearShopName clears the value of the "shop_name" field. -func (m *OrdersMutation) ClearShopName() { - m.shop_name = nil - m.clearedFields[orders.FieldShopName] = struct{}{} -} - -// ShopNameCleared returns if the "shop_name" field was cleared in this mutation. -func (m *OrdersMutation) ShopNameCleared() bool { - _, ok := m.clearedFields[orders.FieldShopName] - return ok -} - -// ResetShopName resets all changes to the "shop_name" field. -func (m *OrdersMutation) ResetShopName() { - m.shop_name = nil - delete(m.clearedFields, orders.FieldShopName) -} - // SetServiceSnapshot sets the "service_snapshot" field. func (m *OrdersMutation) SetServiceSnapshot(value map[string]interface{}) { m.service_snapshot = &value @@ -1905,25 +1781,16 @@ func (m *OrdersMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *OrdersMutation) Fields() []string { - fields := make([]string, 0, 19) + fields := make([]string, 0, 16) if m.consumer_id != nil { fields = append(fields, orders.FieldConsumerID) } - if m.consumer_name != nil { - fields = append(fields, orders.FieldConsumerName) - } if m.player_id != nil { fields = append(fields, orders.FieldPlayerID) } - if m.player_name != nil { - fields = append(fields, orders.FieldPlayerName) - } if m.shop_id != nil { fields = append(fields, orders.FieldShopID) } - if m.shop_name != nil { - fields = append(fields, orders.FieldShopName) - } if m.service_snapshot != nil { fields = append(fields, orders.FieldServiceSnapshot) } @@ -1973,16 +1840,10 @@ func (m *OrdersMutation) Field(name string) (ent.Value, bool) { switch name { case orders.FieldConsumerID: return m.ConsumerID() - case orders.FieldConsumerName: - return m.ConsumerName() case orders.FieldPlayerID: return m.PlayerID() - case orders.FieldPlayerName: - return m.PlayerName() case orders.FieldShopID: return m.ShopID() - case orders.FieldShopName: - return m.ShopName() case orders.FieldServiceSnapshot: return m.ServiceSnapshot() case orders.FieldStatus: @@ -2020,16 +1881,10 @@ func (m *OrdersMutation) OldField(ctx context.Context, name string) (ent.Value, switch name { case orders.FieldConsumerID: return m.OldConsumerID(ctx) - case orders.FieldConsumerName: - return m.OldConsumerName(ctx) case orders.FieldPlayerID: return m.OldPlayerID(ctx) - case orders.FieldPlayerName: - return m.OldPlayerName(ctx) case orders.FieldShopID: return m.OldShopID(ctx) - case orders.FieldShopName: - return m.OldShopName(ctx) case orders.FieldServiceSnapshot: return m.OldServiceSnapshot(ctx) case orders.FieldStatus: @@ -2072,13 +1927,6 @@ func (m *OrdersMutation) SetField(name string, value ent.Value) error { } m.SetConsumerID(v) return nil - case orders.FieldConsumerName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetConsumerName(v) - return nil case orders.FieldPlayerID: v, ok := value.(int64) if !ok { @@ -2086,13 +1934,6 @@ func (m *OrdersMutation) SetField(name string, value ent.Value) error { } m.SetPlayerID(v) return nil - case orders.FieldPlayerName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetPlayerName(v) - return nil case orders.FieldShopID: v, ok := value.(int64) if !ok { @@ -2100,13 +1941,6 @@ func (m *OrdersMutation) SetField(name string, value ent.Value) error { } m.SetShopID(v) return nil - case orders.FieldShopName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetShopName(v) - return nil case orders.FieldServiceSnapshot: v, ok := value.(map[string]interface{}) if !ok { @@ -2282,9 +2116,6 @@ func (m *OrdersMutation) ClearedFields() []string { if m.FieldCleared(orders.FieldShopID) { fields = append(fields, orders.FieldShopID) } - if m.FieldCleared(orders.FieldShopName) { - fields = append(fields, orders.FieldShopName) - } if m.FieldCleared(orders.FieldNote) { fields = append(fields, orders.FieldNote) } @@ -2323,9 +2154,6 @@ func (m *OrdersMutation) ClearField(name string) error { case orders.FieldShopID: m.ClearShopID() return nil - case orders.FieldShopName: - m.ClearShopName() - return nil case orders.FieldNote: m.ClearNote() return nil @@ -2358,21 +2186,12 @@ func (m *OrdersMutation) ResetField(name string) error { case orders.FieldConsumerID: m.ResetConsumerID() return nil - case orders.FieldConsumerName: - m.ResetConsumerName() - return nil case orders.FieldPlayerID: m.ResetPlayerID() return nil - case orders.FieldPlayerName: - m.ResetPlayerName() - return nil case orders.FieldShopID: m.ResetShopID() return nil - case orders.FieldShopName: - m.ResetShopName() - return nil case orders.FieldServiceSnapshot: m.ResetServiceSnapshot() return nil diff --git a/app/order/rpc/internal/models/orders.go b/app/order/rpc/internal/models/orders.go index d9392ec..ae9b540 100644 --- a/app/order/rpc/internal/models/orders.go +++ b/app/order/rpc/internal/models/orders.go @@ -21,16 +21,10 @@ type Orders struct { ID int64 `json:"id,omitempty"` // ConsumerID holds the value of the "consumer_id" field. ConsumerID int64 `json:"consumer_id,omitempty"` - // ConsumerName holds the value of the "consumer_name" field. - ConsumerName string `json:"consumer_name,omitempty"` // PlayerID holds the value of the "player_id" field. PlayerID int64 `json:"player_id,omitempty"` - // PlayerName holds the value of the "player_name" field. - PlayerName string `json:"player_name,omitempty"` // ShopID holds the value of the "shop_id" field. ShopID *int64 `json:"shop_id,omitempty"` - // ShopName holds the value of the "shop_name" field. - ShopName *string `json:"shop_name,omitempty"` // ServiceSnapshot holds the value of the "service_snapshot" field. ServiceSnapshot map[string]interface{} `json:"service_snapshot,omitempty"` // Status holds the value of the "status" field. @@ -71,7 +65,7 @@ func (*Orders) scanValues(columns []string) ([]any, error) { values[i] = new(decimal.Decimal) case orders.FieldID, orders.FieldConsumerID, orders.FieldPlayerID, orders.FieldShopID, orders.FieldVersion: values[i] = new(sql.NullInt64) - case orders.FieldConsumerName, orders.FieldPlayerName, orders.FieldShopName, orders.FieldStatus, orders.FieldNote, orders.FieldTimeoutJobID, orders.FieldSearchText: + case orders.FieldStatus, orders.FieldNote, orders.FieldTimeoutJobID, orders.FieldSearchText: values[i] = new(sql.NullString) case orders.FieldCreatedAt, orders.FieldAcceptedAt, orders.FieldClosedAt, orders.FieldCompletedAt, orders.FieldCancelledAt, orders.FieldUpdatedAt: values[i] = new(sql.NullTime) @@ -102,24 +96,12 @@ func (_m *Orders) assignValues(columns []string, values []any) error { } else if value.Valid { _m.ConsumerID = value.Int64 } - case orders.FieldConsumerName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field consumer_name", values[i]) - } else if value.Valid { - _m.ConsumerName = value.String - } case orders.FieldPlayerID: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field player_id", values[i]) } else if value.Valid { _m.PlayerID = value.Int64 } - case orders.FieldPlayerName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field player_name", values[i]) - } else if value.Valid { - _m.PlayerName = value.String - } case orders.FieldShopID: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field shop_id", values[i]) @@ -127,13 +109,6 @@ func (_m *Orders) assignValues(columns []string, values []any) error { _m.ShopID = new(int64) *_m.ShopID = value.Int64 } - case orders.FieldShopName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field shop_name", values[i]) - } else if value.Valid { - _m.ShopName = new(string) - *_m.ShopName = value.String - } case orders.FieldServiceSnapshot: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field service_snapshot", values[i]) @@ -260,25 +235,14 @@ func (_m *Orders) String() string { builder.WriteString("consumer_id=") builder.WriteString(fmt.Sprintf("%v", _m.ConsumerID)) builder.WriteString(", ") - builder.WriteString("consumer_name=") - builder.WriteString(_m.ConsumerName) - builder.WriteString(", ") builder.WriteString("player_id=") builder.WriteString(fmt.Sprintf("%v", _m.PlayerID)) builder.WriteString(", ") - builder.WriteString("player_name=") - builder.WriteString(_m.PlayerName) - builder.WriteString(", ") if v := _m.ShopID; v != nil { builder.WriteString("shop_id=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") - if v := _m.ShopName; v != nil { - builder.WriteString("shop_name=") - builder.WriteString(*v) - } - builder.WriteString(", ") builder.WriteString("service_snapshot=") builder.WriteString(fmt.Sprintf("%v", _m.ServiceSnapshot)) builder.WriteString(", ") diff --git a/app/order/rpc/internal/models/orders/orders.go b/app/order/rpc/internal/models/orders/orders.go index c0c9428..0af3545 100644 --- a/app/order/rpc/internal/models/orders/orders.go +++ b/app/order/rpc/internal/models/orders/orders.go @@ -15,16 +15,10 @@ const ( FieldID = "id" // FieldConsumerID holds the string denoting the consumer_id field in the database. FieldConsumerID = "consumer_id" - // FieldConsumerName holds the string denoting the consumer_name field in the database. - FieldConsumerName = "consumer_name" // FieldPlayerID holds the string denoting the player_id field in the database. FieldPlayerID = "player_id" - // FieldPlayerName holds the string denoting the player_name field in the database. - FieldPlayerName = "player_name" // FieldShopID holds the string denoting the shop_id field in the database. FieldShopID = "shop_id" - // FieldShopName holds the string denoting the shop_name field in the database. - FieldShopName = "shop_name" // FieldServiceSnapshot holds the string denoting the service_snapshot field in the database. FieldServiceSnapshot = "service_snapshot" // FieldStatus holds the string denoting the status field in the database. @@ -59,11 +53,8 @@ const ( var Columns = []string{ FieldID, FieldConsumerID, - FieldConsumerName, FieldPlayerID, - FieldPlayerName, FieldShopID, - FieldShopName, FieldServiceSnapshot, FieldStatus, FieldTotalPrice, @@ -90,12 +81,6 @@ func ValidColumn(column string) bool { } var ( - // ConsumerNameValidator is a validator for the "consumer_name" field. It is called by the builders before save. - ConsumerNameValidator func(string) error - // PlayerNameValidator is a validator for the "player_name" field. It is called by the builders before save. - PlayerNameValidator func(string) error - // ShopNameValidator is a validator for the "shop_name" field. It is called by the builders before save. - ShopNameValidator func(string) error // DefaultStatus holds the default value on creation for the "status" field. DefaultStatus string // StatusValidator is a validator for the "status" field. It is called by the builders before save. @@ -125,31 +110,16 @@ func ByConsumerID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldConsumerID, opts...).ToFunc() } -// ByConsumerName orders the results by the consumer_name field. -func ByConsumerName(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldConsumerName, opts...).ToFunc() -} - // ByPlayerID orders the results by the player_id field. func ByPlayerID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPlayerID, opts...).ToFunc() } -// ByPlayerName orders the results by the player_name field. -func ByPlayerName(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldPlayerName, opts...).ToFunc() -} - // ByShopID orders the results by the shop_id field. func ByShopID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldShopID, opts...).ToFunc() } -// ByShopName orders the results by the shop_name field. -func ByShopName(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldShopName, opts...).ToFunc() -} - // ByStatus orders the results by the status field. func ByStatus(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStatus, opts...).ToFunc() diff --git a/app/order/rpc/internal/models/orders/where.go b/app/order/rpc/internal/models/orders/where.go index 943f411..a46ecb6 100644 --- a/app/order/rpc/internal/models/orders/where.go +++ b/app/order/rpc/internal/models/orders/where.go @@ -60,31 +60,16 @@ func ConsumerID(v int64) predicate.Orders { return predicate.Orders(sql.FieldEQ(FieldConsumerID, v)) } -// ConsumerName applies equality check predicate on the "consumer_name" field. It's identical to ConsumerNameEQ. -func ConsumerName(v string) predicate.Orders { - return predicate.Orders(sql.FieldEQ(FieldConsumerName, v)) -} - // PlayerID applies equality check predicate on the "player_id" field. It's identical to PlayerIDEQ. func PlayerID(v int64) predicate.Orders { return predicate.Orders(sql.FieldEQ(FieldPlayerID, v)) } -// PlayerName applies equality check predicate on the "player_name" field. It's identical to PlayerNameEQ. -func PlayerName(v string) predicate.Orders { - return predicate.Orders(sql.FieldEQ(FieldPlayerName, v)) -} - // ShopID applies equality check predicate on the "shop_id" field. It's identical to ShopIDEQ. func ShopID(v int64) predicate.Orders { return predicate.Orders(sql.FieldEQ(FieldShopID, v)) } -// ShopName applies equality check predicate on the "shop_name" field. It's identical to ShopNameEQ. -func ShopName(v string) predicate.Orders { - return predicate.Orders(sql.FieldEQ(FieldShopName, v)) -} - // Status applies equality check predicate on the "status" field. It's identical to StatusEQ. func Status(v string) predicate.Orders { return predicate.Orders(sql.FieldEQ(FieldStatus, v)) @@ -185,71 +170,6 @@ func ConsumerIDLTE(v int64) predicate.Orders { return predicate.Orders(sql.FieldLTE(FieldConsumerID, v)) } -// ConsumerNameEQ applies the EQ predicate on the "consumer_name" field. -func ConsumerNameEQ(v string) predicate.Orders { - return predicate.Orders(sql.FieldEQ(FieldConsumerName, v)) -} - -// ConsumerNameNEQ applies the NEQ predicate on the "consumer_name" field. -func ConsumerNameNEQ(v string) predicate.Orders { - return predicate.Orders(sql.FieldNEQ(FieldConsumerName, v)) -} - -// ConsumerNameIn applies the In predicate on the "consumer_name" field. -func ConsumerNameIn(vs ...string) predicate.Orders { - return predicate.Orders(sql.FieldIn(FieldConsumerName, vs...)) -} - -// ConsumerNameNotIn applies the NotIn predicate on the "consumer_name" field. -func ConsumerNameNotIn(vs ...string) predicate.Orders { - return predicate.Orders(sql.FieldNotIn(FieldConsumerName, vs...)) -} - -// ConsumerNameGT applies the GT predicate on the "consumer_name" field. -func ConsumerNameGT(v string) predicate.Orders { - return predicate.Orders(sql.FieldGT(FieldConsumerName, v)) -} - -// ConsumerNameGTE applies the GTE predicate on the "consumer_name" field. -func ConsumerNameGTE(v string) predicate.Orders { - return predicate.Orders(sql.FieldGTE(FieldConsumerName, v)) -} - -// ConsumerNameLT applies the LT predicate on the "consumer_name" field. -func ConsumerNameLT(v string) predicate.Orders { - return predicate.Orders(sql.FieldLT(FieldConsumerName, v)) -} - -// ConsumerNameLTE applies the LTE predicate on the "consumer_name" field. -func ConsumerNameLTE(v string) predicate.Orders { - return predicate.Orders(sql.FieldLTE(FieldConsumerName, v)) -} - -// ConsumerNameContains applies the Contains predicate on the "consumer_name" field. -func ConsumerNameContains(v string) predicate.Orders { - return predicate.Orders(sql.FieldContains(FieldConsumerName, v)) -} - -// ConsumerNameHasPrefix applies the HasPrefix predicate on the "consumer_name" field. -func ConsumerNameHasPrefix(v string) predicate.Orders { - return predicate.Orders(sql.FieldHasPrefix(FieldConsumerName, v)) -} - -// ConsumerNameHasSuffix applies the HasSuffix predicate on the "consumer_name" field. -func ConsumerNameHasSuffix(v string) predicate.Orders { - return predicate.Orders(sql.FieldHasSuffix(FieldConsumerName, v)) -} - -// ConsumerNameEqualFold applies the EqualFold predicate on the "consumer_name" field. -func ConsumerNameEqualFold(v string) predicate.Orders { - return predicate.Orders(sql.FieldEqualFold(FieldConsumerName, v)) -} - -// ConsumerNameContainsFold applies the ContainsFold predicate on the "consumer_name" field. -func ConsumerNameContainsFold(v string) predicate.Orders { - return predicate.Orders(sql.FieldContainsFold(FieldConsumerName, v)) -} - // PlayerIDEQ applies the EQ predicate on the "player_id" field. func PlayerIDEQ(v int64) predicate.Orders { return predicate.Orders(sql.FieldEQ(FieldPlayerID, v)) @@ -290,71 +210,6 @@ func PlayerIDLTE(v int64) predicate.Orders { return predicate.Orders(sql.FieldLTE(FieldPlayerID, v)) } -// PlayerNameEQ applies the EQ predicate on the "player_name" field. -func PlayerNameEQ(v string) predicate.Orders { - return predicate.Orders(sql.FieldEQ(FieldPlayerName, v)) -} - -// PlayerNameNEQ applies the NEQ predicate on the "player_name" field. -func PlayerNameNEQ(v string) predicate.Orders { - return predicate.Orders(sql.FieldNEQ(FieldPlayerName, v)) -} - -// PlayerNameIn applies the In predicate on the "player_name" field. -func PlayerNameIn(vs ...string) predicate.Orders { - return predicate.Orders(sql.FieldIn(FieldPlayerName, vs...)) -} - -// PlayerNameNotIn applies the NotIn predicate on the "player_name" field. -func PlayerNameNotIn(vs ...string) predicate.Orders { - return predicate.Orders(sql.FieldNotIn(FieldPlayerName, vs...)) -} - -// PlayerNameGT applies the GT predicate on the "player_name" field. -func PlayerNameGT(v string) predicate.Orders { - return predicate.Orders(sql.FieldGT(FieldPlayerName, v)) -} - -// PlayerNameGTE applies the GTE predicate on the "player_name" field. -func PlayerNameGTE(v string) predicate.Orders { - return predicate.Orders(sql.FieldGTE(FieldPlayerName, v)) -} - -// PlayerNameLT applies the LT predicate on the "player_name" field. -func PlayerNameLT(v string) predicate.Orders { - return predicate.Orders(sql.FieldLT(FieldPlayerName, v)) -} - -// PlayerNameLTE applies the LTE predicate on the "player_name" field. -func PlayerNameLTE(v string) predicate.Orders { - return predicate.Orders(sql.FieldLTE(FieldPlayerName, v)) -} - -// PlayerNameContains applies the Contains predicate on the "player_name" field. -func PlayerNameContains(v string) predicate.Orders { - return predicate.Orders(sql.FieldContains(FieldPlayerName, v)) -} - -// PlayerNameHasPrefix applies the HasPrefix predicate on the "player_name" field. -func PlayerNameHasPrefix(v string) predicate.Orders { - return predicate.Orders(sql.FieldHasPrefix(FieldPlayerName, v)) -} - -// PlayerNameHasSuffix applies the HasSuffix predicate on the "player_name" field. -func PlayerNameHasSuffix(v string) predicate.Orders { - return predicate.Orders(sql.FieldHasSuffix(FieldPlayerName, v)) -} - -// PlayerNameEqualFold applies the EqualFold predicate on the "player_name" field. -func PlayerNameEqualFold(v string) predicate.Orders { - return predicate.Orders(sql.FieldEqualFold(FieldPlayerName, v)) -} - -// PlayerNameContainsFold applies the ContainsFold predicate on the "player_name" field. -func PlayerNameContainsFold(v string) predicate.Orders { - return predicate.Orders(sql.FieldContainsFold(FieldPlayerName, v)) -} - // ShopIDEQ applies the EQ predicate on the "shop_id" field. func ShopIDEQ(v int64) predicate.Orders { return predicate.Orders(sql.FieldEQ(FieldShopID, v)) @@ -405,81 +260,6 @@ func ShopIDNotNil() predicate.Orders { return predicate.Orders(sql.FieldNotNull(FieldShopID)) } -// ShopNameEQ applies the EQ predicate on the "shop_name" field. -func ShopNameEQ(v string) predicate.Orders { - return predicate.Orders(sql.FieldEQ(FieldShopName, v)) -} - -// ShopNameNEQ applies the NEQ predicate on the "shop_name" field. -func ShopNameNEQ(v string) predicate.Orders { - return predicate.Orders(sql.FieldNEQ(FieldShopName, v)) -} - -// ShopNameIn applies the In predicate on the "shop_name" field. -func ShopNameIn(vs ...string) predicate.Orders { - return predicate.Orders(sql.FieldIn(FieldShopName, vs...)) -} - -// ShopNameNotIn applies the NotIn predicate on the "shop_name" field. -func ShopNameNotIn(vs ...string) predicate.Orders { - return predicate.Orders(sql.FieldNotIn(FieldShopName, vs...)) -} - -// ShopNameGT applies the GT predicate on the "shop_name" field. -func ShopNameGT(v string) predicate.Orders { - return predicate.Orders(sql.FieldGT(FieldShopName, v)) -} - -// ShopNameGTE applies the GTE predicate on the "shop_name" field. -func ShopNameGTE(v string) predicate.Orders { - return predicate.Orders(sql.FieldGTE(FieldShopName, v)) -} - -// ShopNameLT applies the LT predicate on the "shop_name" field. -func ShopNameLT(v string) predicate.Orders { - return predicate.Orders(sql.FieldLT(FieldShopName, v)) -} - -// ShopNameLTE applies the LTE predicate on the "shop_name" field. -func ShopNameLTE(v string) predicate.Orders { - return predicate.Orders(sql.FieldLTE(FieldShopName, v)) -} - -// ShopNameContains applies the Contains predicate on the "shop_name" field. -func ShopNameContains(v string) predicate.Orders { - return predicate.Orders(sql.FieldContains(FieldShopName, v)) -} - -// ShopNameHasPrefix applies the HasPrefix predicate on the "shop_name" field. -func ShopNameHasPrefix(v string) predicate.Orders { - return predicate.Orders(sql.FieldHasPrefix(FieldShopName, v)) -} - -// ShopNameHasSuffix applies the HasSuffix predicate on the "shop_name" field. -func ShopNameHasSuffix(v string) predicate.Orders { - return predicate.Orders(sql.FieldHasSuffix(FieldShopName, v)) -} - -// ShopNameIsNil applies the IsNil predicate on the "shop_name" field. -func ShopNameIsNil() predicate.Orders { - return predicate.Orders(sql.FieldIsNull(FieldShopName)) -} - -// ShopNameNotNil applies the NotNil predicate on the "shop_name" field. -func ShopNameNotNil() predicate.Orders { - return predicate.Orders(sql.FieldNotNull(FieldShopName)) -} - -// ShopNameEqualFold applies the EqualFold predicate on the "shop_name" field. -func ShopNameEqualFold(v string) predicate.Orders { - return predicate.Orders(sql.FieldEqualFold(FieldShopName, v)) -} - -// ShopNameContainsFold applies the ContainsFold predicate on the "shop_name" field. -func ShopNameContainsFold(v string) predicate.Orders { - return predicate.Orders(sql.FieldContainsFold(FieldShopName, v)) -} - // StatusEQ applies the EQ predicate on the "status" field. func StatusEQ(v string) predicate.Orders { return predicate.Orders(sql.FieldEQ(FieldStatus, v)) diff --git a/app/order/rpc/internal/models/orders_create.go b/app/order/rpc/internal/models/orders_create.go index 773f362..8b54ec4 100644 --- a/app/order/rpc/internal/models/orders_create.go +++ b/app/order/rpc/internal/models/orders_create.go @@ -27,24 +27,12 @@ func (_c *OrdersCreate) SetConsumerID(v int64) *OrdersCreate { return _c } -// SetConsumerName sets the "consumer_name" field. -func (_c *OrdersCreate) SetConsumerName(v string) *OrdersCreate { - _c.mutation.SetConsumerName(v) - return _c -} - // SetPlayerID sets the "player_id" field. func (_c *OrdersCreate) SetPlayerID(v int64) *OrdersCreate { _c.mutation.SetPlayerID(v) return _c } -// SetPlayerName sets the "player_name" field. -func (_c *OrdersCreate) SetPlayerName(v string) *OrdersCreate { - _c.mutation.SetPlayerName(v) - return _c -} - // SetShopID sets the "shop_id" field. func (_c *OrdersCreate) SetShopID(v int64) *OrdersCreate { _c.mutation.SetShopID(v) @@ -59,20 +47,6 @@ func (_c *OrdersCreate) SetNillableShopID(v *int64) *OrdersCreate { return _c } -// SetShopName sets the "shop_name" field. -func (_c *OrdersCreate) SetShopName(v string) *OrdersCreate { - _c.mutation.SetShopName(v) - return _c -} - -// SetNillableShopName sets the "shop_name" field if the given value is not nil. -func (_c *OrdersCreate) SetNillableShopName(v *string) *OrdersCreate { - if v != nil { - _c.SetShopName(*v) - } - return _c -} - // SetServiceSnapshot sets the "service_snapshot" field. func (_c *OrdersCreate) SetServiceSnapshot(v map[string]interface{}) *OrdersCreate { _c.mutation.SetServiceSnapshot(v) @@ -303,30 +277,9 @@ func (_c *OrdersCreate) check() error { if _, ok := _c.mutation.ConsumerID(); !ok { return &ValidationError{Name: "consumer_id", err: errors.New(`models: missing required field "Orders.consumer_id"`)} } - if _, ok := _c.mutation.ConsumerName(); !ok { - return &ValidationError{Name: "consumer_name", err: errors.New(`models: missing required field "Orders.consumer_name"`)} - } - if v, ok := _c.mutation.ConsumerName(); ok { - if err := orders.ConsumerNameValidator(v); err != nil { - return &ValidationError{Name: "consumer_name", err: fmt.Errorf(`models: validator failed for field "Orders.consumer_name": %w`, err)} - } - } if _, ok := _c.mutation.PlayerID(); !ok { return &ValidationError{Name: "player_id", err: errors.New(`models: missing required field "Orders.player_id"`)} } - if _, ok := _c.mutation.PlayerName(); !ok { - return &ValidationError{Name: "player_name", err: errors.New(`models: missing required field "Orders.player_name"`)} - } - if v, ok := _c.mutation.PlayerName(); ok { - if err := orders.PlayerNameValidator(v); err != nil { - return &ValidationError{Name: "player_name", err: fmt.Errorf(`models: validator failed for field "Orders.player_name": %w`, err)} - } - } - if v, ok := _c.mutation.ShopName(); ok { - if err := orders.ShopNameValidator(v); err != nil { - return &ValidationError{Name: "shop_name", err: fmt.Errorf(`models: validator failed for field "Orders.shop_name": %w`, err)} - } - } if _, ok := _c.mutation.ServiceSnapshot(); !ok { return &ValidationError{Name: "service_snapshot", err: errors.New(`models: missing required field "Orders.service_snapshot"`)} } @@ -391,26 +344,14 @@ func (_c *OrdersCreate) createSpec() (*Orders, *sqlgraph.CreateSpec) { _spec.SetField(orders.FieldConsumerID, field.TypeInt64, value) _node.ConsumerID = value } - if value, ok := _c.mutation.ConsumerName(); ok { - _spec.SetField(orders.FieldConsumerName, field.TypeString, value) - _node.ConsumerName = value - } if value, ok := _c.mutation.PlayerID(); ok { _spec.SetField(orders.FieldPlayerID, field.TypeInt64, value) _node.PlayerID = value } - if value, ok := _c.mutation.PlayerName(); ok { - _spec.SetField(orders.FieldPlayerName, field.TypeString, value) - _node.PlayerName = value - } if value, ok := _c.mutation.ShopID(); ok { _spec.SetField(orders.FieldShopID, field.TypeInt64, value) _node.ShopID = &value } - if value, ok := _c.mutation.ShopName(); ok { - _spec.SetField(orders.FieldShopName, field.TypeString, value) - _node.ShopName = &value - } if value, ok := _c.mutation.ServiceSnapshot(); ok { _spec.SetField(orders.FieldServiceSnapshot, field.TypeJSON, value) _node.ServiceSnapshot = value diff --git a/app/order/rpc/internal/models/orders_update.go b/app/order/rpc/internal/models/orders_update.go index 9f47ca1..36c228b 100644 --- a/app/order/rpc/internal/models/orders_update.go +++ b/app/order/rpc/internal/models/orders_update.go @@ -50,20 +50,6 @@ func (_u *OrdersUpdate) AddConsumerID(v int64) *OrdersUpdate { return _u } -// SetConsumerName sets the "consumer_name" field. -func (_u *OrdersUpdate) SetConsumerName(v string) *OrdersUpdate { - _u.mutation.SetConsumerName(v) - return _u -} - -// SetNillableConsumerName sets the "consumer_name" field if the given value is not nil. -func (_u *OrdersUpdate) SetNillableConsumerName(v *string) *OrdersUpdate { - if v != nil { - _u.SetConsumerName(*v) - } - return _u -} - // SetPlayerID sets the "player_id" field. func (_u *OrdersUpdate) SetPlayerID(v int64) *OrdersUpdate { _u.mutation.ResetPlayerID() @@ -85,20 +71,6 @@ func (_u *OrdersUpdate) AddPlayerID(v int64) *OrdersUpdate { return _u } -// SetPlayerName sets the "player_name" field. -func (_u *OrdersUpdate) SetPlayerName(v string) *OrdersUpdate { - _u.mutation.SetPlayerName(v) - return _u -} - -// SetNillablePlayerName sets the "player_name" field if the given value is not nil. -func (_u *OrdersUpdate) SetNillablePlayerName(v *string) *OrdersUpdate { - if v != nil { - _u.SetPlayerName(*v) - } - return _u -} - // SetShopID sets the "shop_id" field. func (_u *OrdersUpdate) SetShopID(v int64) *OrdersUpdate { _u.mutation.ResetShopID() @@ -126,26 +98,6 @@ func (_u *OrdersUpdate) ClearShopID() *OrdersUpdate { return _u } -// SetShopName sets the "shop_name" field. -func (_u *OrdersUpdate) SetShopName(v string) *OrdersUpdate { - _u.mutation.SetShopName(v) - return _u -} - -// SetNillableShopName sets the "shop_name" field if the given value is not nil. -func (_u *OrdersUpdate) SetNillableShopName(v *string) *OrdersUpdate { - if v != nil { - _u.SetShopName(*v) - } - return _u -} - -// ClearShopName clears the value of the "shop_name" field. -func (_u *OrdersUpdate) ClearShopName() *OrdersUpdate { - _u.mutation.ClearShopName() - return _u -} - // SetServiceSnapshot sets the "service_snapshot" field. func (_u *OrdersUpdate) SetServiceSnapshot(v map[string]interface{}) *OrdersUpdate { _u.mutation.SetServiceSnapshot(v) @@ -390,21 +342,6 @@ func (_u *OrdersUpdate) defaults() { // check runs all checks and user-defined validators on the builder. func (_u *OrdersUpdate) check() error { - if v, ok := _u.mutation.ConsumerName(); ok { - if err := orders.ConsumerNameValidator(v); err != nil { - return &ValidationError{Name: "consumer_name", err: fmt.Errorf(`models: validator failed for field "Orders.consumer_name": %w`, err)} - } - } - if v, ok := _u.mutation.PlayerName(); ok { - if err := orders.PlayerNameValidator(v); err != nil { - return &ValidationError{Name: "player_name", err: fmt.Errorf(`models: validator failed for field "Orders.player_name": %w`, err)} - } - } - if v, ok := _u.mutation.ShopName(); ok { - if err := orders.ShopNameValidator(v); err != nil { - return &ValidationError{Name: "shop_name", err: fmt.Errorf(`models: validator failed for field "Orders.shop_name": %w`, err)} - } - } if v, ok := _u.mutation.Status(); ok { if err := orders.StatusValidator(v); err != nil { return &ValidationError{Name: "status", err: fmt.Errorf(`models: validator failed for field "Orders.status": %w`, err)} @@ -436,18 +373,12 @@ func (_u *OrdersUpdate) sqlSave(ctx context.Context) (_node int, err error) { if value, ok := _u.mutation.AddedConsumerID(); ok { _spec.AddField(orders.FieldConsumerID, field.TypeInt64, value) } - if value, ok := _u.mutation.ConsumerName(); ok { - _spec.SetField(orders.FieldConsumerName, field.TypeString, value) - } if value, ok := _u.mutation.PlayerID(); ok { _spec.SetField(orders.FieldPlayerID, field.TypeInt64, value) } if value, ok := _u.mutation.AddedPlayerID(); ok { _spec.AddField(orders.FieldPlayerID, field.TypeInt64, value) } - if value, ok := _u.mutation.PlayerName(); ok { - _spec.SetField(orders.FieldPlayerName, field.TypeString, value) - } if value, ok := _u.mutation.ShopID(); ok { _spec.SetField(orders.FieldShopID, field.TypeInt64, value) } @@ -457,12 +388,6 @@ func (_u *OrdersUpdate) sqlSave(ctx context.Context) (_node int, err error) { if _u.mutation.ShopIDCleared() { _spec.ClearField(orders.FieldShopID, field.TypeInt64) } - if value, ok := _u.mutation.ShopName(); ok { - _spec.SetField(orders.FieldShopName, field.TypeString, value) - } - if _u.mutation.ShopNameCleared() { - _spec.ClearField(orders.FieldShopName, field.TypeString) - } if value, ok := _u.mutation.ServiceSnapshot(); ok { _spec.SetField(orders.FieldServiceSnapshot, field.TypeJSON, value) } @@ -564,20 +489,6 @@ func (_u *OrdersUpdateOne) AddConsumerID(v int64) *OrdersUpdateOne { return _u } -// SetConsumerName sets the "consumer_name" field. -func (_u *OrdersUpdateOne) SetConsumerName(v string) *OrdersUpdateOne { - _u.mutation.SetConsumerName(v) - return _u -} - -// SetNillableConsumerName sets the "consumer_name" field if the given value is not nil. -func (_u *OrdersUpdateOne) SetNillableConsumerName(v *string) *OrdersUpdateOne { - if v != nil { - _u.SetConsumerName(*v) - } - return _u -} - // SetPlayerID sets the "player_id" field. func (_u *OrdersUpdateOne) SetPlayerID(v int64) *OrdersUpdateOne { _u.mutation.ResetPlayerID() @@ -599,20 +510,6 @@ func (_u *OrdersUpdateOne) AddPlayerID(v int64) *OrdersUpdateOne { return _u } -// SetPlayerName sets the "player_name" field. -func (_u *OrdersUpdateOne) SetPlayerName(v string) *OrdersUpdateOne { - _u.mutation.SetPlayerName(v) - return _u -} - -// SetNillablePlayerName sets the "player_name" field if the given value is not nil. -func (_u *OrdersUpdateOne) SetNillablePlayerName(v *string) *OrdersUpdateOne { - if v != nil { - _u.SetPlayerName(*v) - } - return _u -} - // SetShopID sets the "shop_id" field. func (_u *OrdersUpdateOne) SetShopID(v int64) *OrdersUpdateOne { _u.mutation.ResetShopID() @@ -640,26 +537,6 @@ func (_u *OrdersUpdateOne) ClearShopID() *OrdersUpdateOne { return _u } -// SetShopName sets the "shop_name" field. -func (_u *OrdersUpdateOne) SetShopName(v string) *OrdersUpdateOne { - _u.mutation.SetShopName(v) - return _u -} - -// SetNillableShopName sets the "shop_name" field if the given value is not nil. -func (_u *OrdersUpdateOne) SetNillableShopName(v *string) *OrdersUpdateOne { - if v != nil { - _u.SetShopName(*v) - } - return _u -} - -// ClearShopName clears the value of the "shop_name" field. -func (_u *OrdersUpdateOne) ClearShopName() *OrdersUpdateOne { - _u.mutation.ClearShopName() - return _u -} - // SetServiceSnapshot sets the "service_snapshot" field. func (_u *OrdersUpdateOne) SetServiceSnapshot(v map[string]interface{}) *OrdersUpdateOne { _u.mutation.SetServiceSnapshot(v) @@ -917,21 +794,6 @@ func (_u *OrdersUpdateOne) defaults() { // check runs all checks and user-defined validators on the builder. func (_u *OrdersUpdateOne) check() error { - if v, ok := _u.mutation.ConsumerName(); ok { - if err := orders.ConsumerNameValidator(v); err != nil { - return &ValidationError{Name: "consumer_name", err: fmt.Errorf(`models: validator failed for field "Orders.consumer_name": %w`, err)} - } - } - if v, ok := _u.mutation.PlayerName(); ok { - if err := orders.PlayerNameValidator(v); err != nil { - return &ValidationError{Name: "player_name", err: fmt.Errorf(`models: validator failed for field "Orders.player_name": %w`, err)} - } - } - if v, ok := _u.mutation.ShopName(); ok { - if err := orders.ShopNameValidator(v); err != nil { - return &ValidationError{Name: "shop_name", err: fmt.Errorf(`models: validator failed for field "Orders.shop_name": %w`, err)} - } - } if v, ok := _u.mutation.Status(); ok { if err := orders.StatusValidator(v); err != nil { return &ValidationError{Name: "status", err: fmt.Errorf(`models: validator failed for field "Orders.status": %w`, err)} @@ -980,18 +842,12 @@ func (_u *OrdersUpdateOne) sqlSave(ctx context.Context) (_node *Orders, err erro if value, ok := _u.mutation.AddedConsumerID(); ok { _spec.AddField(orders.FieldConsumerID, field.TypeInt64, value) } - if value, ok := _u.mutation.ConsumerName(); ok { - _spec.SetField(orders.FieldConsumerName, field.TypeString, value) - } if value, ok := _u.mutation.PlayerID(); ok { _spec.SetField(orders.FieldPlayerID, field.TypeInt64, value) } if value, ok := _u.mutation.AddedPlayerID(); ok { _spec.AddField(orders.FieldPlayerID, field.TypeInt64, value) } - if value, ok := _u.mutation.PlayerName(); ok { - _spec.SetField(orders.FieldPlayerName, field.TypeString, value) - } if value, ok := _u.mutation.ShopID(); ok { _spec.SetField(orders.FieldShopID, field.TypeInt64, value) } @@ -1001,12 +857,6 @@ func (_u *OrdersUpdateOne) sqlSave(ctx context.Context) (_node *Orders, err erro if _u.mutation.ShopIDCleared() { _spec.ClearField(orders.FieldShopID, field.TypeInt64) } - if value, ok := _u.mutation.ShopName(); ok { - _spec.SetField(orders.FieldShopName, field.TypeString, value) - } - if _u.mutation.ShopNameCleared() { - _spec.ClearField(orders.FieldShopName, field.TypeString) - } if value, ok := _u.mutation.ServiceSnapshot(); ok { _spec.SetField(orders.FieldServiceSnapshot, field.TypeJSON, value) } diff --git a/app/order/rpc/internal/models/runtime.go b/app/order/rpc/internal/models/runtime.go index 0342bba..59aca8d 100644 --- a/app/order/rpc/internal/models/runtime.go +++ b/app/order/rpc/internal/models/runtime.go @@ -37,38 +37,26 @@ func init() { orderstatelogs.DefaultCreatedAt = orderstatelogsDescCreatedAt.Default.(func() time.Time) ordersFields := schema.Orders{}.Fields() _ = ordersFields - // ordersDescConsumerName is the schema descriptor for consumer_name field. - ordersDescConsumerName := ordersFields[2].Descriptor() - // orders.ConsumerNameValidator is a validator for the "consumer_name" field. It is called by the builders before save. - orders.ConsumerNameValidator = ordersDescConsumerName.Validators[0].(func(string) error) - // ordersDescPlayerName is the schema descriptor for player_name field. - ordersDescPlayerName := ordersFields[4].Descriptor() - // orders.PlayerNameValidator is a validator for the "player_name" field. It is called by the builders before save. - orders.PlayerNameValidator = ordersDescPlayerName.Validators[0].(func(string) error) - // ordersDescShopName is the schema descriptor for shop_name field. - ordersDescShopName := ordersFields[6].Descriptor() - // orders.ShopNameValidator is a validator for the "shop_name" field. It is called by the builders before save. - orders.ShopNameValidator = ordersDescShopName.Validators[0].(func(string) error) // ordersDescStatus is the schema descriptor for status field. - ordersDescStatus := ordersFields[8].Descriptor() + ordersDescStatus := ordersFields[5].Descriptor() // orders.DefaultStatus holds the default value on creation for the status field. orders.DefaultStatus = ordersDescStatus.Default.(string) // orders.StatusValidator is a validator for the "status" field. It is called by the builders before save. orders.StatusValidator = ordersDescStatus.Validators[0].(func(string) error) // ordersDescVersion is the schema descriptor for version field. - ordersDescVersion := ordersFields[11].Descriptor() + ordersDescVersion := ordersFields[8].Descriptor() // orders.DefaultVersion holds the default value on creation for the version field. orders.DefaultVersion = ordersDescVersion.Default.(int) // ordersDescTimeoutJobID is the schema descriptor for timeout_job_id field. - ordersDescTimeoutJobID := ordersFields[12].Descriptor() + ordersDescTimeoutJobID := ordersFields[9].Descriptor() // orders.TimeoutJobIDValidator is a validator for the "timeout_job_id" field. It is called by the builders before save. orders.TimeoutJobIDValidator = ordersDescTimeoutJobID.Validators[0].(func(string) error) // ordersDescCreatedAt is the schema descriptor for created_at field. - ordersDescCreatedAt := ordersFields[14].Descriptor() + ordersDescCreatedAt := ordersFields[11].Descriptor() // orders.DefaultCreatedAt holds the default value on creation for the created_at field. orders.DefaultCreatedAt = ordersDescCreatedAt.Default.(func() time.Time) // ordersDescUpdatedAt is the schema descriptor for updated_at field. - ordersDescUpdatedAt := ordersFields[19].Descriptor() + ordersDescUpdatedAt := ordersFields[16].Descriptor() // orders.DefaultUpdatedAt holds the default value on creation for the updated_at field. orders.DefaultUpdatedAt = ordersDescUpdatedAt.Default.(func() time.Time) // orders.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. diff --git a/app/order/rpc/internal/models/schema/orders.go b/app/order/rpc/internal/models/schema/orders.go index 3df86c5..9341822 100644 --- a/app/order/rpc/internal/models/schema/orders.go +++ b/app/order/rpc/internal/models/schema/orders.go @@ -34,11 +34,8 @@ 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), diff --git a/app/order/rpc/pb/order.pb.go b/app/order/rpc/pb/order.pb.go index 7cada46..75e150f 100644 --- a/app/order/rpc/pb/order.pb.go +++ b/app/order/rpc/pb/order.pb.go @@ -26,11 +26,8 @@ type Orders struct { state protoimpl.MessageState `protogen:"open.v1"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //id ConsumerId int64 `protobuf:"varint,2,opt,name=consumerId,proto3" json:"consumerId,omitempty"` //consumerId - ConsumerName string `protobuf:"bytes,3,opt,name=consumerName,proto3" json:"consumerName,omitempty"` //consumerName PlayerId int64 `protobuf:"varint,4,opt,name=playerId,proto3" json:"playerId,omitempty"` //playerId - PlayerName string `protobuf:"bytes,5,opt,name=playerName,proto3" json:"playerName,omitempty"` //playerName ShopId *int64 `protobuf:"varint,6,opt,name=shopId,proto3,oneof" json:"shopId,omitempty"` //shopId - ShopName *string `protobuf:"bytes,7,opt,name=shopName,proto3,oneof" json:"shopName,omitempty"` //shopName ServiceSnapshot string `protobuf:"bytes,8,opt,name=serviceSnapshot,proto3" json:"serviceSnapshot,omitempty"` //serviceSnapshot Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"` //status TotalPrice string `protobuf:"bytes,10,opt,name=totalPrice,proto3" json:"totalPrice,omitempty"` //totalPrice @@ -92,13 +89,6 @@ func (x *Orders) GetConsumerId() int64 { return 0 } -func (x *Orders) GetConsumerName() string { - if x != nil { - return x.ConsumerName - } - return "" -} - func (x *Orders) GetPlayerId() int64 { if x != nil { return x.PlayerId @@ -106,13 +96,6 @@ func (x *Orders) GetPlayerId() int64 { return 0 } -func (x *Orders) GetPlayerName() string { - if x != nil { - return x.PlayerName - } - return "" -} - func (x *Orders) GetShopId() int64 { if x != nil && x.ShopId != nil { return *x.ShopId @@ -120,13 +103,6 @@ func (x *Orders) GetShopId() int64 { return 0 } -func (x *Orders) GetShopName() string { - if x != nil && x.ShopName != nil { - return *x.ShopName - } - return "" -} - func (x *Orders) GetServiceSnapshot() string { if x != nil { return x.ServiceSnapshot @@ -222,11 +198,8 @@ type AddOrdersReq struct { state protoimpl.MessageState `protogen:"open.v1"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //id ConsumerId int64 `protobuf:"varint,2,opt,name=consumerId,proto3" json:"consumerId,omitempty"` //consumerId - ConsumerName string `protobuf:"bytes,3,opt,name=consumerName,proto3" json:"consumerName,omitempty"` //consumerName PlayerId int64 `protobuf:"varint,4,opt,name=playerId,proto3" json:"playerId,omitempty"` //playerId - PlayerName string `protobuf:"bytes,5,opt,name=playerName,proto3" json:"playerName,omitempty"` //playerName ShopId *int64 `protobuf:"varint,6,opt,name=shopId,proto3,oneof" json:"shopId,omitempty"` //shopId - ShopName *string `protobuf:"bytes,7,opt,name=shopName,proto3,oneof" json:"shopName,omitempty"` //shopName ServiceSnapshot string `protobuf:"bytes,8,opt,name=serviceSnapshot,proto3" json:"serviceSnapshot,omitempty"` //serviceSnapshot Status *string `protobuf:"bytes,9,opt,name=status,proto3,oneof" json:"status,omitempty"` //status TotalPrice string `protobuf:"bytes,10,opt,name=totalPrice,proto3" json:"totalPrice,omitempty"` //totalPrice @@ -288,13 +261,6 @@ func (x *AddOrdersReq) GetConsumerId() int64 { return 0 } -func (x *AddOrdersReq) GetConsumerName() string { - if x != nil { - return x.ConsumerName - } - return "" -} - func (x *AddOrdersReq) GetPlayerId() int64 { if x != nil { return x.PlayerId @@ -302,13 +268,6 @@ func (x *AddOrdersReq) GetPlayerId() int64 { return 0 } -func (x *AddOrdersReq) GetPlayerName() string { - if x != nil { - return x.PlayerName - } - return "" -} - func (x *AddOrdersReq) GetShopId() int64 { if x != nil && x.ShopId != nil { return *x.ShopId @@ -316,13 +275,6 @@ func (x *AddOrdersReq) GetShopId() int64 { return 0 } -func (x *AddOrdersReq) GetShopName() string { - if x != nil && x.ShopName != nil { - return *x.ShopName - } - return "" -} - func (x *AddOrdersReq) GetServiceSnapshot() string { if x != nil { return x.ServiceSnapshot @@ -462,11 +414,8 @@ type UpdateOrdersReq struct { state protoimpl.MessageState `protogen:"open.v1"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //id ConsumerId *int64 `protobuf:"varint,2,opt,name=consumerId,proto3,oneof" json:"consumerId,omitempty"` //consumerId - ConsumerName *string `protobuf:"bytes,3,opt,name=consumerName,proto3,oneof" json:"consumerName,omitempty"` //consumerName PlayerId *int64 `protobuf:"varint,4,opt,name=playerId,proto3,oneof" json:"playerId,omitempty"` //playerId - PlayerName *string `protobuf:"bytes,5,opt,name=playerName,proto3,oneof" json:"playerName,omitempty"` //playerName ShopId *int64 `protobuf:"varint,6,opt,name=shopId,proto3,oneof" json:"shopId,omitempty"` //shopId - ShopName *string `protobuf:"bytes,7,opt,name=shopName,proto3,oneof" json:"shopName,omitempty"` //shopName ServiceSnapshot *string `protobuf:"bytes,8,opt,name=serviceSnapshot,proto3,oneof" json:"serviceSnapshot,omitempty"` //serviceSnapshot Status *string `protobuf:"bytes,9,opt,name=status,proto3,oneof" json:"status,omitempty"` //status TotalPrice *string `protobuf:"bytes,10,opt,name=totalPrice,proto3,oneof" json:"totalPrice,omitempty"` //totalPrice @@ -528,13 +477,6 @@ func (x *UpdateOrdersReq) GetConsumerId() int64 { return 0 } -func (x *UpdateOrdersReq) GetConsumerName() string { - if x != nil && x.ConsumerName != nil { - return *x.ConsumerName - } - return "" -} - func (x *UpdateOrdersReq) GetPlayerId() int64 { if x != nil && x.PlayerId != nil { return *x.PlayerId @@ -542,13 +484,6 @@ func (x *UpdateOrdersReq) GetPlayerId() int64 { return 0 } -func (x *UpdateOrdersReq) GetPlayerName() string { - if x != nil && x.PlayerName != nil { - return *x.PlayerName - } - return "" -} - func (x *UpdateOrdersReq) GetShopId() int64 { if x != nil && x.ShopId != nil { return *x.ShopId @@ -556,13 +491,6 @@ func (x *UpdateOrdersReq) GetShopId() int64 { return 0 } -func (x *UpdateOrdersReq) GetShopName() string { - if x != nil && x.ShopName != nil { - return *x.ShopName - } - return "" -} - func (x *UpdateOrdersReq) GetServiceSnapshot() string { if x != nil && x.ServiceSnapshot != nil { return *x.ServiceSnapshot @@ -864,11 +792,8 @@ type SearchOrdersReq struct { Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit Id *int64 `protobuf:"varint,3,opt,name=id,proto3,oneof" json:"id,omitempty"` //id ConsumerId *int64 `protobuf:"varint,4,opt,name=consumerId,proto3,oneof" json:"consumerId,omitempty"` //consumerId - ConsumerName *string `protobuf:"bytes,5,opt,name=consumerName,proto3,oneof" json:"consumerName,omitempty"` //consumerName PlayerId *int64 `protobuf:"varint,6,opt,name=playerId,proto3,oneof" json:"playerId,omitempty"` //playerId - PlayerName *string `protobuf:"bytes,7,opt,name=playerName,proto3,oneof" json:"playerName,omitempty"` //playerName ShopId *int64 `protobuf:"varint,8,opt,name=shopId,proto3,oneof" json:"shopId,omitempty"` //shopId - ShopName *string `protobuf:"bytes,9,opt,name=shopName,proto3,oneof" json:"shopName,omitempty"` //shopName ServiceSnapshot *string `protobuf:"bytes,10,opt,name=serviceSnapshot,proto3,oneof" json:"serviceSnapshot,omitempty"` //serviceSnapshot Status *string `protobuf:"bytes,11,opt,name=status,proto3,oneof" json:"status,omitempty"` //status TotalPrice *string `protobuf:"bytes,12,opt,name=totalPrice,proto3,oneof" json:"totalPrice,omitempty"` //totalPrice @@ -944,13 +869,6 @@ func (x *SearchOrdersReq) GetConsumerId() int64 { return 0 } -func (x *SearchOrdersReq) GetConsumerName() string { - if x != nil && x.ConsumerName != nil { - return *x.ConsumerName - } - return "" -} - func (x *SearchOrdersReq) GetPlayerId() int64 { if x != nil && x.PlayerId != nil { return *x.PlayerId @@ -958,13 +876,6 @@ func (x *SearchOrdersReq) GetPlayerId() int64 { return 0 } -func (x *SearchOrdersReq) GetPlayerName() string { - if x != nil && x.PlayerName != nil { - return *x.PlayerName - } - return "" -} - func (x *SearchOrdersReq) GetShopId() int64 { if x != nil && x.ShopId != nil { return *x.ShopId @@ -972,13 +883,6 @@ func (x *SearchOrdersReq) GetShopId() int64 { return 0 } -func (x *SearchOrdersReq) GetShopName() string { - if x != nil && x.ShopName != nil { - return *x.ShopName - } - return "" -} - func (x *SearchOrdersReq) GetServiceSnapshot() string { if x != nil && x.ServiceSnapshot != nil { return *x.ServiceSnapshot @@ -1851,82 +1755,70 @@ var File_order_proto protoreflect.FileDescriptor const file_order_proto_rawDesc = "" + "\n" + - "\vorder.proto\x12\x02pb\"\xf2\x05\n" + + "\vorder.proto\x12\x02pb\"\x80\x05\n" + "\x06Orders\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1e\n" + "\n" + "consumerId\x18\x02 \x01(\x03R\n" + - "consumerId\x12\"\n" + - "\fconsumerName\x18\x03 \x01(\tR\fconsumerName\x12\x1a\n" + - "\bplayerId\x18\x04 \x01(\x03R\bplayerId\x12\x1e\n" + - "\n" + - "playerName\x18\x05 \x01(\tR\n" + - "playerName\x12\x1b\n" + - "\x06shopId\x18\x06 \x01(\x03H\x00R\x06shopId\x88\x01\x01\x12\x1f\n" + - "\bshopName\x18\a \x01(\tH\x01R\bshopName\x88\x01\x01\x12(\n" + + "consumerId\x12\x1a\n" + + "\bplayerId\x18\x04 \x01(\x03R\bplayerId\x12\x1b\n" + + "\x06shopId\x18\x06 \x01(\x03H\x00R\x06shopId\x88\x01\x01\x12(\n" + "\x0fserviceSnapshot\x18\b \x01(\tR\x0fserviceSnapshot\x12\x16\n" + "\x06status\x18\t \x01(\tR\x06status\x12\x1e\n" + "\n" + "totalPrice\x18\n" + " \x01(\tR\n" + "totalPrice\x12\x17\n" + - "\x04note\x18\v \x01(\tH\x02R\x04note\x88\x01\x01\x12\x18\n" + + "\x04note\x18\v \x01(\tH\x01R\x04note\x88\x01\x01\x12\x18\n" + "\aversion\x18\f \x01(\x03R\aversion\x12'\n" + - "\ftimeoutJobId\x18\r \x01(\tH\x03R\ftimeoutJobId\x88\x01\x01\x12\x1e\n" + + "\ftimeoutJobId\x18\r \x01(\tH\x02R\ftimeoutJobId\x88\x01\x01\x12\x1e\n" + "\n" + "searchText\x18\x0e \x01(\tR\n" + "searchText\x12\x1c\n" + "\tcreatedAt\x18\x0f \x01(\x03R\tcreatedAt\x12#\n" + "\n" + - "acceptedAt\x18\x10 \x01(\x03H\x04R\n" + + "acceptedAt\x18\x10 \x01(\x03H\x03R\n" + "acceptedAt\x88\x01\x01\x12\x1f\n" + - "\bclosedAt\x18\x11 \x01(\x03H\x05R\bclosedAt\x88\x01\x01\x12%\n" + - "\vcompletedAt\x18\x12 \x01(\x03H\x06R\vcompletedAt\x88\x01\x01\x12%\n" + - "\vcancelledAt\x18\x13 \x01(\x03H\aR\vcancelledAt\x88\x01\x01\x12\x1c\n" + + "\bclosedAt\x18\x11 \x01(\x03H\x04R\bclosedAt\x88\x01\x01\x12%\n" + + "\vcompletedAt\x18\x12 \x01(\x03H\x05R\vcompletedAt\x88\x01\x01\x12%\n" + + "\vcancelledAt\x18\x13 \x01(\x03H\x06R\vcancelledAt\x88\x01\x01\x12\x1c\n" + "\tupdatedAt\x18\x14 \x01(\x03R\tupdatedAtB\t\n" + - "\a_shopIdB\v\n" + - "\t_shopNameB\a\n" + + "\a_shopIdB\a\n" + "\x05_noteB\x0f\n" + "\r_timeoutJobIdB\r\n" + "\v_acceptedAtB\v\n" + "\t_closedAtB\x0e\n" + "\f_completedAtB\x0e\n" + - "\f_cancelledAt\"\xd3\x06\n" + + "\f_cancelledAt\"\xe1\x05\n" + "\fAddOrdersReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1e\n" + "\n" + "consumerId\x18\x02 \x01(\x03R\n" + - "consumerId\x12\"\n" + - "\fconsumerName\x18\x03 \x01(\tR\fconsumerName\x12\x1a\n" + - "\bplayerId\x18\x04 \x01(\x03R\bplayerId\x12\x1e\n" + - "\n" + - "playerName\x18\x05 \x01(\tR\n" + - "playerName\x12\x1b\n" + - "\x06shopId\x18\x06 \x01(\x03H\x00R\x06shopId\x88\x01\x01\x12\x1f\n" + - "\bshopName\x18\a \x01(\tH\x01R\bshopName\x88\x01\x01\x12(\n" + + "consumerId\x12\x1a\n" + + "\bplayerId\x18\x04 \x01(\x03R\bplayerId\x12\x1b\n" + + "\x06shopId\x18\x06 \x01(\x03H\x00R\x06shopId\x88\x01\x01\x12(\n" + "\x0fserviceSnapshot\x18\b \x01(\tR\x0fserviceSnapshot\x12\x1b\n" + - "\x06status\x18\t \x01(\tH\x02R\x06status\x88\x01\x01\x12\x1e\n" + + "\x06status\x18\t \x01(\tH\x01R\x06status\x88\x01\x01\x12\x1e\n" + "\n" + "totalPrice\x18\n" + " \x01(\tR\n" + "totalPrice\x12\x17\n" + - "\x04note\x18\v \x01(\tH\x03R\x04note\x88\x01\x01\x12\x1d\n" + - "\aversion\x18\f \x01(\x03H\x04R\aversion\x88\x01\x01\x12'\n" + - "\ftimeoutJobId\x18\r \x01(\tH\x05R\ftimeoutJobId\x88\x01\x01\x12#\n" + + "\x04note\x18\v \x01(\tH\x02R\x04note\x88\x01\x01\x12\x1d\n" + + "\aversion\x18\f \x01(\x03H\x03R\aversion\x88\x01\x01\x12'\n" + + "\ftimeoutJobId\x18\r \x01(\tH\x04R\ftimeoutJobId\x88\x01\x01\x12#\n" + "\n" + - "searchText\x18\x0e \x01(\tH\x06R\n" + + "searchText\x18\x0e \x01(\tH\x05R\n" + "searchText\x88\x01\x01\x12!\n" + - "\tcreatedAt\x18\x0f \x01(\x03H\aR\tcreatedAt\x88\x01\x01\x12#\n" + + "\tcreatedAt\x18\x0f \x01(\x03H\x06R\tcreatedAt\x88\x01\x01\x12#\n" + "\n" + - "acceptedAt\x18\x10 \x01(\x03H\bR\n" + + "acceptedAt\x18\x10 \x01(\x03H\aR\n" + "acceptedAt\x88\x01\x01\x12\x1f\n" + - "\bclosedAt\x18\x11 \x01(\x03H\tR\bclosedAt\x88\x01\x01\x12%\n" + - "\vcompletedAt\x18\x12 \x01(\x03H\n" + - "R\vcompletedAt\x88\x01\x01\x12%\n" + - "\vcancelledAt\x18\x13 \x01(\x03H\vR\vcancelledAt\x88\x01\x01\x12!\n" + - "\tupdatedAt\x18\x14 \x01(\x03H\fR\tupdatedAt\x88\x01\x01B\t\n" + - "\a_shopIdB\v\n" + - "\t_shopNameB\t\n" + + "\bclosedAt\x18\x11 \x01(\x03H\bR\bclosedAt\x88\x01\x01\x12%\n" + + "\vcompletedAt\x18\x12 \x01(\x03H\tR\vcompletedAt\x88\x01\x01\x12%\n" + + "\vcancelledAt\x18\x13 \x01(\x03H\n" + + "R\vcancelledAt\x88\x01\x01\x12!\n" + + "\tupdatedAt\x18\x14 \x01(\x03H\vR\tupdatedAt\x88\x01\x01B\t\n" + + "\a_shopIdB\t\n" + "\a_statusB\a\n" + "\x05_noteB\n" + "\n" + @@ -1942,46 +1834,38 @@ const file_order_proto_rawDesc = "" + "\n" + "_updatedAt\"\x1f\n" + "\rAddOrdersResp\x12\x0e\n" + - "\x02id\x18\x01 \x01(\x03R\x02id\"\xd3\a\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\"\xb7\x06\n" + "\x0fUpdateOrdersReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12#\n" + "\n" + "consumerId\x18\x02 \x01(\x03H\x00R\n" + - "consumerId\x88\x01\x01\x12'\n" + - "\fconsumerName\x18\x03 \x01(\tH\x01R\fconsumerName\x88\x01\x01\x12\x1f\n" + - "\bplayerId\x18\x04 \x01(\x03H\x02R\bplayerId\x88\x01\x01\x12#\n" + - "\n" + - "playerName\x18\x05 \x01(\tH\x03R\n" + - "playerName\x88\x01\x01\x12\x1b\n" + - "\x06shopId\x18\x06 \x01(\x03H\x04R\x06shopId\x88\x01\x01\x12\x1f\n" + - "\bshopName\x18\a \x01(\tH\x05R\bshopName\x88\x01\x01\x12-\n" + - "\x0fserviceSnapshot\x18\b \x01(\tH\x06R\x0fserviceSnapshot\x88\x01\x01\x12\x1b\n" + - "\x06status\x18\t \x01(\tH\aR\x06status\x88\x01\x01\x12#\n" + + "consumerId\x88\x01\x01\x12\x1f\n" + + "\bplayerId\x18\x04 \x01(\x03H\x01R\bplayerId\x88\x01\x01\x12\x1b\n" + + "\x06shopId\x18\x06 \x01(\x03H\x02R\x06shopId\x88\x01\x01\x12-\n" + + "\x0fserviceSnapshot\x18\b \x01(\tH\x03R\x0fserviceSnapshot\x88\x01\x01\x12\x1b\n" + + "\x06status\x18\t \x01(\tH\x04R\x06status\x88\x01\x01\x12#\n" + "\n" + "totalPrice\x18\n" + - " \x01(\tH\bR\n" + + " \x01(\tH\x05R\n" + "totalPrice\x88\x01\x01\x12\x17\n" + - "\x04note\x18\v \x01(\tH\tR\x04note\x88\x01\x01\x12\x1d\n" + - "\aversion\x18\f \x01(\x03H\n" + - "R\aversion\x88\x01\x01\x12'\n" + - "\ftimeoutJobId\x18\r \x01(\tH\vR\ftimeoutJobId\x88\x01\x01\x12#\n" + + "\x04note\x18\v \x01(\tH\x06R\x04note\x88\x01\x01\x12\x1d\n" + + "\aversion\x18\f \x01(\x03H\aR\aversion\x88\x01\x01\x12'\n" + + "\ftimeoutJobId\x18\r \x01(\tH\bR\ftimeoutJobId\x88\x01\x01\x12#\n" + "\n" + - "searchText\x18\x0e \x01(\tH\fR\n" + + "searchText\x18\x0e \x01(\tH\tR\n" + "searchText\x88\x01\x01\x12!\n" + - "\tcreatedAt\x18\x0f \x01(\x03H\rR\tcreatedAt\x88\x01\x01\x12#\n" + + "\tcreatedAt\x18\x0f \x01(\x03H\n" + + "R\tcreatedAt\x88\x01\x01\x12#\n" + "\n" + - "acceptedAt\x18\x10 \x01(\x03H\x0eR\n" + + "acceptedAt\x18\x10 \x01(\x03H\vR\n" + "acceptedAt\x88\x01\x01\x12\x1f\n" + - "\bclosedAt\x18\x11 \x01(\x03H\x0fR\bclosedAt\x88\x01\x01\x12%\n" + - "\vcompletedAt\x18\x12 \x01(\x03H\x10R\vcompletedAt\x88\x01\x01\x12%\n" + - "\vcancelledAt\x18\x13 \x01(\x03H\x11R\vcancelledAt\x88\x01\x01\x12!\n" + - "\tupdatedAt\x18\x14 \x01(\x03H\x12R\tupdatedAt\x88\x01\x01B\r\n" + - "\v_consumerIdB\x0f\n" + - "\r_consumerNameB\v\n" + - "\t_playerIdB\r\n" + - "\v_playerNameB\t\n" + - "\a_shopIdB\v\n" + - "\t_shopNameB\x12\n" + + "\bclosedAt\x18\x11 \x01(\x03H\fR\bclosedAt\x88\x01\x01\x12%\n" + + "\vcompletedAt\x18\x12 \x01(\x03H\rR\vcompletedAt\x88\x01\x01\x12%\n" + + "\vcancelledAt\x18\x13 \x01(\x03H\x0eR\vcancelledAt\x88\x01\x01\x12!\n" + + "\tupdatedAt\x18\x14 \x01(\x03H\x0fR\tupdatedAt\x88\x01\x01B\r\n" + + "\v_consumerIdB\v\n" + + "\t_playerIdB\t\n" + + "\a_shopIdB\x12\n" + "\x10_serviceSnapshotB\t\n" + "\a_statusB\r\n" + "\v_totalPriceB\a\n" + @@ -2006,49 +1890,41 @@ const file_order_proto_rawDesc = "" + "\x02id\x18\x01 \x01(\x03R\x02id\"7\n" + "\x11GetOrdersByIdResp\x12\"\n" + "\x06orders\x18\x01 \x01(\v2\n" + - ".pb.OrdersR\x06orders\"\x89\b\n" + + ".pb.OrdersR\x06orders\"\xed\x06\n" + "\x0fSearchOrdersReq\x12\x12\n" + "\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" + "\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x13\n" + "\x02id\x18\x03 \x01(\x03H\x00R\x02id\x88\x01\x01\x12#\n" + "\n" + "consumerId\x18\x04 \x01(\x03H\x01R\n" + - "consumerId\x88\x01\x01\x12'\n" + - "\fconsumerName\x18\x05 \x01(\tH\x02R\fconsumerName\x88\x01\x01\x12\x1f\n" + - "\bplayerId\x18\x06 \x01(\x03H\x03R\bplayerId\x88\x01\x01\x12#\n" + - "\n" + - "playerName\x18\a \x01(\tH\x04R\n" + - "playerName\x88\x01\x01\x12\x1b\n" + - "\x06shopId\x18\b \x01(\x03H\x05R\x06shopId\x88\x01\x01\x12\x1f\n" + - "\bshopName\x18\t \x01(\tH\x06R\bshopName\x88\x01\x01\x12-\n" + + "consumerId\x88\x01\x01\x12\x1f\n" + + "\bplayerId\x18\x06 \x01(\x03H\x02R\bplayerId\x88\x01\x01\x12\x1b\n" + + "\x06shopId\x18\b \x01(\x03H\x03R\x06shopId\x88\x01\x01\x12-\n" + "\x0fserviceSnapshot\x18\n" + - " \x01(\tH\aR\x0fserviceSnapshot\x88\x01\x01\x12\x1b\n" + - "\x06status\x18\v \x01(\tH\bR\x06status\x88\x01\x01\x12#\n" + + " \x01(\tH\x04R\x0fserviceSnapshot\x88\x01\x01\x12\x1b\n" + + "\x06status\x18\v \x01(\tH\x05R\x06status\x88\x01\x01\x12#\n" + "\n" + - "totalPrice\x18\f \x01(\tH\tR\n" + + "totalPrice\x18\f \x01(\tH\x06R\n" + "totalPrice\x88\x01\x01\x12\x17\n" + - "\x04note\x18\r \x01(\tH\n" + - "R\x04note\x88\x01\x01\x12\x1d\n" + - "\aversion\x18\x0e \x01(\x03H\vR\aversion\x88\x01\x01\x12'\n" + - "\ftimeoutJobId\x18\x0f \x01(\tH\fR\ftimeoutJobId\x88\x01\x01\x12#\n" + + "\x04note\x18\r \x01(\tH\aR\x04note\x88\x01\x01\x12\x1d\n" + + "\aversion\x18\x0e \x01(\x03H\bR\aversion\x88\x01\x01\x12'\n" + + "\ftimeoutJobId\x18\x0f \x01(\tH\tR\ftimeoutJobId\x88\x01\x01\x12#\n" + "\n" + - "searchText\x18\x10 \x01(\tH\rR\n" + + "searchText\x18\x10 \x01(\tH\n" + + "R\n" + "searchText\x88\x01\x01\x12!\n" + - "\tcreatedAt\x18\x11 \x01(\x03H\x0eR\tcreatedAt\x88\x01\x01\x12#\n" + + "\tcreatedAt\x18\x11 \x01(\x03H\vR\tcreatedAt\x88\x01\x01\x12#\n" + "\n" + - "acceptedAt\x18\x12 \x01(\x03H\x0fR\n" + + "acceptedAt\x18\x12 \x01(\x03H\fR\n" + "acceptedAt\x88\x01\x01\x12\x1f\n" + - "\bclosedAt\x18\x13 \x01(\x03H\x10R\bclosedAt\x88\x01\x01\x12%\n" + - "\vcompletedAt\x18\x14 \x01(\x03H\x11R\vcompletedAt\x88\x01\x01\x12%\n" + - "\vcancelledAt\x18\x15 \x01(\x03H\x12R\vcancelledAt\x88\x01\x01\x12!\n" + - "\tupdatedAt\x18\x16 \x01(\x03H\x13R\tupdatedAt\x88\x01\x01B\x05\n" + + "\bclosedAt\x18\x13 \x01(\x03H\rR\bclosedAt\x88\x01\x01\x12%\n" + + "\vcompletedAt\x18\x14 \x01(\x03H\x0eR\vcompletedAt\x88\x01\x01\x12%\n" + + "\vcancelledAt\x18\x15 \x01(\x03H\x0fR\vcancelledAt\x88\x01\x01\x12!\n" + + "\tupdatedAt\x18\x16 \x01(\x03H\x10R\tupdatedAt\x88\x01\x01B\x05\n" + "\x03_idB\r\n" + - "\v_consumerIdB\x0f\n" + - "\r_consumerNameB\v\n" + - "\t_playerIdB\r\n" + - "\v_playerNameB\t\n" + - "\a_shopIdB\v\n" + - "\t_shopNameB\x12\n" + + "\v_consumerIdB\v\n" + + "\t_playerIdB\t\n" + + "\a_shopIdB\x12\n" + "\x10_serviceSnapshotB\t\n" + "\a_statusB\r\n" + "\v_totalPriceB\a\n" + diff --git a/desc/api/order.api b/desc/api/order.api index 5f74bcd..3cfb7fd 100644 --- a/desc/api/order.api +++ b/desc/api/order.api @@ -1,113 +1,108 @@ syntax = "v1" + import "common.api" info ( - title: "聚玩订单服务" - desc: "处理订单业务" - author: "Asadz" - version: "1.0" + title: "聚玩订单服务" + desc: "处理订单业务" + author: "Asadz" + version: "1.0" ) type ( - PathId { - Id int64 `path:"id"` - } - PlayerService { - Id int64 `json:"id"` - PlayerId int64 `json:"playerId"` - GameId int64 `json:"gameId"` - GameName string `json:"gameName"` - Title string `json:"title"` - Description string `json:"description"` - Price float64 `json:"price"` - Unit string `json:"unit"` - RankRange string `json:"rankRange,optional"` - Availability []string `json:"availability"` - } - Order { - Id int64 `json:"id"` - ConsumerId int64 `json:"consumerId"` - ConsumerName string `json:"consumerName"` - PlayerId string `json:"playerId"` - PlayerName string `json:"playerName"` - ShopId int64 `json:"shopId,optional"` - ShopName string `json:"shopName,optional"` - Service PlayerService `json:"service"` - Status string `json:"status"` - TotalPrice float64 `json:"totalPrice"` - Note string `json:"note,optional"` - CreatedAt string `json:"createdAt"` - AcceptedAt string `json:"acceptedAt,optional"` - CompletedAt string `json:"completedAt,optional"` - } - - OrderListReq { - PageReq - Role string `form:"role"` // consumer, player, owner - Status string `form:"status,optional"` - } - - OrderListResp { - Items []Order `json:"items"` - Meta PageMeta `json:"meta"` - } - - CreateOrderReq { - PlayerId int64 `json:"playerId"` - ShopId int64 `json:"shopId,optional"` - ServiceId int64 `json:"serviceId"` - Quantity int `json:"quantity"` - Note string `json:"note,optional"` - } - - CreateOrderResp { - Ok bool `json:"ok"` - Order Order `json:"order"` - } + PathId { + Id int64 `path:"id"` + } + PlayerService { + Id int64 `json:"id"` + PlayerId int64 `json:"playerId"` + GameId int64 `json:"gameId"` + GameName string `json:"gameName"` + Title string `json:"title"` + Description string `json:"description"` + Price float64 `json:"price"` + Unit string `json:"unit"` + RankRange string `json:"rankRange,optional"` + Availability []string `json:"availability"` + } + Order { + Id int64 `json:"id"` + ConsumerId int64 `json:"consumerId"` + PlayerId string `json:"playerId"` + ShopId int64 `json:"shopId,optional"` + Service PlayerService `json:"service"` + Status string `json:"status"` + TotalPrice float64 `json:"totalPrice"` + Note string `json:"note,optional"` + CreatedAt string `json:"createdAt"` + AcceptedAt string `json:"acceptedAt,optional"` + CompletedAt string `json:"completedAt,optional"` + } + OrderListReq { + PageReq + Role string `form:"role"` // consumer, player, owner + Status string `form:"status,optional"` + } + OrderListResp { + Items []Order `json:"items"` + Meta PageMeta `json:"meta"` + } + CreateOrderReq { + PlayerId int64 `json:"playerId"` + ShopId int64 `json:"shopId,optional"` + ServiceId int64 `json:"serviceId"` + Quantity int `json:"quantity"` + Note string `json:"note,optional"` + } + CreateOrderResp { + Ok bool `json:"ok"` + Order Order `json:"order"` + } ) -@server( - prefix: api/v1/orders - group: order +@server ( + prefix: api/v1/orders + group: order ) service order-api { - @doc "获取订单列表" - @handler ListOrders - get / (OrderListReq) returns (OrderListResp) + @doc "获取订单列表" + @handler ListOrders + get / (OrderListReq) returns (OrderListResp) - @doc "获取订单详情" - @handler GetOrder - get /:id (PathId) returns (Order) + @doc "获取订单详情" + @handler GetOrder + get /:id (PathId) returns (Order) - @doc "创建订单" - @handler CreateOrder - post / (CreateOrderReq) returns (CreateOrderResp) + @doc "创建订单" + @handler CreateOrder + post / (CreateOrderReq) returns (CreateOrderResp) - @doc "创建并支付订单" - @handler CreateAndPayOrder - post /paid (CreateOrderReq) returns (CreateOrderResp) + @doc "创建并支付订单" + @handler CreateAndPayOrder + post /paid (CreateOrderReq) returns (CreateOrderResp) - @doc "支付订单" - @handler PayOrder - post /:id/pay (PathId) returns (EmptyResp) + @doc "支付订单" + @handler PayOrder + post /:id/pay (PathId) returns (EmptyResp) - @doc "接单" - @handler AcceptOrder - post /:id/accept (PathId) returns (EmptyResp) + @doc "接单" + @handler AcceptOrder + post /:id/accept (PathId) returns (EmptyResp) - @doc "申请结算" - @handler RequestCloseOrder - post /:id/request-close (PathId) returns (EmptyResp) + @doc "申请结算" + @handler RequestCloseOrder + post /:id/request-close (PathId) returns (EmptyResp) - @doc "确认结算" - @handler ConfirmCloseOrder - post /:id/confirm-close (PathId) returns (EmptyResp) + @doc "确认结算" + @handler ConfirmCloseOrder + post /:id/confirm-close (PathId) returns (EmptyResp) - @doc "取消订单" - @handler CancelOrder - post /:id/cancel (PathId) returns (EmptyResp) + @doc "取消订单" + @handler CancelOrder + post /:id/cancel (PathId) returns (EmptyResp) + + @doc "再来一单" + @handler Reorder + post /:id/reorder (PathId) returns (CreateOrderResp) +} - @doc "再来一单" - @handler Reorder - post /:id/reorder (PathId) returns (CreateOrderResp) -} \ No newline at end of file diff --git a/desc/rpc/order.proto b/desc/rpc/order.proto index 70cf17f..b1dda2a 100644 --- a/desc/rpc/order.proto +++ b/desc/rpc/order.proto @@ -12,11 +12,8 @@ package pb; message Orders { int64 id = 1; //id int64 consumerId = 2; //consumerId - string consumerName = 3; //consumerName int64 playerId = 4; //playerId - string playerName = 5; //playerName optional int64 shopId = 6; //shopId - optional string shopName = 7; //shopName string serviceSnapshot = 8; //serviceSnapshot string status = 9; //status string totalPrice = 10; //totalPrice @@ -35,11 +32,8 @@ message Orders { message AddOrdersReq { int64 id = 1; //id int64 consumerId = 2; //consumerId - string consumerName = 3; //consumerName int64 playerId = 4; //playerId - string playerName = 5; //playerName optional int64 shopId = 6; //shopId - optional string shopName = 7; //shopName string serviceSnapshot = 8; //serviceSnapshot optional string status = 9; //status string totalPrice = 10; //totalPrice @@ -62,11 +56,8 @@ message AddOrdersResp { message UpdateOrdersReq { int64 id = 1; //id optional int64 consumerId = 2; //consumerId - optional string consumerName = 3; //consumerName optional int64 playerId = 4; //playerId - optional string playerName = 5; //playerName optional int64 shopId = 6; //shopId - optional string shopName = 7; //shopName optional string serviceSnapshot = 8; //serviceSnapshot optional string status = 9; //status optional string totalPrice = 10; //totalPrice @@ -105,11 +96,8 @@ message SearchOrdersReq { int64 limit = 2; //limit optional int64 id = 3; //id optional int64 consumerId = 4; //consumerId - optional string consumerName = 5; //consumerName optional int64 playerId = 6; //playerId - optional string playerName = 7; //playerName optional int64 shopId = 8; //shopId - optional string shopName = 9; //shopName optional string serviceSnapshot = 10; //serviceSnapshot optional string status = 11; //status optional string totalPrice = 12; //totalPrice