🐛 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

View File

@ -4,9 +4,9 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <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$/.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> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -153,7 +153,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value=":sparkles: Preload api key's ticket" />
<MESSAGE value=":bug: Fix preloading issue" /> <MESSAGE value=":bug: Fix preloading issue" />
<MESSAGE value=":bug: Fix bot related key api issue" /> <MESSAGE value=":bug: Fix bot related key api issue" />
<MESSAGE value=":bug: Fix query statement column issue" /> <MESSAGE value=":bug: Fix query statement column issue" />
@ -178,7 +177,8 @@
<MESSAGE value=":sparkles: New login alert" /> <MESSAGE value=":sparkles: New login alert" />
<MESSAGE value=":bug: Bug fixes in non-cached notification preferences" /> <MESSAGE value=":bug: Bug fixes in non-cached notification preferences" />
<MESSAGE value=":alien: Support better metadata encoder / decoder" /> <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>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -32,7 +32,7 @@ func getNotifications(c *fiber.Ctx) error {
if err := tx. if err := tx.
Limit(take). Limit(take).
Offset(offset). 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 { Find(&notifications).Error; err != nil {
return fiber.NewError(fiber.StatusInternalServerError, err.Error()) return fiber.NewError(fiber.StatusInternalServerError, err.Error())
} }