chore: update workspace setting store

This commit is contained in:
Steven
2024-04-13 02:08:35 +08:00
parent 17e8fc5408
commit 707e5caf89
18 changed files with 369 additions and 464 deletions

View File

@ -2069,10 +2069,10 @@ definitions:
type: integer
format: int32
description: The id of actived external storage.
localStoragePath:
localStoragePathTemplate:
type: string
title: |-
The local storage path for STORAGE_TYPE_LOCAL.
The template of local storage path.
e.g. assets/{timestamp}_{filename}
uploadSizeLimitMb:
type: string

View File

@ -260,8 +260,8 @@ func SaveResourceBlob(ctx context.Context, s *store.Store, create *store.Resourc
if workspaceStorageSetting.StorageType == storepb.WorkspaceStorageSetting_STORAGE_TYPE_LOCAL {
localStoragePath := "assets/{timestamp}_{filename}"
if workspaceStorageSetting.LocalStoragePath != "" {
localStoragePath = workspaceStorageSetting.LocalStoragePath
if workspaceStorageSetting.LocalStoragePathTemplate != "" {
localStoragePath = workspaceStorageSetting.LocalStoragePathTemplate
}
internalPath := localStoragePath

View File

@ -176,9 +176,10 @@ func convertWorkspaceStorageSettingFromStore(setting *storepb.WorkspaceStorageSe
return nil
}
return &apiv2pb.WorkspaceStorageSetting{
StorageType: apiv2pb.WorkspaceStorageSetting_StorageType(setting.StorageType),
LocalStoragePath: setting.LocalStoragePath,
UploadSizeLimitMb: setting.UploadSizeLimitMb,
StorageType: apiv2pb.WorkspaceStorageSetting_StorageType(setting.StorageType),
LocalStoragePathTemplate: setting.LocalStoragePathTemplate,
UploadSizeLimitMb: setting.UploadSizeLimitMb,
ActivedExternalStorageId: setting.ActivedExternalStorageId,
}
}
@ -187,9 +188,10 @@ func convertWorkspaceStorageSettingToStore(setting *apiv2pb.WorkspaceStorageSett
return nil
}
return &storepb.WorkspaceStorageSetting{
StorageType: storepb.WorkspaceStorageSetting_StorageType(setting.StorageType),
LocalStoragePath: setting.LocalStoragePath,
UploadSizeLimitMb: setting.UploadSizeLimitMb,
StorageType: storepb.WorkspaceStorageSetting_StorageType(setting.StorageType),
LocalStoragePathTemplate: setting.LocalStoragePathTemplate,
UploadSizeLimitMb: setting.UploadSizeLimitMb,
ActivedExternalStorageId: setting.ActivedExternalStorageId,
}
}