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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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";
// 文档收藏
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 ];
}
// 取消收藏
message DeleteFavoriteRequest { repeated int64 id = 1; }
// 查询用户的收藏
message ListFavoriteRequest {
int64 page = 1;
int64 size = 2;
int64 user_id = 3;
}
// 查询用户的收藏
message ListFavoriteReply {
int64 total = 1;
repeated Favorite favorite = 2;
}
// 根据文章id查询用户是否有收藏某篇文档
message GetFavoriteRequest { int64 document_id = 1; }
service FavoriteAPI {
// 添加收藏
rpc CreateFavorite(Favorite) returns (Favorite) {
option (google.api.http) = {
post : '/api/v1/favorite',
body : '*',
};
}
// 取消收藏
rpc DeleteFavorite(DeleteFavoriteRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : '/api/v1/favorite',
};
}
// 根据文章id查询用户是否有收藏某篇文档
rpc GetFavorite(GetFavoriteRequest) returns (Favorite) {
option (google.api.http) = {
get : '/api/v1/favorite',
};
}
// 查询用户的收藏
rpc ListFavorite(ListFavoriteRequest) returns (ListFavoriteReply) {
option (google.api.http) = {
get : '/api/v1/favorite/list',
};
}
}