️ feat: update global styles and color variables for improved theming

refactor: change import paths for DeviceContext and GravatarAvatar components

fix: adjust login form API call and update UI text for clarity

feat: add post API for listing posts with pagination and filtering options

feat: implement BlogCard component for displaying blog posts with enhanced UI

feat: create Badge component for consistent styling of labels and indicators

refactor: reintroduce DeviceContext with improved functionality for theme and language management

feat: define Label and Post models for better type safety and structure
This commit is contained in:
2025-07-24 13:12:59 +08:00
parent 21a1726f71
commit abe1099711
30 changed files with 935 additions and 288 deletions

View File

@ -70,15 +70,13 @@ func (u *UserController) Logout(ctx context.Context, c *app.RequestContext) {
}
func (u *UserController) OidcList(ctx context.Context, c *app.RequestContext) {
resp, err := u.service.ListOidcConfigs()
oidcConfigs, err := u.service.ListOidcConfigs()
if err != nil {
serviceErr := errs.AsServiceError(err)
resps.Custom(c, serviceErr.Code, serviceErr.Message, nil)
return
}
resps.Ok(c, resps.Success, map[string]any{
"oidc_configs": resp.OidcConfigs,
})
resps.Ok(c, resps.Success, oidcConfigs)
}
func (u *UserController) OidcLogin(ctx context.Context, c *app.RequestContext) {
@ -109,7 +107,12 @@ func (u *UserController) GetUser(ctx context.Context, c *app.RequestContext) {
userID := c.Param("id")
userIDInt, err := strconv.Atoi(userID)
if err != nil || userIDInt <= 0 {
userIDInt = int(ctxutils.GetCurrentUserID(ctx))
currentUserID, ok := ctxutils.GetCurrentUserID(ctx)
if !ok {
resps.Unauthorized(c, resps.ErrUnauthorized)
return
}
userIDInt = int(currentUserID)
}
resp, err := u.service.GetUser(&dto.GetUserReq{UserID: uint(userIDInt)})
@ -138,8 +141,8 @@ func (u *UserController) UpdateUser(ctx context.Context, c *app.RequestContext)
return
}
updateUserReq.ID = uint(userIDInt)
currentUser := ctxutils.GetCurrentUser(ctx)
if currentUser == nil {
currentUser, ok := ctxutils.GetCurrentUser(ctx)
if !ok {
resps.Unauthorized(c, resps.ErrUnauthorized)
return
}