🐛 Fix clear status affected the statutes cleared before

This commit is contained in:
LittleSheep 2024-06-26 20:43:10 +08:00
parent 9519497887
commit feabff16ec
2 changed files with 4 additions and 8 deletions

11
.idea/workspace.xml generated
View File

@ -4,12 +4,7 @@
<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=":sparkles: Last seen at"> <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Edit, delete current status" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/index.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/index.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/statuses_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/statuses_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/statuses.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/statuses.go" afterDir="false" />
</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" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -154,7 +149,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value=":technologist: Add the server side Hyper SDK" />
<MESSAGE value=":recycle: Improve code structure and much easier to read&#10;:bug: Fix auth middleware" /> <MESSAGE value=":recycle: Improve code structure and much easier to read&#10;:bug: Fix auth middleware" />
<MESSAGE value=":bug: FIx cannot resolve service" /> <MESSAGE value=":bug: FIx cannot resolve service" />
<MESSAGE value=":sparkles: Accepts token in querystring" /> <MESSAGE value=":sparkles: Accepts token in querystring" />
@ -179,7 +173,8 @@
<MESSAGE value=":bug: Fix status expired in cache" /> <MESSAGE value=":bug: Fix status expired in cache" />
<MESSAGE value=":bug: Fix online condition" /> <MESSAGE value=":bug: Fix online condition" />
<MESSAGE value=":sparkles: Last seen at" /> <MESSAGE value=":sparkles: Last seen at" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Last seen at" /> <MESSAGE value=":sparkles: Edit, delete current status" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Edit, delete current status" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -75,6 +75,7 @@ func EditStatus(user models.Account, status models.Status) (models.Status, error
func ClearStatus(user models.Account) error { func ClearStatus(user models.Account) error {
if err := database.C. if err := database.C.
Where("account_id = ?", user.ID). Where("account_id = ?", user.ID).
Where("clear_at < ?", time.Now()).
Updates(models.Status{ClearAt: lo.ToPtr(time.Now())}).Error; err != nil { Updates(models.Status{ClearAt: lo.ToPtr(time.Now())}).Error; err != nil {
return err return err
} }