refactor: unify code formatting and improve push/search implementations
All checks were successful
Build Backend / build (push) Successful in 3m54s
Build Backend / build-docker (push) Successful in 1m9s

- Remove BOM from all Go source files
- Standardize import ordering and whitespace across handlers and services
- Replace PostgreSQL full-text search with ILIKE pattern matching in post and user repositories
- Enhance JPush client with TLS transport, rate limit monitoring, and simplified API
- Refactor PushService to include userID in device management methods
- Add MaxDevicesPerUser limit and extract helper functions for push payload construction
This commit is contained in:
lafay
2026-04-28 14:53:04 +08:00
parent 179e468131
commit 67a5660952
67 changed files with 356 additions and 351 deletions

View File

@@ -1,4 +1,4 @@
package handler
package handler
import (
"with_you/internal/dto"
@@ -67,7 +67,7 @@ func (h *PushHandler) UnregisterDevice(c *gin.Context) {
return
}
err := h.pushService.UnregisterDevice(c.Request.Context(), deviceID)
err := h.pushService.UnregisterDevice(c.Request.Context(), userID, deviceID)
if err != nil {
response.InternalServerError(c, "failed to unregister device")
return
@@ -141,14 +141,14 @@ func (h *PushHandler) UpdateDeviceToken(c *gin.Context) {
}
var req struct {
PushToken string `json:"push_token"`
PushToken string `json:"push_token"`
}
if err := c.ShouldBindJSON(&req); err != nil {
response.BadRequest(c, err.Error())
return
}
err := h.pushService.UpdateDeviceToken(c.Request.Context(), deviceID, req.PushToken)
err := h.pushService.UpdateDeviceToken(c.Request.Context(), userID, deviceID, req.PushToken)
if err != nil {
response.InternalServerError(c, "failed to update device token")
return