Commit eb251a09 authored by Steven's avatar Steven

chore: update workspace setting service

parent 4c47e93f
...@@ -48,8 +48,10 @@ message WorkspaceSetting { ...@@ -48,8 +48,10 @@ message WorkspaceSetting {
// Format: settings/{setting} // Format: settings/{setting}
string name = 1; string name = 1;
oneof value { oneof value {
// general_setting is the general setting of workspace.
WorkspaceGeneralSetting general_setting = 2; WorkspaceGeneralSetting general_setting = 2;
WorkspaceStorageSetting storage_setting = 3;
WorkspaceMemoRelatedSetting memo_related_setting = 4;
WorkspaceTelegramIntegrationSetting telegram_integration_setting = 5;
} }
} }
...@@ -65,3 +67,35 @@ message WorkspaceGeneralSetting { ...@@ -65,3 +67,35 @@ message WorkspaceGeneralSetting {
// additional_style is the additional style. // additional_style is the additional style.
string additional_style = 6; string additional_style = 6;
} }
message WorkspaceStorageSetting {
// storage_type is the storage type.
StorageType storage_type = 1;
// The local storage path for STORAGE_TYPE_LOCAL.
// e.g. assets/{timestamp}_{filename}
string local_storage_path = 2;
// The max upload size in megabytes.
int64 upload_size_limit_mb = 3;
enum StorageType {
STORAGE_TYPE_UNSPECIFIED = 0;
// STORAGE_TYPE_DATABASE is the database storage type.
STORAGE_TYPE_DATABASE = 1;
// STORAGE_TYPE_LOCAL is the local storage type.
STORAGE_TYPE_LOCAL = 2;
// STORAGE_TYPE_EXTERNAL is the external storage type.
STORAGE_TYPE_EXTERNAL = 3;
}
}
message WorkspaceMemoRelatedSetting {
// disallow_public_share disallows set memo as public visible.
bool disallow_public_visible = 1;
// display_with_update_time orders and displays memo with update time.
bool display_with_update_time = 2;
}
message WorkspaceTelegramIntegrationSetting {
// bot_token is the telegram bot token.
string bot_token = 1;
}
...@@ -218,7 +218,12 @@ ...@@ -218,7 +218,12 @@
- [SetWorkspaceSettingRequest](#memos-api-v2-SetWorkspaceSettingRequest) - [SetWorkspaceSettingRequest](#memos-api-v2-SetWorkspaceSettingRequest)
- [SetWorkspaceSettingResponse](#memos-api-v2-SetWorkspaceSettingResponse) - [SetWorkspaceSettingResponse](#memos-api-v2-SetWorkspaceSettingResponse)
- [WorkspaceGeneralSetting](#memos-api-v2-WorkspaceGeneralSetting) - [WorkspaceGeneralSetting](#memos-api-v2-WorkspaceGeneralSetting)
- [WorkspaceMemoRelatedSetting](#memos-api-v2-WorkspaceMemoRelatedSetting)
- [WorkspaceSetting](#memos-api-v2-WorkspaceSetting) - [WorkspaceSetting](#memos-api-v2-WorkspaceSetting)
- [WorkspaceStorageSetting](#memos-api-v2-WorkspaceStorageSetting)
- [WorkspaceTelegramIntegrationSetting](#memos-api-v2-WorkspaceTelegramIntegrationSetting)
- [WorkspaceStorageSetting.StorageType](#memos-api-v2-WorkspaceStorageSetting-StorageType)
- [WorkspaceSettingService](#memos-api-v2-WorkspaceSettingService) - [WorkspaceSettingService](#memos-api-v2-WorkspaceSettingService)
...@@ -2992,6 +2997,22 @@ Used internally for obfuscating the page token. ...@@ -2992,6 +2997,22 @@ Used internally for obfuscating the page token.
<a name="memos-api-v2-WorkspaceMemoRelatedSetting"></a>
### WorkspaceMemoRelatedSetting
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| disallow_public_visible | [bool](#bool) | | disallow_public_share disallows set memo as public visible. |
| display_with_update_time | [bool](#bool) | | display_with_update_time orders and displays memo with update time. |
<a name="memos-api-v2-WorkspaceSetting"></a> <a name="memos-api-v2-WorkspaceSetting"></a>
### WorkspaceSetting ### WorkspaceSetting
...@@ -3001,15 +3022,64 @@ Used internally for obfuscating the page token. ...@@ -3001,15 +3022,64 @@ Used internally for obfuscating the page token.
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| name | [string](#string) | | name is the name of the setting. Format: settings/{setting} | | name | [string](#string) | | name is the name of the setting. Format: settings/{setting} |
| general_setting | [WorkspaceGeneralSetting](#memos-api-v2-WorkspaceGeneralSetting) | | general_setting is the general setting of workspace. | | general_setting | [WorkspaceGeneralSetting](#memos-api-v2-WorkspaceGeneralSetting) | | |
| storage_setting | [WorkspaceStorageSetting](#memos-api-v2-WorkspaceStorageSetting) | | |
| memo_related_setting | [WorkspaceMemoRelatedSetting](#memos-api-v2-WorkspaceMemoRelatedSetting) | | |
| telegram_integration_setting | [WorkspaceTelegramIntegrationSetting](#memos-api-v2-WorkspaceTelegramIntegrationSetting) | | |
<a name="memos-api-v2-WorkspaceStorageSetting"></a>
### WorkspaceStorageSetting
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| storage_type | [WorkspaceStorageSetting.StorageType](#memos-api-v2-WorkspaceStorageSetting-StorageType) | | storage_type is the storage type. |
| local_storage_path | [string](#string) | | The local storage path for STORAGE_TYPE_LOCAL. e.g. assets/{timestamp}_{filename} |
| upload_size_limit_mb | [int64](#int64) | | The max upload size in megabytes. |
<a name="memos-api-v2-WorkspaceTelegramIntegrationSetting"></a>
### WorkspaceTelegramIntegrationSetting
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| bot_token | [string](#string) | | bot_token is the telegram bot token. |
<a name="memos-api-v2-WorkspaceStorageSetting-StorageType"></a>
### WorkspaceStorageSetting.StorageType
| Name | Number | Description |
| ---- | ------ | ----------- |
| STORAGE_TYPE_UNSPECIFIED | 0 | |
| STORAGE_TYPE_DATABASE | 1 | STORAGE_TYPE_DATABASE is the database storage type. |
| STORAGE_TYPE_LOCAL | 2 | STORAGE_TYPE_LOCAL is the local storage type. |
| STORAGE_TYPE_EXTERNAL | 3 | STORAGE_TYPE_EXTERNAL is the external storage type. |
......
...@@ -521,7 +521,7 @@ ...@@ -521,7 +521,7 @@
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| telegram_bot_token | [string](#string) | | telegram_bot_token is the telegram bot token. | | bot_token | [string](#string) | | bot_token is the telegram bot token. |
......
...@@ -464,8 +464,8 @@ type WorkspaceTelegramIntegrationSetting struct { ...@@ -464,8 +464,8 @@ type WorkspaceTelegramIntegrationSetting struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// telegram_bot_token is the telegram bot token. // bot_token is the telegram bot token.
TelegramBotToken string `protobuf:"bytes,1,opt,name=telegram_bot_token,json=telegramBotToken,proto3" json:"telegram_bot_token,omitempty"` BotToken string `protobuf:"bytes,1,opt,name=bot_token,json=botToken,proto3" json:"bot_token,omitempty"`
} }
func (x *WorkspaceTelegramIntegrationSetting) Reset() { func (x *WorkspaceTelegramIntegrationSetting) Reset() {
...@@ -500,9 +500,9 @@ func (*WorkspaceTelegramIntegrationSetting) Descriptor() ([]byte, []int) { ...@@ -500,9 +500,9 @@ func (*WorkspaceTelegramIntegrationSetting) Descriptor() ([]byte, []int) {
return file_store_workspace_setting_proto_rawDescGZIP(), []int{4} return file_store_workspace_setting_proto_rawDescGZIP(), []int{4}
} }
func (x *WorkspaceTelegramIntegrationSetting) GetTelegramBotToken() string { func (x *WorkspaceTelegramIntegrationSetting) GetBotToken() string {
if x != nil { if x != nil {
return x.TelegramBotToken return x.BotToken
} }
return "" return ""
} }
...@@ -586,36 +586,35 @@ var file_store_workspace_setting_proto_rawDesc = []byte{ ...@@ -586,36 +586,35 @@ var file_store_workspace_setting_proto_rawDesc = []byte{
0x37, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x37, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f,
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x57, 0x69, 0x74, 0x68, 0x55, 0x70, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x57, 0x69, 0x74, 0x68, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x53, 0x0a, 0x23, 0x57, 0x6f, 0x72, 0x6b, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x42, 0x0a, 0x23, 0x57, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x49, 0x6e, 0x74, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x49, 0x6e, 0x74,
0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12,
0x2c, 0x0a, 0x12, 0x74, 0x65, 0x6c, 0x65, 0x67, 0x72, 0x61, 0x6d, 0x5f, 0x62, 0x6f, 0x74, 0x5f, 0x1b, 0x0a, 0x09, 0x62, 0x6f, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01,
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x65, 0x6c, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6f, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0xca, 0x01, 0x0a,
0x65, 0x67, 0x72, 0x61, 0x6d, 0x42, 0x6f, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0xca, 0x01, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43,
0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e,
0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x57,
0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19,
0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e,
0x47, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x57,
0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47,
0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x02, 0x12, 0x22, 0x0a, 0x1e, 0x57, 0x4f, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x57, 0x4f,
0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f,
0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x2a, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x02, 0x12, 0x22, 0x0a, 0x1e, 0x57, 0x4f, 0x52,
0x0a, 0x26, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4d,
0x49, 0x4e, 0x47, 0x5f, 0x54, 0x45, 0x4c, 0x45, 0x47, 0x52, 0x41, 0x4d, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x2a, 0x0a,
0x45, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x26, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49,
0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x4e, 0x47, 0x5f, 0x54, 0x45, 0x4c, 0x45, 0x47, 0x52, 0x41, 0x4d, 0x5f, 0x49, 0x4e, 0x54, 0x45,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57,
0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50,
0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f,
0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72,
0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74,
0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c,
0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
......
...@@ -67,6 +67,6 @@ message WorkspaceMemoRelatedSetting { ...@@ -67,6 +67,6 @@ message WorkspaceMemoRelatedSetting {
} }
message WorkspaceTelegramIntegrationSetting { message WorkspaceTelegramIntegrationSetting {
// telegram_bot_token is the telegram bot token. // bot_token is the telegram bot token.
string telegram_bot_token = 1; string bot_token = 1;
} }
...@@ -876,7 +876,12 @@ paths: ...@@ -876,7 +876,12 @@ paths:
properties: properties:
generalSetting: generalSetting:
$ref: '#/definitions/apiv2WorkspaceGeneralSetting' $ref: '#/definitions/apiv2WorkspaceGeneralSetting'
description: general_setting is the general setting of workspace. storageSetting:
$ref: '#/definitions/apiv2WorkspaceStorageSetting'
memoRelatedSetting:
$ref: '#/definitions/apiv2WorkspaceMemoRelatedSetting'
telegramIntegrationSetting:
$ref: '#/definitions/apiv2WorkspaceTelegramIntegrationSetting'
title: setting is the setting to update. title: setting is the setting to update.
tags: tags:
- WorkspaceSettingService - WorkspaceSettingService
...@@ -1954,6 +1959,15 @@ definitions: ...@@ -1954,6 +1959,15 @@ definitions:
additionalStyle: additionalStyle:
type: string type: string
description: additional_style is the additional style. description: additional_style is the additional style.
apiv2WorkspaceMemoRelatedSetting:
type: object
properties:
disallowPublicVisible:
type: boolean
description: disallow_public_share disallows set memo as public visible.
displayWithUpdateTime:
type: boolean
description: display_with_update_time orders and displays memo with update time.
apiv2WorkspaceSetting: apiv2WorkspaceSetting:
type: object type: object
properties: properties:
...@@ -1964,7 +1978,45 @@ definitions: ...@@ -1964,7 +1978,45 @@ definitions:
Format: settings/{setting} Format: settings/{setting}
generalSetting: generalSetting:
$ref: '#/definitions/apiv2WorkspaceGeneralSetting' $ref: '#/definitions/apiv2WorkspaceGeneralSetting'
description: general_setting is the general setting of workspace. storageSetting:
$ref: '#/definitions/apiv2WorkspaceStorageSetting'
memoRelatedSetting:
$ref: '#/definitions/apiv2WorkspaceMemoRelatedSetting'
telegramIntegrationSetting:
$ref: '#/definitions/apiv2WorkspaceTelegramIntegrationSetting'
apiv2WorkspaceStorageSetting:
type: object
properties:
storageType:
$ref: '#/definitions/apiv2WorkspaceStorageSettingStorageType'
description: storage_type is the storage type.
localStoragePath:
type: string
title: |-
The local storage path for STORAGE_TYPE_LOCAL.
e.g. assets/{timestamp}_{filename}
uploadSizeLimitMb:
type: string
format: int64
description: The max upload size in megabytes.
apiv2WorkspaceStorageSettingStorageType:
type: string
enum:
- STORAGE_TYPE_UNSPECIFIED
- STORAGE_TYPE_DATABASE
- STORAGE_TYPE_LOCAL
- STORAGE_TYPE_EXTERNAL
default: STORAGE_TYPE_UNSPECIFIED
description: |2-
- STORAGE_TYPE_DATABASE: STORAGE_TYPE_DATABASE is the database storage type.
- STORAGE_TYPE_LOCAL: STORAGE_TYPE_LOCAL is the local storage type.
- STORAGE_TYPE_EXTERNAL: STORAGE_TYPE_EXTERNAL is the external storage type.
apiv2WorkspaceTelegramIntegrationSetting:
type: object
properties:
botToken:
type: string
description: bot_token is the telegram bot token.
googlerpcStatus: googlerpcStatus:
type: object type: object
properties: properties:
......
...@@ -54,22 +54,57 @@ func (s *APIV2Service) SetWorkspaceSetting(ctx context.Context, request *apiv2pb ...@@ -54,22 +54,57 @@ func (s *APIV2Service) SetWorkspaceSetting(ctx context.Context, request *apiv2pb
} }
func convertWorkspaceSettingFromStore(setting *storepb.WorkspaceSetting) *apiv2pb.WorkspaceSetting { func convertWorkspaceSettingFromStore(setting *storepb.WorkspaceSetting) *apiv2pb.WorkspaceSetting {
return &apiv2pb.WorkspaceSetting{ workspaceSetting := &apiv2pb.WorkspaceSetting{
Name: fmt.Sprintf("%s%s", WorkspaceSettingNamePrefix, setting.Key.String()), Name: fmt.Sprintf("%s%s", WorkspaceSettingNamePrefix, setting.Key.String()),
Value: &apiv2pb.WorkspaceSetting_GeneralSetting{ }
switch setting.Value.(type) {
case *storepb.WorkspaceSetting_GeneralSetting:
workspaceSetting.Value = &apiv2pb.WorkspaceSetting_GeneralSetting{
GeneralSetting: convertWorkspaceGeneralSettingFromStore(setting.GetGeneralSetting()), GeneralSetting: convertWorkspaceGeneralSettingFromStore(setting.GetGeneralSetting()),
},
} }
case *storepb.WorkspaceSetting_StorageSetting:
workspaceSetting.Value = &apiv2pb.WorkspaceSetting_StorageSetting{
StorageSetting: convertWorkspaceStorageSettingFromStore(setting.GetStorageSetting()),
}
case *storepb.WorkspaceSetting_MemoRelatedSetting:
workspaceSetting.Value = &apiv2pb.WorkspaceSetting_MemoRelatedSetting{
MemoRelatedSetting: convertWorkspaceMemoRelatedSettingFromStore(setting.GetMemoRelatedSetting()),
}
case *storepb.WorkspaceSetting_TelegramIntegrationSetting:
workspaceSetting.Value = &apiv2pb.WorkspaceSetting_TelegramIntegrationSetting{
TelegramIntegrationSetting: convertWorkspaceTelegramIntegrationSettingFromStore(setting.GetTelegramIntegrationSetting()),
}
}
return workspaceSetting
} }
func convertWorkspaceSettingToStore(setting *apiv2pb.WorkspaceSetting) *storepb.WorkspaceSetting { func convertWorkspaceSettingToStore(setting *apiv2pb.WorkspaceSetting) *storepb.WorkspaceSetting {
settingKeyString, _ := ExtractWorkspaceSettingKeyFromName(setting.Name) settingKeyString, _ := ExtractWorkspaceSettingKeyFromName(setting.Name)
return &storepb.WorkspaceSetting{ workspaceSetting := &storepb.WorkspaceSetting{
Key: storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[settingKeyString]), Key: storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[settingKeyString]),
Value: &storepb.WorkspaceSetting_GeneralSetting{ Value: &storepb.WorkspaceSetting_GeneralSetting{
GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()), GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()),
}, },
} }
switch workspaceSetting.Key {
case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL:
workspaceSetting.Value = &storepb.WorkspaceSetting_GeneralSetting{
GeneralSetting: convertWorkspaceGeneralSettingToStore(setting.GetGeneralSetting()),
}
case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE:
workspaceSetting.Value = &storepb.WorkspaceSetting_StorageSetting{
StorageSetting: convertWorkspaceStorageSettingToStore(setting.GetStorageSetting()),
}
case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED:
workspaceSetting.Value = &storepb.WorkspaceSetting_MemoRelatedSetting{
MemoRelatedSetting: convertWorkspaceMemoRelatedSettingToStore(setting.GetMemoRelatedSetting()),
}
case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_TELEGRAM_INTEGRATION:
workspaceSetting.Value = &storepb.WorkspaceSetting_TelegramIntegrationSetting{
TelegramIntegrationSetting: convertWorkspaceTelegramIntegrationSettingToStore(setting.GetTelegramIntegrationSetting()),
}
}
return workspaceSetting
} }
func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSetting) *apiv2pb.WorkspaceGeneralSetting { func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSetting) *apiv2pb.WorkspaceGeneralSetting {
...@@ -97,3 +132,63 @@ func convertWorkspaceGeneralSettingToStore(setting *apiv2pb.WorkspaceGeneralSett ...@@ -97,3 +132,63 @@ func convertWorkspaceGeneralSettingToStore(setting *apiv2pb.WorkspaceGeneralSett
AdditionalStyle: setting.AdditionalStyle, AdditionalStyle: setting.AdditionalStyle,
} }
} }
func convertWorkspaceStorageSettingFromStore(setting *storepb.WorkspaceStorageSetting) *apiv2pb.WorkspaceStorageSetting {
if setting == nil {
return nil
}
return &apiv2pb.WorkspaceStorageSetting{
StorageType: apiv2pb.WorkspaceStorageSetting_StorageType(setting.StorageType),
LocalStoragePath: setting.LocalStoragePath,
UploadSizeLimitMb: setting.UploadSizeLimitMb,
}
}
func convertWorkspaceStorageSettingToStore(setting *apiv2pb.WorkspaceStorageSetting) *storepb.WorkspaceStorageSetting {
if setting == nil {
return nil
}
return &storepb.WorkspaceStorageSetting{
StorageType: storepb.WorkspaceStorageSetting_StorageType(setting.StorageType),
LocalStoragePath: setting.LocalStoragePath,
UploadSizeLimitMb: setting.UploadSizeLimitMb,
}
}
func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoRelatedSetting) *apiv2pb.WorkspaceMemoRelatedSetting {
if setting == nil {
return nil
}
return &apiv2pb.WorkspaceMemoRelatedSetting{
DisallowPublicVisible: setting.DisallowPublicVisible,
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
}
}
func convertWorkspaceMemoRelatedSettingToStore(setting *apiv2pb.WorkspaceMemoRelatedSetting) *storepb.WorkspaceMemoRelatedSetting {
if setting == nil {
return nil
}
return &storepb.WorkspaceMemoRelatedSetting{
DisallowPublicVisible: setting.DisallowPublicVisible,
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
}
}
func convertWorkspaceTelegramIntegrationSettingFromStore(setting *storepb.WorkspaceTelegramIntegrationSetting) *apiv2pb.WorkspaceTelegramIntegrationSetting {
if setting == nil {
return nil
}
return &apiv2pb.WorkspaceTelegramIntegrationSetting{
BotToken: setting.BotToken,
}
}
func convertWorkspaceTelegramIntegrationSettingToStore(setting *apiv2pb.WorkspaceTelegramIntegrationSetting) *storepb.WorkspaceTelegramIntegrationSetting {
if setting == nil {
return nil
}
return &storepb.WorkspaceTelegramIntegrationSetting{
BotToken: setting.BotToken,
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment