chore: code clean

This commit is contained in:
Steven 2023-07-04 21:22:47 +08:00
parent f0334d5755
commit ee9e092129
3 changed files with 4 additions and 11 deletions

View File

@ -9,6 +9,7 @@ import (
) )
func (*APIV1Service) registerURLUtilRoutes(g *echo.Group) { func (*APIV1Service) registerURLUtilRoutes(g *echo.Group) {
// GET /url/favicon?url=...
g.GET("/url/favicon", func(c echo.Context) error { g.GET("/url/favicon", func(c echo.Context) error {
url := c.QueryParam("url") url := c.QueryParam("url")
icons, err := favicon.Find(url) icons, err := favicon.Find(url)

View File

@ -80,10 +80,6 @@ type PatchUserRequest struct {
Password *string `json:"password"` Password *string `json:"password"`
} }
type UserDelete struct {
ID int
}
func (s *APIV1Service) registerUserRoutes(g *echo.Group) { func (s *APIV1Service) registerUserRoutes(g *echo.Group) {
g.GET("/user", func(c echo.Context) error { g.GET("/user", func(c echo.Context) error {
ctx := c.Request().Context() ctx := c.Request().Context()
@ -160,7 +156,6 @@ func (s *APIV1Service) registerUserRoutes(g *echo.Group) {
if !validateEmail(*userPatch.Email) { if !validateEmail(*userPatch.Email) {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("invalid email format: %s", *userPatch.Email)) return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("invalid email format: %s", *userPatch.Email))
} }
updateUser.Email = userPatch.Email updateUser.Email = userPatch.Email
} }
if userPatch.Nickname != nil { if userPatch.Nickname != nil {

View File

@ -13,11 +13,8 @@ const (
) )
// String returns the string format of UserSettingKey type. // String returns the string format of UserSettingKey type.
func (key UserSettingKey) String() string { func (k UserSettingKey) String() string {
if key == UserSettingLocaleKey { return string(k)
return "locale"
}
return ""
} }
var ( var (
@ -27,7 +24,7 @@ var (
type UserSetting struct { type UserSetting struct {
UserID int UserID int
Key UserSettingKey `json:"key"` Key UserSettingKey `json:"key"`
// Value is a JSON string with basic value // Value is a JSON string with basic value.
Value string `json:"value"` Value string `json:"value"`
} }