This commit is contained in:
oneao committed 2026-01-18 21:20:51 +08:00
1 parent 78c7a812be
commit 1934225c53
24 files changed
+711 -654

No files matched your search

@@ -7,6 +7,7 @@ option go_package = "money";
import "api.proto";
import "money/money_category_types.proto";
import "money/money_record_types.proto";
import "google/protobuf/empty.proto";
service MoneyCategoryService {
rpc List(ListMoneyCategoryReq) returns (ListMoneyCategoryResp){
@@ -21,6 +22,9 @@ service MoneyCategoryService {
rpc CreateMoneyCategory(CreateMoneyCategoryReq) returns (CreateMoneyCategoryResp){
option (api.post) = '/money/category/create';
};
rpc UpdateMoneyCategory(UpdateMoneyCategoryReq) returns (UpdateMoneyCategoryResp){
option (api.post) = '/money/category/update';
};
}
service MoneyRecordService {
@@ -60,3 +60,19 @@ message CreateMoneyCategoryReq {
message CreateMoneyCategoryResp {
int64 Id = 1 [(api.body)="id"];
}
message UpdateMoneyCategoryReq {
int64 Id = 1[
(api.body)="id"
];;
string Name = 2 [
(api.body)="name",
(api.vd) = "$ != ''"
];;
string Icon = 3 [
(api.body)="icon",
(api.vd) = "$ != ''"
];;
}
message UpdateMoneyCategoryResp {}
@@ -7,30 +7,18 @@ import "api.proto";
// 单条记账记录
message MoneyRecordItem {
message MoneyRecord {
int64 Id = 1 [(api.body)="id"];
int64 CategoryId = 2 [(api.body)="category_id"];
int64 UserId = 3 [(api.body)="user_id"];
string Amount = 4 [(api.body)="amount"];
string Remark = 5 [(api.body)="remark"];
string RecordTime = 6 [(api.body)="record_time"];
string CreateTime = 7 [(api.body)="create_time"];
string UpdateTime = 8 [(api.body)="update_time"];
int64 CreateTime = 7 [(api.body)="create_time"];
int64 UpdateTime = 8 [(api.body)="update_time"];
string Username = 9 [(api.body)="username"];
int32 CategoryType = 10 [(api.body)="category_type"];
string CategoryIcon = 11 [(api.body)="category_icon"];
string CategoryName = 12 [(api.body)="category_name"];
}
// 同一天的记账记录分组
message MoneyRecordGroup {
string RecordTime = 1 [(api.body)="record_time"];
string Expense = 2 [(api.body)="expense"];
string Income = 3 [(api.body)="income"];
repeated MoneyRecordItem Records = 4 [(api.body)="records"];
}
// 查询记账记录请求参数
message QueryMoneyRecordsParams {
@@ -39,11 +27,7 @@ message QueryMoneyRecordsParams {
// 查询记账记录结果
message QueryMoneyRecordsResult {
repeated MoneyRecordGroup Records = 1 [(api.body)="records"];
string TotalIncome = 2 [(api.body)="total_income"];
string TotalExpense = 3 [(api.body)="total_expense"];
string TotalBalance = 4 [(api.body)="total_balance"];
repeated MoneyRecord Records = 1 [(api.body)="records"];
}
// 新增记账记录参数