refactor(db): use int for attachment size and add lookup query
This commit is contained in:
@@ -143,7 +143,7 @@ func (s *ChatService) List(
|
||||
if cursor == nil {
|
||||
rows, err := s.q.ListChatsFirstPage(ctx, db.ListChatsFirstPageParams{
|
||||
UserID: userID,
|
||||
Lim: int32(limit + 1),
|
||||
Lim: limit + 1,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -168,7 +168,7 @@ func (s *ChatService) List(
|
||||
UserID: userID,
|
||||
AfterCreatedAt: decoded.CreatedAt,
|
||||
AfterID: decoded.ID,
|
||||
Lim: int32(limit + 1),
|
||||
Lim: limit + 1,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
||||
@@ -167,7 +167,7 @@ func (s *MessageService) Create(
|
||||
if err := q.CreateMessageAttachment(ctx, db.CreateMessageAttachmentParams{
|
||||
MessageID: id,
|
||||
AttachmentID: attachmentID,
|
||||
Position: int32(i),
|
||||
Position: i,
|
||||
}); err != nil {
|
||||
return model.Message{}, err
|
||||
}
|
||||
@@ -210,7 +210,7 @@ func (s *MessageService) List(
|
||||
if cursor == nil {
|
||||
rows, err = s.q.ListMessagesFirstPage(ctx, db.ListMessagesFirstPageParams{
|
||||
ChatID: chatID,
|
||||
Lim: int32(limit + 1),
|
||||
Lim: limit + 1,
|
||||
})
|
||||
} else {
|
||||
decoded, derr := decodeCursor(*cursor, chatID)
|
||||
@@ -222,7 +222,7 @@ func (s *MessageService) List(
|
||||
ChatID: chatID,
|
||||
AfterCreatedAt: decoded.CreatedAt,
|
||||
AfterID: decoded.ID,
|
||||
Lim: int32(limit + 1),
|
||||
Lim: limit + 1,
|
||||
})
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user