fix: set tenant_id on product insert and regenerate purchase proto

Products were inserted with empty tenant_id because ExtractTenantId was
called after the Insert; moved extraction before the struct so rows are
stored with the correct tenant and appear in list queries.

Regenerated purchase.pb.go and purchase_grpc.pb.go from purchase.proto
using protoc-gen-go v1.36.11; the previous hand-written stubs lacked the
proto.Message interface, causing all purchase gRPC calls to fail with a
marshal error.
This commit is contained in:
kae 2026-06-18 18:24:26 +09:00 committed by Chever John
parent 4759295ce1
commit 4733677334
3 changed files with 3703 additions and 293 deletions

View File

@ -32,11 +32,13 @@ func NewCreateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cre
}
func (l *CreateProductLogic) CreateProduct(in *pb.CreateProductReq) (*pb.IdResp, error) {
tenantId := tenantctx.ExtractTenantId(l.ctx)
productId := uid.Generate()
salesPrice, _ := strconv.ParseFloat(in.SalesPrice, 64)
product := &model.InvProduct{
ProductId: productId,
TenantId: tenantId,
ProductName: in.ProductName,
ImageUrl: in.ImageUrl,
Spec: in.Spec,
@ -50,8 +52,6 @@ func (l *CreateProductLogic) CreateProduct(in *pb.CreateProductReq) (*pb.IdResp,
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
tenantId := tenantctx.ExtractTenantId(l.ctx)
var totalLengthM float64
var totalBolts int

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,75 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v7.34.1
// source: purchase.proto
package pb
import (
"context"
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
PurchaseService_CreateSupplier_FullMethodName = "/purchase.PurchaseService/CreateSupplier"
PurchaseService_UpdateSupplier_FullMethodName = "/purchase.PurchaseService/UpdateSupplier"
PurchaseService_DeleteSupplier_FullMethodName = "/purchase.PurchaseService/DeleteSupplier"
PurchaseService_GetSupplier_FullMethodName = "/purchase.PurchaseService/GetSupplier"
PurchaseService_ListSupplier_FullMethodName = "/purchase.PurchaseService/ListSupplier"
PurchaseService_CreatePurchaseOrder_FullMethodName = "/purchase.PurchaseService/CreatePurchaseOrder"
PurchaseService_UpdatePurchaseOrder_FullMethodName = "/purchase.PurchaseService/UpdatePurchaseOrder"
PurchaseService_ConfirmPurchaseOrder_FullMethodName = "/purchase.PurchaseService/ConfirmPurchaseOrder"
PurchaseService_CancelPurchaseOrder_FullMethodName = "/purchase.PurchaseService/CancelPurchaseOrder"
PurchaseService_GetPurchaseOrder_FullMethodName = "/purchase.PurchaseService/GetPurchaseOrder"
PurchaseService_ListPurchaseOrder_FullMethodName = "/purchase.PurchaseService/ListPurchaseOrder"
PurchaseService_CreatePurchaseReceipt_FullMethodName = "/purchase.PurchaseService/CreatePurchaseReceipt"
PurchaseService_ConfirmPurchaseReceipt_FullMethodName = "/purchase.PurchaseService/ConfirmPurchaseReceipt"
PurchaseService_GetPurchaseReceipt_FullMethodName = "/purchase.PurchaseService/GetPurchaseReceipt"
PurchaseService_ListPurchaseReceipt_FullMethodName = "/purchase.PurchaseService/ListPurchaseReceipt"
PurchaseService_CreatePurchasePayment_FullMethodName = "/purchase.PurchaseService/CreatePurchasePayment"
PurchaseService_ListPurchasePayment_FullMethodName = "/purchase.PurchaseService/ListPurchasePayment"
PurchaseService_ListInventoryLog_FullMethodName = "/purchase.PurchaseService/ListInventoryLog"
PurchaseService_GetPurchaseStatsSummary_FullMethodName = "/purchase.PurchaseService/GetPurchaseStatsSummary"
PurchaseService_GetPurchaseStatsBySupplier_FullMethodName = "/purchase.PurchaseService/GetPurchaseStatsBySupplier"
PurchaseService_GetPurchaseStatsByProduct_FullMethodName = "/purchase.PurchaseService/GetPurchaseStatsByProduct"
)
// PurchaseServiceClient is the client API for PurchaseService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PurchaseServiceClient interface {
// Supplier CRUD
CreateSupplier(ctx context.Context, in *CreateSupplierReq, opts ...grpc.CallOption) (*IdResp, error)
UpdateSupplier(ctx context.Context, in *UpdateSupplierReq, opts ...grpc.CallOption) (*Empty, error)
DeleteSupplier(ctx context.Context, in *DeleteSupplierReq, opts ...grpc.CallOption) (*Empty, error)
GetSupplier(ctx context.Context, in *GetSupplierReq, opts ...grpc.CallOption) (*SupplierInfo, error)
ListSupplier(ctx context.Context, in *ListSupplierReq, opts ...grpc.CallOption) (*ListSupplierResp, error)
// PurchaseOrder CRUD + status
CreatePurchaseOrder(ctx context.Context, in *CreatePurchaseOrderReq, opts ...grpc.CallOption) (*IdResp, error)
UpdatePurchaseOrder(ctx context.Context, in *UpdatePurchaseOrderReq, opts ...grpc.CallOption) (*Empty, error)
ConfirmPurchaseOrder(ctx context.Context, in *ConfirmPurchaseOrderReq, opts ...grpc.CallOption) (*Empty, error)
CancelPurchaseOrder(ctx context.Context, in *CancelPurchaseOrderReq, opts ...grpc.CallOption) (*Empty, error)
GetPurchaseOrder(ctx context.Context, in *GetPurchaseOrderReq, opts ...grpc.CallOption) (*PurchaseOrderInfo, error)
ListPurchaseOrder(ctx context.Context, in *ListPurchaseOrderReq, opts ...grpc.CallOption) (*ListPurchaseOrderResp, error)
// Receipt
CreatePurchaseReceipt(ctx context.Context, in *CreatePurchaseReceiptReq, opts ...grpc.CallOption) (*IdResp, error)
ConfirmPurchaseReceipt(ctx context.Context, in *ConfirmPurchaseReceiptReq, opts ...grpc.CallOption) (*Empty, error)
GetPurchaseReceipt(ctx context.Context, in *GetPurchaseReceiptReq, opts ...grpc.CallOption) (*PurchaseReceiptInfo, error)
ListPurchaseReceipt(ctx context.Context, in *ListPurchaseReceiptReq, opts ...grpc.CallOption) (*ListPurchaseReceiptResp, error)
// Payment
CreatePurchasePayment(ctx context.Context, in *CreatePurchasePaymentReq, opts ...grpc.CallOption) (*IdResp, error)
ListPurchasePayment(ctx context.Context, in *ListPurchasePaymentReq, opts ...grpc.CallOption) (*ListPurchasePaymentResp, error)
// InventoryLog
ListInventoryLog(ctx context.Context, in *ListInventoryLogReq, opts ...grpc.CallOption) (*ListInventoryLogResp, error)
// Stats
GetPurchaseStatsSummary(ctx context.Context, in *PurchaseStatsSummaryReq, opts ...grpc.CallOption) (*PurchaseStatsSummaryResp, error)
GetPurchaseStatsBySupplier(ctx context.Context, in *PurchaseStatsSummaryReq, opts ...grpc.CallOption) (*PurchaseStatsBySupplierResp, error)
GetPurchaseStatsByProduct(ctx context.Context, in *PurchaseStatsSummaryReq, opts ...grpc.CallOption) (*PurchaseStatsByProductResp, error)
@ -45,157 +84,254 @@ func NewPurchaseServiceClient(cc grpc.ClientConnInterface) PurchaseServiceClient
}
func (c *purchaseServiceClient) CreateSupplier(ctx context.Context, in *CreateSupplierReq, opts ...grpc.CallOption) (*IdResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(IdResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/CreateSupplier", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_CreateSupplier_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) UpdateSupplier(ctx context.Context, in *UpdateSupplierReq, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/UpdateSupplier", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_UpdateSupplier_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) DeleteSupplier(ctx context.Context, in *DeleteSupplierReq, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/DeleteSupplier", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_DeleteSupplier_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) GetSupplier(ctx context.Context, in *GetSupplierReq, opts ...grpc.CallOption) (*SupplierInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SupplierInfo)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/GetSupplier", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_GetSupplier_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) ListSupplier(ctx context.Context, in *ListSupplierReq, opts ...grpc.CallOption) (*ListSupplierResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListSupplierResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/ListSupplier", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_ListSupplier_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) CreatePurchaseOrder(ctx context.Context, in *CreatePurchaseOrderReq, opts ...grpc.CallOption) (*IdResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(IdResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/CreatePurchaseOrder", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_CreatePurchaseOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) UpdatePurchaseOrder(ctx context.Context, in *UpdatePurchaseOrderReq, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/UpdatePurchaseOrder", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_UpdatePurchaseOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) ConfirmPurchaseOrder(ctx context.Context, in *ConfirmPurchaseOrderReq, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/ConfirmPurchaseOrder", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_ConfirmPurchaseOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) CancelPurchaseOrder(ctx context.Context, in *CancelPurchaseOrderReq, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/CancelPurchaseOrder", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_CancelPurchaseOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) GetPurchaseOrder(ctx context.Context, in *GetPurchaseOrderReq, opts ...grpc.CallOption) (*PurchaseOrderInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PurchaseOrderInfo)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/GetPurchaseOrder", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_GetPurchaseOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) ListPurchaseOrder(ctx context.Context, in *ListPurchaseOrderReq, opts ...grpc.CallOption) (*ListPurchaseOrderResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListPurchaseOrderResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/ListPurchaseOrder", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_ListPurchaseOrder_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) CreatePurchaseReceipt(ctx context.Context, in *CreatePurchaseReceiptReq, opts ...grpc.CallOption) (*IdResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(IdResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/CreatePurchaseReceipt", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_CreatePurchaseReceipt_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) ConfirmPurchaseReceipt(ctx context.Context, in *ConfirmPurchaseReceiptReq, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/ConfirmPurchaseReceipt", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_ConfirmPurchaseReceipt_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) GetPurchaseReceipt(ctx context.Context, in *GetPurchaseReceiptReq, opts ...grpc.CallOption) (*PurchaseReceiptInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PurchaseReceiptInfo)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/GetPurchaseReceipt", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_GetPurchaseReceipt_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) ListPurchaseReceipt(ctx context.Context, in *ListPurchaseReceiptReq, opts ...grpc.CallOption) (*ListPurchaseReceiptResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListPurchaseReceiptResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/ListPurchaseReceipt", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_ListPurchaseReceipt_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) CreatePurchasePayment(ctx context.Context, in *CreatePurchasePaymentReq, opts ...grpc.CallOption) (*IdResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(IdResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/CreatePurchasePayment", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_CreatePurchasePayment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) ListPurchasePayment(ctx context.Context, in *ListPurchasePaymentReq, opts ...grpc.CallOption) (*ListPurchasePaymentResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListPurchasePaymentResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/ListPurchasePayment", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_ListPurchasePayment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) ListInventoryLog(ctx context.Context, in *ListInventoryLogReq, opts ...grpc.CallOption) (*ListInventoryLogResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListInventoryLogResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/ListInventoryLog", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_ListInventoryLog_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) GetPurchaseStatsSummary(ctx context.Context, in *PurchaseStatsSummaryReq, opts ...grpc.CallOption) (*PurchaseStatsSummaryResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PurchaseStatsSummaryResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/GetPurchaseStatsSummary", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_GetPurchaseStatsSummary_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) GetPurchaseStatsBySupplier(ctx context.Context, in *PurchaseStatsSummaryReq, opts ...grpc.CallOption) (*PurchaseStatsBySupplierResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PurchaseStatsBySupplierResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/GetPurchaseStatsBySupplier", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_GetPurchaseStatsBySupplier_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *purchaseServiceClient) GetPurchaseStatsByProduct(ctx context.Context, in *PurchaseStatsSummaryReq, opts ...grpc.CallOption) (*PurchaseStatsByProductResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PurchaseStatsByProductResp)
err := c.cc.Invoke(ctx, "/purchase.PurchaseService/GetPurchaseStatsByProduct", in, out, opts...)
return out, err
err := c.cc.Invoke(ctx, PurchaseService_GetPurchaseStatsByProduct_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PurchaseServiceServer is the server API for PurchaseService service.
// All implementations must embed UnimplementedPurchaseServiceServer
// for forward compatibility.
type PurchaseServiceServer interface {
// Supplier CRUD
CreateSupplier(context.Context, *CreateSupplierReq) (*IdResp, error)
UpdateSupplier(context.Context, *UpdateSupplierReq) (*Empty, error)
DeleteSupplier(context.Context, *DeleteSupplierReq) (*Empty, error)
GetSupplier(context.Context, *GetSupplierReq) (*SupplierInfo, error)
ListSupplier(context.Context, *ListSupplierReq) (*ListSupplierResp, error)
// PurchaseOrder CRUD + status
CreatePurchaseOrder(context.Context, *CreatePurchaseOrderReq) (*IdResp, error)
UpdatePurchaseOrder(context.Context, *UpdatePurchaseOrderReq) (*Empty, error)
ConfirmPurchaseOrder(context.Context, *ConfirmPurchaseOrderReq) (*Empty, error)
CancelPurchaseOrder(context.Context, *CancelPurchaseOrderReq) (*Empty, error)
GetPurchaseOrder(context.Context, *GetPurchaseOrderReq) (*PurchaseOrderInfo, error)
ListPurchaseOrder(context.Context, *ListPurchaseOrderReq) (*ListPurchaseOrderResp, error)
// Receipt
CreatePurchaseReceipt(context.Context, *CreatePurchaseReceiptReq) (*IdResp, error)
ConfirmPurchaseReceipt(context.Context, *ConfirmPurchaseReceiptReq) (*Empty, error)
GetPurchaseReceipt(context.Context, *GetPurchaseReceiptReq) (*PurchaseReceiptInfo, error)
ListPurchaseReceipt(context.Context, *ListPurchaseReceiptReq) (*ListPurchaseReceiptResp, error)
// Payment
CreatePurchasePayment(context.Context, *CreatePurchasePaymentReq) (*IdResp, error)
ListPurchasePayment(context.Context, *ListPurchasePaymentReq) (*ListPurchasePaymentResp, error)
// InventoryLog
ListInventoryLog(context.Context, *ListInventoryLogReq) (*ListInventoryLogResp, error)
// Stats
GetPurchaseStatsSummary(context.Context, *PurchaseStatsSummaryReq) (*PurchaseStatsSummaryResp, error)
GetPurchaseStatsBySupplier(context.Context, *PurchaseStatsSummaryReq) (*PurchaseStatsBySupplierResp, error)
GetPurchaseStatsByProduct(context.Context, *PurchaseStatsSummaryReq) (*PurchaseStatsByProductResp, error)
mustEmbedUnimplementedPurchaseServiceServer()
}
// UnimplementedPurchaseServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPurchaseServiceServer struct{}
func (UnimplementedPurchaseServiceServer) CreateSupplier(context.Context, *CreateSupplierReq) (*IdResp, error) {
@ -262,43 +398,24 @@ func (UnimplementedPurchaseServiceServer) GetPurchaseStatsByProduct(context.Cont
return nil, status.Errorf(codes.Unimplemented, "method GetPurchaseStatsByProduct not implemented")
}
func (UnimplementedPurchaseServiceServer) mustEmbedUnimplementedPurchaseServiceServer() {}
func (UnimplementedPurchaseServiceServer) testEmbeddedByValue() {}
// UnsafePurchaseServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PurchaseServiceServer will
// result in compilation errors.
type UnsafePurchaseServiceServer interface {
mustEmbedUnimplementedPurchaseServiceServer()
}
func RegisterPurchaseServiceServer(s grpc.ServiceRegistrar, srv PurchaseServiceServer) {
s.RegisterService(&PurchaseService_ServiceDesc, srv)
// If the following call pancis, it indicates UnimplementedPurchaseServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
var PurchaseService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "purchase.PurchaseService",
HandlerType: (*PurchaseServiceServer)(nil),
Methods: []grpc.MethodDesc{
{MethodName: "CreateSupplier", Handler: _PurchaseService_CreateSupplier_Handler},
{MethodName: "UpdateSupplier", Handler: _PurchaseService_UpdateSupplier_Handler},
{MethodName: "DeleteSupplier", Handler: _PurchaseService_DeleteSupplier_Handler},
{MethodName: "GetSupplier", Handler: _PurchaseService_GetSupplier_Handler},
{MethodName: "ListSupplier", Handler: _PurchaseService_ListSupplier_Handler},
{MethodName: "CreatePurchaseOrder", Handler: _PurchaseService_CreatePurchaseOrder_Handler},
{MethodName: "UpdatePurchaseOrder", Handler: _PurchaseService_UpdatePurchaseOrder_Handler},
{MethodName: "ConfirmPurchaseOrder", Handler: _PurchaseService_ConfirmPurchaseOrder_Handler},
{MethodName: "CancelPurchaseOrder", Handler: _PurchaseService_CancelPurchaseOrder_Handler},
{MethodName: "GetPurchaseOrder", Handler: _PurchaseService_GetPurchaseOrder_Handler},
{MethodName: "ListPurchaseOrder", Handler: _PurchaseService_ListPurchaseOrder_Handler},
{MethodName: "CreatePurchaseReceipt", Handler: _PurchaseService_CreatePurchaseReceipt_Handler},
{MethodName: "ConfirmPurchaseReceipt", Handler: _PurchaseService_ConfirmPurchaseReceipt_Handler},
{MethodName: "GetPurchaseReceipt", Handler: _PurchaseService_GetPurchaseReceipt_Handler},
{MethodName: "ListPurchaseReceipt", Handler: _PurchaseService_ListPurchaseReceipt_Handler},
{MethodName: "CreatePurchasePayment", Handler: _PurchaseService_CreatePurchasePayment_Handler},
{MethodName: "ListPurchasePayment", Handler: _PurchaseService_ListPurchasePayment_Handler},
{MethodName: "ListInventoryLog", Handler: _PurchaseService_ListInventoryLog_Handler},
{MethodName: "GetPurchaseStatsSummary", Handler: _PurchaseService_GetPurchaseStatsSummary_Handler},
{MethodName: "GetPurchaseStatsBySupplier", Handler: _PurchaseService_GetPurchaseStatsBySupplier_Handler},
{MethodName: "GetPurchaseStatsByProduct", Handler: _PurchaseService_GetPurchaseStatsByProduct_Handler},
},
Streams: []grpc.StreamDesc{},
Metadata: "purchase.proto",
s.RegisterService(&PurchaseService_ServiceDesc, srv)
}
func _PurchaseService_CreateSupplier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
@ -309,7 +426,10 @@ func _PurchaseService_CreateSupplier_Handler(srv interface{}, ctx context.Contex
if interceptor == nil {
return srv.(PurchaseServiceServer).CreateSupplier(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/CreateSupplier"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_CreateSupplier_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).CreateSupplier(ctx, req.(*CreateSupplierReq))
}
@ -324,7 +444,10 @@ func _PurchaseService_UpdateSupplier_Handler(srv interface{}, ctx context.Contex
if interceptor == nil {
return srv.(PurchaseServiceServer).UpdateSupplier(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/UpdateSupplier"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_UpdateSupplier_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).UpdateSupplier(ctx, req.(*UpdateSupplierReq))
}
@ -339,7 +462,10 @@ func _PurchaseService_DeleteSupplier_Handler(srv interface{}, ctx context.Contex
if interceptor == nil {
return srv.(PurchaseServiceServer).DeleteSupplier(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/DeleteSupplier"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_DeleteSupplier_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).DeleteSupplier(ctx, req.(*DeleteSupplierReq))
}
@ -354,7 +480,10 @@ func _PurchaseService_GetSupplier_Handler(srv interface{}, ctx context.Context,
if interceptor == nil {
return srv.(PurchaseServiceServer).GetSupplier(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/GetSupplier"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_GetSupplier_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).GetSupplier(ctx, req.(*GetSupplierReq))
}
@ -369,7 +498,10 @@ func _PurchaseService_ListSupplier_Handler(srv interface{}, ctx context.Context,
if interceptor == nil {
return srv.(PurchaseServiceServer).ListSupplier(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/ListSupplier"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_ListSupplier_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).ListSupplier(ctx, req.(*ListSupplierReq))
}
@ -384,7 +516,10 @@ func _PurchaseService_CreatePurchaseOrder_Handler(srv interface{}, ctx context.C
if interceptor == nil {
return srv.(PurchaseServiceServer).CreatePurchaseOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/CreatePurchaseOrder"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_CreatePurchaseOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).CreatePurchaseOrder(ctx, req.(*CreatePurchaseOrderReq))
}
@ -399,7 +534,10 @@ func _PurchaseService_UpdatePurchaseOrder_Handler(srv interface{}, ctx context.C
if interceptor == nil {
return srv.(PurchaseServiceServer).UpdatePurchaseOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/UpdatePurchaseOrder"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_UpdatePurchaseOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).UpdatePurchaseOrder(ctx, req.(*UpdatePurchaseOrderReq))
}
@ -414,7 +552,10 @@ func _PurchaseService_ConfirmPurchaseOrder_Handler(srv interface{}, ctx context.
if interceptor == nil {
return srv.(PurchaseServiceServer).ConfirmPurchaseOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/ConfirmPurchaseOrder"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_ConfirmPurchaseOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).ConfirmPurchaseOrder(ctx, req.(*ConfirmPurchaseOrderReq))
}
@ -429,7 +570,10 @@ func _PurchaseService_CancelPurchaseOrder_Handler(srv interface{}, ctx context.C
if interceptor == nil {
return srv.(PurchaseServiceServer).CancelPurchaseOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/CancelPurchaseOrder"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_CancelPurchaseOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).CancelPurchaseOrder(ctx, req.(*CancelPurchaseOrderReq))
}
@ -444,7 +588,10 @@ func _PurchaseService_GetPurchaseOrder_Handler(srv interface{}, ctx context.Cont
if interceptor == nil {
return srv.(PurchaseServiceServer).GetPurchaseOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/GetPurchaseOrder"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_GetPurchaseOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).GetPurchaseOrder(ctx, req.(*GetPurchaseOrderReq))
}
@ -459,7 +606,10 @@ func _PurchaseService_ListPurchaseOrder_Handler(srv interface{}, ctx context.Con
if interceptor == nil {
return srv.(PurchaseServiceServer).ListPurchaseOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/ListPurchaseOrder"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_ListPurchaseOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).ListPurchaseOrder(ctx, req.(*ListPurchaseOrderReq))
}
@ -474,7 +624,10 @@ func _PurchaseService_CreatePurchaseReceipt_Handler(srv interface{}, ctx context
if interceptor == nil {
return srv.(PurchaseServiceServer).CreatePurchaseReceipt(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/CreatePurchaseReceipt"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_CreatePurchaseReceipt_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).CreatePurchaseReceipt(ctx, req.(*CreatePurchaseReceiptReq))
}
@ -489,7 +642,10 @@ func _PurchaseService_ConfirmPurchaseReceipt_Handler(srv interface{}, ctx contex
if interceptor == nil {
return srv.(PurchaseServiceServer).ConfirmPurchaseReceipt(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/ConfirmPurchaseReceipt"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_ConfirmPurchaseReceipt_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).ConfirmPurchaseReceipt(ctx, req.(*ConfirmPurchaseReceiptReq))
}
@ -504,7 +660,10 @@ func _PurchaseService_GetPurchaseReceipt_Handler(srv interface{}, ctx context.Co
if interceptor == nil {
return srv.(PurchaseServiceServer).GetPurchaseReceipt(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/GetPurchaseReceipt"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_GetPurchaseReceipt_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).GetPurchaseReceipt(ctx, req.(*GetPurchaseReceiptReq))
}
@ -519,7 +678,10 @@ func _PurchaseService_ListPurchaseReceipt_Handler(srv interface{}, ctx context.C
if interceptor == nil {
return srv.(PurchaseServiceServer).ListPurchaseReceipt(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/ListPurchaseReceipt"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_ListPurchaseReceipt_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).ListPurchaseReceipt(ctx, req.(*ListPurchaseReceiptReq))
}
@ -534,7 +696,10 @@ func _PurchaseService_CreatePurchasePayment_Handler(srv interface{}, ctx context
if interceptor == nil {
return srv.(PurchaseServiceServer).CreatePurchasePayment(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/CreatePurchasePayment"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_CreatePurchasePayment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).CreatePurchasePayment(ctx, req.(*CreatePurchasePaymentReq))
}
@ -549,7 +714,10 @@ func _PurchaseService_ListPurchasePayment_Handler(srv interface{}, ctx context.C
if interceptor == nil {
return srv.(PurchaseServiceServer).ListPurchasePayment(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/ListPurchasePayment"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_ListPurchasePayment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).ListPurchasePayment(ctx, req.(*ListPurchasePaymentReq))
}
@ -564,7 +732,10 @@ func _PurchaseService_ListInventoryLog_Handler(srv interface{}, ctx context.Cont
if interceptor == nil {
return srv.(PurchaseServiceServer).ListInventoryLog(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/ListInventoryLog"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_ListInventoryLog_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).ListInventoryLog(ctx, req.(*ListInventoryLogReq))
}
@ -579,7 +750,10 @@ func _PurchaseService_GetPurchaseStatsSummary_Handler(srv interface{}, ctx conte
if interceptor == nil {
return srv.(PurchaseServiceServer).GetPurchaseStatsSummary(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/GetPurchaseStatsSummary"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_GetPurchaseStatsSummary_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).GetPurchaseStatsSummary(ctx, req.(*PurchaseStatsSummaryReq))
}
@ -594,7 +768,10 @@ func _PurchaseService_GetPurchaseStatsBySupplier_Handler(srv interface{}, ctx co
if interceptor == nil {
return srv.(PurchaseServiceServer).GetPurchaseStatsBySupplier(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/GetPurchaseStatsBySupplier"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_GetPurchaseStatsBySupplier_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).GetPurchaseStatsBySupplier(ctx, req.(*PurchaseStatsSummaryReq))
}
@ -609,9 +786,108 @@ func _PurchaseService_GetPurchaseStatsByProduct_Handler(srv interface{}, ctx con
if interceptor == nil {
return srv.(PurchaseServiceServer).GetPurchaseStatsByProduct(ctx, in)
}
info := &grpc.UnaryServerInfo{Server: srv, FullMethod: "/purchase.PurchaseService/GetPurchaseStatsByProduct"}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PurchaseService_GetPurchaseStatsByProduct_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PurchaseServiceServer).GetPurchaseStatsByProduct(ctx, req.(*PurchaseStatsSummaryReq))
}
return interceptor(ctx, in, info, handler)
}
// PurchaseService_ServiceDesc is the grpc.ServiceDesc for PurchaseService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PurchaseService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "purchase.PurchaseService",
HandlerType: (*PurchaseServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateSupplier",
Handler: _PurchaseService_CreateSupplier_Handler,
},
{
MethodName: "UpdateSupplier",
Handler: _PurchaseService_UpdateSupplier_Handler,
},
{
MethodName: "DeleteSupplier",
Handler: _PurchaseService_DeleteSupplier_Handler,
},
{
MethodName: "GetSupplier",
Handler: _PurchaseService_GetSupplier_Handler,
},
{
MethodName: "ListSupplier",
Handler: _PurchaseService_ListSupplier_Handler,
},
{
MethodName: "CreatePurchaseOrder",
Handler: _PurchaseService_CreatePurchaseOrder_Handler,
},
{
MethodName: "UpdatePurchaseOrder",
Handler: _PurchaseService_UpdatePurchaseOrder_Handler,
},
{
MethodName: "ConfirmPurchaseOrder",
Handler: _PurchaseService_ConfirmPurchaseOrder_Handler,
},
{
MethodName: "CancelPurchaseOrder",
Handler: _PurchaseService_CancelPurchaseOrder_Handler,
},
{
MethodName: "GetPurchaseOrder",
Handler: _PurchaseService_GetPurchaseOrder_Handler,
},
{
MethodName: "ListPurchaseOrder",
Handler: _PurchaseService_ListPurchaseOrder_Handler,
},
{
MethodName: "CreatePurchaseReceipt",
Handler: _PurchaseService_CreatePurchaseReceipt_Handler,
},
{
MethodName: "ConfirmPurchaseReceipt",
Handler: _PurchaseService_ConfirmPurchaseReceipt_Handler,
},
{
MethodName: "GetPurchaseReceipt",
Handler: _PurchaseService_GetPurchaseReceipt_Handler,
},
{
MethodName: "ListPurchaseReceipt",
Handler: _PurchaseService_ListPurchaseReceipt_Handler,
},
{
MethodName: "CreatePurchasePayment",
Handler: _PurchaseService_CreatePurchasePayment_Handler,
},
{
MethodName: "ListPurchasePayment",
Handler: _PurchaseService_ListPurchasePayment_Handler,
},
{
MethodName: "ListInventoryLog",
Handler: _PurchaseService_ListInventoryLog_Handler,
},
{
MethodName: "GetPurchaseStatsSummary",
Handler: _PurchaseService_GetPurchaseStatsSummary_Handler,
},
{
MethodName: "GetPurchaseStatsBySupplier",
Handler: _PurchaseService_GetPurchaseStatsBySupplier_Handler,
},
{
MethodName: "GetPurchaseStatsByProduct",
Handler: _PurchaseService_GetPurchaseStatsByProduct_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "purchase.proto",
}