From 02490576ca30c0911b5ab3cd754e4eaaa0123b7b Mon Sep 17 00:00:00 2001 From: blaz-cerpnjak Date: Thu, 28 Mar 2024 18:56:19 +0100 Subject: [PATCH] Change order date field to utc timestamp --- .../com.blazc/order_service.pb.go | 883 ------------------ .../com.blazc/order_service_grpc.pb.go | 376 -------- API_GatewayWeb/DataStructures/main.go | 3 +- .../DataStructures/order_service.proto | 2 +- API_GatewayWeb/Logic/Order.go | 3 + API_GatewayWeb/pkg/Converter/OrdersGrpc.go | 8 +- .../kotlin/com/blazc/model/order/Order.kt | 11 +- .../kotlin/com/blazc/service/OrderService.kt | 2 + .../kotlin/com/blazc/utils/DateFormatter.kt | 19 - .../src/main/proto/order_service.proto | 2 +- .../kotlin/com/blazc/test/OrderServiceTest.kt | 5 +- docker-compose.yml | 1 + 12 files changed, 19 insertions(+), 1296 deletions(-) delete mode 100644 API_GatewayWeb/DataStructures/com.blazc/order_service.pb.go delete mode 100644 API_GatewayWeb/DataStructures/com.blazc/order_service_grpc.pb.go delete mode 100644 OrderProcessingAPI/src/main/kotlin/com/blazc/utils/DateFormatter.kt diff --git a/API_GatewayWeb/DataStructures/com.blazc/order_service.pb.go b/API_GatewayWeb/DataStructures/com.blazc/order_service.pb.go deleted file mode 100644 index e4e8769..0000000 --- a/API_GatewayWeb/DataStructures/com.blazc/order_service.pb.go +++ /dev/null @@ -1,883 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v4.25.3 -// source: order_service.proto - -package com_blazc - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type PaymentType int32 - -const ( - PaymentType_CREDIT_CARD PaymentType = 0 - PaymentType_CASH PaymentType = 2 -) - -// Enum value maps for PaymentType. -var ( - PaymentType_name = map[int32]string{ - 0: "CREDIT_CARD", - 2: "CASH", - } - PaymentType_value = map[string]int32{ - "CREDIT_CARD": 0, - "CASH": 2, - } -) - -func (x PaymentType) Enum() *PaymentType { - p := new(PaymentType) - *p = x - return p -} - -func (x PaymentType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PaymentType) Descriptor() protoreflect.EnumDescriptor { - return file_order_service_proto_enumTypes[0].Descriptor() -} - -func (PaymentType) Type() protoreflect.EnumType { - return &file_order_service_proto_enumTypes[0] -} - -func (x PaymentType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PaymentType.Descriptor instead. -func (PaymentType) EnumDescriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{0} -} - -type OrderStatus int32 - -const ( - OrderStatus_PENDING OrderStatus = 0 - OrderStatus_PREPARING OrderStatus = 1 - OrderStatus_READY_FOR_PICKUP OrderStatus = 2 - OrderStatus_DELIVERING OrderStatus = 3 - OrderStatus_DELIVERED OrderStatus = 4 - OrderStatus_CANCELLED OrderStatus = 5 -) - -// Enum value maps for OrderStatus. -var ( - OrderStatus_name = map[int32]string{ - 0: "PENDING", - 1: "PREPARING", - 2: "READY_FOR_PICKUP", - 3: "DELIVERING", - 4: "DELIVERED", - 5: "CANCELLED", - } - OrderStatus_value = map[string]int32{ - "PENDING": 0, - "PREPARING": 1, - "READY_FOR_PICKUP": 2, - "DELIVERING": 3, - "DELIVERED": 4, - "CANCELLED": 5, - } -) - -func (x OrderStatus) Enum() *OrderStatus { - p := new(OrderStatus) - *p = x - return p -} - -func (x OrderStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (OrderStatus) Descriptor() protoreflect.EnumDescriptor { - return file_order_service_proto_enumTypes[1].Descriptor() -} - -func (OrderStatus) Type() protoreflect.EnumType { - return &file_order_service_proto_enumTypes[1] -} - -func (x OrderStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use OrderStatus.Descriptor instead. -func (OrderStatus) EnumDescriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{1} -} - -type Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Empty) Reset() { - *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_order_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Empty) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Empty) ProtoMessage() {} - -func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_order_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Empty.ProtoReflect.Descriptor instead. -func (*Empty) Descriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{0} -} - -type Confirmation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *Confirmation) Reset() { - *x = Confirmation{} - if protoimpl.UnsafeEnabled { - mi := &file_order_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Confirmation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Confirmation) ProtoMessage() {} - -func (x *Confirmation) ProtoReflect() protoreflect.Message { - mi := &file_order_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Confirmation.ProtoReflect.Descriptor instead. -func (*Confirmation) Descriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{1} -} - -func (x *Confirmation) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *Confirmation) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -type GetOrdersRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *GetOrdersRequest) Reset() { - *x = GetOrdersRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_order_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetOrdersRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetOrdersRequest) ProtoMessage() {} - -func (x *GetOrdersRequest) ProtoReflect() protoreflect.Message { - mi := &file_order_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetOrdersRequest.ProtoReflect.Descriptor instead. -func (*GetOrdersRequest) Descriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{2} -} - -func (x *GetOrdersRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -type GetOrderRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *GetOrderRequest) Reset() { - *x = GetOrderRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_order_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetOrderRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetOrderRequest) ProtoMessage() {} - -func (x *GetOrderRequest) ProtoReflect() protoreflect.Message { - mi := &file_order_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetOrderRequest.ProtoReflect.Descriptor instead. -func (*GetOrderRequest) Descriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{3} -} - -func (x *GetOrderRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -type DeleteOrderRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *DeleteOrderRequest) Reset() { - *x = DeleteOrderRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_order_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteOrderRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteOrderRequest) ProtoMessage() {} - -func (x *DeleteOrderRequest) ProtoReflect() protoreflect.Message { - mi := &file_order_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteOrderRequest.ProtoReflect.Descriptor instead. -func (*DeleteOrderRequest) Descriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{4} -} - -func (x *DeleteOrderRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -type Order struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - SellerId string `protobuf:"bytes,2,opt,name=sellerId,proto3" json:"sellerId,omitempty"` - DeliveryPersonId string `protobuf:"bytes,3,opt,name=deliveryPersonId,proto3" json:"deliveryPersonId,omitempty"` - Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"` - CustomerName string `protobuf:"bytes,5,opt,name=customerName,proto3" json:"customerName,omitempty"` - Items []*OrderItem `protobuf:"bytes,6,rep,name=items,proto3" json:"items,omitempty"` - Status OrderStatus `protobuf:"varint,7,opt,name=status,proto3,enum=com.blazc.OrderStatus" json:"status,omitempty"` - OrderDate string `protobuf:"bytes,8,opt,name=orderDate,proto3" json:"orderDate,omitempty"` - PaymentType PaymentType `protobuf:"varint,9,opt,name=paymentType,proto3,enum=com.blazc.PaymentType" json:"paymentType,omitempty"` - TotalPrice int32 `protobuf:"varint,10,opt,name=totalPrice,proto3" json:"totalPrice,omitempty"` -} - -func (x *Order) Reset() { - *x = Order{} - if protoimpl.UnsafeEnabled { - mi := &file_order_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Order) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Order) ProtoMessage() {} - -func (x *Order) ProtoReflect() protoreflect.Message { - mi := &file_order_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Order.ProtoReflect.Descriptor instead. -func (*Order) Descriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{5} -} - -func (x *Order) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Order) GetSellerId() string { - if x != nil { - return x.SellerId - } - return "" -} - -func (x *Order) GetDeliveryPersonId() string { - if x != nil { - return x.DeliveryPersonId - } - return "" -} - -func (x *Order) GetAddress() string { - if x != nil { - return x.Address - } - return "" -} - -func (x *Order) GetCustomerName() string { - if x != nil { - return x.CustomerName - } - return "" -} - -func (x *Order) GetItems() []*OrderItem { - if x != nil { - return x.Items - } - return nil -} - -func (x *Order) GetStatus() OrderStatus { - if x != nil { - return x.Status - } - return OrderStatus_PENDING -} - -func (x *Order) GetOrderDate() string { - if x != nil { - return x.OrderDate - } - return "" -} - -func (x *Order) GetPaymentType() PaymentType { - if x != nil { - return x.PaymentType - } - return PaymentType_CREDIT_CARD -} - -func (x *Order) GetTotalPrice() int32 { - if x != nil { - return x.TotalPrice - } - return 0 -} - -type OrderItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Product *Product `protobuf:"bytes,2,opt,name=product,proto3" json:"product,omitempty"` - Quantity int32 `protobuf:"varint,3,opt,name=quantity,proto3" json:"quantity,omitempty"` - Price int32 `protobuf:"varint,4,opt,name=price,proto3" json:"price,omitempty"` -} - -func (x *OrderItem) Reset() { - *x = OrderItem{} - if protoimpl.UnsafeEnabled { - mi := &file_order_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OrderItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OrderItem) ProtoMessage() {} - -func (x *OrderItem) ProtoReflect() protoreflect.Message { - mi := &file_order_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OrderItem.ProtoReflect.Descriptor instead. -func (*OrderItem) Descriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{6} -} - -func (x *OrderItem) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *OrderItem) GetProduct() *Product { - if x != nil { - return x.Product - } - return nil -} - -func (x *OrderItem) GetQuantity() int32 { - if x != nil { - return x.Quantity - } - return 0 -} - -func (x *OrderItem) GetPrice() int32 { - if x != nil { - return x.Price - } - return 0 -} - -type Product struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Price int32 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"` -} - -func (x *Product) Reset() { - *x = Product{} - if protoimpl.UnsafeEnabled { - mi := &file_order_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Product) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Product) ProtoMessage() {} - -func (x *Product) ProtoReflect() protoreflect.Message { - mi := &file_order_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Product.ProtoReflect.Descriptor instead. -func (*Product) Descriptor() ([]byte, []int) { - return file_order_service_proto_rawDescGZIP(), []int{7} -} - -func (x *Product) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Product) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Product) GetPrice() int32 { - if x != nil { - return x.Price - } - return 0 -} - -var File_order_service_proto protoreflect.FileDescriptor - -var file_order_service_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, - 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x3e, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x22, 0x0a, 0x10, 0x47, 0x65, 0x74, - 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x21, 0x0a, - 0x0f, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x22, 0x24, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xf1, 0x02, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, - 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x49, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, - 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x4e, 0x61, - 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, - 0x63, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x4f, - 0x72, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x44, 0x61, 0x74, 0x65, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x44, 0x61, 0x74, 0x65, - 0x12, 0x38, 0x0a, 0x0b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, - 0x63, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x70, - 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x7b, 0x0a, 0x09, 0x4f, 0x72, - 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, - 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x22, 0x43, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x2a, 0x28, 0x0a, 0x0b, - 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x43, - 0x52, 0x45, 0x44, 0x49, 0x54, 0x5f, 0x43, 0x41, 0x52, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, - 0x43, 0x41, 0x53, 0x48, 0x10, 0x02, 0x2a, 0x6d, 0x0a, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, - 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x45, 0x50, 0x41, 0x52, 0x49, 0x4e, 0x47, 0x10, - 0x01, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x46, 0x4f, 0x52, 0x5f, 0x50, - 0x49, 0x43, 0x4b, 0x55, 0x50, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x45, 0x4c, 0x49, 0x56, - 0x45, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, 0x4c, 0x49, 0x56, - 0x45, 0x52, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, - 0x4c, 0x45, 0x44, 0x10, 0x05, 0x32, 0xda, 0x03, 0x0a, 0x0c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, - 0x63, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, - 0x61, 0x7a, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1a, - 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, - 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x63, 0x6f, 0x6d, - 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, 0x12, 0x3a, - 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x10, 0x2e, - 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, - 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x11, 0x47, 0x65, - 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x42, 0x79, 0x53, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x12, - 0x1b, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, - 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x63, - 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, - 0x30, 0x01, 0x12, 0x4e, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x42, - 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, - 0x1b, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4f, - 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x63, - 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, - 0x30, 0x01, 0x12, 0x47, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, - 0x72, 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x2e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x06, 0x48, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, - 0x63, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, - 0x61, 0x7a, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x00, 0x42, 0x0b, 0x5a, 0x09, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x6c, 0x61, 0x7a, 0x63, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_order_service_proto_rawDescOnce sync.Once - file_order_service_proto_rawDescData = file_order_service_proto_rawDesc -) - -func file_order_service_proto_rawDescGZIP() []byte { - file_order_service_proto_rawDescOnce.Do(func() { - file_order_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_order_service_proto_rawDescData) - }) - return file_order_service_proto_rawDescData -} - -var file_order_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_order_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_order_service_proto_goTypes = []interface{}{ - (PaymentType)(0), // 0: com.blazc.PaymentType - (OrderStatus)(0), // 1: com.blazc.OrderStatus - (*Empty)(nil), // 2: com.blazc.Empty - (*Confirmation)(nil), // 3: com.blazc.Confirmation - (*GetOrdersRequest)(nil), // 4: com.blazc.GetOrdersRequest - (*GetOrderRequest)(nil), // 5: com.blazc.GetOrderRequest - (*DeleteOrderRequest)(nil), // 6: com.blazc.DeleteOrderRequest - (*Order)(nil), // 7: com.blazc.Order - (*OrderItem)(nil), // 8: com.blazc.OrderItem - (*Product)(nil), // 9: com.blazc.Product -} -var file_order_service_proto_depIdxs = []int32{ - 8, // 0: com.blazc.Order.items:type_name -> com.blazc.OrderItem - 1, // 1: com.blazc.Order.status:type_name -> com.blazc.OrderStatus - 0, // 2: com.blazc.Order.paymentType:type_name -> com.blazc.PaymentType - 9, // 3: com.blazc.OrderItem.product:type_name -> com.blazc.Product - 7, // 4: com.blazc.OrderService.CreateOrder:input_type -> com.blazc.Order - 5, // 5: com.blazc.OrderService.GetOrder:input_type -> com.blazc.GetOrderRequest - 7, // 6: com.blazc.OrderService.UpdateOrder:input_type -> com.blazc.Order - 4, // 7: com.blazc.OrderService.GetOrdersBySeller:input_type -> com.blazc.GetOrdersRequest - 4, // 8: com.blazc.OrderService.GetOrdersByDeliveryPerson:input_type -> com.blazc.GetOrdersRequest - 6, // 9: com.blazc.OrderService.DeleteOrder:input_type -> com.blazc.DeleteOrderRequest - 2, // 10: com.blazc.OrderService.Health:input_type -> com.blazc.Empty - 3, // 11: com.blazc.OrderService.CreateOrder:output_type -> com.blazc.Confirmation - 7, // 12: com.blazc.OrderService.GetOrder:output_type -> com.blazc.Order - 3, // 13: com.blazc.OrderService.UpdateOrder:output_type -> com.blazc.Confirmation - 7, // 14: com.blazc.OrderService.GetOrdersBySeller:output_type -> com.blazc.Order - 7, // 15: com.blazc.OrderService.GetOrdersByDeliveryPerson:output_type -> com.blazc.Order - 3, // 16: com.blazc.OrderService.DeleteOrder:output_type -> com.blazc.Confirmation - 3, // 17: com.blazc.OrderService.Health:output_type -> com.blazc.Confirmation - 11, // [11:18] is the sub-list for method output_type - 4, // [4:11] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_order_service_proto_init() } -func file_order_service_proto_init() { - if File_order_service_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_order_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_order_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Confirmation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_order_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetOrdersRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_order_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetOrderRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_order_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteOrderRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_order_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Order); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_order_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OrderItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_order_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Product); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_order_service_proto_rawDesc, - NumEnums: 2, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_order_service_proto_goTypes, - DependencyIndexes: file_order_service_proto_depIdxs, - EnumInfos: file_order_service_proto_enumTypes, - MessageInfos: file_order_service_proto_msgTypes, - }.Build() - File_order_service_proto = out.File - file_order_service_proto_rawDesc = nil - file_order_service_proto_goTypes = nil - file_order_service_proto_depIdxs = nil -} diff --git a/API_GatewayWeb/DataStructures/com.blazc/order_service_grpc.pb.go b/API_GatewayWeb/DataStructures/com.blazc/order_service_grpc.pb.go deleted file mode 100644 index 824d72c..0000000 --- a/API_GatewayWeb/DataStructures/com.blazc/order_service_grpc.pb.go +++ /dev/null @@ -1,376 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v4.25.3 -// source: order_service.proto - -package com_blazc - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// OrderServiceClient is the client API for OrderService 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 OrderServiceClient interface { - CreateOrder(ctx context.Context, in *Order, opts ...grpc.CallOption) (*Confirmation, error) - GetOrder(ctx context.Context, in *GetOrderRequest, opts ...grpc.CallOption) (*Order, error) - UpdateOrder(ctx context.Context, in *Order, opts ...grpc.CallOption) (*Confirmation, error) - GetOrdersBySeller(ctx context.Context, in *GetOrdersRequest, opts ...grpc.CallOption) (OrderService_GetOrdersBySellerClient, error) - GetOrdersByDeliveryPerson(ctx context.Context, in *GetOrdersRequest, opts ...grpc.CallOption) (OrderService_GetOrdersByDeliveryPersonClient, error) - DeleteOrder(ctx context.Context, in *DeleteOrderRequest, opts ...grpc.CallOption) (*Confirmation, error) - Health(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Confirmation, error) -} - -type orderServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewOrderServiceClient(cc grpc.ClientConnInterface) OrderServiceClient { - return &orderServiceClient{cc} -} - -func (c *orderServiceClient) CreateOrder(ctx context.Context, in *Order, opts ...grpc.CallOption) (*Confirmation, error) { - out := new(Confirmation) - err := c.cc.Invoke(ctx, "/com.blazc.OrderService/CreateOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *orderServiceClient) GetOrder(ctx context.Context, in *GetOrderRequest, opts ...grpc.CallOption) (*Order, error) { - out := new(Order) - err := c.cc.Invoke(ctx, "/com.blazc.OrderService/GetOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *orderServiceClient) UpdateOrder(ctx context.Context, in *Order, opts ...grpc.CallOption) (*Confirmation, error) { - out := new(Confirmation) - err := c.cc.Invoke(ctx, "/com.blazc.OrderService/UpdateOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *orderServiceClient) GetOrdersBySeller(ctx context.Context, in *GetOrdersRequest, opts ...grpc.CallOption) (OrderService_GetOrdersBySellerClient, error) { - stream, err := c.cc.NewStream(ctx, &OrderService_ServiceDesc.Streams[0], "/com.blazc.OrderService/GetOrdersBySeller", opts...) - if err != nil { - return nil, err - } - x := &orderServiceGetOrdersBySellerClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type OrderService_GetOrdersBySellerClient interface { - Recv() (*Order, error) - grpc.ClientStream -} - -type orderServiceGetOrdersBySellerClient struct { - grpc.ClientStream -} - -func (x *orderServiceGetOrdersBySellerClient) Recv() (*Order, error) { - m := new(Order) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *orderServiceClient) GetOrdersByDeliveryPerson(ctx context.Context, in *GetOrdersRequest, opts ...grpc.CallOption) (OrderService_GetOrdersByDeliveryPersonClient, error) { - stream, err := c.cc.NewStream(ctx, &OrderService_ServiceDesc.Streams[1], "/com.blazc.OrderService/GetOrdersByDeliveryPerson", opts...) - if err != nil { - return nil, err - } - x := &orderServiceGetOrdersByDeliveryPersonClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type OrderService_GetOrdersByDeliveryPersonClient interface { - Recv() (*Order, error) - grpc.ClientStream -} - -type orderServiceGetOrdersByDeliveryPersonClient struct { - grpc.ClientStream -} - -func (x *orderServiceGetOrdersByDeliveryPersonClient) Recv() (*Order, error) { - m := new(Order) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *orderServiceClient) DeleteOrder(ctx context.Context, in *DeleteOrderRequest, opts ...grpc.CallOption) (*Confirmation, error) { - out := new(Confirmation) - err := c.cc.Invoke(ctx, "/com.blazc.OrderService/DeleteOrder", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *orderServiceClient) Health(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Confirmation, error) { - out := new(Confirmation) - err := c.cc.Invoke(ctx, "/com.blazc.OrderService/Health", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// OrderServiceServer is the server API for OrderService service. -// All implementations must embed UnimplementedOrderServiceServer -// for forward compatibility -type OrderServiceServer interface { - CreateOrder(context.Context, *Order) (*Confirmation, error) - GetOrder(context.Context, *GetOrderRequest) (*Order, error) - UpdateOrder(context.Context, *Order) (*Confirmation, error) - GetOrdersBySeller(*GetOrdersRequest, OrderService_GetOrdersBySellerServer) error - GetOrdersByDeliveryPerson(*GetOrdersRequest, OrderService_GetOrdersByDeliveryPersonServer) error - DeleteOrder(context.Context, *DeleteOrderRequest) (*Confirmation, error) - Health(context.Context, *Empty) (*Confirmation, error) - mustEmbedUnimplementedOrderServiceServer() -} - -// UnimplementedOrderServiceServer must be embedded to have forward compatible implementations. -type UnimplementedOrderServiceServer struct { -} - -func (UnimplementedOrderServiceServer) CreateOrder(context.Context, *Order) (*Confirmation, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateOrder not implemented") -} -func (UnimplementedOrderServiceServer) GetOrder(context.Context, *GetOrderRequest) (*Order, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetOrder not implemented") -} -func (UnimplementedOrderServiceServer) UpdateOrder(context.Context, *Order) (*Confirmation, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateOrder not implemented") -} -func (UnimplementedOrderServiceServer) GetOrdersBySeller(*GetOrdersRequest, OrderService_GetOrdersBySellerServer) error { - return status.Errorf(codes.Unimplemented, "method GetOrdersBySeller not implemented") -} -func (UnimplementedOrderServiceServer) GetOrdersByDeliveryPerson(*GetOrdersRequest, OrderService_GetOrdersByDeliveryPersonServer) error { - return status.Errorf(codes.Unimplemented, "method GetOrdersByDeliveryPerson not implemented") -} -func (UnimplementedOrderServiceServer) DeleteOrder(context.Context, *DeleteOrderRequest) (*Confirmation, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteOrder not implemented") -} -func (UnimplementedOrderServiceServer) Health(context.Context, *Empty) (*Confirmation, error) { - return nil, status.Errorf(codes.Unimplemented, "method Health not implemented") -} -func (UnimplementedOrderServiceServer) mustEmbedUnimplementedOrderServiceServer() {} - -// UnsafeOrderServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to OrderServiceServer will -// result in compilation errors. -type UnsafeOrderServiceServer interface { - mustEmbedUnimplementedOrderServiceServer() -} - -func RegisterOrderServiceServer(s grpc.ServiceRegistrar, srv OrderServiceServer) { - s.RegisterService(&OrderService_ServiceDesc, srv) -} - -func _OrderService_CreateOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Order) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OrderServiceServer).CreateOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/com.blazc.OrderService/CreateOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OrderServiceServer).CreateOrder(ctx, req.(*Order)) - } - return interceptor(ctx, in, info, handler) -} - -func _OrderService_GetOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetOrderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OrderServiceServer).GetOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/com.blazc.OrderService/GetOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OrderServiceServer).GetOrder(ctx, req.(*GetOrderRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _OrderService_UpdateOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Order) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OrderServiceServer).UpdateOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/com.blazc.OrderService/UpdateOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OrderServiceServer).UpdateOrder(ctx, req.(*Order)) - } - return interceptor(ctx, in, info, handler) -} - -func _OrderService_GetOrdersBySeller_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetOrdersRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(OrderServiceServer).GetOrdersBySeller(m, &orderServiceGetOrdersBySellerServer{stream}) -} - -type OrderService_GetOrdersBySellerServer interface { - Send(*Order) error - grpc.ServerStream -} - -type orderServiceGetOrdersBySellerServer struct { - grpc.ServerStream -} - -func (x *orderServiceGetOrdersBySellerServer) Send(m *Order) error { - return x.ServerStream.SendMsg(m) -} - -func _OrderService_GetOrdersByDeliveryPerson_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetOrdersRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(OrderServiceServer).GetOrdersByDeliveryPerson(m, &orderServiceGetOrdersByDeliveryPersonServer{stream}) -} - -type OrderService_GetOrdersByDeliveryPersonServer interface { - Send(*Order) error - grpc.ServerStream -} - -type orderServiceGetOrdersByDeliveryPersonServer struct { - grpc.ServerStream -} - -func (x *orderServiceGetOrdersByDeliveryPersonServer) Send(m *Order) error { - return x.ServerStream.SendMsg(m) -} - -func _OrderService_DeleteOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteOrderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OrderServiceServer).DeleteOrder(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/com.blazc.OrderService/DeleteOrder", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OrderServiceServer).DeleteOrder(ctx, req.(*DeleteOrderRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _OrderService_Health_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OrderServiceServer).Health(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/com.blazc.OrderService/Health", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OrderServiceServer).Health(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -// OrderService_ServiceDesc is the grpc.ServiceDesc for OrderService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var OrderService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "com.blazc.OrderService", - HandlerType: (*OrderServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateOrder", - Handler: _OrderService_CreateOrder_Handler, - }, - { - MethodName: "GetOrder", - Handler: _OrderService_GetOrder_Handler, - }, - { - MethodName: "UpdateOrder", - Handler: _OrderService_UpdateOrder_Handler, - }, - { - MethodName: "DeleteOrder", - Handler: _OrderService_DeleteOrder_Handler, - }, - { - MethodName: "Health", - Handler: _OrderService_Health_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "GetOrdersBySeller", - Handler: _OrderService_GetOrdersBySeller_Handler, - ServerStreams: true, - }, - { - StreamName: "GetOrdersByDeliveryPerson", - Handler: _OrderService_GetOrdersByDeliveryPerson_Handler, - ServerStreams: true, - }, - }, - Metadata: "order_service.proto", -} diff --git a/API_GatewayWeb/DataStructures/main.go b/API_GatewayWeb/DataStructures/main.go index 97c03bc..8b02098 100644 --- a/API_GatewayWeb/DataStructures/main.go +++ b/API_GatewayWeb/DataStructures/main.go @@ -2,7 +2,6 @@ package DataStructures import ( "go.mongodb.org/mongo-driver/bson/primitive" - "time" ) type User struct { @@ -37,7 +36,7 @@ type Order struct { CustomerName string `json:"customerName" bson:"customerName"` OrderItems []OrderItem `json:"items" bson:"items"` Status string `json:"status" bson:"status"` - OrderDate time.Time `json:"orderDate" bson:"orderDate"` + Timestamp int64 `json:"timestamp" bson:"timestamp"` PaymentType string `json:"paymentType" bson:"paymentType"` TotalPrice int32 `json:"totalPrice" bson:"totalPrice"` // in cents } diff --git a/API_GatewayWeb/DataStructures/order_service.proto b/API_GatewayWeb/DataStructures/order_service.proto index 1bbf727..18cc237 100644 --- a/API_GatewayWeb/DataStructures/order_service.proto +++ b/API_GatewayWeb/DataStructures/order_service.proto @@ -41,7 +41,7 @@ message Order { string customerName = 5; repeated OrderItem items = 6; OrderStatus status = 7; - string orderDate = 8; + int64 timestamp = 8; PaymentType paymentType = 9; int32 totalPrice = 10; } diff --git a/API_GatewayWeb/Logic/Order.go b/API_GatewayWeb/Logic/Order.go index 67dda6c..070fa4b 100644 --- a/API_GatewayWeb/Logic/Order.go +++ b/API_GatewayWeb/Logic/Order.go @@ -62,6 +62,8 @@ func (c *Controller) GetOrdersBySellerId(ctx context.Context, id primitive.Objec orders = make([]DataStructures.Order, 0) + fmt.Println("Getting orders") + for { orderGrpc, err := orderStream.Recv() if err != nil { @@ -75,6 +77,7 @@ func (c *Controller) GetOrdersBySellerId(ctx context.Context, id primitive.Objec continue } + fmt.Println(order) orders = append(orders, order) } diff --git a/API_GatewayWeb/pkg/Converter/OrdersGrpc.go b/API_GatewayWeb/pkg/Converter/OrdersGrpc.go index 32c8743..6d93b9d 100644 --- a/API_GatewayWeb/pkg/Converter/OrdersGrpc.go +++ b/API_GatewayWeb/pkg/Converter/OrdersGrpc.go @@ -60,7 +60,7 @@ func ConvertOrderToGrpc(order DataStructures.Order) (orderGrpc *pb.Order) { CustomerName: order.CustomerName, Items: orderItemsGrpc, Status: ConvertFromOrderStatusString(order.Status), - OrderDate: time.Now().Format(time.RFC3339), + Timestamp: time.Now().UTC().Unix(), PaymentType: ConvertFromPaymentTypeString(order.PaymentType), TotalPrice: order.TotalPrice, } @@ -115,11 +115,7 @@ func ConvertOrderFromGrpc(orderGrpc *pb.Order) (order DataStructures.Order, err order.OrderItems = items order.Status = orderGrpc.Status.String() - order.OrderDate, err = time.Parse(time.RFC3339, orderGrpc.OrderDate) - if err != nil { - return - } - + order.Timestamp = orderGrpc.Timestamp order.PaymentType = orderGrpc.PaymentType.String() order.TotalPrice = orderGrpc.TotalPrice return diff --git a/OrderProcessingAPI/src/main/kotlin/com/blazc/model/order/Order.kt b/OrderProcessingAPI/src/main/kotlin/com/blazc/model/order/Order.kt index 9a7f5a8..9478300 100644 --- a/OrderProcessingAPI/src/main/kotlin/com/blazc/model/order/Order.kt +++ b/OrderProcessingAPI/src/main/kotlin/com/blazc/model/order/Order.kt @@ -2,9 +2,8 @@ package com.blazc.model.order import com.blazc.OrderGrpc import com.blazc.model.payment.PaymentType -import com.blazc.utils.DateFormatter import org.bson.types.ObjectId -import java.time.LocalDateTime +import java.time.Instant data class Order ( var id: ObjectId? = null, @@ -14,7 +13,7 @@ data class Order ( var customerName: String, var items: List, var status: OrderStatus, - var orderDate: LocalDateTime, + var timestamp: Long, var paymentType: PaymentType, var totalPrice: Int ) { @@ -27,7 +26,7 @@ data class Order ( customerName = "", items = emptyList(), status = OrderStatus.PENDING, - orderDate = LocalDateTime.now(), + timestamp = Instant.now().epochSecond, paymentType = PaymentType.CASH, totalPrice = 0 ) @@ -44,7 +43,7 @@ data class Order ( OrderItem.fromGrpc(it) }, status = OrderStatus.fromGrpc(order.status), - orderDate = DateFormatter.toLocalDateTime(order.orderDate), + timestamp = order.timestamp, paymentType = PaymentType.fromGrpc(order.paymentType), totalPrice = order.totalPrice ) @@ -61,7 +60,7 @@ data class Order ( OrderItem.toGrpc(it) }) .setStatus(OrderStatus.toGrpc(order.status)) - .setOrderDate(DateFormatter.toString(order.orderDate)) + .setTimestamp(order.timestamp) .setPaymentType(PaymentType.toGrpc(order.paymentType)) .setTotalPrice(order.totalPrice) .build() diff --git a/OrderProcessingAPI/src/main/kotlin/com/blazc/service/OrderService.kt b/OrderProcessingAPI/src/main/kotlin/com/blazc/service/OrderService.kt index 31617d6..94156fa 100644 --- a/OrderProcessingAPI/src/main/kotlin/com/blazc/service/OrderService.kt +++ b/OrderProcessingAPI/src/main/kotlin/com/blazc/service/OrderService.kt @@ -8,11 +8,13 @@ import io.grpc.Status import io.grpc.stub.StreamObserver import io.quarkus.grpc.GrpcService import jakarta.inject.Inject +import jakarta.inject.Singleton import org.bson.types.ObjectId import org.eclipse.microprofile.reactive.messaging.Channel import org.eclipse.microprofile.reactive.messaging.Emitter @GrpcService +@Singleton class OrderService : OrderServiceGrpc.OrderServiceImplBase() { @Inject diff --git a/OrderProcessingAPI/src/main/kotlin/com/blazc/utils/DateFormatter.kt b/OrderProcessingAPI/src/main/kotlin/com/blazc/utils/DateFormatter.kt deleted file mode 100644 index e1964ce..0000000 --- a/OrderProcessingAPI/src/main/kotlin/com/blazc/utils/DateFormatter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.blazc.utils - -import java.time.LocalDateTime - -class DateFormatter { - companion object { - - fun toLocalDateTime(date: String): LocalDateTime { - val localDateTime = LocalDateTime.parse(date, java.time.format.DateTimeFormatter.ISO_DATE_TIME) - return localDateTime - } - - fun toString(date: LocalDateTime): String { - val string = date.format(java.time.format.DateTimeFormatter.ISO_DATE_TIME) - return string - } - - } -} \ No newline at end of file diff --git a/OrderProcessingAPI/src/main/proto/order_service.proto b/OrderProcessingAPI/src/main/proto/order_service.proto index 505bbd6..32487b7 100644 --- a/OrderProcessingAPI/src/main/proto/order_service.proto +++ b/OrderProcessingAPI/src/main/proto/order_service.proto @@ -41,7 +41,7 @@ message Order { string customerName = 5; repeated OrderItem items = 6; OrderStatus status = 7; - string orderDate = 8; + int64 timestamp = 8; PaymentType paymentType = 9; int32 totalPrice = 10; } diff --git a/OrderProcessingAPI/src/test/kotlin/com/blazc/test/OrderServiceTest.kt b/OrderProcessingAPI/src/test/kotlin/com/blazc/test/OrderServiceTest.kt index 817436b..a60faf0 100644 --- a/OrderProcessingAPI/src/test/kotlin/com/blazc/test/OrderServiceTest.kt +++ b/OrderProcessingAPI/src/test/kotlin/com/blazc/test/OrderServiceTest.kt @@ -4,8 +4,9 @@ import com.blazc.OrderGrpc import com.blazc.OrderServiceGrpc import io.grpc.ManagedChannelBuilder import io.quarkus.test.junit.QuarkusTest -import org.junit.jupiter.api.* import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.BeforeAll +import org.junit.jupiter.api.Test @QuarkusTest class OrderServiceTest { @@ -19,7 +20,7 @@ class OrderServiceTest { fun setup() { order = OrderGrpc.Order.newBuilder() .setId("65f33d0f5cc012d6bef8c985") - .setOrderDate("2024-03-14T17:05:24+00:00") + .setTimestamp(1711617513) .setStatus(OrderGrpc.OrderStatus.PENDING) .setAddress("123 Main St") .setCustomerName("John Doe") diff --git a/docker-compose.yml b/docker-compose.yml index 2993646..c38fb26 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,6 +76,7 @@ services: networks: - native + ### API Gateway for Web web-api-gateway: build: context: API_GatewayWeb