feat(upload): integrate upload service for chat image validation and S3 uploads
- 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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user