feat(upload): integrate upload service for chat image validation and S3 uploads
All checks were successful
Build Backend / build (push) Successful in 13m35s
Build Backend / build-docker (push) Successful in 1m11s

- Added UploadService to handle image uploads and validation for chat messages.
- Updated ChatService and MessageService to utilize UploadService for validating image segments in messages.
- Enhanced wire generation to inject UploadService into relevant services.
- Introduced UploadImageBytes method in UploadService for uploading images directly from memory.
- Added TrustedPublicURLPrefix method in S3 Client for generating public URLs for uploaded images.
This commit is contained in:
lafay
2026-03-25 03:57:40 +08:00
parent a887e8ea23
commit 28a45caad3
7 changed files with 150 additions and 13 deletions

View File

@@ -133,8 +133,9 @@ func ProvideMessageService(
db *gorm.DB,
messageRepo *repository.MessageRepository,
cacheBackend cache.Cache,
uploadService *service.UploadService,
) *service.MessageService {
return service.NewMessageService(db, messageRepo, cacheBackend)
return service.NewMessageService(db, messageRepo, cacheBackend, uploadService)
}
// ProvideNotificationService 提供通知服务
@@ -185,8 +186,9 @@ func ProvideChatService(
userRepo *repository.UserRepository,
sseHub *sse.Hub,
cacheBackend cache.Cache,
uploadService *service.UploadService,
) service.ChatService {
return service.NewChatService(db, messageRepo, userRepo, nil, sseHub, cacheBackend)
return service.NewChatService(db, messageRepo, userRepo, nil, sseHub, cacheBackend, uploadService)
}
// ProvideScheduleService 提供日程服务