🐛 Fix notification order

This commit is contained in:
LittleSheep 2024-10-16 20:57:08 +08:00
parent 29629cead6
commit 10d977ab23
2 changed files with 5 additions and 5 deletions

8
.idea/workspace.xml generated
View File

@ -4,9 +4,9 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":alien: Support better metadata encoder / decoder">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Bug fixes on compile time">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/grpc/realms.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/realms.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/notifications_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/notifications_api.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -153,7 +153,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value=":sparkles: Preload api key's ticket" />
<MESSAGE value=":bug: Fix preloading issue" />
<MESSAGE value=":bug: Fix bot related key api issue" />
<MESSAGE value=":bug: Fix query statement column issue" />
@ -178,7 +177,8 @@
<MESSAGE value=":sparkles: New login alert" />
<MESSAGE value=":bug: Bug fixes in non-cached notification preferences" />
<MESSAGE value=":alien: Support better metadata encoder / decoder" />
<option name="LAST_COMMIT_MESSAGE" value=":alien: Support better metadata encoder / decoder" />
<MESSAGE value=":bug: Bug fixes on compile time" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fixes on compile time" />
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>

View File

@ -32,7 +32,7 @@ func getNotifications(c *fiber.Ctx) error {
if err := tx.
Limit(take).
Offset(offset).
Order("CASE WHEN read_at IS NULL THEN 0 ELSE 1 END, created_at").
Order("read_at DESC, created_at").
Find(&notifications).Error; err != nil {
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
}