From 3f0d3fc69e7eeab6ef7b0176ae9a1d40ca738d74 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 27 Jun 2024 00:37:50 +0800 Subject: [PATCH] :bug: Not supposed to appear to status at the same time --- .idea/workspace.xml | 6 +++--- pkg/internal/server/api/statuses_api.go | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0c27140..9e9f776 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,7 +4,7 @@ - @@ -177,7 +176,8 @@ - true diff --git a/pkg/internal/server/api/statuses_api.go b/pkg/internal/server/api/statuses_api.go index bb6bb61..17eb42c 100644 --- a/pkg/internal/server/api/statuses_api.go +++ b/pkg/internal/server/api/statuses_api.go @@ -73,6 +73,12 @@ func setStatus(c *fiber.Ctx) error { return err } + // End the status already exists + if status, err := services.GetStatus(user.ID); err == nil { + status.ClearAt = lo.ToPtr(time.Now()) + database.C.Save(&status) + } + status := models.Status{ Type: req.Type, Label: req.Label,