🐛 Fix status validation issue

This commit is contained in:
LittleSheep 2024-06-27 01:01:47 +08:00
parent b2b8aa467b
commit 7fed35dd04
2 changed files with 5 additions and 5 deletions

6
.idea/workspace.xml generated
View File

@ -4,7 +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=":bug: Not supposed to appear to status at the same time"> <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":ambulance: Fix getting user panic again...">
<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/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/server/api/statuses_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/statuses_api.go" afterDir="false" />
</list> </list>
@ -152,7 +152,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value=":wastebasket: Remove the personal page" />
<MESSAGE value=":recycle: OAuth authenticate" /> <MESSAGE value=":recycle: OAuth authenticate" />
<MESSAGE value=":sparkles: Recommend app component" /> <MESSAGE value=":sparkles: Recommend app component" />
<MESSAGE value=":bug: Bug fixes" /> <MESSAGE value=":bug: Bug fixes" />
@ -177,7 +176,8 @@
<MESSAGE value=":bug: Invisible status is visible to others" /> <MESSAGE value=":bug: Invisible status is visible to others" />
<MESSAGE value=":ambulance: Fix nil pointer panic" /> <MESSAGE value=":ambulance: Fix nil pointer panic" />
<MESSAGE value=":bug: Not supposed to appear to status at the same time" /> <MESSAGE value=":bug: Not supposed to appear to status at the same time" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Not supposed to appear to status at the same time" /> <MESSAGE value=":ambulance: Fix getting user panic again..." />
<option name="LAST_COMMIT_MESSAGE" value=":ambulance: Fix getting user panic again..." />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -63,7 +63,7 @@ func setStatus(c *fiber.Ctx) error {
var req struct { var req struct {
Type string `json:"type" validate:"required"` Type string `json:"type" validate:"required"`
Label string `json:"label" validate:"required"` Label string `json:"label" validate:"required"`
Attitude uint `json:"attitude" validate:"required"` Attitude uint `json:"attitude"`
IsNoDisturb bool `json:"is_no_disturb"` IsNoDisturb bool `json:"is_no_disturb"`
IsInvisible bool `json:"is_invisible"` IsInvisible bool `json:"is_invisible"`
ClearAt *time.Time `json:"clear_at"` ClearAt *time.Time `json:"clear_at"`
@ -105,7 +105,7 @@ func editStatus(c *fiber.Ctx) error {
var req struct { var req struct {
Type string `json:"type" validate:"required"` Type string `json:"type" validate:"required"`
Label string `json:"label" validate:"required"` Label string `json:"label" validate:"required"`
Attitude uint `json:"attitude" validate:"required"` Attitude uint `json:"attitude"`
IsNoDisturb bool `json:"is_no_disturb"` IsNoDisturb bool `json:"is_no_disturb"`
IsInvisible bool `json:"is_invisible"` IsInvisible bool `json:"is_invisible"`
ClearAt *time.Time `json:"clear_at"` ClearAt *time.Time `json:"clear_at"`