implemented mongo gridFS for file upload

This commit is contained in:
m.nazemi
2026-04-21 19:07:51 +03:30
parent 74d9269a19
commit 3aabd95b1c
16 changed files with 1941 additions and 17 deletions
+18
View File
@@ -5,6 +5,7 @@ import (
"time"
"tm/pkg/authorization"
"tm/pkg/config"
"tm/pkg/filestore"
"tm/pkg/glm"
"tm/pkg/hcaptcha"
"tm/pkg/logger"
@@ -315,3 +316,20 @@ func InitGLMService(conf GLMConfig, log logger.Logger) *glm.SDK {
return glmSDK
}
// InitFileStore initializes the GridFS file store service
func InitFileStore(mongoManager *mongo.ConnectionManager, log logger.Logger) (*filestore.GridFSService, error) {
fileStoreService, err := filestore.NewGridFSService(mongoManager, log)
if err != nil {
log.Error("Failed to initialize file store service", map[string]interface{}{
"error": err.Error(),
})
return nil, err
}
log.Info("File store service initialized successfully", map[string]interface{}{
"storage_type": "MongoDB GridFS",
})
return fileStoreService, nil
}