85 lines
2.7 KiB
Protocol Buffer
85 lines
2.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
package cloud;
|
|
option go_package = "bsm/full/module/base/cloud/pb;cloud";
|
|
import "module/base/cloud/proto/const.proto";
|
|
|
|
// 笔记服务
|
|
service Note {
|
|
// 创建笔记
|
|
rpc CreateNote(CreateNoteRequest) returns (blocks.StatusReply);
|
|
// 获取笔记详情
|
|
rpc GetNote(blocks.IdentRequest) returns (CloudNoteItem);
|
|
// 更新笔记
|
|
rpc UpdateNote(CloudNoteItem) returns (blocks.StatusReply);
|
|
// 删除笔记
|
|
rpc DeleteNote(blocks.IdentRequest) returns (blocks.StatusReply);
|
|
// 获取笔记列表
|
|
rpc ListNotes(blocks.FetchRequest) returns (ListNotesResponse);
|
|
// 置顶/取消置顶笔记
|
|
rpc TogglePin(TogglePinRequest) returns (blocks.StatusReply);
|
|
// 增加浏览次数
|
|
rpc IncrementViews(blocks.IdentRequest) returns (blocks.StatusReply);
|
|
// 搜索笔记
|
|
rpc SearchNotes(blocks.FetchRequest) returns (ListNotesResponse);
|
|
|
|
// 上传附件
|
|
rpc InsertAttachment(NoteAttachmentItem) returns (blocks.StatusReply);
|
|
// 删除附件
|
|
rpc DeleteAttachment(blocks.IdentRequest) returns (blocks.StatusReply);
|
|
}
|
|
|
|
// 请求消息定义
|
|
message CreateNoteRequest {
|
|
uint64 cloud_id = 1;
|
|
string cloud_identity = 2;
|
|
string title = 3; // 标题
|
|
string content = 4; // 内容
|
|
string category = 5; // 分类
|
|
string tags = 6; // 标签,逗号分隔
|
|
bool is_markdown = 7; // 是否是markdown格式
|
|
bool is_pinned = 8; // 是否是置顶
|
|
bool is_private = 9; // 是否是私有
|
|
}
|
|
|
|
message ListNotesResponse {
|
|
repeated CloudNoteItem notes = 1;
|
|
int64 total = 2;
|
|
}
|
|
|
|
message TogglePinRequest {
|
|
uint64 id = 1;
|
|
bool is_pinned = 2;
|
|
}
|
|
|
|
|
|
// 知识笔记模型
|
|
message CloudNoteItem {
|
|
uint64 id = 1;
|
|
string identity = 2;
|
|
string title = 3; // 标题
|
|
string content = 4; // 内容
|
|
string category = 5; // 分类
|
|
string tags = 6; // 标签,逗号分隔
|
|
bool is_markdown = 7; // 是否是markdown格式
|
|
bool is_pinned = 8; // 是否是置顶
|
|
bool is_private = 9; // 是否是私有
|
|
int32 views = 10; // 浏览次数
|
|
string created_at = 11;
|
|
string updated_at = 12;
|
|
|
|
// 关联关系
|
|
repeated NoteAttachmentItem attachments = 13;
|
|
}
|
|
|
|
|
|
// 笔记附件模型
|
|
message NoteAttachmentItem {
|
|
uint64 id = 1;
|
|
uint64 note_id = 2; // 笔记ID
|
|
string file_name = 3; // 文件名
|
|
string file_path = 4; // 文件路径
|
|
int64 file_size = 5; // 文件大小
|
|
string mime_type = 6; // 文件类型
|
|
string created_at = 7; // 创建时间
|
|
}
|