modernize the codebase

Run the modernize linter across the codebase.
Change generated by running:

```
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...
```

Ref:
https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize
This commit is contained in:
2025-09-23 09:13:29 +03:30
parent fc1502c4a0
commit 94694741a7
5 changed files with 33 additions and 38 deletions
+5 -5
View File
@@ -28,7 +28,7 @@ func NewAdminDashboardHandler(
postService: postService,
jwt: jwt,
cfg: cfg,
imgKit: imgKit,
imgKit: imgKit,
}
}
@@ -61,8 +61,8 @@ func (adh *AdminDashboardHandler) RejectMedia(c *gin.Context) {
func (adh *AdminDashboardHandler) GetMedia(c *gin.Context) {
media := adh.postService.GetMedia()
// TODO: Fix this - we need to inject ImgKitHelper
media.PreviewUrl = adh.imgKit.GetPreviewUrl(media.RemoteUrl)
media.RemoteUrl = adh.imgKit.GetRemoteUrl(media.RemoteUrl)
media.PreviewUrl = adh.imgKit.GetPreviewUrl(media.RemoteUrl)
media.RemoteUrl = adh.imgKit.GetRemoteUrl(media.RemoteUrl)
c.JSON(http.StatusOK, media)
}
@@ -77,7 +77,7 @@ func (adh *AdminDashboardHandler) Login(c *gin.Context) {
}
if input.Password == adh.cfg.AdminPassword { // Its more than enough for this project
token, err := adh.jwt.GenerateToken(map[string]interface{}{"role": "admin"})
token, err := adh.jwt.GenerateToken(map[string]any{"role": "admin"})
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Token generation failed"})
return
@@ -97,4 +97,4 @@ func (adh *AdminDashboardHandler) Login(c *gin.Context) {
// Expose the JWT middleware for use in routes
func (adh *AdminDashboardHandler) JWTMiddleware() gin.HandlerFunc {
return adh.jwt.GinMiddleware()
}
}