Skip to content

Commit

Permalink
fix(protos): add setting resource, enrich templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Nov 6, 2024
1 parent 19a14f9 commit 63fe572
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 55 deletions.
18 changes: 18 additions & 0 deletions packages/protos/io/restorecommerce/customer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ message Commercial {
field_name: "organization",
}
];
repeated string template_ids = 2 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.template.Template",
target_service: "master_data",
target_sub_service: "template",
target_method: "Read",
field_name: "templates",
}
]; // list of active templates
}

message PublicSector {
Expand All @@ -104,4 +113,13 @@ message PublicSector {
field_name: "organization",
}
];
repeated string template_ids = 2 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.template.Template",
target_service: "master_data",
target_sub_service: "template",
target_method: "Read",
field_name: "templates",
}
]; // list of active templates
}
4 changes: 0 additions & 4 deletions packages/protos/io/restorecommerce/file.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ message File {
message FileList {
repeated File items = 1;
optional uint32 total_count = 2;
}

message Deleted {
optional string id = 1;
}
4 changes: 0 additions & 4 deletions packages/protos/io/restorecommerce/fulfillment.proto
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,6 @@ message FulfillmentIdList {
optional io.restorecommerce.auth.Subject subject = 3;
}

message Deleted {
optional string id = 1;
}

message FulfillmentInvoiceSection {
optional string fulfillment_id = 1;
repeated string selected_parcels = 2; // selects all on empty
Expand Down
7 changes: 2 additions & 5 deletions packages/protos/io/restorecommerce/fulfillment_courier.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ message FulfillmentCourier {
optional string description = 5;
optional string logo = 6;
optional string website = 7;
optional string stub_type = 8;
optional string stub_type = 8; // obsolete, use api
optional string credential_id = 9;
optional google.protobuf.Any configuration = 10;
optional string api = 11;
}

message FulfillmentCourierList {
Expand All @@ -72,7 +73,3 @@ message FulfillmentCourierListResponse {
optional io.restorecommerce.status.OperationStatus operation_status = 3;
}

message Deleted {
optional string id = 1;
}

9 changes: 3 additions & 6 deletions packages/protos/io/restorecommerce/fulfillment_product.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ service FulfillmentProductService {

message Preferences {
optional bool partial_fulfillment_allowed = 1;
repeated string courier_ids = 2; // leave empty for open search
repeated io.restorecommerce.attribute.Attribute options = 3; // Courier specific options such as C02 neutral delivery etc.
repeated string courier_ids = 2; // Narrows search to certain couriers, leave empty for open search
repeated string fulfillment_product_ids = 3; // Narrows search to certain tariffs, leave empty for open search
repeated io.restorecommerce.attribute.Attribute options = 3; // Courier specific options such as CO2 neutral delivery etc.
}

message FulfillmentSolutionQuery {
Expand Down Expand Up @@ -144,7 +145,3 @@ message FulfillmentSolutionListResponse {
optional uint32 total_count = 2;
optional io.restorecommerce.status.OperationStatus operation_status = 3;
}

message Deleted {
optional string id = 1;
}
46 changes: 46 additions & 0 deletions packages/protos/io/restorecommerce/setting.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
syntax = "proto3";

package io.restorecommerce.setting;

import "io/restorecommerce/meta.proto";
import "io/restorecommerce/attribute.proto";
import "io/restorecommerce/resource_base.proto";
import "io/restorecommerce/auth.proto";
import "io/restorecommerce/status.proto";
import "io/restorecommerce/attribute.proto";
import "io/restorecommerce/options.proto";

service SettingService {
rpc Read (io.restorecommerce.resourcebase.ReadRequest) returns (SettingListResponse) {
option (io.restorecommerce.options.is_query) = true;
};
rpc Create (SettingList) returns (SettingListResponse);
rpc Delete (io.restorecommerce.resourcebase.DeleteRequest) returns (io.restorecommerce.resourcebase.DeleteResponse);
rpc Update (SettingList) returns (SettingListResponse);
rpc Upsert (SettingList) returns (SettingListResponse);
}

message Setting {
optional string id = 1;
optional io.restorecommerce.meta.Meta meta = 2;
optional string name = 3;
optional string description = 4;
repeated io.restorecommerce.attribute.Attribute settings = 5;
}

message SettingList {
repeated Setting items = 1;
optional uint32 total_count = 2;
optional io.restorecommerce.auth.Subject subject = 3;
}

message SettingListResponse {
repeated SettingResponse items = 1;
optional uint32 total_count = 2;
optional io.restorecommerce.status.OperationStatus operation_status = 3;
}

message SettingResponse {
optional Setting payload = 1;
optional io.restorecommerce.status.Status status = 3;
}
53 changes: 22 additions & 31 deletions packages/protos/io/restorecommerce/shop.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "io/restorecommerce/meta.proto";
import "io/restorecommerce/auth.proto";
import "io/restorecommerce/attribute.proto";
import "io/restorecommerce/status.proto";
import "io/restorecommerce/setting.proto";
import "io/restorecommerce/options.proto";

// Used by resolvers
Expand Down Expand Up @@ -44,36 +45,6 @@ message ShopResponse {
optional io.restorecommerce.status.Status status = 2;
}

message ShopSettings {
message InvoiceNumber {
optional uint32 start = 1;
optional uint32 increment = 2;
optional string pattern = 3;
}
message Source {
oneof source {
string id = 1;
string url = 2;
string plain_text = 3;
}
}
message Template {
optional uint32 index = 2;
optional string subject = 3;
optional Source body = 4;
optional Source layout = 5;
}
message TemplateGroup {
optional io.restorecommerce.template.TemplateUseCase use_case = 1;
repeated Template templates = 2;
}

optional InvoiceNumber invoice_number = 1;
repeated Template templates = 2;

repeated io.restorecommerce.attribute.Attribute miscellaneous = 8;
}

message Shop {
optional string id = 1;
optional io.restorecommerce.meta.Meta meta = 2;
Expand All @@ -90,5 +61,25 @@ message Shop {
field_name: "organization",
}
];

repeated string template_ids = 8 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.template.Template",
target_service: "master_data",
target_sub_service: "template",
target_method: "Read",
field_name: "templates",
}
]; // list of active templates
oneof setting_type {
string setting_id = 9 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.setting.Setting",
target_service: "master_data",
target_sub_service: "setting",
target_method: "Read",
field_name: "setting",
}
];
io.restorecommerce.setting.Setting setting = 10;
};
}
16 changes: 11 additions & 5 deletions packages/protos/io/restorecommerce/template.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "io/restorecommerce/file.proto";
import "io/restorecommerce/meta.proto";
import "io/restorecommerce/auth.proto";
import "io/restorecommerce/status.proto";
import "io/restorecommerce/reference.proto";
import "io/restorecommerce/options.proto";

/*
Expand Down Expand Up @@ -55,16 +54,23 @@ message TemplateResponse {
optional io.restorecommerce.status.Status status = 2;
}

message Localization {
repeated string local_codes = 1; // e.g. en, en_US, en_UK, ...
optional io.restorecommerce.file.File l10n = 2; // JSON expected
}

message Template {
optional string id = 1;
optional io.restorecommerce.meta.Meta meta = 2;
optional string name = 3;
optional string description = 4;
optional TemplateUseCase use_case = 5;
optional uint32 index = 6; // order number
optional uint32 indice = 6; // sort number
optional string subject = 7; // e.g. header, body, footer
optional io.restorecommerce.file.File body = 8;
optional io.restorecommerce.file.File body = 8; // e.g. text/html
optional io.restorecommerce.file.File layout = 9;
repeated io.restorecommerce.image.Image images = 10;
repeated io.restorecommerce.attribute.Attribute attributes = 11;
repeated io.restorecommerce.file.File styles = 10; // e.g. application/css
repeated io.restorecommerce.image.Image images = 11;
repeated Localization localization = 12;
repeated io.restorecommerce.attribute.Attribute attributes = 14;
}

0 comments on commit 63fe572

Please sign in to comment.