fix-queries

This commit is contained in:
tonyrewin 2022-11-16 10:42:43 +03:00
parent d370bc4fe4
commit b5c0eb88fe
7 changed files with 16 additions and 16 deletions

View File

@ -2,7 +2,7 @@ import { gql } from '@urql/core'
export default gql` export default gql`
query LoadShoutsByQuery($by: ShoutsBy, $limit: Int!, $offset: Int!) { query LoadShoutsByQuery($by: ShoutsBy, $limit: Int!, $offset: Int!) {
loadShoutsBy(by: $by, amount: $limit, offset: $offset) { loadShoutsBy(by: $by, limit: $limit, offset: $offset) {
_id: slug _id: slug
title title
subtitle subtitle

View File

@ -2,7 +2,7 @@ import { gql } from '@urql/core'
export default gql` export default gql`
query AuthorLoadByQuery($by: AuthorsBy, $limit: Int, $offset: Int) { query AuthorLoadByQuery($by: AuthorsBy, $limit: Int, $offset: Int) {
loadAuthorsBy(by: $by, amount: $limit, offset: $offset) { loadAuthorsBy(by: $by, limit: $limit, offset: $offset) {
_id: slug _id: slug
slug slug
name name

View File

@ -1,8 +1,8 @@
import { gql } from '@urql/core' import { gql } from '@urql/core'
export default gql` export default gql`
query LoadMessagesQuery($by: MessagesBy!, $amount: Int, $offset: Int) { query LoadMessagesQuery($by: MessagesBy!, $limit: Int, $offset: Int) {
loadMessagesBy(by: $by, amount: $amount, offset: $offset) { loadMessagesBy(by: $by, limit: $limit, offset: $offset) {
error error
messages { messages {
author author

View File

@ -1,8 +1,8 @@
import { gql } from '@urql/core' import { gql } from '@urql/core'
export default gql` export default gql`
query GetChatsQuery { query GetChatsQuery($limit: Int, $offset: Int) {
myChats { loadChats(limit: $limit, offset: $offset) {
error error
chats { chats {
title title

View File

@ -2,7 +2,7 @@ import { gql } from '@urql/core'
export default gql` export default gql`
query LoadReactionsByQuery($by: ReactionsBy, $limit: Int!, $offset: Int!) { query LoadReactionsByQuery($by: ReactionsBy, $limit: Int!, $offset: Int!) {
loadReactionsBy(by: $by, amount: $limit, offset: $offset) { loadReactionsBy(by: $by, limit: $limit, offset: $offset) {
id id
createdBy { createdBy {
slug slug

View File

@ -352,30 +352,30 @@ export type QueryIsEmailUsedArgs = {
} }
export type QueryLoadAuthorsByArgs = { export type QueryLoadAuthorsByArgs = {
amount?: InputMaybe<Scalars['Int']> limit?: InputMaybe<Scalars['Int']>
by?: InputMaybe<AuthorsBy> by?: InputMaybe<AuthorsBy>
offset?: InputMaybe<Scalars['Int']> offset?: InputMaybe<Scalars['Int']>
} }
export type QueryLoadChatsArgs = { export type QueryLoadChatsArgs = {
amount?: InputMaybe<Scalars['Int']> limit?: InputMaybe<Scalars['Int']>
offset?: InputMaybe<Scalars['Int']> offset?: InputMaybe<Scalars['Int']>
} }
export type QueryLoadMessagesByArgs = { export type QueryLoadMessagesByArgs = {
amount?: InputMaybe<Scalars['Int']> limit?: InputMaybe<Scalars['Int']>
by: MessagesBy by: MessagesBy
offset?: InputMaybe<Scalars['Int']> offset?: InputMaybe<Scalars['Int']>
} }
export type QueryLoadReactionsByArgs = { export type QueryLoadReactionsByArgs = {
amount?: InputMaybe<Scalars['Int']> offset?: InputMaybe<Scalars['Int']>
by: ReactionBy by: ReactionBy
limit?: InputMaybe<Scalars['Int']> limit?: InputMaybe<Scalars['Int']>
} }
export type QueryLoadShoutsByArgs = { export type QueryLoadShoutsByArgs = {
amount?: InputMaybe<Scalars['Int']> limit?: InputMaybe<Scalars['Int']>
by?: InputMaybe<ShoutsBy> by?: InputMaybe<ShoutsBy>
offset?: InputMaybe<Scalars['Int']> offset?: InputMaybe<Scalars['Int']>
} }
@ -385,7 +385,7 @@ export type QueryMarkdownBodyArgs = {
} }
export type QuerySearchUsersArgs = { export type QuerySearchUsersArgs = {
amount?: InputMaybe<Scalars['Int']> limit?: InputMaybe<Scalars['Int']>
offset?: InputMaybe<Scalars['Int']> offset?: InputMaybe<Scalars['Int']>
query: Scalars['String'] query: Scalars['String']
} }

View File

@ -255,17 +255,17 @@ export const apiClient = {
getChatMessages: async ({ getChatMessages: async ({
chat, chat,
amount = 50, limit = 50,
offset = 0 offset = 0
}: { }: {
chat: string chat: string
amount?: number limit?: number
offset?: number offset?: number
}) => { }) => {
const by = { const by = {
chat chat
} }
const resp = await privateGraphQLClient.query(chatMessagesLoadBy, { by, offset, amount }).toPromise() const resp = await privateGraphQLClient.query(chatMessagesLoadBy, { by, offset, limit }).toPromise()
return resp.data.loadChat return resp.data.loadChat
} }
} }