u
This commit is contained in:
1 parent
d51eacb8ad
commit
44b3ef27d2
50 files changed
+3141
-9734
No files matched your search
@@ -6,50 +6,56 @@ option go_package = "auth";
|
||||
|
||||
import "api.proto";
|
||||
|
||||
// 登录请求
|
||||
message LoginDefaultReq {
|
||||
string Account = 1[(api.body)="account",(api.vd)="$!=''"];
|
||||
string Password = 2[(api.body)="password",(api.vd)="$!=''"];
|
||||
string Account = 1 [(api.body)="account", (api.vd)="$!=''"];
|
||||
string Password = 2 [(api.body)="password", (api.vd)="$!=''"];
|
||||
}
|
||||
|
||||
// 登录响应
|
||||
message LoginDefaultResp {
|
||||
string token = 1;
|
||||
string refreshToken = 2;
|
||||
int64 userId = 3;
|
||||
string username = 4;
|
||||
int32 seqNo = 5;
|
||||
int32 gender = 6;
|
||||
string Token = 1 [(api.body)="token"];
|
||||
string RefreshToken = 2 [(api.body)="refreshToken"];
|
||||
int64 UserId = 3 [(api.body)="userId"];
|
||||
string Username = 4 [(api.body)="username"];
|
||||
int32 SeqNo = 5 [(api.body)="seqNo"];
|
||||
int32 Gender = 6 [(api.body)="gender"];
|
||||
}
|
||||
|
||||
// 注册请求
|
||||
message RegisterDefaultReq {
|
||||
string Account = 1[(api.body)="account",(api.vd)="$!=''"];
|
||||
string Password = 2[(api.body)="password",(api.vd)="$!=''"];
|
||||
string Account = 1 [(api.body)="account", (api.vd)="$!=''"];
|
||||
string Password = 2 [(api.body)="password", (api.vd)="$!=''"];
|
||||
}
|
||||
|
||||
message RegisterDefaultResp {
|
||||
// 注册响应
|
||||
message RegisterDefaultResp {}
|
||||
|
||||
}
|
||||
|
||||
message RefreshAccessTokenReq {
|
||||
}
|
||||
// 刷新 access token 请求
|
||||
message RefreshAccessTokenReq {}
|
||||
|
||||
// 刷新 access token 响应
|
||||
message RefreshAccessTokenResp {
|
||||
string accessToken = 1;
|
||||
string AccessToken = 1 [(api.body)="accessToken"];
|
||||
}
|
||||
|
||||
// 登录服务
|
||||
service LoginService {
|
||||
rpc LoginDefault(LoginDefaultReq) returns(LoginDefaultResp) {
|
||||
option (api.post) = "/auth/login/default";
|
||||
}
|
||||
}
|
||||
|
||||
// 注册服务
|
||||
service RegisterService {
|
||||
rpc RegisterDefault(RegisterDefaultReq) returns(RegisterDefaultResp) {
|
||||
option (api.post) = "/auth/register/default";
|
||||
}
|
||||
}
|
||||
|
||||
// token 服务
|
||||
service TokenService {
|
||||
rpc RefreshAccessToken(RefreshAccessTokenReq) returns(RefreshAccessTokenResp) {
|
||||
option (api.post) = "/auth/refreshToken";
|
||||
option (api.get) = "/auth/refresh/token";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
import "api.proto";
|
||||
import "money/money_category_types.proto";
|
||||
import "money/money_record_types.proto";
|
||||
|
||||
service MoneyCategoryService {
|
||||
rpc QueryUserMoneyCategory(QueryMoneyCategoryReq) returns (QueryMoneyCategoryResp){
|
||||
option (api.get) = '/money/category';
|
||||
};
|
||||
rpc DeleteUserMoneyCategory(DeleteMoneyCategoryReq) returns (DeleteMoneyCategoryResp){
|
||||
option (api.post) = '/money/category/delete';
|
||||
};
|
||||
rpc UpdateMoneyCategorySort(UpdateMoneyCategorySortReq) returns (UpdateMoneyCategorySortResp){
|
||||
option (api.post) = '/money/category/updateSort';
|
||||
};
|
||||
}
|
||||
|
||||
service MoneyRecordService {
|
||||
rpc QueryMoneyRecord(QueryMoneyRecordsParams) returns (QueryMoneyRecordsResult){
|
||||
option (api.post) = '/money/record/query';
|
||||
}
|
||||
rpc InsertMoneyRecord(InsertMoneyRecordParams) returns (InsertMoneyRecordResult){
|
||||
option (api.post) = '/money/record/insert';
|
||||
}
|
||||
rpc UpdateMoneyRecord(UpdateMoneyRecordParams) returns (UpdateMoneyRecordResult){
|
||||
option (api.post) = '/money/record/update';
|
||||
}
|
||||
rpc DeleteMoneyRecord(DeleteMoneyRecordParams) returns (DeleteMoneyRecordResult){
|
||||
option (api.post) = '/money/record/delete';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "api.proto";
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
// 记账分类
|
||||
message MoneyCategory {
|
||||
int64 Id = 1 [(api.body)="id"];
|
||||
string Name = 2 [(api.body)="name"];
|
||||
string Icon = 3 [(api.body)="icon"];
|
||||
int32 Type = 4 [(api.body)="type"];
|
||||
int32 SortNumber = 5 [(api.body)="sort_number"];
|
||||
}
|
||||
|
||||
// 查询记账分类请求
|
||||
message QueryMoneyCategoryReq {}
|
||||
|
||||
// 查询记账分类响应
|
||||
message QueryMoneyCategoryResp {
|
||||
repeated MoneyCategory Categories = 1 [(api.body)="categories"];
|
||||
}
|
||||
|
||||
// 删除记账分类请求
|
||||
message DeleteMoneyCategoryReq {
|
||||
int64 Id = 1 [(api.body)="id", (api.vd)="$ != 0"];
|
||||
}
|
||||
|
||||
// 删除记账分类响应
|
||||
message DeleteMoneyCategoryResp {}
|
||||
|
||||
// 修改分类排序项
|
||||
message MoneyCategorySortItem {
|
||||
int64 Id = 1 [(api.body)="id"];
|
||||
int32 SortNumber = 2 [(api.body)="sort_number"];
|
||||
}
|
||||
|
||||
// 修改分类排序请求
|
||||
message UpdateMoneyCategorySortReq {
|
||||
repeated MoneyCategorySortItem Data = 1 [(api.body)="data"];
|
||||
}
|
||||
|
||||
// 修改分类排序响应
|
||||
message UpdateMoneyCategorySortResp {}
|
||||
@@ -0,0 +1,89 @@
|
||||
syntax = "proto3";
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
import "api.proto";
|
||||
|
||||
|
||||
// 单条记账记录
|
||||
message MoneyRecordItem {
|
||||
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"];
|
||||
}
|
||||
|
||||
// 同一天的记账记录分组
|
||||
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 {
|
||||
string RecordTime = 1 [(api.body)="record_time"];
|
||||
}
|
||||
|
||||
// 查询记账记录结果
|
||||
message QueryMoneyRecordsResult {
|
||||
repeated MoneyRecordGroup Records = 1 [(api.body)="records"];
|
||||
|
||||
string TotalIncome = 2 [(api.body)="total_income"];
|
||||
string TotalExpense = 3 [(api.body)="total_expense"];
|
||||
}
|
||||
|
||||
// 新增记账记录参数
|
||||
message InsertMoneyRecordParams {
|
||||
int64 CategoryId = 1 [(api.body)="category_id",(api.vd)="$!=''"];
|
||||
string Amount = 2 [
|
||||
(api.body)="amount",
|
||||
(api.vd)="$!='' && regexp('^\\d+(\\.\\d{1,2})?$', $)"
|
||||
];
|
||||
string Remark = 3 [(api.body)="remark"];
|
||||
string RecordTime = 4 [
|
||||
(api.body)="record_time",
|
||||
(api.vd)="$!='' && regexp('^\\d{4}-\\d{2}-\\d{2}$', $)"
|
||||
];
|
||||
}
|
||||
|
||||
// 新增记账记录结果
|
||||
message InsertMoneyRecordResult {
|
||||
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"];
|
||||
}
|
||||
|
||||
// 更新记账记录
|
||||
message UpdateMoneyRecordParams {
|
||||
int64 Id = 1 [(api.body)="id",(api.vd)="$!=0"];
|
||||
int64 CategoryId = 2 [(api.body)="category_id"];
|
||||
string Amount = 3 [(api.body)="amount"];
|
||||
string Remark = 4 [(api.body)="remark"];
|
||||
string RecordTime = 5 [(api.body)="record_time"];
|
||||
}
|
||||
|
||||
message UpdateMoneyRecordResult {
|
||||
|
||||
}
|
||||
|
||||
// 删除记账记录
|
||||
message DeleteMoneyRecordParams{
|
||||
int64 Id = 1 [(api.body)="id",(api.vd)="$!=0"];
|
||||
}
|
||||
message DeleteMoneyRecordResult {
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
import "api.proto";
|
||||
|
||||
|
||||
message QueryMoneyCategoryReq{}
|
||||
message MoneyCategory {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string icon = 3;
|
||||
int32 type = 4;
|
||||
int32 sort_number = 5;
|
||||
}
|
||||
|
||||
message QueryMoneyCategoryResp {
|
||||
repeated MoneyCategory categories = 1;
|
||||
}
|
||||
|
||||
message DeleteMoneyCategoryReq{
|
||||
int64 Id = 1[(api.body)="id",(api.vd)="$ != 0"];
|
||||
}
|
||||
|
||||
message DeleteMoneyCategoryResp {
|
||||
}
|
||||
|
||||
message MoneyCategorySortItem {
|
||||
int64 id = 1;
|
||||
int32 sort_number = 2;
|
||||
}
|
||||
|
||||
message UpdateMoneyCategorySortReq {
|
||||
repeated MoneyCategorySortItem data = 1;
|
||||
}
|
||||
|
||||
message UpdateMoneyCategorySortResp {}
|
||||
|
||||
service MoneyCategoryService {
|
||||
rpc QueryUserMoneyCategory(QueryMoneyCategoryReq) returns (QueryMoneyCategoryResp){
|
||||
option (api.get) = '/money/category';
|
||||
};
|
||||
rpc DeleteUserMoneyCategory(DeleteMoneyCategoryReq) returns (DeleteMoneyCategoryResp){
|
||||
option (api.post) = '/money/category/delete';
|
||||
};
|
||||
rpc UpdateMoneyCategorySort(UpdateMoneyCategorySortReq) returns (UpdateMoneyCategorySortResp){
|
||||
option (api.post) = '/money/category/updateSort';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
import "api.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
message MoneyRecordBase {
|
||||
int64 id = 1;
|
||||
int64 category_id = 2;
|
||||
int64 user_id = 3;
|
||||
string amount = 4;
|
||||
string remark = 5;
|
||||
google.protobuf.Timestamp record_time = 6;
|
||||
google.protobuf.Timestamp create_time = 7;
|
||||
google.protobuf.Timestamp update_time = 8;
|
||||
}
|
||||
|
||||
message MoneyRecordItem {
|
||||
MoneyRecordBase base = 1;
|
||||
|
||||
string category_name = 2;
|
||||
string category_icon = 3;
|
||||
int32 category_type = 4;
|
||||
}
|
||||
|
||||
message MoneyRecordGroup {
|
||||
string record_time = 1;
|
||||
|
||||
string expense = 2;
|
||||
string income = 3;
|
||||
|
||||
repeated MoneyRecordItem records = 4;
|
||||
}
|
||||
|
||||
message QueryMoneyRecordsParams {
|
||||
string record_time = 1;
|
||||
}
|
||||
message QueryMoneyRecordsResult {
|
||||
repeated MoneyRecordGroup records = 1;
|
||||
|
||||
string total_income = 2;
|
||||
string total_expense = 3;
|
||||
}
|
||||
|
||||
service MoneyRecordService {
|
||||
rpc QueryMoneyRecord(QueryMoneyRecordsParams) returns (QueryMoneyRecordsResult){
|
||||
option (api.post) = '/money/record';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user