We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3901343 commit ec00381Copy full SHA for ec00381
1 file changed
internal/handler/rest/chat/list_chat.go
@@ -79,7 +79,8 @@ func (h *ListChatHandler) Handle(c *fiber.Ctx) error {
79
query := h.deps.DB.NewSelect().
80
Model((*domain.Chat)(nil)).
81
Relation("Summary").
82
- Where("c.user_id = ?", userID)
+ Where("c.user_id = ?", userID).
83
+ Order("c.created_at DESC")
84
85
if datetimeGte != "" {
86
localStartTime, err := time.Parse(time.RFC3339, datetimeGte)
@@ -148,6 +149,7 @@ func (h *ListChatHandler) Handle(c *fiber.Ctx) error {
148
149
err := h.deps.DB.NewSelect().
150
Model((*domain.History)(nil)).
151
Where("chat_id = ?", chat.ID).
152
+ Order("created_at ASC").
153
Scan(ctx, &histories)
154
if err == nil {
155
summaryDTO := chat.Summary.ToSummaryWithTopicMessages(histories)
0 commit comments