From 50dd603388733c8a5c0f102c11cd78569856f1e0 Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 19:43:36 +0530 Subject: [PATCH 01/11] chore: adds /local get endpoint to put locale for user --- backend/api/src/routes/locale.ts | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 backend/api/src/routes/locale.ts diff --git a/backend/api/src/routes/locale.ts b/backend/api/src/routes/locale.ts new file mode 100644 index 00000000..44a4227c --- /dev/null +++ b/backend/api/src/routes/locale.ts @@ -0,0 +1,43 @@ +import { extractClientId } from "@paybox/backend-common"; +import { ChangeLocaleSchema, dbResStatus, responseStatus } from "@paybox/common"; +import { Router } from "express"; +import {updateLocale} from "@paybox/backend-common"; + +export const localeRouter = Router(); + +/** + * Updates user locale + */ +localeRouter.get('/', extractClientId, async (req, res) => { + try { + //@ts-ignore + const id = req.id; + if(id) { + const {locale} = ChangeLocaleSchema.parse(req.query); + + //todo: save locale to db + const {status} = await updateLocale(locale, id); + if(status == dbResStatus.Error) { + return res.status(500).json({ + message: "Error updating locale...", + status: responseStatus.Error + }); + } + + return res.status(200).json({ + message: "Locale updated successfully...", + status: responseStatus.Ok + }); + } + return res.status(401).json({ + message: "Auth Error, Please login again...", + status: responseStatus.Error + }); + } catch (error) { + console.log(error); + return res.status(500).json({ + message: 'Internal server error', + status: responseStatus.Ok + }) + } +}); \ No newline at end of file From 53c32344def24d08c9d7f7ad1f3fc8926357952f Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:36:29 +0530 Subject: [PATCH 02/11] chore: enums and valid for locale --- packages/common/src/enum.ts | 12 ++++++++++++ packages/common/src/validations/index.ts | 3 ++- packages/common/src/validations/locale.ts | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/common/src/validations/locale.ts diff --git a/packages/common/src/enum.ts b/packages/common/src/enum.ts index 765c9ab5..05eca32d 100644 --- a/packages/common/src/enum.ts +++ b/packages/common/src/enum.ts @@ -173,4 +173,16 @@ export enum TxnStatus { Completed = "completed", Rejected = "rejected", Pending = "pending", +} + +export enum Locales { + en = "en", + es = "es", + de = "de", + hi = "hi", + fr = "fr", + ja = "ja", + ko = "ko", + ru = "ru", + zh = "zh", } \ No newline at end of file diff --git a/packages/common/src/validations/index.ts b/packages/common/src/validations/index.ts index f3b173d7..8f08f26b 100644 --- a/packages/common/src/validations/index.ts +++ b/packages/common/src/validations/index.ts @@ -9,4 +9,5 @@ export * from "./sol"; export * from "./eth"; export * from "./friendship"; export * from "./notification"; -export * from "./buy"; \ No newline at end of file +export * from "./buy"; +export * from "./locale"; \ No newline at end of file diff --git a/packages/common/src/validations/locale.ts b/packages/common/src/validations/locale.ts new file mode 100644 index 00000000..434ea255 --- /dev/null +++ b/packages/common/src/validations/locale.ts @@ -0,0 +1,6 @@ +import z from "zod"; +import { Locales } from "../enum"; + +export const ChangeLocaleSchema = z.object({ + locale: z.nativeEnum(Locales).default(Locales.en) +}); \ No newline at end of file From 1f90528cda48b0f450c849eda315c65a1439bb30 Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:36:51 +0530 Subject: [PATCH 03/11] chore: adds locale atom --- packages/recoil/src/atoms/index.tsx | 1 + packages/recoil/src/atoms/locale.tsx | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 packages/recoil/src/atoms/locale.tsx diff --git a/packages/recoil/src/atoms/index.tsx b/packages/recoil/src/atoms/index.tsx index b97000ff..15d0e69e 100644 --- a/packages/recoil/src/atoms/index.tsx +++ b/packages/recoil/src/atoms/index.tsx @@ -4,3 +4,4 @@ export * from "./wallet"; export * from "./friendship"; export * from "./notif"; export * from "./quote"; +export * from "./locale"; diff --git a/packages/recoil/src/atoms/locale.tsx b/packages/recoil/src/atoms/locale.tsx new file mode 100644 index 00000000..ea289e40 --- /dev/null +++ b/packages/recoil/src/atoms/locale.tsx @@ -0,0 +1,7 @@ +import { Locales } from "@paybox/common"; +import { atom } from "recoil"; + +export const localeAtom = atom({ + default: Locales.en, + key: "localeAtom", +}) \ No newline at end of file From 9178b9acb814d994128c9f700f3a5737a619e92f Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:37:13 +0530 Subject: [PATCH 04/11] chore: get locale endpoint --- backend/api/src/routes/locale.ts | 34 ++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/backend/api/src/routes/locale.ts b/backend/api/src/routes/locale.ts index 44a4227c..f316fcee 100644 --- a/backend/api/src/routes/locale.ts +++ b/backend/api/src/routes/locale.ts @@ -2,6 +2,7 @@ import { extractClientId } from "@paybox/backend-common"; import { ChangeLocaleSchema, dbResStatus, responseStatus } from "@paybox/common"; import { Router } from "express"; import {updateLocale} from "@paybox/backend-common"; +import { getLocale } from "../db/locale"; export const localeRouter = Router(); @@ -14,7 +15,6 @@ localeRouter.get('/', extractClientId, async (req, res) => { const id = req.id; if(id) { const {locale} = ChangeLocaleSchema.parse(req.query); - //todo: save locale to db const {status} = await updateLocale(locale, id); if(status == dbResStatus.Error) { @@ -40,4 +40,34 @@ localeRouter.get('/', extractClientId, async (req, res) => { status: responseStatus.Ok }) } -}); \ No newline at end of file +}); + +localeRouter.get('/locale', extractClientId, async (req, res) => { + try { + //@ts-ignore + const id = req.id; + if(id) { + const {status, locale} = await getLocale(id); + if(status == dbResStatus.Error || !locale) { + return res.status(404).json({ + msg: "Database Query error", + status: responseStatus.Error + }); + } + return res.status(200).json({ + locale, + status: responseStatus.Ok + }); + } + return res.status(401).json({ + message: "Auth Error, Please login again...", + status: responseStatus.Error + }); + } catch (error) { + console.log(error); + return res.status(500).json({ + message: 'Internal server error', + status: responseStatus.Ok + }) + } +}) \ No newline at end of file From 38d92de282de6b8bc0bda8c5a610a72e574ae8c5 Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:37:48 +0530 Subject: [PATCH 05/11] chore: adds get locale queuy function --- backend/backend-common/src/db/locale.ts | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 backend/backend-common/src/db/locale.ts diff --git a/backend/backend-common/src/db/locale.ts b/backend/backend-common/src/db/locale.ts new file mode 100644 index 00000000..35026061 --- /dev/null +++ b/backend/backend-common/src/db/locale.ts @@ -0,0 +1,44 @@ +import { Chain, order_by } from "@paybox/zeus"; +import { HASURA_URL, JWT } from "../config"; +import { Address, HASURA_ADMIN_SERCRET, Locales, NotifType, TopicTypes, dbResStatus } from "@paybox/common"; + +const chain = Chain(HASURA_URL, { + headers: { + Authorization: `Bearer ${JWT}`, + "x-hasura-admin-secret": HASURA_ADMIN_SERCRET, + }, +}); + +/** + * updateLocale for signed up client + * @param locale + * @param clientId + * @returns + */ +export const updateLocale = async ( + locale: Locales, + clientId: string, +): Promise<{ + status: dbResStatus +}> => { + const response = await chain("mutation")({ + update_client_settings: [{ + where: { + clientId: {_eq: clientId} + }, + _set: { + locale + } + }, { + affected_rows: true, + }] + }, {operationName: "update_client_settings"}); + if(response.update_client_settings?.affected_rows === 1) { + return { + status: dbResStatus.Ok + } + } + return { + status: dbResStatus.Error + } +} \ No newline at end of file From 0ff12e3b3eba5328a0a484b5e0ece59b1164fac0 Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:38:29 +0530 Subject: [PATCH 06/11] chore: changing lang attribute to locale in client settings --- .../tables/public_client_settings.yaml | 3 + .../down.sql | 1 + .../up.sql | 1 + backend/zeus/src/codegen/types.ts | 47 +++- backend/zeus/src/zeus/const.ts | 30 ++- backend/zeus/src/zeus/index.ts | 250 +++++++++++++++--- 6 files changed, 283 insertions(+), 49 deletions(-) create mode 100644 backend/hasura/hasura/migrations/default/1713616945407_alter_table_public_client_settings_alter_column_lang/down.sql create mode 100644 backend/hasura/hasura/migrations/default/1713616945407_alter_table_public_client_settings_alter_column_lang/up.sql diff --git a/backend/hasura/hasura/metadata/databases/default/tables/public_client_settings.yaml b/backend/hasura/hasura/metadata/databases/default/tables/public_client_settings.yaml index bc3b1836..3991074e 100644 --- a/backend/hasura/hasura/metadata/databases/default/tables/public_client_settings.yaml +++ b/backend/hasura/hasura/metadata/databases/default/tables/public_client_settings.yaml @@ -7,6 +7,8 @@ configuration: custom_name: clientId created_at: custom_name: createdAt + locale: + custom_name: locale prefered_explorer: custom_name: preferedExplorer prefered_wallet: @@ -16,6 +18,7 @@ configuration: custom_column_names: client_id: clientId created_at: createdAt + locale: locale prefered_explorer: preferedExplorer prefered_wallet: preferedWallet updated_at: updatedAt diff --git a/backend/hasura/hasura/migrations/default/1713616945407_alter_table_public_client_settings_alter_column_lang/down.sql b/backend/hasura/hasura/migrations/default/1713616945407_alter_table_public_client_settings_alter_column_lang/down.sql new file mode 100644 index 00000000..d8b1e4ab --- /dev/null +++ b/backend/hasura/hasura/migrations/default/1713616945407_alter_table_public_client_settings_alter_column_lang/down.sql @@ -0,0 +1 @@ +alter table "public"."client_settings" rename column "locale" to "lang"; diff --git a/backend/hasura/hasura/migrations/default/1713616945407_alter_table_public_client_settings_alter_column_lang/up.sql b/backend/hasura/hasura/migrations/default/1713616945407_alter_table_public_client_settings_alter_column_lang/up.sql new file mode 100644 index 00000000..5d6b779a --- /dev/null +++ b/backend/hasura/hasura/migrations/default/1713616945407_alter_table_public_client_settings_alter_column_lang/up.sql @@ -0,0 +1 @@ +alter table "public"."client_settings" rename column "lang" to "locale"; diff --git a/backend/zeus/src/codegen/types.ts b/backend/zeus/src/codegen/types.ts index 1ed2eae2..39120bae 100644 --- a/backend/zeus/src/codegen/types.ts +++ b/backend/zeus/src/codegen/types.ts @@ -1939,6 +1939,8 @@ export type Client = { chats_aggregate: Chat_Aggregate; /** An object relationship */ client_setting?: Maybe; + /** An object relationship */ + connection?: Maybe; createdAt?: Maybe; email: Scalars['String']['output']; firstname?: Maybe; @@ -2204,6 +2206,7 @@ export type Client_Bool_Exp = { chats?: InputMaybe; chats_aggregate?: InputMaybe; client_setting?: InputMaybe; + connection?: InputMaybe; createdAt?: InputMaybe; email?: InputMaybe; firstname?: InputMaybe; @@ -2248,6 +2251,7 @@ export type Client_Insert_Input = { centralized_txns?: InputMaybe; chats?: InputMaybe; client_setting?: InputMaybe; + connection?: InputMaybe; createdAt?: InputMaybe; email?: InputMaybe; firstname?: InputMaybe; @@ -2324,6 +2328,7 @@ export type Client_Order_By = { centralized_txns_aggregate?: InputMaybe; chats_aggregate?: InputMaybe; client_setting?: InputMaybe; + connection?: InputMaybe; createdAt?: InputMaybe; email?: InputMaybe; firstname?: InputMaybe; @@ -2391,9 +2396,11 @@ export type Client_Settings = { /** An object relationship */ client: Client; clientId: Scalars['uuid']['output']; + /** An object relationship */ + connection?: Maybe; createdAt: Scalars['timestamptz']['output']; id: Scalars['uuid']['output']; - lang: Scalars['String']['output']; + locale: Scalars['String']['output']; preferedExplorer: Scalars['String']['output']; preferedWallet: Scalars['String']['output']; testmode: Scalars['Boolean']['output']; @@ -2429,9 +2436,10 @@ export type Client_Settings_Bool_Exp = { _or?: InputMaybe>; client?: InputMaybe; clientId?: InputMaybe; + connection?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; - lang?: InputMaybe; + locale?: InputMaybe; preferedExplorer?: InputMaybe; preferedWallet?: InputMaybe; testmode?: InputMaybe; @@ -2450,9 +2458,10 @@ export enum Client_Settings_Constraint { export type Client_Settings_Insert_Input = { client?: InputMaybe; clientId?: InputMaybe; + connection?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; - lang?: InputMaybe; + locale?: InputMaybe; preferedExplorer?: InputMaybe; preferedWallet?: InputMaybe; testmode?: InputMaybe; @@ -2465,7 +2474,7 @@ export type Client_Settings_Max_Fields = { clientId?: Maybe; createdAt?: Maybe; id?: Maybe; - lang?: Maybe; + locale?: Maybe; preferedExplorer?: Maybe; preferedWallet?: Maybe; updatedAt?: Maybe; @@ -2477,7 +2486,7 @@ export type Client_Settings_Min_Fields = { clientId?: Maybe; createdAt?: Maybe; id?: Maybe; - lang?: Maybe; + locale?: Maybe; preferedExplorer?: Maybe; preferedWallet?: Maybe; updatedAt?: Maybe; @@ -2510,9 +2519,10 @@ export type Client_Settings_On_Conflict = { export type Client_Settings_Order_By = { client?: InputMaybe; clientId?: InputMaybe; + connection?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; - lang?: InputMaybe; + locale?: InputMaybe; preferedExplorer?: InputMaybe; preferedWallet?: InputMaybe; testmode?: InputMaybe; @@ -2533,7 +2543,7 @@ export enum Client_Settings_Select_Column { /** column name */ Id = 'id', /** column name */ - Lang = 'lang', + Locale = 'locale', /** column name */ PreferedExplorer = 'preferedExplorer', /** column name */ @@ -2549,7 +2559,7 @@ export type Client_Settings_Set_Input = { clientId?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; - lang?: InputMaybe; + locale?: InputMaybe; preferedExplorer?: InputMaybe; preferedWallet?: InputMaybe; testmode?: InputMaybe; @@ -2569,7 +2579,7 @@ export type Client_Settings_Stream_Cursor_Value_Input = { clientId?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; - lang?: InputMaybe; + locale?: InputMaybe; preferedExplorer?: InputMaybe; preferedWallet?: InputMaybe; testmode?: InputMaybe; @@ -2585,7 +2595,7 @@ export enum Client_Settings_Update_Column { /** column name */ Id = 'id', /** column name */ - Lang = 'lang', + Locale = 'locale', /** column name */ PreferedExplorer = 'preferedExplorer', /** column name */ @@ -2704,8 +2714,12 @@ export type Client_Variance_Fields = { export type Connections = { __typename?: 'connections'; btcNetwork: Scalars['String']['output']; + /** An object relationship */ + client: Client; clientId: Scalars['uuid']['output']; clientSettingsId: Scalars['uuid']['output']; + /** An object relationship */ + client_setting: Client_Settings; createdAt: Scalars['timestamptz']['output']; ethNetwork: Scalars['String']['output']; id: Scalars['uuid']['output']; @@ -2741,8 +2755,10 @@ export type Connections_Bool_Exp = { _not?: InputMaybe; _or?: InputMaybe>; btcNetwork?: InputMaybe; + client?: InputMaybe; clientId?: InputMaybe; clientSettingsId?: InputMaybe; + client_setting?: InputMaybe; createdAt?: InputMaybe; ethNetwork?: InputMaybe; id?: InputMaybe; @@ -2763,8 +2779,10 @@ export enum Connections_Constraint { /** input type for inserting data into table "connections" */ export type Connections_Insert_Input = { btcNetwork?: InputMaybe; + client?: InputMaybe; clientId?: InputMaybe; clientSettingsId?: InputMaybe; + client_setting?: InputMaybe; createdAt?: InputMaybe; ethNetwork?: InputMaybe; id?: InputMaybe; @@ -2807,6 +2825,13 @@ export type Connections_Mutation_Response = { returning: Array; }; +/** input type for inserting object relation for remote table "connections" */ +export type Connections_Obj_Rel_Insert_Input = { + data: Connections_Insert_Input; + /** upsert condition */ + on_conflict?: InputMaybe; +}; + /** on_conflict condition type for table "connections" */ export type Connections_On_Conflict = { constraint: Connections_Constraint; @@ -2817,8 +2842,10 @@ export type Connections_On_Conflict = { /** Ordering options when selecting data from "connections". */ export type Connections_Order_By = { btcNetwork?: InputMaybe; + client?: InputMaybe; clientId?: InputMaybe; clientSettingsId?: InputMaybe; + client_setting?: InputMaybe; createdAt?: InputMaybe; ethNetwork?: InputMaybe; id?: InputMaybe; diff --git a/backend/zeus/src/zeus/const.ts b/backend/zeus/src/zeus/const.ts index a9a08640..10197478 100644 --- a/backend/zeus/src/zeus/const.ts +++ b/backend/zeus/src/zeus/const.ts @@ -839,6 +839,7 @@ export const AllTypesProps: Record = { chats: "chat_bool_exp", chats_aggregate: "chat_aggregate_bool_exp", client_setting: "client_settings_bool_exp", + connection: "connections_bool_exp", createdAt: "timestamptz_comparison_exp", email: "String_comparison_exp", firstname: "String_comparison_exp", @@ -873,6 +874,7 @@ export const AllTypesProps: Record = { centralized_txns: "centralized_txn_arr_rel_insert_input", chats: "chat_arr_rel_insert_input", client_setting: "client_settings_obj_rel_insert_input", + connection: "connections_obj_rel_insert_input", createdAt: "timestamptz", friendships: "friendship_arr_rel_insert_input", friendshipsByClientid2: "friendship_arr_rel_insert_input", @@ -900,6 +902,7 @@ export const AllTypesProps: Record = { centralized_txns_aggregate: "centralized_txn_aggregate_order_by", chats_aggregate: "chat_aggregate_order_by", client_setting: "client_settings_order_by", + connection: "connections_order_by", createdAt: "order_by", email: "order_by", firstname: "order_by", @@ -939,9 +942,10 @@ export const AllTypesProps: Record = { _or: "client_settings_bool_exp", client: "client_bool_exp", clientId: "uuid_comparison_exp", + connection: "connections_bool_exp", createdAt: "timestamptz_comparison_exp", id: "uuid_comparison_exp", - lang: "String_comparison_exp", + locale: "String_comparison_exp", preferedExplorer: "String_comparison_exp", preferedWallet: "String_comparison_exp", testmode: "Boolean_comparison_exp", @@ -951,6 +955,7 @@ export const AllTypesProps: Record = { client_settings_insert_input: { client: "client_obj_rel_insert_input", clientId: "uuid", + connection: "connections_obj_rel_insert_input", createdAt: "timestamptz", id: "uuid", updatedAt: "timestamptz", @@ -967,9 +972,10 @@ export const AllTypesProps: Record = { client_settings_order_by: { client: "client_order_by", clientId: "order_by", + connection: "connections_order_by", createdAt: "order_by", id: "order_by", - lang: "order_by", + locale: "order_by", preferedExplorer: "order_by", preferedWallet: "order_by", testmode: "order_by", @@ -1026,8 +1032,10 @@ export const AllTypesProps: Record = { _not: "connections_bool_exp", _or: "connections_bool_exp", btcNetwork: "String_comparison_exp", + client: "client_bool_exp", clientId: "uuid_comparison_exp", clientSettingsId: "uuid_comparison_exp", + client_setting: "client_settings_bool_exp", createdAt: "timestamptz_comparison_exp", ethNetwork: "String_comparison_exp", id: "uuid_comparison_exp", @@ -1036,12 +1044,18 @@ export const AllTypesProps: Record = { }, connections_constraint: "enum" as const, connections_insert_input: { + client: "client_obj_rel_insert_input", clientId: "uuid", clientSettingsId: "uuid", + client_setting: "client_settings_obj_rel_insert_input", createdAt: "timestamptz", id: "uuid", updatedAt: "timestamptz", }, + connections_obj_rel_insert_input: { + data: "connections_insert_input", + on_conflict: "connections_on_conflict", + }, connections_on_conflict: { constraint: "connections_constraint", update_columns: "connections_update_column", @@ -1049,8 +1063,10 @@ export const AllTypesProps: Record = { }, connections_order_by: { btcNetwork: "order_by", + client: "client_order_by", clientId: "order_by", clientSettingsId: "order_by", + client_setting: "client_settings_order_by", createdAt: "order_by", ethNetwork: "order_by", id: "order_by", @@ -3504,6 +3520,7 @@ export const ReturnTypes: Record = { chats: "chat", chats_aggregate: "chat_aggregate", client_setting: "client_settings", + connection: "connections", createdAt: "timestamptz", email: "String", firstname: "String", @@ -3576,9 +3593,10 @@ export const ReturnTypes: Record = { client_settings: { client: "client", clientId: "uuid", + connection: "connections", createdAt: "timestamptz", id: "uuid", - lang: "String", + locale: "String", preferedExplorer: "String", preferedWallet: "String", testmode: "Boolean", @@ -3597,7 +3615,7 @@ export const ReturnTypes: Record = { clientId: "uuid", createdAt: "timestamptz", id: "uuid", - lang: "String", + locale: "String", preferedExplorer: "String", preferedWallet: "String", updatedAt: "timestamptz", @@ -3606,7 +3624,7 @@ export const ReturnTypes: Record = { clientId: "uuid", createdAt: "timestamptz", id: "uuid", - lang: "String", + locale: "String", preferedExplorer: "String", preferedWallet: "String", updatedAt: "timestamptz", @@ -3638,8 +3656,10 @@ export const ReturnTypes: Record = { }, connections: { btcNetwork: "String", + client: "client", clientId: "uuid", clientSettingsId: "uuid", + client_setting: "client_settings", createdAt: "timestamptz", ethNetwork: "String", id: "uuid", diff --git a/backend/zeus/src/zeus/index.ts b/backend/zeus/src/zeus/index.ts index 1d767a34..5f03171f 100644 --- a/backend/zeus/src/zeus/index.ts +++ b/backend/zeus/src/zeus/index.ts @@ -4089,6 +4089,8 @@ export type ValueTypes = { ]; /** An object relationship */ client_setting?: ValueTypes["client_settings"]; + /** An object relationship */ + connection?: ValueTypes["connections"]; createdAt?: boolean | `@${string}`; email?: boolean | `@${string}`; firstname?: boolean | `@${string}`; @@ -4602,6 +4604,11 @@ export type ValueTypes = { | undefined | null | Variable; + connection?: + | ValueTypes["connections_bool_exp"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["timestamptz_comparison_exp"] | undefined @@ -4746,6 +4753,11 @@ export type ValueTypes = { | undefined | null | Variable; + connection?: + | ValueTypes["connections_obj_rel_insert_input"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["timestamptz"] | undefined @@ -4878,6 +4890,11 @@ export type ValueTypes = { | undefined | null | Variable; + connection?: + | ValueTypes["connections_order_by"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["order_by"] | undefined @@ -4975,9 +4992,11 @@ export type ValueTypes = { /** An object relationship */ client?: ValueTypes["client"]; clientId?: boolean | `@${string}`; + /** An object relationship */ + connection?: ValueTypes["connections"]; createdAt?: boolean | `@${string}`; id?: boolean | `@${string}`; - lang?: boolean | `@${string}`; + locale?: boolean | `@${string}`; preferedExplorer?: boolean | `@${string}`; preferedWallet?: boolean | `@${string}`; testmode?: boolean | `@${string}`; @@ -5034,6 +5053,11 @@ export type ValueTypes = { | undefined | null | Variable; + connection?: + | ValueTypes["connections_bool_exp"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["timestamptz_comparison_exp"] | undefined @@ -5044,7 +5068,7 @@ export type ValueTypes = { | undefined | null | Variable; - lang?: + locale?: | ValueTypes["String_comparison_exp"] | undefined | null @@ -5080,13 +5104,18 @@ export type ValueTypes = { | null | Variable; clientId?: ValueTypes["uuid"] | undefined | null | Variable; + connection?: + | ValueTypes["connections_obj_rel_insert_input"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["timestamptz"] | undefined | null | Variable; id?: ValueTypes["uuid"] | undefined | null | Variable; - lang?: string | undefined | null | Variable; + locale?: string | undefined | null | Variable; preferedExplorer?: string | undefined | null | Variable; preferedWallet?: string | undefined | null | Variable; testmode?: boolean | undefined | null | Variable; @@ -5101,7 +5130,7 @@ export type ValueTypes = { clientId?: boolean | `@${string}`; createdAt?: boolean | `@${string}`; id?: boolean | `@${string}`; - lang?: boolean | `@${string}`; + locale?: boolean | `@${string}`; preferedExplorer?: boolean | `@${string}`; preferedWallet?: boolean | `@${string}`; updatedAt?: boolean | `@${string}`; @@ -5112,7 +5141,7 @@ export type ValueTypes = { clientId?: boolean | `@${string}`; createdAt?: boolean | `@${string}`; id?: boolean | `@${string}`; - lang?: boolean | `@${string}`; + locale?: boolean | `@${string}`; preferedExplorer?: boolean | `@${string}`; preferedWallet?: boolean | `@${string}`; updatedAt?: boolean | `@${string}`; @@ -5162,13 +5191,18 @@ export type ValueTypes = { | undefined | null | Variable; + connection?: + | ValueTypes["connections_order_by"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["order_by"] | undefined | null | Variable; id?: ValueTypes["order_by"] | undefined | null | Variable; - lang?: ValueTypes["order_by"] | undefined | null | Variable; + locale?: ValueTypes["order_by"] | undefined | null | Variable; preferedExplorer?: | ValueTypes["order_by"] | undefined @@ -5205,7 +5239,7 @@ export type ValueTypes = { | null | Variable; id?: ValueTypes["uuid"] | undefined | null | Variable; - lang?: string | undefined | null | Variable; + locale?: string | undefined | null | Variable; preferedExplorer?: string | undefined | null | Variable; preferedWallet?: string | undefined | null | Variable; testmode?: boolean | undefined | null | Variable; @@ -5237,7 +5271,7 @@ export type ValueTypes = { | null | Variable; id?: ValueTypes["uuid"] | undefined | null | Variable; - lang?: string | undefined | null | Variable; + locale?: string | undefined | null | Variable; preferedExplorer?: string | undefined | null | Variable; preferedWallet?: string | undefined | null | Variable; testmode?: boolean | undefined | null | Variable; @@ -5349,8 +5383,12 @@ export type ValueTypes = { /** blockchains connections metadata */ ["connections"]: AliasType<{ btcNetwork?: boolean | `@${string}`; + /** An object relationship */ + client?: ValueTypes["client"]; clientId?: boolean | `@${string}`; clientSettingsId?: boolean | `@${string}`; + /** An object relationship */ + client_setting?: ValueTypes["client_settings"]; createdAt?: boolean | `@${string}`; ethNetwork?: boolean | `@${string}`; id?: boolean | `@${string}`; @@ -5403,6 +5441,11 @@ export type ValueTypes = { | undefined | null | Variable; + client?: + | ValueTypes["client_bool_exp"] + | undefined + | null + | Variable; clientId?: | ValueTypes["uuid_comparison_exp"] | undefined @@ -5413,6 +5456,11 @@ export type ValueTypes = { | undefined | null | Variable; + client_setting?: + | ValueTypes["client_settings_bool_exp"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["timestamptz_comparison_exp"] | undefined @@ -5444,12 +5492,22 @@ export type ValueTypes = { /** input type for inserting data into table "connections" */ ["connections_insert_input"]: { btcNetwork?: string | undefined | null | Variable; + client?: + | ValueTypes["client_obj_rel_insert_input"] + | undefined + | null + | Variable; clientId?: ValueTypes["uuid"] | undefined | null | Variable; clientSettingsId?: | ValueTypes["uuid"] | undefined | null | Variable; + client_setting?: + | ValueTypes["client_settings_obj_rel_insert_input"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["timestamptz"] | undefined @@ -5496,6 +5554,16 @@ export type ValueTypes = { returning?: ValueTypes["connections"]; __typename?: boolean | `@${string}`; }>; + /** input type for inserting object relation for remote table "connections" */ + ["connections_obj_rel_insert_input"]: { + data: ValueTypes["connections_insert_input"] | Variable; + /** upsert condition */ + on_conflict?: + | ValueTypes["connections_on_conflict"] + | undefined + | null + | Variable; + }; /** on_conflict condition type for table "connections" */ ["connections_on_conflict"]: { constraint: ValueTypes["connections_constraint"] | Variable; @@ -5515,6 +5583,11 @@ export type ValueTypes = { | undefined | null | Variable; + client?: + | ValueTypes["client_order_by"] + | undefined + | null + | Variable; clientId?: | ValueTypes["order_by"] | undefined @@ -5525,6 +5598,11 @@ export type ValueTypes = { | undefined | null | Variable; + client_setting?: + | ValueTypes["client_settings_order_by"] + | undefined + | null + | Variable; createdAt?: | ValueTypes["order_by"] | undefined @@ -15511,6 +15589,8 @@ export type ResolverInputTypes = { ]; /** An object relationship */ client_setting?: ResolverInputTypes["client_settings"]; + /** An object relationship */ + connection?: ResolverInputTypes["connections"]; createdAt?: boolean | `@${string}`; email?: boolean | `@${string}`; firstname?: boolean | `@${string}`; @@ -15868,6 +15948,7 @@ export type ResolverInputTypes = { | ResolverInputTypes["client_settings_bool_exp"] | undefined | null; + connection?: ResolverInputTypes["connections_bool_exp"] | undefined | null; createdAt?: | ResolverInputTypes["timestamptz_comparison_exp"] | undefined @@ -15952,6 +16033,10 @@ export type ResolverInputTypes = { | ResolverInputTypes["client_settings_obj_rel_insert_input"] | undefined | null; + connection?: + | ResolverInputTypes["connections_obj_rel_insert_input"] + | undefined + | null; createdAt?: ResolverInputTypes["timestamptz"] | undefined | null; email?: string | undefined | null; firstname?: string | undefined | null; @@ -16052,6 +16137,7 @@ export type ResolverInputTypes = { | ResolverInputTypes["client_settings_order_by"] | undefined | null; + connection?: ResolverInputTypes["connections_order_by"] | undefined | null; createdAt?: ResolverInputTypes["order_by"] | undefined | null; email?: ResolverInputTypes["order_by"] | undefined | null; firstname?: ResolverInputTypes["order_by"] | undefined | null; @@ -16111,9 +16197,11 @@ export type ResolverInputTypes = { /** An object relationship */ client?: ResolverInputTypes["client"]; clientId?: boolean | `@${string}`; + /** An object relationship */ + connection?: ResolverInputTypes["connections"]; createdAt?: boolean | `@${string}`; id?: boolean | `@${string}`; - lang?: boolean | `@${string}`; + locale?: boolean | `@${string}`; preferedExplorer?: boolean | `@${string}`; preferedWallet?: boolean | `@${string}`; testmode?: boolean | `@${string}`; @@ -16155,12 +16243,13 @@ export type ResolverInputTypes = { | null; client?: ResolverInputTypes["client_bool_exp"] | undefined | null; clientId?: ResolverInputTypes["uuid_comparison_exp"] | undefined | null; + connection?: ResolverInputTypes["connections_bool_exp"] | undefined | null; createdAt?: | ResolverInputTypes["timestamptz_comparison_exp"] | undefined | null; id?: ResolverInputTypes["uuid_comparison_exp"] | undefined | null; - lang?: ResolverInputTypes["String_comparison_exp"] | undefined | null; + locale?: ResolverInputTypes["String_comparison_exp"] | undefined | null; preferedExplorer?: | ResolverInputTypes["String_comparison_exp"] | undefined @@ -16184,9 +16273,13 @@ export type ResolverInputTypes = { | undefined | null; clientId?: ResolverInputTypes["uuid"] | undefined | null; + connection?: + | ResolverInputTypes["connections_obj_rel_insert_input"] + | undefined + | null; createdAt?: ResolverInputTypes["timestamptz"] | undefined | null; id?: ResolverInputTypes["uuid"] | undefined | null; - lang?: string | undefined | null; + locale?: string | undefined | null; preferedExplorer?: string | undefined | null; preferedWallet?: string | undefined | null; testmode?: boolean | undefined | null; @@ -16197,7 +16290,7 @@ export type ResolverInputTypes = { clientId?: boolean | `@${string}`; createdAt?: boolean | `@${string}`; id?: boolean | `@${string}`; - lang?: boolean | `@${string}`; + locale?: boolean | `@${string}`; preferedExplorer?: boolean | `@${string}`; preferedWallet?: boolean | `@${string}`; updatedAt?: boolean | `@${string}`; @@ -16208,7 +16301,7 @@ export type ResolverInputTypes = { clientId?: boolean | `@${string}`; createdAt?: boolean | `@${string}`; id?: boolean | `@${string}`; - lang?: boolean | `@${string}`; + locale?: boolean | `@${string}`; preferedExplorer?: boolean | `@${string}`; preferedWallet?: boolean | `@${string}`; updatedAt?: boolean | `@${string}`; @@ -16241,9 +16334,10 @@ export type ResolverInputTypes = { ["client_settings_order_by"]: { client?: ResolverInputTypes["client_order_by"] | undefined | null; clientId?: ResolverInputTypes["order_by"] | undefined | null; + connection?: ResolverInputTypes["connections_order_by"] | undefined | null; createdAt?: ResolverInputTypes["order_by"] | undefined | null; id?: ResolverInputTypes["order_by"] | undefined | null; - lang?: ResolverInputTypes["order_by"] | undefined | null; + locale?: ResolverInputTypes["order_by"] | undefined | null; preferedExplorer?: ResolverInputTypes["order_by"] | undefined | null; preferedWallet?: ResolverInputTypes["order_by"] | undefined | null; testmode?: ResolverInputTypes["order_by"] | undefined | null; @@ -16260,7 +16354,7 @@ export type ResolverInputTypes = { clientId?: ResolverInputTypes["uuid"] | undefined | null; createdAt?: ResolverInputTypes["timestamptz"] | undefined | null; id?: ResolverInputTypes["uuid"] | undefined | null; - lang?: string | undefined | null; + locale?: string | undefined | null; preferedExplorer?: string | undefined | null; preferedWallet?: string | undefined | null; testmode?: boolean | undefined | null; @@ -16278,7 +16372,7 @@ export type ResolverInputTypes = { clientId?: ResolverInputTypes["uuid"] | undefined | null; createdAt?: ResolverInputTypes["timestamptz"] | undefined | null; id?: ResolverInputTypes["uuid"] | undefined | null; - lang?: string | undefined | null; + locale?: string | undefined | null; preferedExplorer?: string | undefined | null; preferedWallet?: string | undefined | null; testmode?: boolean | undefined | null; @@ -16360,8 +16454,12 @@ export type ResolverInputTypes = { /** blockchains connections metadata */ ["connections"]: AliasType<{ btcNetwork?: boolean | `@${string}`; + /** An object relationship */ + client?: ResolverInputTypes["client"]; clientId?: boolean | `@${string}`; clientSettingsId?: boolean | `@${string}`; + /** An object relationship */ + client_setting?: ResolverInputTypes["client_settings"]; createdAt?: boolean | `@${string}`; ethNetwork?: boolean | `@${string}`; id?: boolean | `@${string}`; @@ -16397,11 +16495,16 @@ export type ResolverInputTypes = { _not?: ResolverInputTypes["connections_bool_exp"] | undefined | null; _or?: Array | undefined | null; btcNetwork?: ResolverInputTypes["String_comparison_exp"] | undefined | null; + client?: ResolverInputTypes["client_bool_exp"] | undefined | null; clientId?: ResolverInputTypes["uuid_comparison_exp"] | undefined | null; clientSettingsId?: | ResolverInputTypes["uuid_comparison_exp"] | undefined | null; + client_setting?: + | ResolverInputTypes["client_settings_bool_exp"] + | undefined + | null; createdAt?: | ResolverInputTypes["timestamptz_comparison_exp"] | undefined @@ -16419,8 +16522,16 @@ export type ResolverInputTypes = { /** input type for inserting data into table "connections" */ ["connections_insert_input"]: { btcNetwork?: string | undefined | null; + client?: + | ResolverInputTypes["client_obj_rel_insert_input"] + | undefined + | null; clientId?: ResolverInputTypes["uuid"] | undefined | null; clientSettingsId?: ResolverInputTypes["uuid"] | undefined | null; + client_setting?: + | ResolverInputTypes["client_settings_obj_rel_insert_input"] + | undefined + | null; createdAt?: ResolverInputTypes["timestamptz"] | undefined | null; ethNetwork?: string | undefined | null; id?: ResolverInputTypes["uuid"] | undefined | null; @@ -16459,6 +16570,15 @@ export type ResolverInputTypes = { returning?: ResolverInputTypes["connections"]; __typename?: boolean | `@${string}`; }>; + /** input type for inserting object relation for remote table "connections" */ + ["connections_obj_rel_insert_input"]: { + data: ResolverInputTypes["connections_insert_input"]; + /** upsert condition */ + on_conflict?: + | ResolverInputTypes["connections_on_conflict"] + | undefined + | null; + }; /** on_conflict condition type for table "connections" */ ["connections_on_conflict"]: { constraint: ResolverInputTypes["connections_constraint"]; @@ -16468,8 +16588,13 @@ export type ResolverInputTypes = { /** Ordering options when selecting data from "connections". */ ["connections_order_by"]: { btcNetwork?: ResolverInputTypes["order_by"] | undefined | null; + client?: ResolverInputTypes["client_order_by"] | undefined | null; clientId?: ResolverInputTypes["order_by"] | undefined | null; clientSettingsId?: ResolverInputTypes["order_by"] | undefined | null; + client_setting?: + | ResolverInputTypes["client_settings_order_by"] + | undefined + | null; createdAt?: ResolverInputTypes["order_by"] | undefined | null; ethNetwork?: ResolverInputTypes["order_by"] | undefined | null; id?: ResolverInputTypes["order_by"] | undefined | null; @@ -23319,6 +23444,8 @@ export type ModelTypes = { chats_aggregate: ModelTypes["chat_aggregate"]; /** An object relationship */ client_setting?: ModelTypes["client_settings"] | undefined; + /** An object relationship */ + connection?: ModelTypes["connections"] | undefined; createdAt?: ModelTypes["timestamptz"] | undefined; email: string; firstname?: string | undefined; @@ -23392,6 +23519,7 @@ export type ModelTypes = { chats?: ModelTypes["chat_bool_exp"] | undefined; chats_aggregate?: ModelTypes["chat_aggregate_bool_exp"] | undefined; client_setting?: ModelTypes["client_settings_bool_exp"] | undefined; + connection?: ModelTypes["connections_bool_exp"] | undefined; createdAt?: ModelTypes["timestamptz_comparison_exp"] | undefined; email?: ModelTypes["String_comparison_exp"] | undefined; firstname?: ModelTypes["String_comparison_exp"] | undefined; @@ -23443,6 +23571,7 @@ export type ModelTypes = { client_setting?: | ModelTypes["client_settings_obj_rel_insert_input"] | undefined; + connection?: ModelTypes["connections_obj_rel_insert_input"] | undefined; createdAt?: ModelTypes["timestamptz"] | undefined; email?: string | undefined; firstname?: string | undefined; @@ -23516,6 +23645,7 @@ export type ModelTypes = { | undefined; chats_aggregate?: ModelTypes["chat_aggregate_order_by"] | undefined; client_setting?: ModelTypes["client_settings_order_by"] | undefined; + connection?: ModelTypes["connections_order_by"] | undefined; createdAt?: ModelTypes["order_by"] | undefined; email?: ModelTypes["order_by"] | undefined; firstname?: ModelTypes["order_by"] | undefined; @@ -23566,9 +23696,11 @@ export type ModelTypes = { /** An object relationship */ client: ModelTypes["client"]; clientId: ModelTypes["uuid"]; + /** An object relationship */ + connection?: ModelTypes["connections"] | undefined; createdAt: ModelTypes["timestamptz"]; id: ModelTypes["uuid"]; - lang: string; + locale: string; preferedExplorer: string; preferedWallet: string; testmode: boolean; @@ -23592,9 +23724,10 @@ export type ModelTypes = { _or?: Array | undefined; client?: ModelTypes["client_bool_exp"] | undefined; clientId?: ModelTypes["uuid_comparison_exp"] | undefined; + connection?: ModelTypes["connections_bool_exp"] | undefined; createdAt?: ModelTypes["timestamptz_comparison_exp"] | undefined; id?: ModelTypes["uuid_comparison_exp"] | undefined; - lang?: ModelTypes["String_comparison_exp"] | undefined; + locale?: ModelTypes["String_comparison_exp"] | undefined; preferedExplorer?: ModelTypes["String_comparison_exp"] | undefined; preferedWallet?: ModelTypes["String_comparison_exp"] | undefined; testmode?: ModelTypes["Boolean_comparison_exp"] | undefined; @@ -23605,9 +23738,10 @@ export type ModelTypes = { ["client_settings_insert_input"]: { client?: ModelTypes["client_obj_rel_insert_input"] | undefined; clientId?: ModelTypes["uuid"] | undefined; + connection?: ModelTypes["connections_obj_rel_insert_input"] | undefined; createdAt?: ModelTypes["timestamptz"] | undefined; id?: ModelTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; testmode?: boolean | undefined; @@ -23618,7 +23752,7 @@ export type ModelTypes = { clientId?: ModelTypes["uuid"] | undefined; createdAt?: ModelTypes["timestamptz"] | undefined; id?: ModelTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; updatedAt?: ModelTypes["timestamptz"] | undefined; @@ -23628,7 +23762,7 @@ export type ModelTypes = { clientId?: ModelTypes["uuid"] | undefined; createdAt?: ModelTypes["timestamptz"] | undefined; id?: ModelTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; updatedAt?: ModelTypes["timestamptz"] | undefined; @@ -23656,9 +23790,10 @@ export type ModelTypes = { ["client_settings_order_by"]: { client?: ModelTypes["client_order_by"] | undefined; clientId?: ModelTypes["order_by"] | undefined; + connection?: ModelTypes["connections_order_by"] | undefined; createdAt?: ModelTypes["order_by"] | undefined; id?: ModelTypes["order_by"] | undefined; - lang?: ModelTypes["order_by"] | undefined; + locale?: ModelTypes["order_by"] | undefined; preferedExplorer?: ModelTypes["order_by"] | undefined; preferedWallet?: ModelTypes["order_by"] | undefined; testmode?: ModelTypes["order_by"] | undefined; @@ -23674,7 +23809,7 @@ export type ModelTypes = { clientId?: ModelTypes["uuid"] | undefined; createdAt?: ModelTypes["timestamptz"] | undefined; id?: ModelTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; testmode?: boolean | undefined; @@ -23692,7 +23827,7 @@ export type ModelTypes = { clientId?: ModelTypes["uuid"] | undefined; createdAt?: ModelTypes["timestamptz"] | undefined; id?: ModelTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; testmode?: boolean | undefined; @@ -23765,8 +23900,12 @@ export type ModelTypes = { /** blockchains connections metadata */ ["connections"]: { btcNetwork: string; + /** An object relationship */ + client: ModelTypes["client"]; clientId: ModelTypes["uuid"]; clientSettingsId: ModelTypes["uuid"]; + /** An object relationship */ + client_setting: ModelTypes["client_settings"]; createdAt: ModelTypes["timestamptz"]; ethNetwork: string; id: ModelTypes["uuid"]; @@ -23790,8 +23929,10 @@ export type ModelTypes = { _not?: ModelTypes["connections_bool_exp"] | undefined; _or?: Array | undefined; btcNetwork?: ModelTypes["String_comparison_exp"] | undefined; + client?: ModelTypes["client_bool_exp"] | undefined; clientId?: ModelTypes["uuid_comparison_exp"] | undefined; clientSettingsId?: ModelTypes["uuid_comparison_exp"] | undefined; + client_setting?: ModelTypes["client_settings_bool_exp"] | undefined; createdAt?: ModelTypes["timestamptz_comparison_exp"] | undefined; ethNetwork?: ModelTypes["String_comparison_exp"] | undefined; id?: ModelTypes["uuid_comparison_exp"] | undefined; @@ -23802,8 +23943,12 @@ export type ModelTypes = { /** input type for inserting data into table "connections" */ ["connections_insert_input"]: { btcNetwork?: string | undefined; + client?: ModelTypes["client_obj_rel_insert_input"] | undefined; clientId?: ModelTypes["uuid"] | undefined; clientSettingsId?: ModelTypes["uuid"] | undefined; + client_setting?: + | ModelTypes["client_settings_obj_rel_insert_input"] + | undefined; createdAt?: ModelTypes["timestamptz"] | undefined; ethNetwork?: string | undefined; id?: ModelTypes["uuid"] | undefined; @@ -23839,6 +23984,12 @@ export type ModelTypes = { /** data from the rows affected by the mutation */ returning: Array; }; + /** input type for inserting object relation for remote table "connections" */ + ["connections_obj_rel_insert_input"]: { + data: ModelTypes["connections_insert_input"]; + /** upsert condition */ + on_conflict?: ModelTypes["connections_on_conflict"] | undefined; + }; /** on_conflict condition type for table "connections" */ ["connections_on_conflict"]: { constraint: ModelTypes["connections_constraint"]; @@ -23848,8 +23999,10 @@ export type ModelTypes = { /** Ordering options when selecting data from "connections". */ ["connections_order_by"]: { btcNetwork?: ModelTypes["order_by"] | undefined; + client?: ModelTypes["client_order_by"] | undefined; clientId?: ModelTypes["order_by"] | undefined; clientSettingsId?: ModelTypes["order_by"] | undefined; + client_setting?: ModelTypes["client_settings_order_by"] | undefined; createdAt?: ModelTypes["order_by"] | undefined; ethNetwork?: ModelTypes["order_by"] | undefined; id?: ModelTypes["order_by"] | undefined; @@ -27874,6 +28027,8 @@ export type GraphQLTypes = { chats_aggregate: GraphQLTypes["chat_aggregate"]; /** An object relationship */ client_setting?: GraphQLTypes["client_settings"] | undefined; + /** An object relationship */ + connection?: GraphQLTypes["connections"] | undefined; createdAt?: GraphQLTypes["timestamptz"] | undefined; email: string; firstname?: string | undefined; @@ -27952,6 +28107,7 @@ export type GraphQLTypes = { chats?: GraphQLTypes["chat_bool_exp"] | undefined; chats_aggregate?: GraphQLTypes["chat_aggregate_bool_exp"] | undefined; client_setting?: GraphQLTypes["client_settings_bool_exp"] | undefined; + connection?: GraphQLTypes["connections_bool_exp"] | undefined; createdAt?: GraphQLTypes["timestamptz_comparison_exp"] | undefined; email?: GraphQLTypes["String_comparison_exp"] | undefined; firstname?: GraphQLTypes["String_comparison_exp"] | undefined; @@ -28004,6 +28160,7 @@ export type GraphQLTypes = { client_setting?: | GraphQLTypes["client_settings_obj_rel_insert_input"] | undefined; + connection?: GraphQLTypes["connections_obj_rel_insert_input"] | undefined; createdAt?: GraphQLTypes["timestamptz"] | undefined; email?: string | undefined; firstname?: string | undefined; @@ -28084,6 +28241,7 @@ export type GraphQLTypes = { | undefined; chats_aggregate?: GraphQLTypes["chat_aggregate_order_by"] | undefined; client_setting?: GraphQLTypes["client_settings_order_by"] | undefined; + connection?: GraphQLTypes["connections_order_by"] | undefined; createdAt?: GraphQLTypes["order_by"] | undefined; email?: GraphQLTypes["order_by"] | undefined; firstname?: GraphQLTypes["order_by"] | undefined; @@ -28136,9 +28294,11 @@ export type GraphQLTypes = { /** An object relationship */ client: GraphQLTypes["client"]; clientId: GraphQLTypes["uuid"]; + /** An object relationship */ + connection?: GraphQLTypes["connections"] | undefined; createdAt: GraphQLTypes["timestamptz"]; id: GraphQLTypes["uuid"]; - lang: string; + locale: string; preferedExplorer: string; preferedWallet: string; testmode: boolean; @@ -28164,9 +28324,10 @@ export type GraphQLTypes = { _or?: Array | undefined; client?: GraphQLTypes["client_bool_exp"] | undefined; clientId?: GraphQLTypes["uuid_comparison_exp"] | undefined; + connection?: GraphQLTypes["connections_bool_exp"] | undefined; createdAt?: GraphQLTypes["timestamptz_comparison_exp"] | undefined; id?: GraphQLTypes["uuid_comparison_exp"] | undefined; - lang?: GraphQLTypes["String_comparison_exp"] | undefined; + locale?: GraphQLTypes["String_comparison_exp"] | undefined; preferedExplorer?: GraphQLTypes["String_comparison_exp"] | undefined; preferedWallet?: GraphQLTypes["String_comparison_exp"] | undefined; testmode?: GraphQLTypes["Boolean_comparison_exp"] | undefined; @@ -28178,9 +28339,10 @@ export type GraphQLTypes = { ["client_settings_insert_input"]: { client?: GraphQLTypes["client_obj_rel_insert_input"] | undefined; clientId?: GraphQLTypes["uuid"] | undefined; + connection?: GraphQLTypes["connections_obj_rel_insert_input"] | undefined; createdAt?: GraphQLTypes["timestamptz"] | undefined; id?: GraphQLTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; testmode?: boolean | undefined; @@ -28192,7 +28354,7 @@ export type GraphQLTypes = { clientId?: GraphQLTypes["uuid"] | undefined; createdAt?: GraphQLTypes["timestamptz"] | undefined; id?: GraphQLTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; updatedAt?: GraphQLTypes["timestamptz"] | undefined; @@ -28203,7 +28365,7 @@ export type GraphQLTypes = { clientId?: GraphQLTypes["uuid"] | undefined; createdAt?: GraphQLTypes["timestamptz"] | undefined; id?: GraphQLTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; updatedAt?: GraphQLTypes["timestamptz"] | undefined; @@ -28232,9 +28394,10 @@ export type GraphQLTypes = { ["client_settings_order_by"]: { client?: GraphQLTypes["client_order_by"] | undefined; clientId?: GraphQLTypes["order_by"] | undefined; + connection?: GraphQLTypes["connections_order_by"] | undefined; createdAt?: GraphQLTypes["order_by"] | undefined; id?: GraphQLTypes["order_by"] | undefined; - lang?: GraphQLTypes["order_by"] | undefined; + locale?: GraphQLTypes["order_by"] | undefined; preferedExplorer?: GraphQLTypes["order_by"] | undefined; preferedWallet?: GraphQLTypes["order_by"] | undefined; testmode?: GraphQLTypes["order_by"] | undefined; @@ -28251,7 +28414,7 @@ export type GraphQLTypes = { clientId?: GraphQLTypes["uuid"] | undefined; createdAt?: GraphQLTypes["timestamptz"] | undefined; id?: GraphQLTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; testmode?: boolean | undefined; @@ -28269,7 +28432,7 @@ export type GraphQLTypes = { clientId?: GraphQLTypes["uuid"] | undefined; createdAt?: GraphQLTypes["timestamptz"] | undefined; id?: GraphQLTypes["uuid"] | undefined; - lang?: string | undefined; + locale?: string | undefined; preferedExplorer?: string | undefined; preferedWallet?: string | undefined; testmode?: boolean | undefined; @@ -28352,8 +28515,12 @@ export type GraphQLTypes = { ["connections"]: { __typename: "connections"; btcNetwork: string; + /** An object relationship */ + client: GraphQLTypes["client"]; clientId: GraphQLTypes["uuid"]; clientSettingsId: GraphQLTypes["uuid"]; + /** An object relationship */ + client_setting: GraphQLTypes["client_settings"]; createdAt: GraphQLTypes["timestamptz"]; ethNetwork: string; id: GraphQLTypes["uuid"]; @@ -28379,8 +28546,10 @@ export type GraphQLTypes = { _not?: GraphQLTypes["connections_bool_exp"] | undefined; _or?: Array | undefined; btcNetwork?: GraphQLTypes["String_comparison_exp"] | undefined; + client?: GraphQLTypes["client_bool_exp"] | undefined; clientId?: GraphQLTypes["uuid_comparison_exp"] | undefined; clientSettingsId?: GraphQLTypes["uuid_comparison_exp"] | undefined; + client_setting?: GraphQLTypes["client_settings_bool_exp"] | undefined; createdAt?: GraphQLTypes["timestamptz_comparison_exp"] | undefined; ethNetwork?: GraphQLTypes["String_comparison_exp"] | undefined; id?: GraphQLTypes["uuid_comparison_exp"] | undefined; @@ -28392,8 +28561,12 @@ export type GraphQLTypes = { /** input type for inserting data into table "connections" */ ["connections_insert_input"]: { btcNetwork?: string | undefined; + client?: GraphQLTypes["client_obj_rel_insert_input"] | undefined; clientId?: GraphQLTypes["uuid"] | undefined; clientSettingsId?: GraphQLTypes["uuid"] | undefined; + client_setting?: + | GraphQLTypes["client_settings_obj_rel_insert_input"] + | undefined; createdAt?: GraphQLTypes["timestamptz"] | undefined; ethNetwork?: string | undefined; id?: GraphQLTypes["uuid"] | undefined; @@ -28432,6 +28605,12 @@ export type GraphQLTypes = { /** data from the rows affected by the mutation */ returning: Array; }; + /** input type for inserting object relation for remote table "connections" */ + ["connections_obj_rel_insert_input"]: { + data: GraphQLTypes["connections_insert_input"]; + /** upsert condition */ + on_conflict?: GraphQLTypes["connections_on_conflict"] | undefined; + }; /** on_conflict condition type for table "connections" */ ["connections_on_conflict"]: { constraint: GraphQLTypes["connections_constraint"]; @@ -28441,8 +28620,10 @@ export type GraphQLTypes = { /** Ordering options when selecting data from "connections". */ ["connections_order_by"]: { btcNetwork?: GraphQLTypes["order_by"] | undefined; + client?: GraphQLTypes["client_order_by"] | undefined; clientId?: GraphQLTypes["order_by"] | undefined; clientSettingsId?: GraphQLTypes["order_by"] | undefined; + client_setting?: GraphQLTypes["client_settings_order_by"] | undefined; createdAt?: GraphQLTypes["order_by"] | undefined; ethNetwork?: GraphQLTypes["order_by"] | undefined; id?: GraphQLTypes["order_by"] | undefined; @@ -31399,7 +31580,7 @@ export const enum client_settings_select_column { clientId = "clientId", createdAt = "createdAt", id = "id", - lang = "lang", + locale = "locale", preferedExplorer = "preferedExplorer", preferedWallet = "preferedWallet", testmode = "testmode", @@ -31410,7 +31591,7 @@ export const enum client_settings_update_column { clientId = "clientId", createdAt = "createdAt", id = "id", - lang = "lang", + locale = "locale", preferedExplorer = "preferedExplorer", preferedWallet = "preferedWallet", testmode = "testmode", @@ -31902,6 +32083,7 @@ type ZEUS_VARIABLES = { ["connections_bool_exp"]: ValueTypes["connections_bool_exp"]; ["connections_constraint"]: ValueTypes["connections_constraint"]; ["connections_insert_input"]: ValueTypes["connections_insert_input"]; + ["connections_obj_rel_insert_input"]: ValueTypes["connections_obj_rel_insert_input"]; ["connections_on_conflict"]: ValueTypes["connections_on_conflict"]; ["connections_order_by"]: ValueTypes["connections_order_by"]; ["connections_pk_columns_input"]: ValueTypes["connections_pk_columns_input"]; From 5ff69313f3db6f10f3e3b32e56fa9113e3c22db3 Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:39:09 +0530 Subject: [PATCH 07/11] chore: update locale function --- backend/backend-common/src/db/client.ts | 2 +- backend/backend-common/src/db/index.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/backend-common/src/db/client.ts b/backend/backend-common/src/db/client.ts index e6da53de..939bcbb7 100644 --- a/backend/backend-common/src/db/client.ts +++ b/backend/backend-common/src/db/client.ts @@ -627,7 +627,7 @@ export const createBaseClient = async ( password: hashPassword, client_setting: { data: { - lang: "en", + locale: "en", } } }, diff --git a/backend/backend-common/src/db/index.ts b/backend/backend-common/src/db/index.ts index 457a0a59..784ce899 100644 --- a/backend/backend-common/src/db/index.ts +++ b/backend/backend-common/src/db/index.ts @@ -7,4 +7,5 @@ export * from "./wallet"; export * from "./chat"; export * from "./friendship"; export * from "./notification"; -export * from "./hook"; \ No newline at end of file +export * from "./hook"; +export * from "./locale"; \ No newline at end of file From 5b492aaf425d95f79d3e6c714afa32d85497fb2f Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:40:30 +0530 Subject: [PATCH 08/11] chore: locale get func --- backend/api/package.json | 1 + backend/api/src/db/locale.ts | 40 ++++++++++++++++++++++++++++++++++++ backend/api/src/index.ts | 2 ++ 3 files changed, 43 insertions(+) create mode 100644 backend/api/src/db/locale.ts diff --git a/backend/api/package.json b/backend/api/package.json index 3fe022c1..4bcefaf8 100644 --- a/backend/api/package.json +++ b/backend/api/package.json @@ -20,6 +20,7 @@ "@moonpay/moonpay-node": "^0.2.5", "@paybox/backend-common": "*", "@paybox/common": "^0.1.5", + "@paybox/zeus": "^0.1.2", "@paybox/openapi": "^0.1.2", "@solana/spl-token": "^0.3.11", "@solana/wallet-adapter-wallets": "^0.19.26", diff --git a/backend/api/src/db/locale.ts b/backend/api/src/db/locale.ts new file mode 100644 index 00000000..56ebcb52 --- /dev/null +++ b/backend/api/src/db/locale.ts @@ -0,0 +1,40 @@ +import { Chain } from "@paybox/zeus"; +import { HASURA_URL, JWT } from "../config"; +import { HASURA_ADMIN_SERCRET, Locales, dbResStatus } from "@paybox/common"; + +const chain = Chain(HASURA_URL, { + headers: { + Authorization: `Bearer ${JWT}`, + "x-hasura-admin-secret": HASURA_ADMIN_SERCRET, + }, +}); + +/** + * @param clientId + */ +export const getLocale = async ( + clientId: string +): Promise<{ + status: dbResStatus, + locale?: Locales +}> => { + const response = await chain("query")({ + client_settings: [{ + limit: 1, + where: { + clientId: {_eq: clientId} + }, + }, { + locale: true + }] + }, {operationName: "getLocale"}); + if(response.client_settings[0].locale) { + return { + locale: response.client_settings[0].locale as Locales, + status: dbResStatus.Ok + } + } + return { + status: dbResStatus.Error + } +} \ No newline at end of file diff --git a/backend/api/src/index.ts b/backend/api/src/index.ts index ea7254cd..63589207 100644 --- a/backend/api/src/index.ts +++ b/backend/api/src/index.ts @@ -46,6 +46,7 @@ import { notifRouter } from "./routes/notif"; import { MoonPay } from "@moonpay/moonpay-node"; import { buyRouter } from "./routes/buy"; import { hooksRouter } from "./routes/webhooks"; +import { localeRouter } from "./routes/locale"; export * from "./Redis"; @@ -161,6 +162,7 @@ app.use('/notif', extractClientId, checkValidation, notifRouter); app.use('/notif_sub', extractClientId, notifSubRouter); app.use('/buy', extractClientId, checkValidation, buyRouter); app.use('/hooks', hooksRouter); +app.use('/locale', localeRouter); app.get("/metrics", async (_req, res) => { res.set("Content-Type", Prometheus.register.contentType); From 2a32af30ad621f932a1ca27768b30f30934c6db2 Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:40:52 +0530 Subject: [PATCH 09/11] chore: locale btn --- .../settings/components/locale-btn.tsx | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 apps/web/app/profile/settings/components/locale-btn.tsx diff --git a/apps/web/app/profile/settings/components/locale-btn.tsx b/apps/web/app/profile/settings/components/locale-btn.tsx new file mode 100644 index 00000000..7c1328e2 --- /dev/null +++ b/apps/web/app/profile/settings/components/locale-btn.tsx @@ -0,0 +1,71 @@ +"use client"; +import { CommandMenu } from '@/components/combo-box'; +import { Button } from '@/components/ui/button'; +import { langs } from '@/lib/contants'; +import { updateLocale } from '@/lib/helper'; +import { getLocaleName } from '@/lib/utils'; +import { Locales } from '@paybox/common'; +import { clientJwtAtom, localeAtom } from '@paybox/recoil'; +import { ChevronRight } from 'lucide-react'; +import React, { useEffect } from 'react' +import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'; +import { toast } from 'sonner'; + +function LocaleButton({ + locale +}: { + locale: Locales +}) { + const [open, setOpen] = React.useState(false); + let [changedLocale, setChangedLocale] = React.useState(); + const [localeState, setLocale] = useRecoilState(localeAtom); + const jwt = useRecoilValue(clientJwtAtom); + + useEffect(() => { + setLocale(locale); + }, [locale]); + + useEffect(() => { + if (changedLocale) { + if(jwt) { + toast.promise(updateLocale(jwt, changedLocale as Locales), { + loading: 'Updating locale...', + success: () => { + setLocale(changedLocale as Locales); + return 'Locale updated successfully'; + }, + error: ({msg}) => { + return msg || 'Failed to update locale'; + } + }); + } else { + toast.error('Auth Token not found. Please login again.'); + + } + } + }, [changedLocale]); + + return ( + <> +
{ + setOpen(true); + }}> + +
+ + + ) +} + +export default LocaleButton \ No newline at end of file From 876191843de48b2894af33e3b16f2388ce0a37ed Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:41:19 +0530 Subject: [PATCH 10/11] chore: general combo box for option type --- apps/web/components/combo-box.tsx | 82 +++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 apps/web/components/combo-box.tsx diff --git a/apps/web/components/combo-box.tsx b/apps/web/components/combo-box.tsx new file mode 100644 index 00000000..68008fd7 --- /dev/null +++ b/apps/web/components/combo-box.tsx @@ -0,0 +1,82 @@ +"use client"; +import { + Command, + CommandDialog, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + CommandSeparator, + CommandShortcut, +} from "@/components/ui/command" +import React from "react" +import { Button } from "./ui/button" +import { CheckCheck } from "lucide-react"; + + +interface Option { + name: string, + value: string, +} + +export function CommandMenu({ + open, + setOpen, + onSelect, + options, + strokeKey, + heading, + selected +}: { + open: boolean, + setOpen: React.Dispatch> + onSelect: (value: string) => void, + options: Option[], + strokeKey: string, + heading: string, + selected: string +}) { + + React.useEffect(() => { + const down = (e: KeyboardEvent) => { + if (e.key === strokeKey && (e.metaKey || e.ctrlKey)) { + e.preventDefault() + setOpen((open) => !open) + } + } + document.addEventListener("keydown", down) + return () => document.removeEventListener("keydown", down) + }, []) + + return ( + + + + No results found. + + {options.map((option) => ( + + + + ))} + + + + + + + ) +} From f6f2a2047a5a3a1ca9cade9f8c3cbe53b7cc7a90 Mon Sep 17 00:00:00 2001 From: Akash Shaw Date: Sat, 20 Apr 2024 20:42:27 +0530 Subject: [PATCH 11/11] chore: adds helper funcs and cleaning --- apps/web/app/profile/settings/page.tsx | 38 +++++++++++++++++++-- apps/web/components/buy-combo.tsx | 1 - apps/web/lib/contants.ts | 13 ++++++++ apps/web/lib/helper.ts | 46 +++++++++++++++++++++----- apps/web/lib/utils.ts | 6 ++++ 5 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 apps/web/lib/contants.ts diff --git a/apps/web/app/profile/settings/page.tsx b/apps/web/app/profile/settings/page.tsx index da17b2b8..26f7183d 100644 --- a/apps/web/app/profile/settings/page.tsx +++ b/apps/web/app/profile/settings/page.tsx @@ -17,9 +17,34 @@ import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Switch } from "@/components/ui/switch" -import { Terminal } from "lucide-react"; +import { ChevronRight, Languages, Terminal } from "lucide-react"; import TestModeSwitch from "./components/test-mode"; +import LocaleButton from "./components/locale-btn"; +import { BACKEND_URL, Locales, responseStatus } from "@paybox/common"; +//todo: get the local from db if not set, set it to en +const getLocale = async (jwt: string) => { + try { + const { status, locale, msg }: { status: responseStatus, locale: Locales, msg?: string } + = await fetch(`${BACKEND_URL}/locale/locale`, { + method: "GET", + headers: { + "Content-type": "application/json", + authorization: `Bearer ${jwt}`, + }, + cache: "no-cache" + }).then(res => res.json()); + console.log(locale); + if (status === responseStatus.Error) { + console.log(msg) + return Locales.en; + } + return locale; + } catch (error) { + console.log(error); + return Locales.en; + } +} export default async function Home({ @@ -37,7 +62,7 @@ export default async function Home({ if (!jwt) { redirect('/signin'); } - + const locale = await getLocale(jwt) || Locales.en; const layout = cookies().get("react-resizable-panels:layout"); const defaultLayout = layout ? JSON.parse(layout.value) : undefined; @@ -90,6 +115,15 @@ export default async function Home({ +
+ + +
diff --git a/apps/web/components/buy-combo.tsx b/apps/web/components/buy-combo.tsx index a2802d2b..408fa448 100644 --- a/apps/web/components/buy-combo.tsx +++ b/apps/web/components/buy-combo.tsx @@ -71,7 +71,6 @@ export function TokenCommandMenu({