🗃️ Add the status model

This commit is contained in:
LittleSheep 2024-06-26 17:59:15 +08:00
parent 7aef153bf3
commit ab5130de2a
4 changed files with 32 additions and 9 deletions

View File

@ -4,11 +4,11 @@
<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: Better avatar and banner APIs"> <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix frontend">
<change afterPath="$PROJECT_DIR$/pkg/internal/models/statuses.go" afterDir="false" />
<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/avatar_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/avatar_api.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/internal/database/migrator.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/database/migrator.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/src/components/UserMenu.vue" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/components/UserMenu.vue" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/internal/models/accounts.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/accounts.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/src/views/dashboard.vue" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/views/dashboard.vue" 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" />
@ -146,8 +146,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value=":bug: Fix APNs non-production" />
<MESSAGE value=":bug: Bug fixes on notification badges for APNs" />
<MESSAGE value=":bug: Fix APNs pushes no sound" /> <MESSAGE value=":bug: Fix APNs pushes no sound" />
<MESSAGE value=":bug: Fix APNs pushes no sound (again)" /> <MESSAGE value=":bug: Fix APNs pushes no sound (again)" />
<MESSAGE value=":fire: Remove ws connected does not push notify feature" /> <MESSAGE value=":fire: Remove ws connected does not push notify feature" />
@ -171,7 +169,9 @@
<MESSAGE value=":arrow_up: Fix notification listen" /> <MESSAGE value=":arrow_up: Fix notification listen" />
<MESSAGE value=":bug: Fix magic token's foreign key" /> <MESSAGE value=":bug: Fix magic token's foreign key" />
<MESSAGE value=":sparkles: Better avatar and banner APIs" /> <MESSAGE value=":sparkles: Better avatar and banner APIs" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Better avatar and banner APIs" /> <MESSAGE value=":bug: Fix avatar and banner APIs" />
<MESSAGE value=":bug: Fix frontend" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix frontend" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -11,6 +11,7 @@ var AutoMaintainRange = []any{
&models.AccountProfile{}, &models.AccountProfile{},
&models.AccountContact{}, &models.AccountContact{},
&models.AccountFriendship{}, &models.AccountFriendship{},
&models.Status{},
&models.Badge{}, &models.Badge{},
&models.Realm{}, &models.Realm{},
&models.RealmMember{}, &models.RealmMember{},

View File

@ -21,7 +21,9 @@ type Account struct {
PermNodes datatypes.JSONMap `json:"perm_nodes"` PermNodes datatypes.JSONMap `json:"perm_nodes"`
Profile AccountProfile `json:"profile"` Profile AccountProfile `json:"profile"`
Statuses []Status `json:"statuses"`
Badges []Badge `json:"badges"` Badges []Badge `json:"badges"`
Contacts []AccountContact `json:"contacts"` Contacts []AccountContact `json:"contacts"`
RealmIdentities []RealmMember `json:"realm_identities"` RealmIdentities []RealmMember `json:"realm_identities"`

View File

@ -0,0 +1,20 @@
package models
type StatusAttitude = uint8
const (
AttitudeNeutral = StatusAttitude(iota)
AttitudePositive
AttitudeNegative
)
type Status struct {
BaseModel
Type string `json:"type"`
Label string `json:"label"`
Attitude StatusAttitude `json:"attitude"`
IsNoDisturb bool `json:"is_no_disturb"`
IsInvisible bool `json:"is_invisible"`
AccountID uint `json:"account_id"`
}