From 6746b9dc580aed8452bf232929b676e2db9fc922 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 21 May 2024 21:57:03 +0800 Subject: [PATCH] chore: support fr locale --- .../components/setting/PreferenceSection.tsx | 4 + frontend/web/src/i18n.ts | 4 + frontend/web/src/layouts/Root.tsx | 2 + proto/api/v1/user_setting_service.proto | 1 + proto/gen/api/v1/README.md | 1 + proto/gen/api/v1/user_setting_service.pb.go | 140 +++++++++--------- proto/gen/apidocs.swagger.yaml | 1 + proto/gen/store/README.md | 17 ++- proto/gen/store/user_setting.pb.go | 120 +++++++-------- proto/store/user_setting.proto | 17 ++- server/route/api/v1/user_service.go | 4 +- server/route/api/v1/user_setting_service.go | 32 ++-- server/server.go | 2 +- store/db/postgres/user_setting.go | 15 +- store/db/sqlite/user_setting.go | 15 +- store/user_setting.go | 2 +- test/store/user_setting_test.go | 36 ++--- 17 files changed, 216 insertions(+), 197 deletions(-) diff --git a/frontend/web/src/components/setting/PreferenceSection.tsx b/frontend/web/src/components/setting/PreferenceSection.tsx index 064820f..e3e0a87 100644 --- a/frontend/web/src/components/setting/PreferenceSection.tsx +++ b/frontend/web/src/components/setting/PreferenceSection.tsx @@ -20,6 +20,10 @@ const PreferenceSection: React.FC = () => { value: UserSetting_Locale.LOCALE_ZH, label: "中文", }, + { + value: UserSetting_Locale.LOCALE_FR, + label: "Français", + }, ]; const colorThemeOptions = [ diff --git a/frontend/web/src/i18n.ts b/frontend/web/src/i18n.ts index ce58517..714cf37 100644 --- a/frontend/web/src/i18n.ts +++ b/frontend/web/src/i18n.ts @@ -1,6 +1,7 @@ import i18n from "i18next"; import { initReactI18next } from "react-i18next"; import en from "../../locales/en.json"; +import fr from "../../locales/fr.json"; import zh from "../../locales/zh.json"; i18n.use(initReactI18next).init({ @@ -11,6 +12,9 @@ i18n.use(initReactI18next).init({ zh: { translation: zh, }, + fr: { + translation: fr, + }, }, lng: "en", fallbackLng: "en", diff --git a/frontend/web/src/layouts/Root.tsx b/frontend/web/src/layouts/Root.tsx index 2e3955b..5d65ae9 100644 --- a/frontend/web/src/layouts/Root.tsx +++ b/frontend/web/src/layouts/Root.tsx @@ -37,6 +37,8 @@ const Root: React.FC = () => { if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_ZH)) { i18n.changeLanguage("zh"); + } else if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_FR)) { + i18n.changeLanguage("fr"); } else { i18n.changeLanguage("en"); } diff --git a/proto/api/v1/user_setting_service.proto b/proto/api/v1/user_setting_service.proto index a8a0d5d..1556c79 100644 --- a/proto/api/v1/user_setting_service.proto +++ b/proto/api/v1/user_setting_service.proto @@ -32,6 +32,7 @@ message UserSetting { LOCALE_UNSPECIFIED = 0; LOCALE_EN = 1; LOCALE_ZH = 2; + LOCALE_FR = 3; } // locale is the user locale. Locale locale = 2; diff --git a/proto/gen/api/v1/README.md b/proto/gen/api/v1/README.md index ee62e58..e146bcc 100644 --- a/proto/gen/api/v1/README.md +++ b/proto/gen/api/v1/README.md @@ -1360,6 +1360,7 @@ | LOCALE_UNSPECIFIED | 0 | | | LOCALE_EN | 1 | | | LOCALE_ZH | 2 | | +| LOCALE_FR | 3 | | diff --git a/proto/gen/api/v1/user_setting_service.pb.go b/proto/gen/api/v1/user_setting_service.pb.go index 02b6af4..7fa632b 100644 --- a/proto/gen/api/v1/user_setting_service.pb.go +++ b/proto/gen/api/v1/user_setting_service.pb.go @@ -28,6 +28,7 @@ const ( UserSetting_LOCALE_UNSPECIFIED UserSetting_Locale = 0 UserSetting_LOCALE_EN UserSetting_Locale = 1 UserSetting_LOCALE_ZH UserSetting_Locale = 2 + UserSetting_LOCALE_FR UserSetting_Locale = 3 ) // Enum value maps for UserSetting_Locale. @@ -36,11 +37,13 @@ var ( 0: "LOCALE_UNSPECIFIED", 1: "LOCALE_EN", 2: "LOCALE_ZH", + 3: "LOCALE_FR", } UserSetting_Locale_value = map[string]int32{ "LOCALE_UNSPECIFIED": 0, "LOCALE_EN": 1, "LOCALE_ZH": 2, + "LOCALE_FR": 3, } ) @@ -408,7 +411,7 @@ var file_api_v1_user_setting_service_proto_rawDesc = []byte{ 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, - 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xce, 0x02, 0x0a, 0x0b, 0x55, + 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdd, 0x02, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x38, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x73, 0x6c, 0x61, @@ -418,76 +421,77 @@ var file_api_v1_user_setting_service_proto_rawDesc = []byte{ 0x65, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x52, - 0x0a, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3e, 0x0a, 0x06, 0x4c, + 0x0a, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x4d, 0x0a, 0x06, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, - 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x5a, 0x48, 0x10, 0x02, 0x22, 0x6e, 0x0a, 0x0a, 0x43, - 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4c, - 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, - 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x01, 0x12, 0x15, - 0x0a, 0x11, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x4c, 0x49, - 0x47, 0x48, 0x54, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, - 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x22, 0x27, 0x0a, 0x15, 0x47, - 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, - 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, - 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0xa5, 0x01, 0x0a, - 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, - 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x59, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, - 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, - 0xd1, 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, - 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, - 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, - 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1d, 0x12, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, - 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xb2, - 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, - 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0xda, 0x41, 0x18, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, - 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, - 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, - 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x17, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x79, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, - 0x6c, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, - 0x58, 0xaa, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, - 0xca, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x18, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, - 0x73, 0x68, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x5a, 0x48, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x4c, + 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x46, 0x52, 0x10, 0x03, 0x22, 0x6e, 0x0a, 0x0a, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4c, 0x4f, + 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, + 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x01, 0x12, 0x15, 0x0a, + 0x11, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x4c, 0x49, 0x47, + 0x48, 0x54, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, + 0x45, 0x4d, 0x45, 0x5f, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x22, 0x27, 0x0a, 0x15, 0x47, 0x65, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, + 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, + 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0xa5, 0x01, 0x0a, 0x18, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, + 0x61, 0x73, 0x6b, 0x22, 0x59, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xd1, + 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, + 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x28, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, + 0x12, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, + 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xb2, 0x01, + 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x6c, + 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0xda, 0x41, 0x18, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, + 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, + 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x73, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x17, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, + 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c, + 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, + 0xaa, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, + 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x18, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, + 0x68, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index a86e750..6687285 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -738,6 +738,7 @@ definitions: - LOCALE_UNSPECIFIED - LOCALE_EN - LOCALE_ZH + - LOCALE_FR default: LOCALE_UNSPECIFIED apiv1AutoBackupWorkspaceSetting: type: object diff --git a/proto/gen/store/README.md b/proto/gen/store/README.md index 5ed7b89..470a837 100644 --- a/proto/gen/store/README.md +++ b/proto/gen/store/README.md @@ -294,9 +294,9 @@ | Name | Number | Description | | ---- | ------ | ----------- | | COLOR_THEME_USER_SETTING_UNSPECIFIED | 0 | | -| COLOR_THEME_USER_SETTING_SYSTEM | 1 | | -| COLOR_THEME_USER_SETTING_LIGHT | 2 | | -| COLOR_THEME_USER_SETTING_DARK | 3 | | +| SYSTEM | 1 | | +| LIGHT | 2 | | +| DARK | 3 | | @@ -308,8 +308,9 @@ | Name | Number | Description | | ---- | ------ | ----------- | | LOCALE_USER_SETTING_UNSPECIFIED | 0 | | -| LOCALE_USER_SETTING_EN | 1 | | -| LOCALE_USER_SETTING_ZH | 2 | | +| EN | 1 | | +| ZH | 2 | | +| FR | 3 | | @@ -321,9 +322,9 @@ | Name | Number | Description | | ---- | ------ | ----------- | | USER_SETTING_KEY_UNSPECIFIED | 0 | | -| USER_SETTING_ACCESS_TOKENS | 1 | Access tokens for the user. | -| USER_SETTING_LOCALE | 2 | Locale for the user. | -| USER_SETTING_COLOR_THEME | 3 | Color theme for the user. | +| ACCESS_TOKENS | 1 | Access tokens for the user. | +| LOCALE | 2 | Locale for the user. | +| COLOR_THEME | 3 | Color theme for the user. | diff --git a/proto/gen/store/user_setting.pb.go b/proto/gen/store/user_setting.pb.go index 2c9301d..d1a9fce 100644 --- a/proto/gen/store/user_setting.pb.go +++ b/proto/gen/store/user_setting.pb.go @@ -25,26 +25,26 @@ type UserSettingKey int32 const ( UserSettingKey_USER_SETTING_KEY_UNSPECIFIED UserSettingKey = 0 // Access tokens for the user. - UserSettingKey_USER_SETTING_ACCESS_TOKENS UserSettingKey = 1 + UserSettingKey_ACCESS_TOKENS UserSettingKey = 1 // Locale for the user. - UserSettingKey_USER_SETTING_LOCALE UserSettingKey = 2 + UserSettingKey_LOCALE UserSettingKey = 2 // Color theme for the user. - UserSettingKey_USER_SETTING_COLOR_THEME UserSettingKey = 3 + UserSettingKey_COLOR_THEME UserSettingKey = 3 ) // Enum value maps for UserSettingKey. var ( UserSettingKey_name = map[int32]string{ 0: "USER_SETTING_KEY_UNSPECIFIED", - 1: "USER_SETTING_ACCESS_TOKENS", - 2: "USER_SETTING_LOCALE", - 3: "USER_SETTING_COLOR_THEME", + 1: "ACCESS_TOKENS", + 2: "LOCALE", + 3: "COLOR_THEME", } UserSettingKey_value = map[string]int32{ "USER_SETTING_KEY_UNSPECIFIED": 0, - "USER_SETTING_ACCESS_TOKENS": 1, - "USER_SETTING_LOCALE": 2, - "USER_SETTING_COLOR_THEME": 3, + "ACCESS_TOKENS": 1, + "LOCALE": 2, + "COLOR_THEME": 3, } ) @@ -79,21 +79,24 @@ type LocaleUserSetting int32 const ( LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED LocaleUserSetting = 0 - LocaleUserSetting_LOCALE_USER_SETTING_EN LocaleUserSetting = 1 - LocaleUserSetting_LOCALE_USER_SETTING_ZH LocaleUserSetting = 2 + LocaleUserSetting_EN LocaleUserSetting = 1 + LocaleUserSetting_ZH LocaleUserSetting = 2 + LocaleUserSetting_FR LocaleUserSetting = 3 ) // Enum value maps for LocaleUserSetting. var ( LocaleUserSetting_name = map[int32]string{ 0: "LOCALE_USER_SETTING_UNSPECIFIED", - 1: "LOCALE_USER_SETTING_EN", - 2: "LOCALE_USER_SETTING_ZH", + 1: "EN", + 2: "ZH", + 3: "FR", } LocaleUserSetting_value = map[string]int32{ "LOCALE_USER_SETTING_UNSPECIFIED": 0, - "LOCALE_USER_SETTING_EN": 1, - "LOCALE_USER_SETTING_ZH": 2, + "EN": 1, + "ZH": 2, + "FR": 3, } ) @@ -128,24 +131,24 @@ type ColorThemeUserSetting int32 const ( ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED ColorThemeUserSetting = 0 - ColorThemeUserSetting_COLOR_THEME_USER_SETTING_SYSTEM ColorThemeUserSetting = 1 - ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT ColorThemeUserSetting = 2 - ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK ColorThemeUserSetting = 3 + ColorThemeUserSetting_SYSTEM ColorThemeUserSetting = 1 + ColorThemeUserSetting_LIGHT ColorThemeUserSetting = 2 + ColorThemeUserSetting_DARK ColorThemeUserSetting = 3 ) // Enum value maps for ColorThemeUserSetting. var ( ColorThemeUserSetting_name = map[int32]string{ 0: "COLOR_THEME_USER_SETTING_UNSPECIFIED", - 1: "COLOR_THEME_USER_SETTING_SYSTEM", - 2: "COLOR_THEME_USER_SETTING_LIGHT", - 3: "COLOR_THEME_USER_SETTING_DARK", + 1: "SYSTEM", + 2: "LIGHT", + 3: "DARK", } ColorThemeUserSetting_value = map[string]int32{ "COLOR_THEME_USER_SETTING_UNSPECIFIED": 0, - "COLOR_THEME_USER_SETTING_SYSTEM": 1, - "COLOR_THEME_USER_SETTING_LIGHT": 2, - "COLOR_THEME_USER_SETTING_DARK": 3, + "SYSTEM": 1, + "LIGHT": 2, + "DARK": 3, } ) @@ -428,45 +431,36 @@ var file_store_user_setting_proto_rawDesc = []byte{ 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x89, 0x01, - 0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, - 0x12, 0x20, 0x0a, 0x1c, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, - 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, - 0x4e, 0x47, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x53, - 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, - 0x4e, 0x47, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x55, - 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x4f, 0x4c, 0x4f, - 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x70, 0x0a, 0x11, 0x4c, 0x6f, 0x63, - 0x61, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, - 0x0a, 0x1f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, - 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x55, 0x53, - 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x4e, 0x10, 0x01, 0x12, - 0x1a, 0x0a, 0x16, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, - 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x5a, 0x48, 0x10, 0x02, 0x2a, 0xad, 0x01, 0x0a, 0x15, - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x24, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, - 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, - 0x47, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x23, 0x0a, 0x1f, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, - 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x59, 0x53, 0x54, - 0x45, 0x4d, 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, - 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, - 0x5f, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x02, 0x12, 0x21, 0x0a, 0x1d, 0x43, 0x4f, 0x4c, 0x4f, - 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, - 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x42, 0xa1, 0x01, 0x0a, 0x0f, - 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, - 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x79, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, - 0x6c, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x53, 0x6c, 0x61, - 0x73, 0x68, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, - 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x62, 0x0a, + 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, + 0x20, 0x0a, 0x1c, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, + 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x4f, 0x4b, 0x45, + 0x4e, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x10, 0x02, + 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x10, + 0x03, 0x2a, 0x50, 0x0a, 0x11, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, + 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, + 0x4e, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x5a, 0x48, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x46, + 0x52, 0x10, 0x03, 0x2a, 0x62, 0x0a, 0x15, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x24, + 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, + 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, + 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x02, 0x12, 0x08, 0x0a, + 0x04, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x42, 0xa1, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, + 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x10, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x6f, 0x75, 0x72, + 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x53, + 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, 0x74, 0x6f, + 0x72, 0x65, 0xe2, 0x02, 0x17, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x53, + 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/proto/store/user_setting.proto b/proto/store/user_setting.proto index 95a8dfa..3f2758e 100644 --- a/proto/store/user_setting.proto +++ b/proto/store/user_setting.proto @@ -21,11 +21,11 @@ message UserSetting { enum UserSettingKey { USER_SETTING_KEY_UNSPECIFIED = 0; // Access tokens for the user. - USER_SETTING_ACCESS_TOKENS = 1; + ACCESS_TOKENS = 1; // Locale for the user. - USER_SETTING_LOCALE = 2; + LOCALE = 2; // Color theme for the user. - USER_SETTING_COLOR_THEME = 3; + COLOR_THEME = 3; } message AccessTokensUserSetting { @@ -41,13 +41,14 @@ message AccessTokensUserSetting { enum LocaleUserSetting { LOCALE_USER_SETTING_UNSPECIFIED = 0; - LOCALE_USER_SETTING_EN = 1; - LOCALE_USER_SETTING_ZH = 2; + EN = 1; + ZH = 2; + FR = 3; } enum ColorThemeUserSetting { COLOR_THEME_USER_SETTING_UNSPECIFIED = 0; - COLOR_THEME_USER_SETTING_SYSTEM = 1; - COLOR_THEME_USER_SETTING_LIGHT = 2; - COLOR_THEME_USER_SETTING_DARK = 3; + SYSTEM = 1; + LIGHT = 2; + DARK = 3; } diff --git a/server/route/api/v1/user_service.go b/server/route/api/v1/user_service.go index 48dbc54..926a93e 100644 --- a/server/route/api/v1/user_service.go +++ b/server/route/api/v1/user_service.go @@ -260,7 +260,7 @@ func (s *APIV1Service) DeleteUserAccessToken(ctx context.Context, request *apiv1 } if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, + Key: storepb.UserSettingKey_ACCESS_TOKENS, Value: &storepb.UserSetting_AccessTokens{ AccessTokens: &storepb.AccessTokensUserSetting{ AccessTokens: updatedUserAccessTokens, @@ -285,7 +285,7 @@ func (s *APIV1Service) UpsertAccessTokenToStore(ctx context.Context, user *store userAccessTokens = append(userAccessTokens, &userAccessToken) if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, + Key: storepb.UserSettingKey_ACCESS_TOKENS, Value: &storepb.UserSetting_AccessTokens{ AccessTokens: &storepb.AccessTokensUserSetting{ AccessTokens: userAccessTokens, diff --git a/server/route/api/v1/user_setting_service.go b/server/route/api/v1/user_setting_service.go index 59e89e7..34138c0 100644 --- a/server/route/api/v1/user_setting_service.go +++ b/server/route/api/v1/user_setting_service.go @@ -35,7 +35,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *apiv1pb.U if path == "locale" { if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_LOCALE, + Key: storepb.UserSettingKey_LOCALE, Value: &storepb.UserSetting_Locale{ Locale: convertUserSettingLocaleToStore(request.UserSetting.Locale), }, @@ -45,7 +45,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *apiv1pb.U } else if path == "color_theme" { if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_COLOR_THEME, + Key: storepb.UserSettingKey_COLOR_THEME, Value: &storepb.UserSetting_ColorTheme{ ColorTheme: convertUserSettingColorThemeToStore(request.UserSetting.ColorTheme), }, @@ -80,9 +80,9 @@ func getUserSetting(ctx context.Context, s *store.Store, userID int32) (*apiv1pb ColorTheme: apiv1pb.UserSetting_COLOR_THEME_SYSTEM, } for _, setting := range userSettings { - if setting.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { + if setting.Key == storepb.UserSettingKey_LOCALE { userSetting.Locale = convertUserSettingLocaleFromStore(setting.GetLocale()) - } else if setting.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { + } else if setting.Key == storepb.UserSettingKey_COLOR_THEME { userSetting.ColorTheme = convertUserSettingColorThemeFromStore(setting.GetColorTheme()) } } @@ -92,9 +92,11 @@ func getUserSetting(ctx context.Context, s *store.Store, userID int32) (*apiv1pb func convertUserSettingLocaleToStore(locale apiv1pb.UserSetting_Locale) storepb.LocaleUserSetting { switch locale { case apiv1pb.UserSetting_LOCALE_EN: - return storepb.LocaleUserSetting_LOCALE_USER_SETTING_EN + return storepb.LocaleUserSetting_EN case apiv1pb.UserSetting_LOCALE_ZH: - return storepb.LocaleUserSetting_LOCALE_USER_SETTING_ZH + return storepb.LocaleUserSetting_ZH + case apiv1pb.UserSetting_LOCALE_FR: + return storepb.LocaleUserSetting_FR default: return storepb.LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED } @@ -102,10 +104,12 @@ func convertUserSettingLocaleToStore(locale apiv1pb.UserSetting_Locale) storepb. func convertUserSettingLocaleFromStore(locale storepb.LocaleUserSetting) apiv1pb.UserSetting_Locale { switch locale { - case storepb.LocaleUserSetting_LOCALE_USER_SETTING_EN: + case storepb.LocaleUserSetting_EN: return apiv1pb.UserSetting_LOCALE_EN - case storepb.LocaleUserSetting_LOCALE_USER_SETTING_ZH: + case storepb.LocaleUserSetting_ZH: return apiv1pb.UserSetting_LOCALE_ZH + case storepb.LocaleUserSetting_FR: + return apiv1pb.UserSetting_LOCALE_FR default: return apiv1pb.UserSetting_LOCALE_UNSPECIFIED } @@ -114,11 +118,11 @@ func convertUserSettingLocaleFromStore(locale storepb.LocaleUserSetting) apiv1pb func convertUserSettingColorThemeToStore(colorTheme apiv1pb.UserSetting_ColorTheme) storepb.ColorThemeUserSetting { switch colorTheme { case apiv1pb.UserSetting_COLOR_THEME_SYSTEM: - return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_SYSTEM + return storepb.ColorThemeUserSetting_SYSTEM case apiv1pb.UserSetting_COLOR_THEME_LIGHT: - return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT + return storepb.ColorThemeUserSetting_LIGHT case apiv1pb.UserSetting_COLOR_THEME_DARK: - return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK + return storepb.ColorThemeUserSetting_DARK default: return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED } @@ -126,11 +130,11 @@ func convertUserSettingColorThemeToStore(colorTheme apiv1pb.UserSetting_ColorThe func convertUserSettingColorThemeFromStore(colorTheme storepb.ColorThemeUserSetting) apiv1pb.UserSetting_ColorTheme { switch colorTheme { - case storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_SYSTEM: + case storepb.ColorThemeUserSetting_SYSTEM: return apiv1pb.UserSetting_COLOR_THEME_SYSTEM - case storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT: + case storepb.ColorThemeUserSetting_LIGHT: return apiv1pb.UserSetting_COLOR_THEME_LIGHT - case storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK: + case storepb.ColorThemeUserSetting_DARK: return apiv1pb.UserSetting_COLOR_THEME_DARK default: return apiv1pb.UserSetting_COLOR_THEME_UNSPECIFIED diff --git a/server/server.go b/server/server.go index 287a883..f1788de 100644 --- a/server/server.go +++ b/server/server.go @@ -87,7 +87,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store func (s *Server) Start(ctx context.Context) error { // Load subscription. if _, err := s.licenseService.LoadSubscription(ctx); err != nil { - slog.Error("failed to load subscription", err) + slog.Error("failed to load subscription", slog.Any("error", err)) } // Start gRPC server. listen, err := net.Listen("tcp", fmt.Sprintf(":%d", s.Profile.Port+1)) diff --git a/store/db/postgres/user_setting.go b/store/db/postgres/user_setting.go index 9cd3188..39ca6dd 100644 --- a/store/db/postgres/user_setting.go +++ b/store/db/postgres/user_setting.go @@ -23,15 +23,15 @@ func (d *DB) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting) ` var valueString string - if upsert.Key == storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS { + if upsert.Key == storepb.UserSettingKey_ACCESS_TOKENS { valueBytes, err := protojson.Marshal(upsert.GetAccessTokens()) if err != nil { return nil, err } valueString = string(valueBytes) - } else if upsert.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { + } else if upsert.Key == storepb.UserSettingKey_LOCALE { valueString = upsert.GetLocale().String() - } else if upsert.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { + } else if upsert.Key == storepb.UserSettingKey_COLOR_THEME { valueString = upsert.GetColorTheme().String() } else { return nil, errors.New("invalid user setting key") @@ -80,7 +80,7 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting) return nil, err } userSetting.Key = storepb.UserSettingKey(storepb.UserSettingKey_value[keyString]) - if userSetting.Key == storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS { + if userSetting.Key == storepb.UserSettingKey_ACCESS_TOKENS { accessTokensUserSetting := &storepb.AccessTokensUserSetting{} if err := protojson.Unmarshal([]byte(valueString), accessTokensUserSetting); err != nil { return nil, err @@ -88,16 +88,17 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting) userSetting.Value = &storepb.UserSetting_AccessTokens{ AccessTokens: accessTokensUserSetting, } - } else if userSetting.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { + } else if userSetting.Key == storepb.UserSettingKey_LOCALE { userSetting.Value = &storepb.UserSetting_Locale{ Locale: storepb.LocaleUserSetting(storepb.LocaleUserSetting_value[valueString]), } - } else if userSetting.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { + } else if userSetting.Key == storepb.UserSettingKey_COLOR_THEME { userSetting.Value = &storepb.UserSetting_ColorTheme{ ColorTheme: storepb.ColorThemeUserSetting(storepb.ColorThemeUserSetting_value[valueString]), } } else { - return nil, errors.New("invalid user setting key") + // Skip unknown key. + continue } userSettingList = append(userSettingList, userSetting) } diff --git a/store/db/sqlite/user_setting.go b/store/db/sqlite/user_setting.go index ce814e2..6136d8c 100644 --- a/store/db/sqlite/user_setting.go +++ b/store/db/sqlite/user_setting.go @@ -22,15 +22,15 @@ func (d *DB) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting) SET value = EXCLUDED.value ` var valueString string - if upsert.Key == storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS { + if upsert.Key == storepb.UserSettingKey_ACCESS_TOKENS { valueBytes, err := protojson.Marshal(upsert.GetAccessTokens()) if err != nil { return nil, err } valueString = string(valueBytes) - } else if upsert.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { + } else if upsert.Key == storepb.UserSettingKey_LOCALE { valueString = upsert.GetLocale().String() - } else if upsert.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { + } else if upsert.Key == storepb.UserSettingKey_COLOR_THEME { valueString = upsert.GetColorTheme().String() } else { return nil, errors.New("invalid user setting key") @@ -79,7 +79,7 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting) return nil, err } userSetting.Key = storepb.UserSettingKey(storepb.UserSettingKey_value[keyString]) - if userSetting.Key == storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS { + if userSetting.Key == storepb.UserSettingKey_ACCESS_TOKENS { accessTokensUserSetting := &storepb.AccessTokensUserSetting{} if err := protojson.Unmarshal([]byte(valueString), accessTokensUserSetting); err != nil { return nil, err @@ -87,16 +87,17 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting) userSetting.Value = &storepb.UserSetting_AccessTokens{ AccessTokens: accessTokensUserSetting, } - } else if userSetting.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { + } else if userSetting.Key == storepb.UserSettingKey_LOCALE { userSetting.Value = &storepb.UserSetting_Locale{ Locale: storepb.LocaleUserSetting(storepb.LocaleUserSetting_value[valueString]), } - } else if userSetting.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { + } else if userSetting.Key == storepb.UserSettingKey_COLOR_THEME { userSetting.Value = &storepb.UserSetting_ColorTheme{ ColorTheme: storepb.ColorThemeUserSetting(storepb.ColorThemeUserSetting_value[valueString]), } } else { - return nil, errors.New("invalid user setting key") + // Skip unknown key. + continue } userSettingList = append(userSettingList, userSetting) } diff --git a/store/user_setting.go b/store/user_setting.go index 3bcd703..d73c31e 100644 --- a/store/user_setting.go +++ b/store/user_setting.go @@ -57,7 +57,7 @@ func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*sto func (s *Store) GetUserAccessTokens(ctx context.Context, userID int32) ([]*storepb.AccessTokensUserSetting_AccessToken, error) { userSetting, err := s.GetUserSetting(ctx, &FindUserSetting{ UserID: &userID, - Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, + Key: storepb.UserSettingKey_ACCESS_TOKENS, }) if err != nil { return nil, err diff --git a/test/store/user_setting_test.go b/test/store/user_setting_test.go index 0aa097b..1a2eee0 100644 --- a/test/store/user_setting_test.go +++ b/test/store/user_setting_test.go @@ -24,7 +24,7 @@ func TestUserSettingStore(t *testing.T) { // Test for access tokens user setting. accessTokensUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, + Key: storepb.UserSettingKey_ACCESS_TOKENS, Value: &storepb.UserSetting_AccessTokens{ AccessTokens: &storepb.AccessTokensUserSetting{ AccessTokens: []*storepb.AccessTokensUserSetting_AccessToken{ @@ -37,7 +37,7 @@ func TestUserSettingStore(t *testing.T) { }) require.NoError(t, err) require.NotNil(t, accessTokensUserSetting) - require.Equal(t, storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, accessTokensUserSetting.Key) + require.Equal(t, storepb.UserSettingKey_ACCESS_TOKENS, accessTokensUserSetting.Key) require.Equal(t, user.ID, accessTokensUserSetting.UserId) require.Equal(t, 1, len(accessTokensUserSetting.GetAccessTokens().AccessTokens)) userSettings, err = ts.ListUserSettings(ctx, &store.FindUserSetting{ @@ -48,7 +48,7 @@ func TestUserSettingStore(t *testing.T) { require.Equal(t, accessTokensUserSetting, userSettings[0]) accessTokensUserSetting, err = ts.GetUserSetting(ctx, &store.FindUserSetting{ UserID: &user.ID, - Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, + Key: storepb.UserSettingKey_ACCESS_TOKENS, }) require.NoError(t, err) require.NotNil(t, accessTokensUserSetting) @@ -56,7 +56,7 @@ func TestUserSettingStore(t *testing.T) { require.Equal(t, "test_access_token", accessTokensUserSetting.GetAccessTokens().AccessTokens[0].AccessToken) accessTokensUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, + Key: storepb.UserSettingKey_ACCESS_TOKENS, Value: &storepb.UserSetting_AccessTokens{ AccessTokens: &storepb.AccessTokensUserSetting{ AccessTokens: []*storepb.AccessTokensUserSetting_AccessToken{ @@ -77,44 +77,44 @@ func TestUserSettingStore(t *testing.T) { // Test for locale user setting. localeUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_LOCALE, + Key: storepb.UserSettingKey_LOCALE, Value: &storepb.UserSetting_Locale{ - Locale: storepb.LocaleUserSetting_LOCALE_USER_SETTING_ZH, + Locale: storepb.LocaleUserSetting_ZH, }, }) require.NoError(t, err) require.NotNil(t, localeUserSetting) - require.Equal(t, storepb.UserSettingKey_USER_SETTING_LOCALE, localeUserSetting.Key) - require.Equal(t, storepb.LocaleUserSetting_LOCALE_USER_SETTING_ZH, localeUserSetting.GetLocale()) + require.Equal(t, storepb.UserSettingKey_LOCALE, localeUserSetting.Key) + require.Equal(t, storepb.LocaleUserSetting_ZH, localeUserSetting.GetLocale()) localeUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_LOCALE, + Key: storepb.UserSettingKey_LOCALE, Value: &storepb.UserSetting_Locale{ - Locale: storepb.LocaleUserSetting_LOCALE_USER_SETTING_EN, + Locale: storepb.LocaleUserSetting_EN, }, }) require.NoError(t, err) - require.Equal(t, storepb.LocaleUserSetting_LOCALE_USER_SETTING_EN, localeUserSetting.GetLocale()) + require.Equal(t, storepb.LocaleUserSetting_EN, localeUserSetting.GetLocale()) // Test for color theme user setting. colorThemeUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_COLOR_THEME, + Key: storepb.UserSettingKey_COLOR_THEME, Value: &storepb.UserSetting_ColorTheme{ - ColorTheme: storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT, + ColorTheme: storepb.ColorThemeUserSetting_LIGHT, }, }) require.NoError(t, err) require.NotNil(t, colorThemeUserSetting) - require.Equal(t, storepb.UserSettingKey_USER_SETTING_COLOR_THEME, colorThemeUserSetting.Key) - require.Equal(t, storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT, colorThemeUserSetting.GetColorTheme()) + require.Equal(t, storepb.UserSettingKey_COLOR_THEME, colorThemeUserSetting.Key) + require.Equal(t, storepb.ColorThemeUserSetting_LIGHT, colorThemeUserSetting.GetColorTheme()) colorThemeUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{ UserId: user.ID, - Key: storepb.UserSettingKey_USER_SETTING_COLOR_THEME, + Key: storepb.UserSettingKey_COLOR_THEME, Value: &storepb.UserSetting_ColorTheme{ - ColorTheme: storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK, + ColorTheme: storepb.ColorThemeUserSetting_DARK, }, }) require.NoError(t, err) - require.Equal(t, storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK, colorThemeUserSetting.GetColorTheme()) + require.Equal(t, storepb.ColorThemeUserSetting_DARK, colorThemeUserSetting.GetColorTheme()) }