-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb-service.proto
More file actions
142 lines (113 loc) · 3.23 KB
/
Copy pathdb-service.proto
File metadata and controls
142 lines (113 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
syntax = "proto3";
package db;
option go_package = "gen/db-service/pb;pb";
import "google/protobuf/empty.proto";
import "models.proto";
service DBService {
// community crud operations
rpc ListCommunities (ListCommunitiesRequest) returns (ListCommunitiesResponse);
rpc CreateCommunity (CreateCommunityRequest) returns (CreateCommunityResponse);
rpc GetCommunity (GetCommunityRequest) returns (models.Community);
rpc UpdateCommunity (UpdateCommunityRequest) returns (google.protobuf.Empty);
rpc DeleteCommunity (DeleteCommunityRequest) returns (google.protobuf.Empty);
// thread crud operations
rpc ListThreads (ListThreadsRequest) returns (ListThreadsResponse);
rpc CreateThread (CreateThreadRequest) returns (CreateThreadResponse);
rpc GetThread (GetThreadRequest) returns (models.Thread);
rpc UpdateThread (UpdateThreadRequest) returns (google.protobuf.Empty);
rpc DeleteThread (DeleteThreadRequest) returns (google.protobuf.Empty);
// comment crud operations
rpc ListComments(ListCommentsRequest) returns (ListCommentsResponse);
rpc CreateComment(CreateCommentRequest) returns (CreateCommentResponse);
rpc GetComment(GetCommentRequest) returns (models.Comment);
rpc UpdateComment(UpdateCommentRequest) returns (google.protobuf.Empty);
rpc DeleteComment(DeleteCommentRequest) returns (google.protobuf.Empty);
}
message ListCommunitiesRequest {
optional string name = 1;
optional int32 offset = 2;
optional int32 limit = 3;
}
message ListCommunitiesResponse {
repeated models.Community communities = 1;
}
message CreateCommunityRequest {
string name = 2;
}
message CreateCommunityResponse {
string id = 1;
}
message GetCommunityRequest {
string id = 1;
}
message UpdateCommunityRequest {
string id = 1;
optional string name = 2;
optional int32 num_threads_offset = 3;
}
message DeleteCommunityRequest {
string id = 1;
}
message ListThreadsRequest {
optional string community_id = 1;
optional string title = 2;
optional int32 offset = 3;
optional int32 limit = 4;
optional string sort_by = 5;
}
message ListThreadsResponse {
repeated models.Thread threads = 1;
}
message CreateThreadRequest {
string community_id = 1;
string title = 2;
string content = 3;
}
message CreateThreadResponse {
string id = 1;
}
message GetThreadRequest {
string id = 1;
}
message UpdateThreadRequest {
string id = 1;
optional string title = 2;
optional string content = 3;
optional int32 vote_offset = 4;
optional int32 num_comments_offset = 5;
}
message DeleteThreadRequest {
string id = 1;
}
message ListCommentsRequest {
optional string thread_id = 1;
optional int32 offset = 2;
optional int32 limit = 3;
optional string sort_by = 4;
}
message ListCommentsResponse {
repeated models.Comment comments = 1;
}
message CreateCommentRequest {
string content = 1;
string parent_id = 2;
models.CommentParentType parent_type = 3;
}
message CreateCommentResponse {
string id = 1;
}
message GetCommentRequest {
string id = 1;
}
message GetCommentResponse {
models.Comment comment = 1;
}
message UpdateCommentRequest {
string id = 1;
optional string content = 2;
optional int32 vote_offset = 3;
optional int32 num_comments_offset = 4;
}
message DeleteCommentRequest {
string id = 1;
}