From 03710a4ed49b39a1b11541423bee962a4b7b33d5 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Wed, 29 May 2024 11:23:21 +0200 Subject: [PATCH] feat: move user query to a separate file --- src/gql/query/index.ts | 1 + src/gql/query/user.ts | 33 +++++++++++++++++++++++++++++++++ src/gql/query/users.ts | 24 ------------------------ 3 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 src/gql/query/user.ts diff --git a/src/gql/query/index.ts b/src/gql/query/index.ts index 240dbc6b..0724566e 100644 --- a/src/gql/query/index.ts +++ b/src/gql/query/index.ts @@ -20,5 +20,6 @@ export * from "./spotPools" export * from "./spotPoolSwap" export * from "./staking" export * from "./stats" +export * from "./user" export * from "./users" export * from "./wasm" diff --git a/src/gql/query/user.ts b/src/gql/query/user.ts new file mode 100644 index 00000000..237893e4 --- /dev/null +++ b/src/gql/query/user.ts @@ -0,0 +1,33 @@ +import { + convertObjectToPropertiesString, + doGqlQuery, + gqlQuery, + GQLQuery, + GQLUser, + DeepPartial, + GQLQueryGqlUserArgs, +} from ".." + +export interface GqlOutUser { + user?: GQLQuery["user"] +} + +export const userQueryString = ( + args: GQLQueryGqlUserArgs, + excludeParentObject: boolean, + fields: DeepPartial +) => { + return gqlQuery( + "user", + args, + convertObjectToPropertiesString(fields), + excludeParentObject + ) +} + +export const user = async ( + args: GQLQueryGqlUserArgs, + endpt: string, + fields: DeepPartial +): Promise => + doGqlQuery(userQueryString(args, false, fields), endpt) diff --git a/src/gql/query/users.ts b/src/gql/query/users.ts index a14b4f2b..a60a7772 100644 --- a/src/gql/query/users.ts +++ b/src/gql/query/users.ts @@ -7,29 +7,12 @@ import { GQLUser, GQLUserOrder, DeepPartial, - GQLQueryGqlUserArgs, } from ".." -export interface GqlOutUser { - user?: GQLQuery["user"] -} export interface GqlOutUsers { users?: GQLQuery["users"] } -export const userQueryString = ( - args: GQLQueryGqlUserArgs, - excludeParentObject: boolean, - fields: DeepPartial -) => { - return gqlQuery( - "user", - args, - convertObjectToPropertiesString(fields), - excludeParentObject - ) -} - export const usersQueryString = ( args: GQLQueryGqlUsersArgs, excludeParentObject: boolean, @@ -47,13 +30,6 @@ export const usersQueryString = ( ) } -export const user = async ( - args: GQLQueryGqlUserArgs, - endpt: string, - fields: DeepPartial -): Promise => - doGqlQuery(userQueryString(args, false, fields), endpt) - export const users = async ( args: GQLQueryGqlUsersArgs, endpt: string,