forked from mtusi2026/mtusi2026lab3
refactor(app) agent refactoring + a little review
This commit is contained in:
@@ -118,6 +118,9 @@ func (s *Store) findIdempotentMessage(ctx context.Context, senderID, chatID uuid
|
||||
}
|
||||
|
||||
func (s *Store) ListMessages(ctx context.Context, userID, chatID uuid.UUID, limit int, cursor *common.CursorKeyCtx) (*common.Page[model.Message], error) {
|
||||
ctx, cancel := s.withTimeout(ctx)
|
||||
defer cancel()
|
||||
|
||||
isMember, err := s.IsMember(ctx, userID, chatID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -131,9 +134,6 @@ func (s *Store) ListMessages(ctx context.Context, userID, chatID uuid.UUID, limi
|
||||
return nil, common.BadRequest("bad cursor value")
|
||||
}
|
||||
|
||||
ctx, cancel := s.withTimeout(ctx)
|
||||
defer cancel()
|
||||
|
||||
cursorTime, cursorID := cursorValues(cursor)
|
||||
rows, err := s.pool.Query(ctx, `
|
||||
SELECT id, chat_id, sender_id, text, created_at
|
||||
|
||||
Reference in New Issue
Block a user