You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.8 KiB

1 year ago
syntax = "proto3";
import "google/protobuf/timestamp.proto";
import "gogoproto/gogo.proto";
// import "validate/validate.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
package api.v1;
option go_package = "moredoc/api/v1;v1";
option java_multiple_files = true;
option java_package = "api.v1";
1 year ago
// 文档收藏
message Favorite {
int64 id = 1;
int64 user_id = 2;
int64 document_id = 3;
string title = 6;
string ext = 7;
int32 score = 8;
int64 size = 9;
int32 pages = 10;
google.protobuf.Timestamp created_at = 4 [ (gogoproto.stdtime) = true ];
google.protobuf.Timestamp updated_at = 5 [ (gogoproto.stdtime) = true ];
}
1 year ago
// 取消收藏
message DeleteFavoriteRequest { repeated int64 id = 1; }
1 year ago
// 查询用户的收藏
message ListFavoriteRequest {
1 year ago
int64 page = 1;
int64 size = 2;
int64 user_id = 3;
}
1 year ago
// 查询用户的收藏
message ListFavoriteReply {
1 year ago
int64 total = 1;
repeated Favorite favorite = 2;
}
1 year ago
// 根据文章id查询用户是否有收藏某篇文档
message GetFavoriteRequest { int64 document_id = 1; }
1 year ago
service FavoriteAPI {
// 添加收藏
rpc CreateFavorite(Favorite) returns (Favorite) {
option (google.api.http) = {
post : '/api/v1/favorite',
body : '*',
};
}
1 year ago
// 取消收藏
rpc DeleteFavorite(DeleteFavoriteRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : '/api/v1/favorite',
};
}
1 year ago
// 根据文章id查询用户是否有收藏某篇文档
rpc GetFavorite(GetFavoriteRequest) returns (Favorite) {
option (google.api.http) = {
get : '/api/v1/favorite',
};
}
1 year ago
// 查询用户的收藏
rpc ListFavorite(ListFavoriteRequest) returns (ListFavoriteReply) {
option (google.api.http) = {
get : '/api/v1/favorite/list',
};
}
}