init: init refactor
This commit is contained in:
@@ -0,0 +1,328 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package plant;
|
||||
|
||||
option go_package = "./plant";
|
||||
|
||||
// ========== 用户Profile ==========
|
||||
message UserProfile {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string nickName = 3;
|
||||
string avatarId = 4;
|
||||
string levelId = 5;
|
||||
int64 currentSunlight = 6;
|
||||
int64 totalSunlight = 7;
|
||||
int64 plantCount = 8;
|
||||
int64 careCount = 9;
|
||||
int64 postCount = 10;
|
||||
int64 waterCount = 11;
|
||||
int64 fertilizeCount = 12;
|
||||
int64 repotCount = 13;
|
||||
int64 pruneCount = 14;
|
||||
int64 photoCount = 15;
|
||||
}
|
||||
|
||||
message GetUserProfileReq { string userId = 1; }
|
||||
message GetUserProfileResp { UserProfile profile = 1; }
|
||||
message UpdateUserProfileReq {
|
||||
string userId = 1;
|
||||
string nickName = 2;
|
||||
string avatarId = 3;
|
||||
}
|
||||
message UpdateUserProfileResp {}
|
||||
message IncrUserCounterReq {
|
||||
string userId = 1;
|
||||
string field = 2; // care_count, water_count, etc.
|
||||
int64 delta = 3;
|
||||
}
|
||||
message IncrUserCounterResp {}
|
||||
|
||||
// ========== 我的植物 ==========
|
||||
message PlantInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string name = 3;
|
||||
string plantTime = 4;
|
||||
int32 status = 5;
|
||||
string placement = 6;
|
||||
string potMaterial = 7;
|
||||
string potSize = 8;
|
||||
string sunlight = 9;
|
||||
string plantingMaterial = 10;
|
||||
repeated string imgIds = 11;
|
||||
int64 createdAt = 12;
|
||||
}
|
||||
|
||||
message CreatePlantReq {
|
||||
string userId = 1;
|
||||
string name = 2;
|
||||
string plantTime = 3;
|
||||
string placement = 4;
|
||||
string potMaterial = 5;
|
||||
string potSize = 6;
|
||||
string sunlight = 7;
|
||||
string plantingMaterial = 8;
|
||||
repeated string imgIds = 9;
|
||||
}
|
||||
message CreatePlantResp { string id = 1; }
|
||||
|
||||
message UpdatePlantReq {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
int32 status = 3;
|
||||
string placement = 4;
|
||||
string potMaterial = 5;
|
||||
string potSize = 6;
|
||||
string sunlight = 7;
|
||||
string plantingMaterial = 8;
|
||||
}
|
||||
message UpdatePlantResp {}
|
||||
|
||||
message DeletePlantReq { repeated string ids = 1; }
|
||||
message DeletePlantResp {}
|
||||
|
||||
message GetPlantListReq {
|
||||
string userId = 1;
|
||||
int32 current = 2;
|
||||
int32 pageSize = 3;
|
||||
string name = 4;
|
||||
}
|
||||
message GetPlantListResp {
|
||||
repeated PlantInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetPlantDetailReq { string id = 1; }
|
||||
message GetPlantDetailResp { PlantInfo plant = 1; }
|
||||
|
||||
// ========== 养护 ==========
|
||||
message CarePlanInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string plantId = 3;
|
||||
string name = 4;
|
||||
string icon = 5;
|
||||
string targetAction = 6;
|
||||
int32 period = 7;
|
||||
}
|
||||
|
||||
message AddCarePlanReq {
|
||||
string userId = 1;
|
||||
string plantId = 2;
|
||||
string name = 3;
|
||||
string icon = 4;
|
||||
string targetAction = 5;
|
||||
int32 period = 6;
|
||||
}
|
||||
message AddCarePlanResp { string id = 1; }
|
||||
|
||||
message AddCareRecordReq {
|
||||
string userId = 1;
|
||||
string plantId = 2;
|
||||
string planId = 3;
|
||||
string action = 4;
|
||||
string note = 5;
|
||||
}
|
||||
message AddCareRecordResp {}
|
||||
|
||||
message AddGrowthRecordReq {
|
||||
string userId = 1;
|
||||
string plantId = 2;
|
||||
string content = 3;
|
||||
repeated string imgIds = 4;
|
||||
}
|
||||
message AddGrowthRecordResp {}
|
||||
|
||||
// ========== 百科 ==========
|
||||
message WikiInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string latinName = 3;
|
||||
string aliases = 4;
|
||||
string genus = 5;
|
||||
int32 difficulty = 6;
|
||||
int32 isHot = 7;
|
||||
int64 createdAt = 8;
|
||||
}
|
||||
|
||||
message GetWikiListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string name = 3;
|
||||
string classId = 4;
|
||||
int32 isHot = 5;
|
||||
}
|
||||
message GetWikiListResp {
|
||||
repeated WikiInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetWikiDetailReq { string id = 1; }
|
||||
message GetWikiDetailResp { WikiInfo wiki = 1; }
|
||||
|
||||
message WikiClassInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string ossId = 3;
|
||||
}
|
||||
message GetWikiClassListResp { repeated WikiClassInfo list = 1; }
|
||||
message CreateWikiClassReq { string name = 1; string ossId = 2; }
|
||||
message CreateWikiClassResp { string id = 1; }
|
||||
|
||||
message ToggleStarReq {
|
||||
string userId = 1;
|
||||
string targetId = 2;
|
||||
string type = 3;
|
||||
}
|
||||
message ToggleStarResp { bool starred = 1; }
|
||||
|
||||
// ========== 社区 ==========
|
||||
message PostInfo {
|
||||
string id = 1;
|
||||
string userId = 2;
|
||||
string title = 3;
|
||||
string content = 4;
|
||||
int32 viewCount = 5;
|
||||
int32 commentCount = 6;
|
||||
int32 likeCount = 7;
|
||||
int32 starCount = 8;
|
||||
string location = 9;
|
||||
int64 createdAt = 10;
|
||||
}
|
||||
|
||||
message CreatePostReq {
|
||||
string userId = 1;
|
||||
string title = 2;
|
||||
string content = 3;
|
||||
string location = 4;
|
||||
repeated string imgIds = 5;
|
||||
string topicId = 6;
|
||||
}
|
||||
message CreatePostResp { string id = 1; }
|
||||
|
||||
message GetPostListReq {
|
||||
int32 current = 1;
|
||||
int32 pageSize = 2;
|
||||
string keyword = 3;
|
||||
string topicId = 4;
|
||||
}
|
||||
message GetPostListResp {
|
||||
repeated PostInfo list = 1;
|
||||
int64 total = 2;
|
||||
}
|
||||
|
||||
message GetPostDetailReq { string id = 1; }
|
||||
message GetPostDetailResp { PostInfo post = 1; }
|
||||
|
||||
message DeletePostReq { repeated string ids = 1; }
|
||||
message DeletePostResp {}
|
||||
|
||||
message CommentPostReq {
|
||||
string userId = 1;
|
||||
string postId = 2;
|
||||
string content = 3;
|
||||
string parentId = 4;
|
||||
}
|
||||
message CommentPostResp {}
|
||||
|
||||
message LikePostReq {
|
||||
string userId = 1;
|
||||
string postId = 2;
|
||||
}
|
||||
message LikePostResp { bool liked = 1; }
|
||||
|
||||
// ========== 话题 ==========
|
||||
message TopicInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
int32 postCount = 3;
|
||||
}
|
||||
message GetTopicListResp { repeated TopicInfo list = 1; }
|
||||
message CreateTopicReq { string name = 1; }
|
||||
message CreateTopicResp { string id = 1; }
|
||||
message DeleteTopicReq { repeated string ids = 1; }
|
||||
message DeleteTopicResp {}
|
||||
|
||||
// ========== 配置 ==========
|
||||
message LevelConfigInfo {
|
||||
string id = 1;
|
||||
int32 level = 2;
|
||||
string title = 3;
|
||||
int64 minSunlight = 4;
|
||||
string perks = 5;
|
||||
}
|
||||
message GetLevelConfigListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetLevelConfigListResp { repeated LevelConfigInfo list = 1; int64 total = 2; }
|
||||
|
||||
message BadgeConfigInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
string dimension = 4;
|
||||
string groupId = 5;
|
||||
int32 tier = 6;
|
||||
string targetAction = 7;
|
||||
int64 threshold = 8;
|
||||
int64 rewardSunlight = 9;
|
||||
}
|
||||
message GetBadgeConfigListReq { int32 current = 1; int32 pageSize = 2; string dimension = 3; }
|
||||
message GetBadgeConfigListResp { repeated BadgeConfigInfo list = 1; int64 total = 2; }
|
||||
|
||||
// ========== 兑换 ==========
|
||||
message ExchangeItemInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string desc = 3;
|
||||
int64 cost = 4;
|
||||
int32 stock = 5;
|
||||
}
|
||||
message GetExchangeItemListReq { int32 current = 1; int32 pageSize = 2; }
|
||||
message GetExchangeItemListResp { repeated ExchangeItemInfo list = 1; int64 total = 2; }
|
||||
|
||||
message CreateExchangeOrderReq { string userId = 1; string itemId = 2; }
|
||||
message CreateExchangeOrderResp { string id = 1; }
|
||||
|
||||
// ========== 通用 ==========
|
||||
message Empty {}
|
||||
|
||||
// ========== 服务定义 ==========
|
||||
service PlantService {
|
||||
// 用户Profile
|
||||
rpc GetUserProfile(GetUserProfileReq) returns (GetUserProfileResp);
|
||||
rpc UpdateUserProfile(UpdateUserProfileReq) returns (UpdateUserProfileResp);
|
||||
rpc IncrUserCounter(IncrUserCounterReq) returns (IncrUserCounterResp);
|
||||
// 植物
|
||||
rpc CreatePlant(CreatePlantReq) returns (CreatePlantResp);
|
||||
rpc UpdatePlant(UpdatePlantReq) returns (UpdatePlantResp);
|
||||
rpc DeletePlant(DeletePlantReq) returns (DeletePlantResp);
|
||||
rpc GetPlantList(GetPlantListReq) returns (GetPlantListResp);
|
||||
rpc GetPlantDetail(GetPlantDetailReq) returns (GetPlantDetailResp);
|
||||
// 养护
|
||||
rpc AddCarePlan(AddCarePlanReq) returns (AddCarePlanResp);
|
||||
rpc AddCareRecord(AddCareRecordReq) returns (AddCareRecordResp);
|
||||
rpc AddGrowthRecord(AddGrowthRecordReq) returns (AddGrowthRecordResp);
|
||||
// 百科
|
||||
rpc GetWikiList(GetWikiListReq) returns (GetWikiListResp);
|
||||
rpc GetWikiDetail(GetWikiDetailReq) returns (GetWikiDetailResp);
|
||||
rpc GetWikiClassList(Empty) returns (GetWikiClassListResp);
|
||||
rpc CreateWikiClass(CreateWikiClassReq) returns (CreateWikiClassResp);
|
||||
rpc ToggleStar(ToggleStarReq) returns (ToggleStarResp);
|
||||
// 社区
|
||||
rpc CreatePost(CreatePostReq) returns (CreatePostResp);
|
||||
rpc GetPostList(GetPostListReq) returns (GetPostListResp);
|
||||
rpc GetPostDetail(GetPostDetailReq) returns (GetPostDetailResp);
|
||||
rpc DeletePost(DeletePostReq) returns (DeletePostResp);
|
||||
rpc CommentPost(CommentPostReq) returns (CommentPostResp);
|
||||
rpc LikePost(LikePostReq) returns (LikePostResp);
|
||||
// 话题
|
||||
rpc GetTopicList(Empty) returns (GetTopicListResp);
|
||||
rpc CreateTopic(CreateTopicReq) returns (CreateTopicResp);
|
||||
rpc DeleteTopic(DeleteTopicReq) returns (DeleteTopicResp);
|
||||
// 配置
|
||||
rpc GetLevelConfigList(GetLevelConfigListReq) returns (GetLevelConfigListResp);
|
||||
rpc GetBadgeConfigList(GetBadgeConfigListReq) returns (GetBadgeConfigListResp);
|
||||
// 兑换
|
||||
rpc GetExchangeItemList(GetExchangeItemListReq) returns (GetExchangeItemListResp);
|
||||
rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CreateExchangeOrderResp);
|
||||
}
|
||||
Reference in New Issue
Block a user