mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 14:03:45 +03:00
126 lines
2.6 KiB
Protocol Buffer
126 lines
2.6 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
import "google/protobuf/empty.proto";
|
|
import "validate/validate.proto";
|
|
import "google/api/annotations.proto";
|
|
import "protoc-gen-openapiv2/options/annotations.proto";
|
|
|
|
option go_package = "route256/pkg/api/loms/v1;loms";
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|
info: {
|
|
title: "LOMS Service";
|
|
version: "1.0.0";
|
|
};
|
|
schemes: HTTP;
|
|
schemes: HTTPS;
|
|
consumes: "application/json";
|
|
produces: "application/json";
|
|
};
|
|
|
|
service LOMS {
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {
|
|
description: "LOMS Service"
|
|
external_docs: {
|
|
url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/examples/internal/proto/examplepb/a_bit_of_everything.proto";
|
|
description: "Find out more about grpc-gateway";
|
|
}
|
|
};
|
|
|
|
rpc OrderCreate(OrderCreateRequest) returns (OrderCreateResponse) {
|
|
option(google.api.http) = {
|
|
post: "/order/create"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc OrderInfo(OrderInfoRequest) returns (OrderInfoResponse) {
|
|
option (google.api.http) = {
|
|
get: "/order/info"
|
|
};
|
|
}
|
|
|
|
rpc OrderPay(OrderPayRequest) returns (google.protobuf.Empty) {
|
|
option (google.api.http) = {
|
|
post: "/order/pay"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc OrderCancel(OrderCancelRequest) returns (google.protobuf.Empty) {
|
|
option (google.api.http) = {
|
|
post: "/order/cancel"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc StocksInfo(StocksInfoRequest) returns (StocksInfoResponse) {
|
|
option (google.api.http) = {
|
|
get: "/stock/info"
|
|
};
|
|
}
|
|
}
|
|
|
|
message OrderItem {
|
|
int64 sku = 1 [(validate.rules).int64 = {gt: 0}];
|
|
uint32 count = 2 [(validate.rules).uint32 = {gt: 0}];
|
|
}
|
|
|
|
// OrderCreate
|
|
|
|
message OrderCreateRequest {
|
|
int64 user_id = 1 [
|
|
(validate.rules).int64 = {gt: 0}
|
|
];
|
|
repeated OrderItem items = 2 [
|
|
(validate.rules).repeated = {min_items: 1}
|
|
];
|
|
}
|
|
|
|
message OrderCreateResponse {
|
|
int64 orderId = 1;
|
|
}
|
|
|
|
// OrderInfo
|
|
|
|
message OrderInfoRequest {
|
|
int64 orderId = 1 [(validate.rules).int64 = {gt: 0}];
|
|
}
|
|
|
|
message OrderInfoResponse {
|
|
string status = 1;
|
|
int64 user_id = 2;
|
|
repeated OrderItem items = 3;
|
|
}
|
|
|
|
enum OrderStatus {
|
|
ORDER_STATUS_UNSPECIFIED = 0;
|
|
ORDER_STATUS_NEW = 1;
|
|
ORDER_STATUS_AWAITING_PAYMENT = 2;
|
|
ORDER_STATUS_FAILED = 3;
|
|
ORDER_STATUS_PAYED = 4;
|
|
ORDER_STATUS_CANCELLED = 5;
|
|
}
|
|
|
|
// OrderPay
|
|
|
|
message OrderPayRequest {
|
|
int64 order_id = 1 [(validate.rules).int64 = {gt: 0}];
|
|
}
|
|
|
|
// OrderCancel
|
|
|
|
message OrderCancelRequest {
|
|
int64 order_id = 1 [(validate.rules).int64 = {gt: 0}];
|
|
}
|
|
|
|
// StocksInfo
|
|
|
|
message StocksInfoRequest {
|
|
int64 sku = 1 [(validate.rules).int64 = {gt: 0}];
|
|
}
|
|
|
|
message StocksInfoResponse {
|
|
uint32 count = 1;
|
|
}
|