refactor: unify code formatting and improve push/search implementations
- 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:
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"with_you/internal/dto"
|
||||
"with_you/internal/pkg/response"
|
||||
"with_you/internal/service"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
@@ -149,4 +149,4 @@ func parsePageParams(c *gin.Context) (int, int) {
|
||||
pageSize = 20
|
||||
}
|
||||
return page, pageSize
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"with_you/internal/model"
|
||||
@@ -120,4 +120,3 @@ func (h *ChannelHandler) AdminDelete(c *gin.Context) {
|
||||
}
|
||||
response.Success(c, gin.H{"success": true})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -940,7 +940,7 @@ func (h *MessageHandler) HandleSetConversationNotificationMuted(c *gin.Context)
|
||||
}
|
||||
|
||||
response.SuccessWithMessage(c, "conversation notification_muted status updated", gin.H{
|
||||
"conversation_id": conversationID,
|
||||
"conversation_id": conversationID,
|
||||
"notification_muted": req.NotificationMuted,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"with_you/internal/dto"
|
||||
@@ -58,4 +58,4 @@ func (h *ReportHandler) Create(c *gin.Context) {
|
||||
}
|
||||
|
||||
response.Success(c, dto.ConvertReportToResponse(report))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -217,4 +217,4 @@ func (h *TradeHandler) Unfavorite(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
response.Success(c, dto.TradeFavoriteResponse{Favorited: false})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package handler
|
||||
package handler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
Reference in New Issue
Block a user