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.
113 lines
2.6 KiB
113 lines
2.6 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;
|
|
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 : '*',
|
|
};
|
|
}
|
|
} |