This commit is contained in:
2024-11-19 15:13:01 +07:00
parent 55ee2bccbc
commit be0ce71de6
5 changed files with 1003 additions and 33 deletions
+46 -1
View File
@@ -3,7 +3,6 @@ syntax = "proto3";
package crabs.smm_core;
import "google/api/annotations.proto";
import "google/api/httpbody.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "pkg/proto";
@@ -16,8 +15,54 @@ service SmmCore {
get: "/ping"
};
}
// categories
rpc AddCategory(CreateCategoryReq) returns (Category) {
option (google.api.http) = {
post: "/categories"
};
}
rpc UpdateCategory(UpdateCategoryReq) returns (Category) {
option (google.api.http) = {
put: "/categories/{id}"
};
}
rpc GetCategories(CategoryFilterReq) returns (Categories) {
option (google.api.http) = {
get: "/categories"
};
}
}
message PingReq {}
message PingRsp {}
message CreateCategoryReq {
string name = 1;
int32 user_id = 2;
bool favorite = 3;
int32 monthly_limit = 4;
}
message UpdateCategoryReq {
int32 id = 1;
string name = 2;
bool favorite = 3;
int32 monthly_limit = 4;
}
message Category {
int32 id = 1;
string name = 2;
bool favorite = 4;
int32 monthly_limit = 5;
}
message CategoryFilterReq {
bool favorite = 1;
}
message Categories {
repeated Category categories = 1;
}