File tree 2 files changed +25
-19
lines changed
2 files changed +25
-19
lines changed Original file line number Diff line number Diff line change @@ -4,30 +4,31 @@ import "google/protobuf/empty.proto";
4
4
5
5
package news ;
6
6
7
+ enum Status {
8
+ PUBLISHED = 0 ;
9
+ DRAFT = 1 ;
10
+ DELETED = 2 ;
11
+ }
12
+
7
13
message News {
8
- int32 id = 1 ;
9
- string title = 2 ;
10
- string body = 3 ;
11
- string postImage = 4 ;
14
+ int32 id = 1 ;
15
+ string title = 2 ;
16
+ string body = 3 ;
17
+ string postImage = 4 ;
18
+ Status status = 5 ;
12
19
}
13
20
14
21
service NewsService {
15
- rpc GetAllNews (google .protobuf .Empty ) returns (NewsList ) {}
16
- rpc GetNews (NewsId ) returns (News ) {}
17
- rpc GetMultipleNews (MultipleNewsId ) returns (NewsList ) {}
18
- rpc DeleteNews (NewsId ) returns (google .protobuf .Empty ) {}
19
- rpc EditNews (News ) returns (News ) {}
20
- rpc AddNews (News ) returns (News ) {}
22
+ rpc GetAllNews (google .protobuf .Empty ) returns (NewsList ) {}
23
+ rpc GetNews (NewsId ) returns (News ) {}
24
+ rpc GetMultipleNews (MultipleNewsId ) returns (NewsList ) {}
25
+ rpc DeleteNews (NewsId ) returns (google .protobuf .Empty ) {}
26
+ rpc EditNews (News ) returns (News ) {}
27
+ rpc AddNews (News ) returns (News ) {}
21
28
}
22
29
23
- message NewsId {
24
- int32 id = 1 ;
25
- }
30
+ message NewsId { int32 id = 1 ; }
26
31
27
- message MultipleNewsId {
28
- repeated NewsId ids = 1 ;
29
- }
32
+ message MultipleNewsId { repeated NewsId ids = 1 ; }
30
33
31
- message NewsList {
32
- repeated News news = 1 ;
33
- }
34
+ message NewsList { repeated News news = 1 ; }
Original file line number Diff line number Diff line change @@ -37,30 +37,35 @@ impl MyNewsService {
37
37
title: "Note 1" . into( ) ,
38
38
body: "Content 1" . into( ) ,
39
39
post_image: "Post image 1" . into( ) ,
40
+ status: 0 ,
40
41
} ,
41
42
News {
42
43
id: 2 ,
43
44
title: "Note 2" . into( ) ,
44
45
body: "Content 2" . into( ) ,
45
46
post_image: "Post image 2" . into( ) ,
47
+ status: 1 ,
46
48
} ,
47
49
News {
48
50
id: 3 ,
49
51
title: "Note 3" . into( ) ,
50
52
body: "Content 3" . into( ) ,
51
53
post_image: "Post image 3" . into( ) ,
54
+ status: 1 ,
52
55
} ,
53
56
News {
54
57
id: 4 ,
55
58
title: "Note 4" . into( ) ,
56
59
body: "Content 4" . into( ) ,
57
60
post_image: "Post image 4" . into( ) ,
61
+ status: 1 ,
58
62
} ,
59
63
News {
60
64
id: 5 ,
61
65
title: "Note 5" . into( ) ,
62
66
body: "Content 5" . into( ) ,
63
67
post_image: "Post image 5" . into( ) ,
68
+ status: 1 ,
64
69
} ,
65
70
] ;
66
71
MyNewsService {
You can’t perform that action at this time.
0 commit comments