Skip to content

Commit

Permalink
feat: 通知
Browse files Browse the repository at this point in the history
  • Loading branch information
Cbgogogog committed Dec 20, 2023
1 parent 552491f commit 6fbbcd9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 13 deletions.
4 changes: 4 additions & 0 deletions meowchat/core_api/core_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ service system {
rpc ReadNotification(ReadNotificationReq) returns (ReadNotificationResp) {
option(http.get) = "/notification/read_notification";
}
rpc ReadRangeNotification(ReadRangeNotificationReq) returns (ReadRangeNotificationResp) {
option(http.get) = "/notification/read_range_notification";
}


rpc Prefetch(PrefetchReq) returns (PrefetchResp) {
option(http.get) = "/prefetch";
Expand Down
22 changes: 17 additions & 5 deletions meowchat/core_api/system.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ message Notification {
string notificationId = 1;
user.UserPreview user = 2;
string SourceContentId = 3;
system.NotificationType types = 4;
string text = 5;
int64 createAt = 6;
bool isRead = 7;
system.NotificationTargetType targetType = 4;
system.NotificationType type = 5;
string text = 6;
int64 createAt = 7;
bool isRead = 8;
}

message GetNewsReq {
Expand Down Expand Up @@ -249,13 +250,24 @@ message GetUserByRoleResp {
}

message ListNotificationReq {
optional basic.PaginationOptions paginationOption = 3;
optional system.NotificationType type = 1;
optional basic.PaginationOptions paginationOption = 2;
}

message ListNotificationResp {
repeated Notification notifications = 1;
int64 NotRead = 2;
int64 total = 3;
string token = 4;
}

message ReadRangeNotificationReq {
optional system.NotificationType type = 1;
optional basic.PaginationOptions paginationOption = 2;
}

message ReadRangeNotificationResp {
int64 NotRead = 1;
}

message ReadNotificationReq {
Expand Down
24 changes: 16 additions & 8 deletions meowchat/system/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ message Notification {
string TargetUserId = 2;
string SourceUserId = 3;
string SourceContentId = 4;
NotificationType type = 5;
string text = 6;
int64 createAt = 7;
bool isRead = 8;
NotificationTargetType targetType = 5;
NotificationType type = 6;
string text = 7;
int64 createAt = 8;
bool isRead = 9;
}

enum RoleType {
Expand All @@ -77,10 +78,17 @@ enum ApplyStatus {
StatusRejected = 3;
}

enum NotificationTargetType {
TargetTypeOther = 0;
TargetTypePost = 1;
TargetTypeMoment = 2;
TargetTypeComment = 3;
TargetTypeUser = 4;
}

enum NotificationType {
TypeOther = 0;
TypePost = 1;
TypeMoment = 2;
TypeComment = 3;
TypeUser = 4;
TypeFollowed = 1;
TypeLiked = 2;
TypeCommented = 3;
}
14 changes: 14 additions & 0 deletions meowchat/system/system.proto
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,28 @@ message ListUserIdByRoleResp {

message ListNotificationReq {
string userId = 1;
NotificationType type = 2;
optional basic.PaginationOptions paginationOptions = 3;
}

message ListNotificationResp {
repeated Notification notifications = 1;
int64 notRead = 2;
int64 total = 3;
string token = 4;
}

message ReadRangeNotificationReq {
string userId = 1;
NotificationType type = 2;
optional basic.PaginationOptions paginationOptions = 3;
}

message ReadRangeNotificationResp {
int64 notRead = 1;
}


message AddNotificationReq {
Notification notification = 1;
}
Expand Down Expand Up @@ -376,4 +389,5 @@ service system_rpc {
rpc CountNotification(CountNotificationReq) returns (CountNotificationResp);
rpc ReadNotification(ReadNotificationReq) returns (ReadNotificationResp);
rpc AddNotification(AddNotificationReq) returns (AddNotificationResp);
rpc ReadRangeNotification(ReadRangeNotificationReq) returns (ReadRangeNotificationResp);
}

0 comments on commit 6fbbcd9

Please sign in to comment.