refactor: Update tenant ID handling across the application
This commit is contained in:
@@ -46,7 +46,7 @@ func NewCosFileService(bucketName, region, secretId, secretKey, cosPathPrefix st
|
||||
// SaveFile saves a file to COS storage
|
||||
// It generates a unique name for the file and organizes it by tenant and knowledge ID
|
||||
func (s *cosFileService) SaveFile(ctx context.Context,
|
||||
file *multipart.FileHeader, tenantID uint, knowledgeID string,
|
||||
file *multipart.FileHeader, tenantID uint64, knowledgeID string,
|
||||
) (string, error) {
|
||||
ext := filepath.Ext(file.Filename)
|
||||
objectName := fmt.Sprintf("%s/%d/%s/%s%s", s.cosPathPrefix, tenantID, knowledgeID, uuid.New().String(), ext)
|
||||
|
||||
@@ -22,7 +22,7 @@ func NewDummyFileService() interfaces.FileService {
|
||||
// SaveFile pretends to save a file but just returns a random UUID
|
||||
// This is useful for testing without actual file operations
|
||||
func (s *DummyFileService) SaveFile(ctx context.Context,
|
||||
file *multipart.FileHeader, tenantID uint, knowledgeID string,
|
||||
file *multipart.FileHeader, tenantID uint64, knowledgeID string,
|
||||
) (string, error) {
|
||||
return uuid.New().String(), nil
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func NewLocalFileService(baseDir string) interfaces.FileService {
|
||||
// The file is stored in a directory structure: baseDir/tenantID/knowledgeID/filename
|
||||
// Returns the full file path or an error if saving fails
|
||||
func (s *localFileService) SaveFile(ctx context.Context,
|
||||
file *multipart.FileHeader, tenantID uint, knowledgeID string,
|
||||
file *multipart.FileHeader, tenantID uint64, knowledgeID string,
|
||||
) (string, error) {
|
||||
logger.Info(ctx, "Starting to save file locally")
|
||||
logger.Infof(ctx, "File information: name=%s, size=%d, tenant ID=%d, knowledge ID=%s",
|
||||
|
||||
@@ -52,7 +52,7 @@ func NewMinioFileService(endpoint,
|
||||
|
||||
// SaveFile saves a file to MinIO
|
||||
func (s *minioFileService) SaveFile(ctx context.Context,
|
||||
file *multipart.FileHeader, tenantID uint, knowledgeID string,
|
||||
file *multipart.FileHeader, tenantID uint64, knowledgeID string,
|
||||
) (string, error) {
|
||||
// Generate object name
|
||||
ext := filepath.Ext(file.Filename)
|
||||
|
||||
Reference in New Issue
Block a user