mirror of
https://github.com/hexolan/stocklet.git
synced 2026-12-01 11:19:10 +00:00
chore: initial commit
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// Copyright (C) 2024 Declan Teevan
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package stocklet.events.v1;
|
||||
|
||||
option go_package = "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1;events_v1";
|
||||
|
||||
// Order Status = processing
|
||||
message OrderCreatedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string order_id = 2;
|
||||
string customer_id = 3;
|
||||
|
||||
map<string, int32> item_quantities = 4;
|
||||
}
|
||||
|
||||
// Order Status = pending
|
||||
message OrderPendingEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string order_id = 2;
|
||||
string customer_id = 3;
|
||||
|
||||
map<string, int32> item_quantities = 4;
|
||||
|
||||
float items_price = 5;
|
||||
float total_price = 6;
|
||||
}
|
||||
|
||||
// Order Status = rejected
|
||||
message OrderRejectedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string order_id = 2;
|
||||
|
||||
optional string transaction_id = 3;
|
||||
optional string shipping_id = 4;
|
||||
}
|
||||
|
||||
// Order Status = approved
|
||||
message OrderApprovedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string order_id = 2;
|
||||
|
||||
string transaction_id = 3;
|
||||
string shipping_id = 4;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// Copyright (C) 2024 Declan Teevan
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package stocklet.events.v1;
|
||||
|
||||
option go_package = "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1;events_v1";
|
||||
|
||||
message BalanceCreatedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string customer_id = 2;
|
||||
float balance = 3;
|
||||
}
|
||||
|
||||
message BalanceCreditedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string customer_id = 2;
|
||||
float amount = 3;
|
||||
float new_balance = 4;
|
||||
}
|
||||
|
||||
message BalanceDebitedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string customer_id = 2;
|
||||
float amount = 3;
|
||||
float new_balance = 4;
|
||||
}
|
||||
|
||||
message BalanceClosedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string customer_id = 2;
|
||||
float balance = 3;
|
||||
}
|
||||
|
||||
message TransactionLoggedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string transaction_id = 2;
|
||||
float amount = 3;
|
||||
|
||||
string order_id = 4;
|
||||
string customer_id = 5;
|
||||
}
|
||||
|
||||
message TransactionReversedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string transaction_id = 2;
|
||||
float amount = 3;
|
||||
|
||||
string order_id = 4;
|
||||
string customer_id = 5;
|
||||
}
|
||||
|
||||
message PaymentProcessedEvent {
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
TYPE_FAILED = 1;
|
||||
TYPE_SUCCESS = 2;
|
||||
}
|
||||
|
||||
int32 revision = 1;
|
||||
Type type = 2;
|
||||
|
||||
string order_id = 3;
|
||||
string customer_id = 4;
|
||||
|
||||
float amount = 5;
|
||||
|
||||
optional string transaction_id = 6;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Copyright (C) 2024 Declan Teevan
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package stocklet.events.v1;
|
||||
|
||||
option go_package = "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1;events_v1";
|
||||
|
||||
message ProductCreatedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string product_id = 2;
|
||||
string name = 3;
|
||||
string description = 4;
|
||||
float price = 5;
|
||||
}
|
||||
|
||||
message ProductPriceUpdatedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string product_id = 2;
|
||||
float price = 3;
|
||||
}
|
||||
|
||||
message ProductDeletedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string product_id = 2;
|
||||
}
|
||||
|
||||
message ProductPriceQuoteEvent {
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
TYPE_UNAVALIABLE = 1;
|
||||
TYPE_AVALIABLE = 2;
|
||||
}
|
||||
|
||||
int32 revision = 1;
|
||||
Type type = 2;
|
||||
|
||||
string order_id = 3;
|
||||
|
||||
// Product ID: Quantity
|
||||
map<string, int32> product_quantities = 4;
|
||||
|
||||
// Product ID: Unit Price
|
||||
map<string, float> product_prices = 5;
|
||||
|
||||
float total_price = 6;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (C) 2024 Declan Teevan
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package stocklet.events.v1;
|
||||
|
||||
option go_package = "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1;events_v1";
|
||||
|
||||
message ShipmentAllocationEvent {
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
TYPE_FAILED = 1;
|
||||
TYPE_ALLOCATED = 2;
|
||||
TYPE_ALLOCATION_RELEASED = 3;
|
||||
}
|
||||
|
||||
int32 revision = 1;
|
||||
Type type = 2;
|
||||
|
||||
message OrderMetadata {
|
||||
string customer_id = 1;
|
||||
float items_price = 2;
|
||||
float total_price = 3;
|
||||
}
|
||||
|
||||
string order_id = 3;
|
||||
OrderMetadata order_metadata = 4;
|
||||
|
||||
string shipment_id = 5; // provided with type enum value 2+
|
||||
map<string, int32> product_quantities = 6;
|
||||
}
|
||||
|
||||
message ShipmentDispatchedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string shipment_id = 2;
|
||||
string order_id = 3;
|
||||
map<string, int32> product_quantities = 4;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (C) 2024 Declan Teevan
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package stocklet.events.v1;
|
||||
|
||||
option go_package = "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1;events_v1";
|
||||
|
||||
message UserCreatedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string user_id = 2;
|
||||
string email = 3;
|
||||
string first_name = 4;
|
||||
string last_name = 5;
|
||||
}
|
||||
|
||||
message UserEmailUpdatedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string user_id = 2;
|
||||
string email = 3;
|
||||
}
|
||||
|
||||
message UserDeletedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string user_id = 2;
|
||||
string email = 3;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Copyright (C) 2024 Declan Teevan
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package stocklet.events.v1;
|
||||
|
||||
option go_package = "github.com/hexolan/stocklet/internal/pkg/protogen/events/v1;events_v1";
|
||||
|
||||
message StockCreatedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string product_id = 2;
|
||||
int32 quantity = 3;
|
||||
}
|
||||
|
||||
message StockAddedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string product_id = 2;
|
||||
int32 amount = 3;
|
||||
|
||||
// If the stock is returned as a result of a stock reservation outcome,
|
||||
// then the reservation id will be included for reference.
|
||||
optional string reservation_id = 4;
|
||||
}
|
||||
|
||||
message StockRemovedEvent {
|
||||
int32 revision = 1;
|
||||
|
||||
string product_id = 2;
|
||||
int32 amount = 3;
|
||||
|
||||
// If the stock is removed as a result of a stock reservation being closed,
|
||||
// then the reservation id will be included for reference.
|
||||
optional string reservation_id = 4;
|
||||
}
|
||||
|
||||
message StockReservationEvent {
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
TYPE_INSUFFICIENT_STOCK = 1;
|
||||
TYPE_STOCK_RESERVED = 2;
|
||||
TYPE_STOCK_RETURNED = 3;
|
||||
TYPE_STOCK_CONSUMED = 4;
|
||||
}
|
||||
|
||||
int32 revision = 1;
|
||||
Type type = 2;
|
||||
|
||||
message OrderMetadata {
|
||||
string customer_id = 1;
|
||||
float items_price = 2;
|
||||
float total_price = 3;
|
||||
}
|
||||
|
||||
string order_id = 3;
|
||||
OrderMetadata order_metadata = 4;
|
||||
|
||||
string reservation_id = 5; // provided with type enum value 2+
|
||||
map<string, int32> reservation_stock = 6; // Product ID: Quantity (provided with type enum value 2+)
|
||||
repeated string insufficient_stock = 7; // Product IDs (only provided with TYPE_INSUFFICIENT_STOCK)
|
||||
}
|
||||
Reference in New Issue
Block a user