new-api-refactoring
This commit is contained in:
parent
d47396bb9c
commit
9164383fa3
|
@ -1,47 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query GetShoutBySlugQuery($slug: String!) {
|
||||
getShoutBySlug(slug: $slug) {
|
||||
_id: slug
|
||||
slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
cover
|
||||
# community
|
||||
body
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
caption
|
||||
}
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
publishedAt
|
||||
visibility
|
||||
media
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
rating
|
||||
commented
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,42 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query ShoutsForAuthorsQuery($slugs: [String]!, $limit: Int!, $offset: Int!) {
|
||||
shoutsByAuthors(slugs: $slugs, limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
bio
|
||||
links
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,40 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query ShoutsForCommunitiesQuery($slugs: [String]!, $limit: Int!, $offset: Int!) {
|
||||
shoutsByCommunities(slugs: $slugs, limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community { ... }
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,42 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query ShoutsBySessionQuery($limit: Int!, $offset: Int!) {
|
||||
shoutsForFeed(limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
rating
|
||||
commented
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,40 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query ShoutsForTopicsQuery($slugs: [String]!, $limit: Int!, $offset: Int!) {
|
||||
shoutsByTopics(slugs: $slugs, limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,14 +1,16 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query RecentPublishedQuery($limit: Int!, $offset: Int!) {
|
||||
recentPublished(limit: $limit, offset: $offset) {
|
||||
query LoadShoutsByQuery($by: ShoutsBy, $limit: Int!, $offset: Int!) {
|
||||
loadShoutsBy(by: $by, amount: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
slug
|
||||
layout
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
|
@ -26,10 +28,8 @@ export default gql`
|
|||
slug
|
||||
userpic
|
||||
}
|
||||
# community
|
||||
mainTopic
|
||||
publishedAt
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
|
@ -1,40 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query RecentAllQuery($limit: Int!, $offset: Int!) {
|
||||
recentAll(limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
slug
|
||||
layout
|
||||
cover
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
# community
|
||||
mainTopic
|
||||
createdAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
rating
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,40 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query TopMonthShoutsQuery($limit: Int!, $offset: Int!) {
|
||||
topMonth(limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,41 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query TopOverallShoutsQuery($limit: Int!, $offset: Int!) {
|
||||
topOverall(limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
slug
|
||||
layout
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
rating
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,41 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query TopViewedShoutsQuery($limit: Int!, $offset: Int!) {
|
||||
topViewed(limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
slug
|
||||
layout
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
rating
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,8 +1,8 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query GetAuthorsBySlugsQuery($slugs: [String]!) {
|
||||
getUsersBySlugs(slugs: $slugs) {
|
||||
query AuthorLoadByQuery($by: AuthorsBy, $limit: Int, $offset: Int) {
|
||||
loadAuthorsBy(by: $by, amount: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
slug
|
||||
name
|
|
@ -1,8 +1,8 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query LoadMessagesQuery($chatId: String!, $offset: Int, $amount: Int) {
|
||||
loadChat(chatId: $chatId, offset: $offset, amount: $amount) {
|
||||
query LoadMessagesQuery($by: MessagesBy!, $amount: Int, $offset: Int) {
|
||||
loadMessagesBy(by: $by, amount: $amount, offset: $offset) {
|
||||
error
|
||||
messages {
|
||||
author
|
|
@ -1,13 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query {
|
||||
getMyCollections {
|
||||
id
|
||||
title
|
||||
desc
|
||||
slug
|
||||
amount
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,13 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query CollectionsUserQuery($slug: String!) {
|
||||
getUserCollections(user: $slug) {
|
||||
id
|
||||
title
|
||||
desc
|
||||
slug
|
||||
amount
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,40 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query RecentShoutsForLayout($layout: String!, $amount: Int, $offset: Int) {
|
||||
recentLayoutShouts(layout: $layout, amount: $amount, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,40 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query TopMonthShoutsForLayout($layout: String!, $amount: Int, $offset: Int) {
|
||||
topMonthLayoutShouts(layout: $layout, amount: $amount, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,40 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query TopShoutsForLayout($layout: String!, $amount: Int, $offset: Int) {
|
||||
topLayoutShouts(layout: $layout, amount: $amount, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -1,8 +1,8 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query ReactionsForShoutsQuery($shouts: [String]!, $limit: Int!, $offset: Int!) {
|
||||
reactionsForShouts(shouts: $shouts, limit: $limit, offset: $offset) {
|
||||
query LoadReactionsByQuery($by: ReactionsBy, $limit: Int!, $offset: Int!) {
|
||||
loadReactionsBy(by: $by, amount: $limit, offset: $offset) {
|
||||
id
|
||||
createdBy {
|
||||
slug
|
|
@ -1,42 +0,0 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
query SearchResultsQuery($q: String!, $limit: Int!, $offset: Int!) {
|
||||
searchQuery(q: $q, limit: $limit, offset: $offset) {
|
||||
_id: slug
|
||||
title
|
||||
subtitle
|
||||
layout
|
||||
slug
|
||||
cover
|
||||
# community
|
||||
mainTopic
|
||||
topics {
|
||||
title
|
||||
body
|
||||
slug
|
||||
stat {
|
||||
_id: shouts
|
||||
shouts
|
||||
authors
|
||||
followers
|
||||
}
|
||||
}
|
||||
authors {
|
||||
_id: slug
|
||||
name
|
||||
slug
|
||||
userpic
|
||||
}
|
||||
createdAt
|
||||
publishedAt
|
||||
stat {
|
||||
_id: viewed
|
||||
viewed
|
||||
reacted
|
||||
rating
|
||||
commented
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
|
@ -41,6 +41,17 @@ export type AuthorStat = {
|
|||
rating?: Maybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type AuthorsBy = {
|
||||
createdAt?: InputMaybe<Scalars['DateTime']>
|
||||
days?: InputMaybe<Scalars['Int']>
|
||||
lastSeen?: InputMaybe<Scalars['DateTime']>
|
||||
name?: InputMaybe<Scalars['String']>
|
||||
order?: InputMaybe<Scalars['String']>
|
||||
slug?: InputMaybe<Scalars['String']>
|
||||
stat?: InputMaybe<Scalars['String']>
|
||||
topic?: InputMaybe<Scalars['String']>
|
||||
}
|
||||
|
||||
export type Chat = {
|
||||
admins?: Maybe<Array<Maybe<User>>>
|
||||
createdAt: Scalars['Int']
|
||||
|
@ -88,12 +99,6 @@ export type Collection = {
|
|||
title: Scalars['String']
|
||||
}
|
||||
|
||||
export type CollectionInput = {
|
||||
desc?: InputMaybe<Scalars['String']>
|
||||
pic?: InputMaybe<Scalars['String']>
|
||||
title: Scalars['String']
|
||||
}
|
||||
|
||||
export type Community = {
|
||||
createdAt: Scalars['DateTime']
|
||||
createdBy: User
|
||||
|
@ -104,12 +109,6 @@ export type Community = {
|
|||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type CommunityInput = {
|
||||
desc?: InputMaybe<Scalars['String']>
|
||||
pic?: InputMaybe<Scalars['String']>
|
||||
title: Scalars['String']
|
||||
}
|
||||
|
||||
export enum FollowingEntity {
|
||||
Author = 'AUTHOR',
|
||||
Community = 'COMMUNITY',
|
||||
|
@ -133,25 +132,28 @@ export enum MessageStatus {
|
|||
Updated = 'UPDATED'
|
||||
}
|
||||
|
||||
export type MessagesBy = {
|
||||
author?: InputMaybe<Scalars['String']>
|
||||
body?: InputMaybe<Scalars['String']>
|
||||
chat?: InputMaybe<Scalars['String']>
|
||||
days?: InputMaybe<Scalars['Int']>
|
||||
order?: InputMaybe<Scalars['String']>
|
||||
stat?: InputMaybe<Scalars['String']>
|
||||
}
|
||||
|
||||
export type Mutation = {
|
||||
confirmEmail: AuthResult
|
||||
createChat: Result
|
||||
createCollection: Result
|
||||
createCommunity: Result
|
||||
createMessage: Result
|
||||
createReaction: Result
|
||||
createShout: Result
|
||||
createTopic: Result
|
||||
deleteChat: Result
|
||||
deleteCollection: Result
|
||||
deleteCommunity: Result
|
||||
deleteMessage: Result
|
||||
deleteReaction: Result
|
||||
deleteShout: Result
|
||||
destroyTopic: Result
|
||||
enterChat: Result
|
||||
follow: Result
|
||||
incrementView: Result
|
||||
inviteAuthor: Result
|
||||
inviteChat: Result
|
||||
markAsRead: Result
|
||||
|
@ -162,9 +164,8 @@ export type Mutation = {
|
|||
sendLink: Result
|
||||
unfollow: Result
|
||||
updateChat: Result
|
||||
updateCollection: Result
|
||||
updateCommunity: Result
|
||||
updateMessage: Result
|
||||
updateOnlineStatus: Result
|
||||
updateProfile: Result
|
||||
updateReaction: Result
|
||||
updateShout: Result
|
||||
|
@ -180,14 +181,6 @@ export type MutationCreateChatArgs = {
|
|||
title?: InputMaybe<Scalars['String']>
|
||||
}
|
||||
|
||||
export type MutationCreateCollectionArgs = {
|
||||
collection: CollectionInput
|
||||
}
|
||||
|
||||
export type MutationCreateCommunityArgs = {
|
||||
community: CommunityInput
|
||||
}
|
||||
|
||||
export type MutationCreateMessageArgs = {
|
||||
body: Scalars['String']
|
||||
chatId: Scalars['String']
|
||||
|
@ -210,14 +203,6 @@ export type MutationDeleteChatArgs = {
|
|||
chatId: Scalars['String']
|
||||
}
|
||||
|
||||
export type MutationDeleteCollectionArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type MutationDeleteCommunityArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type MutationDeleteMessageArgs = {
|
||||
chatId: Scalars['String']
|
||||
id: Scalars['Int']
|
||||
|
@ -235,19 +220,11 @@ export type MutationDestroyTopicArgs = {
|
|||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type MutationEnterChatArgs = {
|
||||
chatId: Scalars['String']
|
||||
}
|
||||
|
||||
export type MutationFollowArgs = {
|
||||
slug: Scalars['String']
|
||||
what: FollowingEntity
|
||||
}
|
||||
|
||||
export type MutationIncrementViewArgs = {
|
||||
shout: Scalars['String']
|
||||
}
|
||||
|
||||
export type MutationInviteAuthorArgs = {
|
||||
author: Scalars['String']
|
||||
shout: Scalars['String']
|
||||
|
@ -293,14 +270,6 @@ export type MutationUpdateChatArgs = {
|
|||
chat: ChatInput
|
||||
}
|
||||
|
||||
export type MutationUpdateCollectionArgs = {
|
||||
collection: CollectionInput
|
||||
}
|
||||
|
||||
export type MutationUpdateCommunityArgs = {
|
||||
community: CommunityInput
|
||||
}
|
||||
|
||||
export type MutationUpdateMessageArgs = {
|
||||
body: Scalars['String']
|
||||
chatId: Scalars['String']
|
||||
|
@ -348,98 +317,66 @@ export type ProfileInput = {
|
|||
|
||||
export type Query = {
|
||||
authorsAll: Array<Maybe<Author>>
|
||||
collectionsAll: Array<Maybe<Collection>>
|
||||
getAuthor: User
|
||||
getCollabs: Array<Maybe<Collab>>
|
||||
getCommunities: Array<Maybe<Community>>
|
||||
getCommunity: Community
|
||||
getShoutBySlug: Shout
|
||||
getTopic: Topic
|
||||
getUserCollections: Array<Maybe<Collection>>
|
||||
getUserRoles: Array<Maybe<Role>>
|
||||
getUsersBySlugs: Array<Maybe<Author>>
|
||||
isEmailUsed: Scalars['Boolean']
|
||||
loadAuthorsBy: Array<Maybe<Author>>
|
||||
loadChats: Result
|
||||
loadMessages: Result
|
||||
loadMessagesBy: Result
|
||||
loadReactionsBy: Array<Maybe<Reaction>>
|
||||
loadShoutsBy: Array<Maybe<Shout>>
|
||||
markdownBody: Scalars['String']
|
||||
reactionsByAuthor: Array<Maybe<Reaction>>
|
||||
reactionsForShouts: Array<Maybe<Reaction>>
|
||||
recentAll: Array<Maybe<Shout>>
|
||||
recentCandidates: Array<Maybe<Shout>>
|
||||
recentCommented: Array<Maybe<Shout>>
|
||||
recentLayoutShouts: Array<Maybe<Shout>>
|
||||
recentPublished: Array<Maybe<Shout>>
|
||||
recentReacted: Array<Maybe<Shout>>
|
||||
searchChats: Result
|
||||
searchMessages: Result
|
||||
searchQuery?: Maybe<Array<Maybe<Shout>>>
|
||||
searchUsers: Result
|
||||
shoutsByAuthors: Array<Maybe<Shout>>
|
||||
shoutsByCollection: Array<Maybe<Shout>>
|
||||
shoutsByCommunities: Array<Maybe<Shout>>
|
||||
shoutsByLayout: Array<Maybe<Shout>>
|
||||
shoutsByTopics: Array<Maybe<Shout>>
|
||||
shoutsForFeed: Array<Maybe<Shout>>
|
||||
signIn: AuthResult
|
||||
signOut: AuthResult
|
||||
topAuthors: Array<Maybe<Author>>
|
||||
topCommented: Array<Maybe<Shout>>
|
||||
topLayoutShouts: Array<Maybe<Shout>>
|
||||
topMonth: Array<Maybe<Shout>>
|
||||
topMonthLayoutShouts: Array<Maybe<Shout>>
|
||||
topOverall: Array<Maybe<Shout>>
|
||||
topPublished: Array<Maybe<Shout>>
|
||||
topicsAll: Array<Maybe<Topic>>
|
||||
topicsByAuthor: Array<Maybe<Topic>>
|
||||
topicsByCommunity: Array<Maybe<Topic>>
|
||||
topicsRandom: Array<Maybe<Topic>>
|
||||
userFollowedAuthors: Array<Maybe<Author>>
|
||||
userFollowedCommunities: Array<Maybe<Community>>
|
||||
userFollowedTopics: Array<Maybe<Topic>>
|
||||
userFollowers: Array<Maybe<Author>>
|
||||
userReactedShouts: Array<Maybe<Shout>>
|
||||
}
|
||||
|
||||
export type QueryGetAuthorArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryGetCommunityArgs = {
|
||||
slug?: InputMaybe<Scalars['String']>
|
||||
}
|
||||
|
||||
export type QueryGetShoutBySlugArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryGetTopicArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryGetUserCollectionsArgs = {
|
||||
author: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryGetUserRolesArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryGetUsersBySlugsArgs = {
|
||||
slugs: Array<InputMaybe<Scalars['String']>>
|
||||
}
|
||||
|
||||
export type QueryIsEmailUsedArgs = {
|
||||
email: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryLoadAuthorsByArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
by?: InputMaybe<AuthorsBy>
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type QueryLoadChatsArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type QueryLoadMessagesArgs = {
|
||||
export type QueryLoadMessagesByArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
chatId: Scalars['String']
|
||||
by: MessagesBy
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type QueryLoadReactionsByArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
by: ReactionBy
|
||||
limit?: InputMaybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type QueryLoadShoutsByArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
by?: InputMaybe<ShoutsBy>
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
|
@ -447,106 +384,10 @@ export type QueryMarkdownBodyArgs = {
|
|||
body: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryReactionsByAuthorArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryReactionsForShoutsArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
shouts: Array<InputMaybe<Scalars['String']>>
|
||||
}
|
||||
|
||||
export type QueryRecentAllArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryRecentCandidatesArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryRecentCommentedArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryRecentLayoutShoutsArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
layout: Scalars['String']
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type QueryRecentPublishedArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryRecentReactedArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QuerySearchChatsArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
q: Scalars['String']
|
||||
}
|
||||
|
||||
export type QuerySearchMessagesArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
q: Scalars['String']
|
||||
}
|
||||
|
||||
export type QuerySearchQueryArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
q?: InputMaybe<Scalars['String']>
|
||||
}
|
||||
|
||||
export type QuerySearchUsersArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
q: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryShoutsByAuthorsArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
slugs: Array<InputMaybe<Scalars['String']>>
|
||||
}
|
||||
|
||||
export type QueryShoutsByCollectionArgs = {
|
||||
collection: Scalars['String']
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryShoutsByCommunitiesArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
slugs: Array<InputMaybe<Scalars['String']>>
|
||||
}
|
||||
|
||||
export type QueryShoutsByLayoutArgs = {
|
||||
amount: Scalars['Int']
|
||||
layout?: InputMaybe<Scalars['String']>
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryShoutsByTopicsArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
slugs: Array<InputMaybe<Scalars['String']>>
|
||||
}
|
||||
|
||||
export type QueryShoutsForFeedArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
query: Scalars['String']
|
||||
}
|
||||
|
||||
export type QuerySignInArgs = {
|
||||
|
@ -555,44 +396,6 @@ export type QuerySignInArgs = {
|
|||
password?: InputMaybe<Scalars['String']>
|
||||
}
|
||||
|
||||
export type QueryTopAuthorsArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryTopCommentedArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryTopLayoutShoutsArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
layout: Scalars['String']
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type QueryTopMonthArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryTopMonthLayoutShoutsArgs = {
|
||||
amount?: InputMaybe<Scalars['Int']>
|
||||
layout: Scalars['String']
|
||||
offset?: InputMaybe<Scalars['Int']>
|
||||
}
|
||||
|
||||
export type QueryTopOverallArgs = {
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryTopPublishedArgs = {
|
||||
daysago: Scalars['Int']
|
||||
limit: Scalars['Int']
|
||||
offset: Scalars['Int']
|
||||
}
|
||||
|
||||
export type QueryTopicsByAuthorArgs = {
|
||||
author: Scalars['String']
|
||||
}
|
||||
|
@ -609,10 +412,6 @@ export type QueryUserFollowedAuthorsArgs = {
|
|||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryUserFollowedCommunitiesArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryUserFollowedTopicsArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
@ -621,10 +420,6 @@ export type QueryUserFollowersArgs = {
|
|||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type QueryUserReactedShoutsArgs = {
|
||||
slug: Scalars['String']
|
||||
}
|
||||
|
||||
export type Rating = {
|
||||
rater: Scalars['String']
|
||||
value: Scalars['Int']
|
||||
|
@ -647,6 +442,16 @@ export type Reaction = {
|
|||
updatedAt?: Maybe<Scalars['DateTime']>
|
||||
}
|
||||
|
||||
export type ReactionBy = {
|
||||
author?: InputMaybe<Scalars['String']>
|
||||
body?: InputMaybe<Scalars['String']>
|
||||
days?: InputMaybe<Scalars['Int']>
|
||||
order?: InputMaybe<Scalars['String']>
|
||||
shout?: InputMaybe<Scalars['String']>
|
||||
stat?: InputMaybe<Scalars['String']>
|
||||
topic?: InputMaybe<Scalars['String']>
|
||||
}
|
||||
|
||||
export type ReactionInput = {
|
||||
body?: InputMaybe<Scalars['String']>
|
||||
kind: Scalars['Int']
|
||||
|
@ -757,6 +562,20 @@ export type ShoutInput = {
|
|||
visibleForUsers?: InputMaybe<Array<InputMaybe<Scalars['String']>>>
|
||||
}
|
||||
|
||||
export type ShoutsBy = {
|
||||
author?: InputMaybe<Scalars['String']>
|
||||
body?: InputMaybe<Scalars['String']>
|
||||
days?: InputMaybe<Scalars['Int']>
|
||||
layout?: InputMaybe<Scalars['String']>
|
||||
order?: InputMaybe<Scalars['String']>
|
||||
published?: InputMaybe<Scalars['Boolean']>
|
||||
slug?: InputMaybe<Scalars['String']>
|
||||
stat?: InputMaybe<Scalars['String']>
|
||||
title?: InputMaybe<Scalars['String']>
|
||||
topic?: InputMaybe<Scalars['String']>
|
||||
visibility?: InputMaybe<Scalars['String']>
|
||||
}
|
||||
|
||||
export type Stat = {
|
||||
commented?: Maybe<Scalars['Int']>
|
||||
ranking?: Maybe<Scalars['Int']>
|
||||
|
|
|
@ -9,11 +9,8 @@ import type {
|
|||
} from '../graphql/types.gen'
|
||||
import { publicGraphQLClient } from '../graphql/publicGraphQLClient'
|
||||
import { getToken, privateGraphQLClient } from '../graphql/privateGraphQLClient'
|
||||
import articleBySlug from '../graphql/query/article-by-slug'
|
||||
import articlesRecentAll from '../graphql/query/articles-recent-all'
|
||||
import articlesRecentPublished from '../graphql/query/articles-recent-published'
|
||||
import topicsAll from '../graphql/query/topics-all'
|
||||
import reactionsForShouts from '../graphql/query/reactions-for-shouts'
|
||||
import reactionsForShouts from '../graphql/query/reactions-load-by'
|
||||
import mySession from '../graphql/mutation/my-session'
|
||||
import authLogoutQuery from '../graphql/mutation/auth-logout'
|
||||
import authLoginQuery from '../graphql/query/auth-login'
|
||||
|
@ -23,26 +20,20 @@ import authConfirmEmailMutation from '../graphql/mutation/auth-confirm-email'
|
|||
import authSendLinkMutation from '../graphql/mutation/auth-send-link'
|
||||
import followMutation from '../graphql/mutation/follow'
|
||||
import unfollowMutation from '../graphql/mutation/unfollow'
|
||||
import articlesForAuthors from '../graphql/query/articles-for-authors'
|
||||
import articlesForTopics from '../graphql/query/articles-for-topics'
|
||||
import searchResults from '../graphql/query/search-results'
|
||||
import topicsRandomQuery from '../graphql/query/topics-random'
|
||||
import articlesTopMonth from '../graphql/query/articles-top-month'
|
||||
import articlesTopRated from '../graphql/query/articles-top-rated'
|
||||
import authorsAll from '../graphql/query/authors-all'
|
||||
import reactionCreate from '../graphql/mutation/reaction-create'
|
||||
import reactionDestroy from '../graphql/mutation/reaction-destroy'
|
||||
import reactionUpdate from '../graphql/mutation/reaction-update'
|
||||
import incrementView from '../graphql/mutation/increment-view'
|
||||
import createArticle from '../graphql/mutation/article-create'
|
||||
import myChats from '../graphql/query/im-chats'
|
||||
import loadChat from '../graphql/query/im-load-messages'
|
||||
import getRecentByLayout from '../graphql/query/layout-recent'
|
||||
import getTopByLayout from '../graphql/query/layout-top'
|
||||
import getTopMonthByLayout from '../graphql/query/layout-top-month'
|
||||
import type { LayoutType } from '../stores/zine/layouts'
|
||||
import myChats from '../graphql/query/chats-load'
|
||||
import loadChat from '../graphql/query/chat-messages-load-by'
|
||||
import topicBySlug from '../graphql/query/topic-by-slug'
|
||||
import authorBySlug from '../graphql/query/author-by-slug'
|
||||
import shoutsLoadBy from '../graphql/query/articles-load-by'
|
||||
import reactionsLoadBy from '../graphql/query/reactions-load-by'
|
||||
import authorsLoadBy from '../graphql/query/authors-load-by'
|
||||
|
||||
const FEED_SIZE = 50
|
||||
|
||||
|
@ -157,12 +148,21 @@ export const apiClient = {
|
|||
},
|
||||
|
||||
getTopArticles: async () => {
|
||||
const response = await publicGraphQLClient.query(articlesTopRated, { limit: 10, offset: 0 }).toPromise()
|
||||
return response.data.topOverall
|
||||
const by = {
|
||||
stat: 'rating',
|
||||
visibility: 'public'
|
||||
}
|
||||
const response = await publicGraphQLClient.query(shoutsLoadBy, { by, limit: 10, offset: 0 }).toPromise()
|
||||
return response.data.loadShoutsBy
|
||||
},
|
||||
getTopMonthArticles: async () => {
|
||||
const response = await publicGraphQLClient.query(articlesTopMonth, { limit: 10, offset: 0 }).toPromise()
|
||||
return response.data.topMonth
|
||||
const by = {
|
||||
stat: 'rating',
|
||||
visibility: 'public',
|
||||
days: 30
|
||||
}
|
||||
const response = await publicGraphQLClient.query(shoutsLoadBy, { by, limit: 10, offset: 0 }).toPromise()
|
||||
return response.data.loadShoutsBy
|
||||
},
|
||||
getRecentPublishedArticles: async ({
|
||||
limit = FEED_SIZE,
|
||||
|
@ -171,9 +171,12 @@ export const apiClient = {
|
|||
limit?: number
|
||||
offset?: number
|
||||
}) => {
|
||||
const response = await publicGraphQLClient.query(articlesRecentPublished, { limit, offset }).toPromise()
|
||||
const by = {
|
||||
visibility: 'public'
|
||||
}
|
||||
const response = await publicGraphQLClient.query(shoutsLoadBy, { by, limit, offset }).toPromise()
|
||||
|
||||
return response.data.recentPublished
|
||||
return response.data.loadShoutsBy
|
||||
},
|
||||
getRandomTopics: async ({ amount }: { amount: number }) => {
|
||||
const response = await publicGraphQLClient.query(topicsRandomQuery, { amount }).toPromise()
|
||||
|
@ -187,17 +190,19 @@ export const apiClient = {
|
|||
getSearchResults: async ({
|
||||
query,
|
||||
limit = FEED_SIZE,
|
||||
offset = 0,
|
||||
layout = 'literature'
|
||||
offset = 0
|
||||
}: {
|
||||
query: string
|
||||
limit: number
|
||||
offset?: number
|
||||
layout?: LayoutType
|
||||
}): Promise<Shout[]> => {
|
||||
const by = {
|
||||
title: query,
|
||||
body: query
|
||||
}
|
||||
const response = await publicGraphQLClient
|
||||
.query(searchResults, {
|
||||
q: query,
|
||||
.query(shoutsLoadBy, {
|
||||
by,
|
||||
limit,
|
||||
offset
|
||||
})
|
||||
|
@ -213,7 +218,8 @@ export const apiClient = {
|
|||
offset?: number
|
||||
}): Promise<Shout[]> => {
|
||||
const response = await publicGraphQLClient
|
||||
.query(articlesRecentAll, {
|
||||
.query(shoutsLoadBy, {
|
||||
by: {},
|
||||
limit,
|
||||
offset
|
||||
})
|
||||
|
@ -230,9 +236,13 @@ export const apiClient = {
|
|||
limit: number
|
||||
offset?: number
|
||||
}): Promise<Shout[]> => {
|
||||
const by = {
|
||||
topics: topicSlugs,
|
||||
visibility: 'public'
|
||||
}
|
||||
const response = await publicGraphQLClient
|
||||
.query(articlesForTopics, {
|
||||
slugs: topicSlugs,
|
||||
.query(shoutsLoadBy, {
|
||||
by,
|
||||
limit,
|
||||
offset
|
||||
})
|
||||
|
@ -253,13 +263,17 @@ export const apiClient = {
|
|||
limit: number
|
||||
offset?: number
|
||||
}): Promise<Shout[]> => {
|
||||
const by = {
|
||||
authors: authorSlugs,
|
||||
visibility: 'public'
|
||||
}
|
||||
const vars = {
|
||||
slugs: authorSlugs,
|
||||
by,
|
||||
limit,
|
||||
offset
|
||||
}
|
||||
console.debug(vars)
|
||||
const response = await publicGraphQLClient.query(articlesForAuthors, vars).toPromise()
|
||||
// console.debug(vars)
|
||||
const response = await publicGraphQLClient.query(shoutsLoadBy, vars).toPromise()
|
||||
|
||||
if (response.error) {
|
||||
console.error('[api-client] getArticlesForAuthors', response.error)
|
||||
|
@ -298,7 +312,10 @@ export const apiClient = {
|
|||
return response.data.refreshSession
|
||||
},
|
||||
getPublishedArticles: async ({ limit = FEED_SIZE, offset }: { limit?: number; offset?: number }) => {
|
||||
const response = await publicGraphQLClient.query(articlesRecentPublished, { limit, offset }).toPromise()
|
||||
const by = {
|
||||
visibility: 'public'
|
||||
}
|
||||
const response = await publicGraphQLClient.query(shoutsLoadBy, { by, limit, offset }).toPromise()
|
||||
|
||||
if (response.error) {
|
||||
console.error('[api-client] getPublishedArticles', response.error)
|
||||
|
@ -329,7 +346,9 @@ export const apiClient = {
|
|||
return response.data.getTopic
|
||||
},
|
||||
getArticle: async ({ slug }: { slug: string }): Promise<Shout> => {
|
||||
const response = await publicGraphQLClient.query(articleBySlug, { slug }).toPromise()
|
||||
const response = await publicGraphQLClient
|
||||
.query(shoutsLoadBy, { by: { slug }, amount: 1, offset: 0 })
|
||||
.toPromise()
|
||||
return response.data?.getShoutBySlug
|
||||
},
|
||||
|
||||
|
@ -382,29 +401,44 @@ export const apiClient = {
|
|||
return resp.data.myChats
|
||||
},
|
||||
getRecentLayoutShouts: async ({ layout = 'article', amount = 50, offset = 0 }) => {
|
||||
const resp = await publicGraphQLClient.query(getRecentByLayout, { amount, offset, layout }).toPromise()
|
||||
const by = {
|
||||
layout
|
||||
}
|
||||
const resp = await publicGraphQLClient.query(shoutsLoadBy, { by, amount, offset }).toPromise()
|
||||
return resp.data.recentLayoutShouts
|
||||
},
|
||||
getTopLayoutShouts: async ({ layout = 'article', amount = 50, offset = 0 }) => {
|
||||
const resp = await publicGraphQLClient.query(getTopByLayout, { amount, offset, layout }).toPromise()
|
||||
const by = {
|
||||
layout,
|
||||
stat: 'rating',
|
||||
order: 'rating'
|
||||
}
|
||||
const resp = await publicGraphQLClient.query(shoutsLoadBy, { by, amount, offset }).toPromise()
|
||||
return resp.data.topLayoutShouts
|
||||
},
|
||||
getTopMonthLayoutShouts: async ({ layout = 'article', amount = 50, offset = 0 }) => {
|
||||
const resp = await publicGraphQLClient
|
||||
.query(getTopMonthByLayout, { amount, offset, layout })
|
||||
.toPromise()
|
||||
const by = {
|
||||
layout,
|
||||
stat: 'rating',
|
||||
order: 'rating',
|
||||
days: 30
|
||||
}
|
||||
const resp = await publicGraphQLClient.query(shoutsLoadBy, { amount, offset, layout }).toPromise()
|
||||
return resp.data.topMonthLayoutShouts
|
||||
},
|
||||
getChatMessages: async ({
|
||||
chatId,
|
||||
offset = 0,
|
||||
amount = 50
|
||||
chat,
|
||||
amount = 50,
|
||||
offset = 0
|
||||
}: {
|
||||
chatId: string
|
||||
offset?: number
|
||||
chat: string
|
||||
amount?: number
|
||||
offset?: number
|
||||
}) => {
|
||||
const resp = await privateGraphQLClient.query(loadChat, { chatId, offset, amount }).toPromise()
|
||||
const by = {
|
||||
chat
|
||||
}
|
||||
const resp = await privateGraphQLClient.query(loadChat, { by, offset, amount }).toPromise()
|
||||
return resp.data.loadChat
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user