👽 Change avatar and banner id to string

This commit is contained in:
LittleSheep 2024-08-18 22:08:58 +08:00
parent dd3586b241
commit 0285b82ca2
3 changed files with 11 additions and 13 deletions

View File

@ -4,12 +4,10 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix internal token audience update isn't fully applied">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":arrow_up: Implement list user relative grpc function">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/grpc/auth.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/auth.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/settings.toml" beforeDir="false" afterPath="$PROJECT_DIR$/settings.toml" 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$/pkg/internal/server/api/avatar_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/avatar_api.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -156,7 +154,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value=":zap: Optimized audit, event logging system&#10;:sparkles: Audit logs&#10;:sparkles: Admin edit user permissions" />
<MESSAGE value=":sparkles: Admin force confirm account" />
<MESSAGE value=":sparkles: Admin notify one user" />
<MESSAGE value=":sparkles: Admin check users' auth factor" />
@ -181,7 +178,8 @@
<MESSAGE value=":wastebasket: Clean up code" />
<MESSAGE value=":sparkles: Use capital to deal with links" />
<MESSAGE value=":bug: Fix internal token audience update isn't fully applied" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix internal token audience update isn't fully applied" />
<MESSAGE value=":arrow_up: Implement list user relative grpc function" />
<option name="LAST_COMMIT_MESSAGE" value=":arrow_up: Implement list user relative grpc function" />
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>

View File

@ -15,8 +15,8 @@ type Account struct {
Name string `json:"name" gorm:"uniqueIndex"`
Nick string `json:"nick"`
Description string `json:"description"`
Avatar *uint `json:"avatar"`
Banner *uint `json:"banner"`
Avatar *string `json:"avatar"`
Banner *string `json:"banner"`
ConfirmedAt *time.Time `json:"confirmed_at"`
SuspendedAt *time.Time `json:"suspended_at"`
PermNodes datatypes.JSONMap `json:"perm_nodes"`
@ -38,14 +38,14 @@ type Account struct {
func (v Account) GetAvatar() *string {
if v.Avatar != nil {
return lo.ToPtr(fmt.Sprintf("%s/%d", viper.GetString("content_endpoint"), *v.Avatar))
return lo.ToPtr(fmt.Sprintf("%s/%s", viper.GetString("content_endpoint"), *v.Avatar))
}
return nil
}
func (v Account) GetBanner() *string {
if v.Banner != nil {
return lo.ToPtr(fmt.Sprintf("%s/%d", viper.GetString("content_endpoint"), *v.Banner))
return lo.ToPtr(fmt.Sprintf("%s/%s", viper.GetString("content_endpoint"), *v.Banner))
}
return nil
}

View File

@ -15,7 +15,7 @@ func setAvatar(c *fiber.Ctx) error {
user := c.Locals("user").(models.Account)
var data struct {
AttachmentID uint `json:"attachment" validate:"required"`
AttachmentID string `json:"attachment" validate:"required"`
}
if err := exts.BindAndValidate(c, &data); err != nil {
@ -40,7 +40,7 @@ func setBanner(c *fiber.Ctx) error {
user := c.Locals("user").(models.Account)
var data struct {
AttachmentID uint `json:"attachment" validate:"required"`
AttachmentID string `json:"attachment" validate:"required"`
}
if err := exts.BindAndValidate(c, &data); err != nil {