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

@@ -65,19 +65,19 @@ func InitializeApp() (*App, error) {
channelService := wire.ProvideChannelService(channelRepository, cache)
postHandler := wire.ProvidePostHandler(postService, userService, channelService, logService)
commentHandler := handler.NewCommentHandler(commentService)
chatService := wire.ProvideChatService(db, messageRepository, userRepository, hub, cache)
messageService := wire.ProvideMessageService(db, messageRepository, cache)
s3Client, err := wire.ProvideS3Client(config)
if err != nil {
return nil, err
}
uploadService := wire.ProvideUploadService(s3Client, userService)
chatService := wire.ProvideChatService(db, messageRepository, userRepository, hub, cache, uploadService)
messageService := wire.ProvideMessageService(db, messageRepository, cache, uploadService)
groupRepository := repository.NewGroupRepository(db)
groupService := wire.ProvideGroupService(db, groupRepository, userRepository, messageRepository, hub, cache)
messageHandler := wire.ProvideMessageHandler(chatService, messageService, userService, groupService, hub)
notificationRepository := repository.NewNotificationRepository(db)
notificationService := wire.ProvideNotificationService(notificationRepository, cache)
notificationHandler := handler.NewNotificationHandler(notificationService)
s3Client, err := wire.ProvideS3Client(config)
if err != nil {
return nil, err
}
uploadService := wire.ProvideUploadService(s3Client, userService)
uploadHandler := handler.NewUploadHandler(uploadService)
jwtService := wire.ProvideJWTService(config)
pushHandler := handler.NewPushHandler(pushService)