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.
moredoc/api/v1/attachment.proto

93 lines
2.8 KiB

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 Attachment {
1 year ago
int64 id = 1; // 附件ID
string hash = 2; // 附件哈希值MD5
int64 user_id = 3; // 上传用户ID
int64 type_id = 4; // 附件类型ID如果是文档类型则为文档ID
1 year ago
int32 type = 5; // 附件类型,见 web/utils/enum.js
bool enable = 6; // 是否启用
string path = 7; // 附件路径
string name = 8; // 附件名称
int64 size = 9; // 附件大小,单位:字节
int64 width = 10; // 附件宽度,单位:像素。针对图片附件
int64 height = 11; // 附件高度,单位:像素。针对图片附件
string ext = 12; // 扩展名,如:.docx
string ip = 13; // 上传IP地址
string username = 16; // 用户名称
string type_name = 17; // 附件类型名称
string description = 18; // 附件描述、备注
1 year ago
google.protobuf.Timestamp created_at = 14
[ (gogoproto.stdtime) = true ]; // 创建时间
google.protobuf.Timestamp updated_at = 15
[ (gogoproto.stdtime) = true ]; // 更新时间
}
1 year ago
// 删除附件请求
message DeleteAttachmentRequest { repeated int64 id = 1; }
1 year ago
// 获取附件请求
message GetAttachmentRequest { int64 id = 1; }
1 year ago
// 列出附件请求
message ListAttachmentRequest {
1 year ago
int64 page = 1; // 页码
int64 size = 2; // 每页数量
string wd = 3; // 搜索关键字
repeated bool enable = 4; // 是否启用
repeated int64 user_id = 5; // 用户ID
repeated int64 type = 6; // 类型
1 year ago
string ext = 7; // 扩展名
}
1 year ago
// 列出附件响应
message ListAttachmentReply {
int64 total = 1;
repeated Attachment attachment = 2;
}
1 year ago
// 附件服务。只有管理员才有权限操作
service AttachmentAPI {
1 year ago
// 更新附件
rpc UpdateAttachment(Attachment) returns (google.protobuf.Empty) {
option (google.api.http) = {
put : '/api/v1/attachment',
body : '*',
};
}
1 year ago
// 删除附件。这里只是软删除不会真正删除附件默认24小时候会真正清除附件
rpc DeleteAttachment(DeleteAttachmentRequest)
returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : '/api/v1/attachment',
};
}
1 year ago
// 查询附件
rpc GetAttachment(GetAttachmentRequest) returns (Attachment) {
option (google.api.http) = {
get : '/api/v1/attachment',
};
}
1 year ago
// 列出附件
rpc ListAttachment(ListAttachmentRequest) returns (ListAttachmentReply) {
option (google.api.http) = {
get : '/api/v1/attachment/list',
};
}
}