Skip to content

Commit

Permalink
feat: cron
Browse files Browse the repository at this point in the history
  • Loading branch information
withchao committed Dec 20, 2024
1 parent 8db3abc commit 0198942
Show file tree
Hide file tree
Showing 12 changed files with 1,134 additions and 740 deletions.
7 changes: 7 additions & 0 deletions conversation/conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,10 @@ func (x *GetFullOwnerConversationIDsResp) Format() any {
}
return x
}

func (x *ClearUserConversationMsgReq) Check() error {
if x.Limit <= 0 {
return errors.New("limit is invalid")
}
return nil
}
573 changes: 346 additions & 227 deletions conversation/conversation.pb.go

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions conversation/conversation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ message GetPinnedConversationIDsResp {
repeated string conversationIDs = 1;
}

message ClearUserConversationMsgReq {
int64 timestamp = 1;
int32 limit = 2;
}
message ClearUserConversationMsgResp {
int32 count = 1;
}

service conversation {
rpc GetConversation(GetConversationReq) returns (GetConversationResp);
rpc GetSortedConversationList(GetSortedConversationListReq) returns (GetSortedConversationListResp);
Expand All @@ -320,4 +328,5 @@ service conversation {
rpc GetConversationsNeedClearMsg(GetConversationsNeedClearMsgReq) returns (GetConversationsNeedClearMsgResp);
rpc GetNotNotifyConversationIDs(GetNotNotifyConversationIDsReq) returns (GetNotNotifyConversationIDsResp);
rpc GetPinnedConversationIDs(GetPinnedConversationIDsReq) returns (GetPinnedConversationIDsResp);
rpc ClearUserConversationMsg(ClearUserConversationMsgReq) returns (ClearUserConversationMsgResp);
}
38 changes: 38 additions & 0 deletions conversation/conversation_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions msg/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package msg
import (
"errors"
"fmt"
"time"
)

func (x *GetMaxAndMinSeqReq) Check() error {
Expand Down Expand Up @@ -239,3 +240,13 @@ func (x *SeqsInfoResp) Format() any {
}
return x
}

func (x *DestructMsgsReq) Check() error {
if x.Timestamp > time.Now().UnixMilli() {
return errors.New("request millisecond timestamp error")
}
if x.Limit <= 0 {
return errors.New("request limit error")
}
return nil
}
Loading

0 comments on commit 0198942

Please sign in to comment.