refactor: cleanup unused code and simplify internal packages
Some checks failed
Build Backend / build (push) Successful in 1m56s
Build Backend / build-docker (push) Has been cancelled

This commit performs a significant cleanup of the codebase by removing unused functions, methods, and entire files across various internal modules. This reduces technical debt and simplifies the project structure.

Key changes include:
- **cache**: Removed unused cache key generators and metrics snapshots.
- **dto**: Removed redundant converter functions and segment creation helpers.
- **middleware**: Deleted the unused `logger.go` middleware and simplified `ratelimit.go` and `casbin.go`.
- **model**: Removed unused ID helpers, database closing functions, and batch decryption logic.
- **pkg**: Cleaned up unused utility functions in `circuitbreaker`, `crypto`, `cursor`, `hook`, and `utils`.
- **service**: Deleted `account_cleanup_service.go` and removed unused helper functions in `log_cleanup_service.go` and `sensitive_service.go`.
- **repository**: Removed unused private loading methods in `comment_repo.go`.
This commit is contained in:
2026-05-14 02:24:30 +08:00
parent d2894066f8
commit 9a1851f023
36 changed files with 0 additions and 1449 deletions

View File

@@ -143,49 +143,3 @@ type CallConfigResponse struct {
ICEServers []ICEServerConfig `json:"ice_servers"`
}
// ==================== Converter Functions ====================
// ConvertCallSessionToResponse 转换通话会话为响应格式
func ConvertCallSessionToResponse(call *model.CallSession, caller *model.User, participants []*model.User) *CallSessionResponse {
resp := &CallSessionResponse{
ID: call.ID,
ConversationID: call.ConversationID,
CallerID: call.CallerID,
CallType: call.CallType,
Status: call.Status,
StartedAt: call.StartedAt,
EndedAt: call.EndedAt,
Duration: call.Duration,
CreatedAt: call.CreatedAt,
}
if call.GroupID != nil {
resp.GroupID = *call.GroupID
}
if caller != nil {
resp.Caller = ConvertUserToResponse(caller)
}
// 转换参与者
resp.Participants = make([]CallParticipantResponse, 0, len(call.Participants))
userMap := make(map[string]*model.User)
for _, u := range participants {
userMap[u.ID] = u
}
for _, p := range call.Participants {
pr := CallParticipantResponse{
UserID: p.UserID,
Status: p.Status,
JoinedAt: p.JoinedAt,
LeftAt: p.LeftAt,
}
if u, ok := userMap[p.UserID]; ok {
pr.User = ConvertUserToResponse(u)
}
resp.Participants = append(resp.Participants, pr)
}
return resp
}