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.
122 lines
3.2 KiB
122 lines
3.2 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";
|
|
|
|
// 用户组,角色
|
|
message Group {
|
|
int64 id = 1; // 用户组ID
|
|
string title = 2; // 用户组名称
|
|
string color = 3; // 用户组颜色
|
|
bool is_default = 4; // 是否是默认用户组
|
|
bool is_display = 5; // 是否显示
|
|
string description = 6; // 用户组描述
|
|
int32 user_count = 7; // 用户组下的用户数量
|
|
int32 sort = 8; // 排序
|
|
bool enable_upload = 11; // 是否允许上传文档
|
|
bool enable_comment_approval = 12; // 是否需要审核评论
|
|
google.protobuf.Timestamp created_at = 9
|
|
[ (gogoproto.stdtime) = true ]; // 创建时间
|
|
google.protobuf.Timestamp updated_at = 10
|
|
[ (gogoproto.stdtime) = true ]; // 更新时间
|
|
}
|
|
|
|
// 删除用户组,可以批量删除
|
|
message DeleteGroupRequest { repeated int64 id = 1; }
|
|
|
|
// 根据组名或者ID获取用户组
|
|
message GetGroupRequest {
|
|
int64 id = 1;
|
|
string title = 2;
|
|
}
|
|
|
|
// 查询用户组列表。不需要分页,直接返回全部用户组,只是可以指定查询哪些字段
|
|
message ListGroupRequest {
|
|
string wd = 1;
|
|
int64 page = 2;
|
|
int64 size = 3;
|
|
string sort = 4;
|
|
repeated string field = 5;
|
|
}
|
|
|
|
// 用户组列表
|
|
message ListGroupReply {
|
|
repeated Group group = 1;
|
|
int64 total = 2;
|
|
}
|
|
|
|
// 获取用户组权限
|
|
message GetGroupPermissionRequest { int64 id = 1; }
|
|
|
|
// 更新用户组权限
|
|
message UpdateGroupPermissionRequest {
|
|
int64 group_id = 1;
|
|
repeated int64 permission_id = 2;
|
|
}
|
|
|
|
// 用户组权限
|
|
message GroupPermissions { repeated int64 permission_id = 1; }
|
|
|
|
service GroupAPI {
|
|
// 创建用户组
|
|
rpc CreateGroup(Group) returns (Group) {
|
|
option (google.api.http) = {
|
|
post : '/api/v1/group',
|
|
body : '*',
|
|
};
|
|
}
|
|
|
|
// 更新用户组
|
|
rpc UpdateGroup(Group) returns (google.protobuf.Empty) {
|
|
option (google.api.http) = {
|
|
put : '/api/v1/group',
|
|
body : '*',
|
|
};
|
|
}
|
|
|
|
// 删除用户组
|
|
rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) {
|
|
option (google.api.http) = {
|
|
delete : '/api/v1/group',
|
|
};
|
|
}
|
|
|
|
// 获取用户组
|
|
rpc GetGroup(GetGroupRequest) returns (Group) {
|
|
option (google.api.http) = {
|
|
get : '/api/v1/group',
|
|
};
|
|
}
|
|
|
|
// 获取用户组列表
|
|
rpc ListGroup(ListGroupRequest) returns (ListGroupReply) {
|
|
option (google.api.http) = {
|
|
get : '/api/v1/group/list',
|
|
};
|
|
}
|
|
|
|
// 获取用户组权限列表
|
|
rpc GetGroupPermission(GetGroupPermissionRequest) returns (GroupPermissions) {
|
|
option (google.api.http) = {
|
|
get : '/api/v1/group/permission',
|
|
};
|
|
}
|
|
|
|
// 更新用户组权限,给用户组设置权限
|
|
rpc UpdateGroupPermission(UpdateGroupPermissionRequest)
|
|
returns (google.protobuf.Empty) {
|
|
option (google.api.http) = {
|
|
put : '/api/v1/group/permission',
|
|
body : '*',
|
|
};
|
|
}
|
|
} |