🗃️ Add the status model
This commit is contained in:
		
							
								
								
									
										14
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										14
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							| @@ -4,11 +4,11 @@ | ||||
|     <option name="autoReloadType" value="ALL" /> | ||||
|   </component> | ||||
|   <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$/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$/web/src/components/UserMenu.vue" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/components/UserMenu.vue" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/web/src/views/dashboard.vue" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/views/dashboard.vue" 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$/pkg/internal/models/accounts.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/accounts.go" afterDir="false" /> | ||||
|     </list> | ||||
|     <option name="SHOW_DIALOG" value="false" /> | ||||
|     <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||||
| @@ -146,8 +146,6 @@ | ||||
|     </option> | ||||
|   </component> | ||||
|   <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 (again)" /> | ||||
|     <MESSAGE value=":fire: Remove ws connected does not push notify feature" /> | ||||
| @@ -171,7 +169,9 @@ | ||||
|     <MESSAGE value=":arrow_up: Fix notification listen" /> | ||||
|     <MESSAGE value=":bug: Fix magic token's foreign key" /> | ||||
|     <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 name="VgoProject"> | ||||
|     <settings-migrated>true</settings-migrated> | ||||
|   | ||||
| @@ -11,6 +11,7 @@ var AutoMaintainRange = []any{ | ||||
| 	&models.AccountProfile{}, | ||||
| 	&models.AccountContact{}, | ||||
| 	&models.AccountFriendship{}, | ||||
| 	&models.Status{}, | ||||
| 	&models.Badge{}, | ||||
| 	&models.Realm{}, | ||||
| 	&models.RealmMember{}, | ||||
|   | ||||
| @@ -20,8 +20,10 @@ type Account struct { | ||||
| 	ConfirmedAt *time.Time        `json:"confirmed_at"` | ||||
| 	PermNodes   datatypes.JSONMap `json:"perm_nodes"` | ||||
|  | ||||
| 	Profile         AccountProfile   `json:"profile"` | ||||
| 	Badges          []Badge          `json:"badges"` | ||||
| 	Profile  AccountProfile `json:"profile"` | ||||
| 	Statuses []Status       `json:"statuses"` | ||||
| 	Badges   []Badge        `json:"badges"` | ||||
|  | ||||
| 	Contacts        []AccountContact `json:"contacts"` | ||||
| 	RealmIdentities []RealmMember    `json:"realm_identities"` | ||||
|  | ||||
|   | ||||
							
								
								
									
										20
									
								
								pkg/internal/models/statuses.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								pkg/internal/models/statuses.go
									
									
									
									
									
										Normal 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"` | ||||
| } | ||||
		Reference in New Issue
	
	Block a user