jacky-htg / inventory-service Goto Github PK
View Code? Open in Web Editor NEWInventory service using golang grpc and postgresql. This service is part of ERP microservices.
License: GNU General Public License v3.0
Inventory service using golang grpc and postgresql. This service is part of ERP microservices.
License: GNU General Public License v3.0
Each company can manage their product
message Product { string id = 1; string company_id = 2; Brand brand = 3; ProductCategory product_category = 4; string code = 5; string name = 6; uint32 minimun_stock = 7; google.protobuf.Timestamp created_at = 8; string created_by = 9; google.protobuf.Timestamp updated_at = 10; string updated_by = 11; }
`message ListProductRequest {
Pagination pagination = 1;
string product_category_id = 2;
string brand_id = 3;
}
message ProductPaginationResponse {
Pagination pagination = 1;
string product_category_id = 2;
string brand_id = 3;
uint32 count = 4;
}
message ListProductResponse {
ProductPaginationResponse pagination = 1;
Product product = 2;
}
service ProductService {
rpc Create(Product) returns (Product) {}
rpc Update(Product) returns (Product) {}
rpc View(Id) returns (Product) {}
rpc Delete(Id) returns (Boolean) {}
rpc List(ListProductRequest) returns (stream ListProductResponse) {}
}`
Each company can manage their brand.
message Brand { string id = 1; string company_id = 2; string code = 3; string name = 4; google.protobuf.Timestamp created_at = 5; string created_by = 6; google.protobuf.Timestamp updated_at = 7; string updated_by = 8; }
`message ListBrandResponse {
PaginationResponse pagination = 1;
Brand brand = 2;
}
service BrandService {
rpc Create(Brand) returns (Brand) {}
rpc Update(Brand) returns (Brand) {}
rpc View(Id) returns (Brand) {}
rpc Delete(Id) returns (Boolean) {}
rpc List(Pagination) returns (stream ListBrandResponse) {}
}`
create module receiving return
Each company can manage their warehouse
message Warehouse { string id = 1; string company_id = 2; string branch_id = 3; string branch_name = 4; string code = 5; string name = 6; string pic_name = 7; string pic_phone = 8; google.protobuf.Timestamp created_at = 9; string created_by = 10; google.protobuf.Timestamp updated_at = 11; string updated_by = 12; }
`message ListWarehouseRequest {
Pagination pagination = 1;
string branch_id = 2;
}
message WarehousePaginationResponse {
Pagination pagination = 1;
string branch_id = 2;
uint32 count = 3;
}
message ListWarehouseResponse {
WarehousePaginationResponse pagination = 1;
Warehouse warehouse = 2;
}
service WarehouseService {
rpc Create(Warehouse) returns (Warehouse) {}
rpc Update(Warehouse) returns (Warehouse) {}
rpc View(Id) returns (Warehouse) {}
rpc Delete(Id) returns (Boolean) {}
rpc List(ListWarehouseRequest) returns (stream ListWarehouseResponse) {}
}`
Each company can manage trheir shelves on warehouse.
message Shelve { string id = 1; Warehouse warehouse = 2; string code = 3; string name = 4; google.protobuf.Timestamp created_at = 5; string created_by = 6; google.protobuf.Timestamp updated_at = 7; string updated_by = 8; }
`message ListShelveRequest {
Pagination pagination = 1;
string warehouse_id = 2;
}
message ShelvePaginationResponse {
Pagination pagination = 1;
string warehouse_id = 3;
uint32 count = 4;
}
message ListShelveResponse {
ShelvePaginationResponse pagination = 1;
Shelve shelve = 2;
}
service ShelveService {
rpc Create(Shelve) returns (Shelve) {}
rpc Update(Shelve) returns (Shelve) {}
rpc View(Id) returns (Shelve) {}
rpc Delete(Id) returns (Boolean) {}
rpc List(ListShelveRequest) returns (stream ListShelveResponse) {}
}`
Each company can manage their product category.
`
message Empty {}
message Id { string id = 1; }
message String { string string = 1; }
message Message { string message = 1; }
message Boolean { bool boolean = 1; }
message Pagination {
enum Sort {
ASC = 0;
DESC = 1;
}
uint32 page = 1;
uint32 limit = 2;
uint32 offset = 3;
string search = 4;
string order_by = 5;
Sort sort = 6;
}
message PaginationResponse {
Pagination pagination = 1;
uint32 count = 2;
}
`
message ProductCategory { string id = 1; string company_id = 2; Category category = 3; string name = 4; google.protobuf.Timestamp created_at = 5; string created_by = 6; google.protobuf.Timestamp updated_at = 7; string updated_by = 8; }
`
message ListProductCategoryRequest {
Pagination pagination = 1;
string category_id = 2;
}
message ProductCategoryPaginationResponse {
Pagination pagination = 1;
string category_id = 2;
uint32 count = 3;
}
message ListProductCategoryResponse {
ProductCategoryPaginationResponse pagination = 1;
ProductCategory product_category = 2;
}
service ProductCategoryService {
rpc Create(ProductCategory) returns (ProductCategory) {}
rpc Update(ProductCategory) returns (ProductCategory) {}
rpc View(Id) returns (ProductCategory) {}
rpc Delete(Id) returns (Boolean) {}
rpc List(ListProductCategoryRequest) returns (stream ListProductCategoryResponse) {}
}
`
Each company can create and manage own product category, but for manage the standardisation, each product category must related with category. Need no CRUD for category service, the category will be insert from seed. The service just need a streaming list category.
service CategoryService { rpc List(Empty) returns (stream Category) {} }
Create module delivery order using proto contract below :
`
message Delivery {
string id = 1;
string branch_id = 3;
string branch_name = 4;
string sales_order_id = 5;
string code = 6;
google.protobuf.Timestamp delivery_date = 7;
string remark = 8;
google.protobuf.Timestamp created_at = 9;
string created_by = 10;
google.protobuf.Timestamp updated_at = 11;
string updated_by = 12;
repeated DeliveryDetail details = 13;
}
message DeliveryDetail {
string id = 1;
string delivery_id = 2;
Product product = 3;
string barcode = 4;
Shelve shelve = 5;
}
message ListDeliveryRequest {
Pagination pagination = 1;
string branch_id = 2;
string sales_order_id = 3;
}
message DeliveryPaginationResponse {
Pagination pagination = 1;
string branch_id = 2;
string sales_order_id = 3;
uint32 count = 4;
}
message ListDeliveryResponse {
DeliveryPaginationResponse pagination = 1;
Delivery Delivery = 2;
}
service DeliveryService {
rpc Create(Delivery) returns (Delivery) {}
rpc Update(Delivery) returns (Delivery) {}
rpc View(Id) returns (Delivery) {}
rpc List(ListDeliveryRequest) returns (stream ListDeliveryResponse) {}
}
`
Good receiving modules
message Receive { string id = 1; string company_id = 2; string branch_id = 3; string branch_name = 4; string purchase_id = 5; string purchase_code = 6; string code = 7; google.protobuf.Timestamp date = 8; string remark = 9; google.protobuf.Timestamp created_at = 10; string created_by = 11; google.protobuf.Timestamp updated_at = 12; string updated_by = 13; repeated ReceiveDetail details = 14; }
message ReceiveDetail { string id = 1; string receive_id = 2; Product product = 3; Shelve shelve = 4; string code = 5; uint32 qty = 6; google.protobuf.Timestamp expired_date = 7; }
`message ListReceiveRequest {
Pagination pagination = 1;
string branch_id = 2;
string purchase_id = 3;
}
message ReceivePaginationResponse {
Pagination pagination = 1;
string branch_id = 2;
string purchase_id = 3;
uint32 count = 4;
}
message ListReceiveResponse {
ReceivePaginationResponse pagination = 1;
Receive Receive = 2;
}
service ReceiveService {
rpc Create(Receive) returns (Receive) {}
rpc Update(Receive) returns (Receive) {}
rpc View(Id) returns (Receive) {}
rpc List(ListReceiveRequest) returns (stream ListReceiveResponse) {}
}`
create modul stock opname
when run make seed will be insert master of categories
Mutation product between one shelve to another shelve in one warehouse.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.