From 94b00b73f966ee1363d3851841a64da2799909d0 Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Thu, 29 Apr 2021 11:01:51 +0300 Subject: [PATCH 1/5] Fix after merge --- .../graphql/src/generated/nexus-typegen.ts | 311 +- .../Proposals/Queries/GetProposals.query.ts | 26 + .../src/schema/Types/Proposals/index.ts | 2 + packages/web/.eslintrc.js | 32 +- packages/web/package.json | 2 + .../AuthContainer/AuthContainer.tsx | 11 +- .../CommonListItem/CommonListItem.tsx | 2 +- .../CommonDetailContainer.tsx | 2 + .../CommonListContainer.tsx | 18 +- .../web/src/containers/Common/store/api.tsx | 1 + .../src/containers/Common/store/reducer.tsx | 1 + packages/web/src/context/AuthContext.tsx | 56 + .../web/src/context/PermissionsContext.tsx | 62 + packages/web/src/context/index.ts | 2 + packages/web/src/graphql/index.ts | 252 + packages/web/src/graphql/indexx.ts | 2154 +++++++ packages/web/src/graphql/schema.graphql | 416 ++ packages/web/src/graphql/schema.json | 5345 +++++++++++++++++ packages/web/src/helpers/apolloHelper.ts | 22 + packages/web/src/hooks/index.ts | 1 + packages/web/src/hooks/useApollo.ts | 8 + packages/web/src/index.tsx | 5 +- packages/web/src/providers/ApolloProvider.tsx | 17 + yarn.lock | 48 + 24 files changed, 8606 insertions(+), 190 deletions(-) create mode 100644 packages/graphql/src/schema/Types/Proposals/Queries/GetProposals.query.ts create mode 100644 packages/web/src/context/AuthContext.tsx create mode 100644 packages/web/src/context/PermissionsContext.tsx create mode 100644 packages/web/src/context/index.ts create mode 100644 packages/web/src/graphql/index.ts create mode 100644 packages/web/src/graphql/indexx.ts create mode 100644 packages/web/src/graphql/schema.graphql create mode 100644 packages/web/src/graphql/schema.json create mode 100644 packages/web/src/helpers/apolloHelper.ts create mode 100644 packages/web/src/hooks/index.ts create mode 100644 packages/web/src/hooks/useApollo.ts create mode 100644 packages/web/src/providers/ApolloProvider.tsx diff --git a/packages/graphql/src/generated/nexus-typegen.ts b/packages/graphql/src/generated/nexus-typegen.ts index c7832306d..b821b2e4b 100644 --- a/packages/graphql/src/generated/nexus-typegen.ts +++ b/packages/graphql/src/generated/nexus-typegen.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ /** * This file was generated by Nexus Schema * Do not make changes to this file directly @@ -14,15 +15,15 @@ declare global { /** * A field whose value conforms to the standard URL format as specified in RFC3986: https://www.ietf.org/rfc/rfc3986.txt. */ - url(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void // "URL"; + url(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void; // "URL"; /** * A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */ - date(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void // "DateTime"; + date(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void; // "DateTime"; /** * The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */ - json(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void // "JSON"; + json(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void; // "JSON"; /** * A field whose value is a generic Universally Unique Identifier: https://en.wikipedia.org/wiki/Universally_unique_identifier. */ @@ -35,15 +36,15 @@ declare global { /** * A field whose value conforms to the standard URL format as specified in RFC3986: https://www.ietf.org/rfc/rfc3986.txt. */ - url(fieldName: FieldName, ...opts: core.ScalarOutSpread): void // "URL"; + url(fieldName: FieldName, ...opts: core.ScalarOutSpread): void; // "URL"; /** * A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */ - date(fieldName: FieldName, ...opts: core.ScalarOutSpread): void // "DateTime"; + date(fieldName: FieldName, ...opts: core.ScalarOutSpread): void; // "DateTime"; /** * The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */ - json(fieldName: FieldName, ...opts: core.ScalarOutSpread): void // "JSON"; + json(fieldName: FieldName, ...opts: core.ScalarOutSpread): void; // "JSON"; /** * A field whose value is a generic Universally Unique Identifier: https://en.wikipedia.org/wiki/Universally_unique_identifier. */ @@ -70,37 +71,37 @@ export interface NexusGenInputs { line2?: string | null; // String name: string; // String! postalCode: string; // String! - } + }; CommonMemberOrderByInput: { // input type createdAt: NexusGenEnums['SortOrder']; // SortOrder! - } + }; CommonWhereUniqueInput: { // input type id: string; // ID! - } + }; CreateCardInput: { // input type billingDetails: NexusGenInputs['BillingDetailsInput']; // BillingDetailsInput! encryptedData: string; // String! expMonth: number; // Int! expYear: number; // Int! keyId: string; // String! - } + }; CreateCommonInput: { // input type description?: string | null; // String fundingMinimumAmount: number; // Int! fundingType: NexusGenEnums['FundingType']; // FundingType! image: string; // String! name: string; // String! - } + }; CreateDiscussionInput: { // input type commonId: string; // ID! description: string; // String! proposalId?: string | null; // ID topic: string; // String! - } + }; CreateDiscussionMessageInput: { // input type discussionId: string; // ID! message: string; // String! - } + }; CreateFundingProposalInput: { // input type amount: number; // Int! commonId: string; // ID! @@ -109,7 +110,7 @@ export interface NexusGenInputs { images?: NexusGenInputs['ProposalImageInput'][] | null; // [ProposalImageInput!] links?: NexusGenInputs['ProposalLinkInput'][] | null; // [ProposalLinkInput!] title: string; // String! - } + }; CreateJoinProposalInput: { // input type cardId: string; // String! commonId: string; // String! @@ -133,33 +134,33 @@ export interface NexusGenInputs { CreateUserNotificationTokenInput: { // input type description: string; // String! token: string; // String! - } + }; CreateVoteInput: { // input type outcome: NexusGenEnums['VoteOutcome']; // VoteOutcome! proposalId: string; // ID! - } + }; DiscussionMessagesOrderByInput: { // input type createdAt?: NexusGenEnums['SortOrder'] | null; // SortOrder updatedAt?: NexusGenEnums['SortOrder'] | null; // SortOrder - } + }; DiscussionSubscriptionOrderByInput: { // input type createdAt?: NexusGenEnums['SortOrder'] | null; // SortOrder updatedAt?: NexusGenEnums['SortOrder'] | null; // SortOrder - } + }; EventOrderByInput: { // input type createdAt?: NexusGenEnums['SortOrder'] | null; // SortOrder type?: NexusGenEnums['SortOrder'] | null; // SortOrder updatedAt?: NexusGenEnums['SortOrder'] | null; // SortOrder - } + }; LinkInput: { // input type title: string; // String! url: string; // String! - } + }; NotificationOrderByInput: { // input type createdAt?: NexusGenEnums['SortOrder'] | null; // SortOrder status?: NexusGenEnums['SortOrder'] | null; // SortOrder updatedAt?: NexusGenEnums['SortOrder'] | null; // SortOrder - } + }; NotificationWhereInput: { // input type commonId?: NexusGenScalars['UUID'] | null; // UUID discussionId?: NexusGenScalars['UUID'] | null; // UUID @@ -167,7 +168,7 @@ export interface NexusGenInputs { seenStatus?: NexusGenEnums['NotificationSeenStatus'] | null; // NotificationSeenStatus type?: NexusGenEnums['NotificationType'] | null; // NotificationType userId?: string | null; // ID - } + }; NotificationWhereUniqueInput: { // input type id?: NexusGenScalars['UUID'] | null; // UUID } @@ -177,20 +178,20 @@ export interface NexusGenInputs { } ProposalFileInput: { // input type value: string; // String! - } + }; ProposalImageInput: { // input type value: string; // String! - } + }; ProposalLinkInput: { // input type title: string; // String! url: string; // String! - } + }; ProposalWhereInput: { // input type type?: NexusGenEnums['ProposalType'] | null; // ProposalType - } + }; ProposalWhereUniqueInput: { // input type id: NexusGenScalars['UUID']; // UUID! - } + }; ReportDiscussionMessageInput: { // input type for: NexusGenEnums['ReportFor']; // ReportFor! messageId: NexusGenScalars['UUID']; // UUID! @@ -218,7 +219,7 @@ export interface NexusGenInputs { lte?: string | null; // String notIn?: string[] | null; // [String!] startsWith?: string | null; // String - } + }; } export interface NexusGenEnums { @@ -263,7 +264,7 @@ export interface NexusGenObjects { createdAt: NexusGenScalars['DateTime']; // DateTime! id: string; // ID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; Common: { // root type action?: string | null; // String balance: number; // Int! @@ -278,7 +279,7 @@ export interface NexusGenObjects { raised: number; // Int! updatedAt: NexusGenScalars['DateTime']; // DateTime! whitelisted: boolean; // Boolean! - } + }; CommonMember: { // root type commonId: string; // ID! createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -286,7 +287,7 @@ export interface NexusGenObjects { roles: NexusGenEnums['CommonMemberRole'][]; // [CommonMemberRole!]! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId: string; // ID! - } + }; Discussion: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string; // String! @@ -295,7 +296,7 @@ export interface NexusGenObjects { topic: string; // String! type: NexusGenEnums['DiscussionType']; // DiscussionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; DiscussionMessage: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! flag: NexusGenEnums['DiscussionMessageFlag']; // DiscussionMessageFlag! @@ -303,7 +304,7 @@ export interface NexusGenObjects { message: string; // String! type: NexusGenEnums['DiscussionMessageType']; // DiscussionMessageType! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; DiscussionSubscription: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! discussionId: NexusGenScalars['UUID']; // UUID! @@ -311,7 +312,7 @@ export interface NexusGenObjects { type: NexusGenEnums['DiscussionSubscriptionType']; // DiscussionSubscriptionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId: string; // String! - } + }; Event: { // root type commonId?: string | null; // ID createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -320,14 +321,14 @@ export interface NexusGenObjects { type: NexusGenEnums['EventType']; // EventType! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId?: string | null; // ID - } + }; FundingProposal: { // root type amount: number; // Int! createdAt: NexusGenScalars['DateTime']; // DateTime! fundingState: NexusGenEnums['FundingState']; // FundingState! id: NexusGenScalars['UUID']; // UUID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; JoinProposal: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! funding: number; // Int! @@ -335,11 +336,11 @@ export interface NexusGenObjects { id: NexusGenScalars['UUID']; // UUID! paymentState: NexusGenEnums['PaymentState']; // PaymentState! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; Link: { // root type title: string; // String! url: string; // String! - } + }; Mutation: {}; Notification: { // root type commonId?: NexusGenScalars['UUID'] | null; // UUID @@ -352,7 +353,7 @@ export interface NexusGenObjects { type: NexusGenEnums['NotificationType']; // NotificationType! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId: NexusGenScalars['UUID']; // UUID! - } + }; Proposal: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! description?: string | null; // String @@ -411,7 +412,7 @@ export interface NexusGenObjects { permissions: string[]; // [String!]! photo: string; // String! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; UserNotificationToken: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string; // String! @@ -420,12 +421,12 @@ export interface NexusGenObjects { lastVerified: NexusGenScalars['DateTime']; // DateTime! state: NexusGenEnums['UserNotificationTokenState']; // UserNotificationTokenState! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; Vote: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! id: string; // ID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; } export interface NexusGenInterfaces { @@ -444,7 +445,7 @@ export interface NexusGenFieldTypes { createdAt: NexusGenScalars['DateTime']; // DateTime! id: string; // ID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; Common: { // field return type action: string | null; // String activeFundingProposals: number; // Int! @@ -467,7 +468,7 @@ export interface NexusGenFieldTypes { reports: NexusGenRootTypes['Report'][]; // [Report!]! updatedAt: NexusGenScalars['DateTime']; // DateTime! whitelisted: boolean; // Boolean! - } + }; CommonMember: { // field return type common: NexusGenRootTypes['Common'] | null; // Common commonId: string; // ID! @@ -478,7 +479,7 @@ export interface NexusGenFieldTypes { updatedAt: NexusGenScalars['DateTime']; // DateTime! user: NexusGenRootTypes['User'] | null; // User userId: string; // ID! - } + }; Discussion: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string; // String! @@ -488,7 +489,7 @@ export interface NexusGenFieldTypes { topic: string; // String! type: NexusGenEnums['DiscussionType']; // DiscussionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; DiscussionMessage: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! flag: NexusGenEnums['DiscussionMessageFlag']; // DiscussionMessageFlag! @@ -497,7 +498,7 @@ export interface NexusGenFieldTypes { reports: NexusGenRootTypes['Report'][]; // [Report!]! type: NexusGenEnums['DiscussionMessageType']; // DiscussionMessageType! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; DiscussionSubscription: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! discussion: NexusGenRootTypes['Discussion']; // Discussion! @@ -506,7 +507,7 @@ export interface NexusGenFieldTypes { type: NexusGenEnums['DiscussionSubscriptionType']; // DiscussionSubscriptionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId: string; // String! - } + }; Event: { // field return type commonId: string | null; // ID createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -516,14 +517,14 @@ export interface NexusGenFieldTypes { updatedAt: NexusGenScalars['DateTime']; // DateTime! user: NexusGenRootTypes['User'] | null; // User userId: string | null; // ID - } + }; FundingProposal: { // field return type amount: number; // Int! createdAt: NexusGenScalars['DateTime']; // DateTime! fundingState: NexusGenEnums['FundingState']; // FundingState! id: NexusGenScalars['UUID']; // UUID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; JoinProposal: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! funding: number; // Int! @@ -531,11 +532,11 @@ export interface NexusGenFieldTypes { id: NexusGenScalars['UUID']; // UUID! paymentState: NexusGenEnums['PaymentState']; // PaymentState! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; Link: { // field return type title: string; // String! url: string; // String! - } + }; Mutation: { // field return type actOnReport: NexusGenRootTypes['Report'] | null; // Report assignRole: NexusGenScalars['Void'] | null; // Void @@ -571,7 +572,7 @@ export interface NexusGenFieldTypes { updatedAt: NexusGenScalars['DateTime']; // DateTime! user: NexusGenRootTypes['User']; // User! userId: NexusGenScalars['UUID']; // UUID! - } + }; Proposal: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string | null; // String @@ -603,7 +604,7 @@ export interface NexusGenFieldTypes { proposal: NexusGenRootTypes['Proposal'] | null; // Proposal roles: Array | null; // [Role] user: NexusGenRootTypes['User'] | null; // User - } + }; Report: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! for: NexusGenEnums['ReportFor']; // ReportFor! @@ -639,7 +640,7 @@ export interface NexusGenFieldTypes { discussionMessageCreated: NexusGenRootTypes['DiscussionMessage'] | null; // DiscussionMessage notificationCreated: NexusGenRootTypes['Notification'] | null; // Notification onProposalChange: NexusGenRootTypes['Proposal'] | null; // Proposal - } + }; User: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! discussionSubscriptions: NexusGenRootTypes['DiscussionSubscription'][]; // [DiscussionSubscription!]! @@ -655,7 +656,7 @@ export interface NexusGenFieldTypes { photo: string; // String! proposals: NexusGenRootTypes['Proposal'][]; // [Proposal!]! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; UserNotificationToken: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string; // String! @@ -665,25 +666,25 @@ export interface NexusGenFieldTypes { state: NexusGenEnums['UserNotificationTokenState']; // UserNotificationTokenState! token: string; // String! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; Vote: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! id: string; // ID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; BaseEntity: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! id: NexusGenScalars['UUID']; // UUID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - } + }; } export interface NexusGenFieldTypeNames { Card: { // field return type name - createdAt: 'DateTime' - id: 'ID' - updatedAt: 'DateTime' - } + createdAt: 'DateTime'; + id: 'ID'; + updatedAt: 'DateTime'; + }; Common: { // field return type name action: 'String' activeFundingProposals: 'Int' @@ -719,15 +720,15 @@ export interface NexusGenFieldTypeNames { userId: 'ID' } Discussion: { // field return type name - createdAt: 'DateTime' - description: 'String' - id: 'UUID' - latestMessage: 'DateTime' - messages: 'DiscussionMessage' - topic: 'String' - type: 'DiscussionType' - updatedAt: 'DateTime' - } + createdAt: 'DateTime'; + description: 'String'; + id: 'UUID'; + latestMessage: 'DateTime'; + messages: 'DiscussionMessage'; + topic: 'String'; + type: 'DiscussionType'; + updatedAt: 'DateTime'; + }; DiscussionMessage: { // field return type name createdAt: 'DateTime' flag: 'DiscussionMessageFlag' @@ -738,14 +739,14 @@ export interface NexusGenFieldTypeNames { updatedAt: 'DateTime' } DiscussionSubscription: { // field return type name - createdAt: 'DateTime' - discussion: 'Discussion' - discussionId: 'UUID' - id: 'UUID' - type: 'DiscussionSubscriptionType' - updatedAt: 'DateTime' - userId: 'String' - } + createdAt: 'DateTime'; + discussion: 'Discussion'; + discussionId: 'UUID'; + id: 'UUID'; + type: 'DiscussionSubscriptionType'; + updatedAt: 'DateTime'; + userId: 'String'; + }; Event: { // field return type name commonId: 'ID' createdAt: 'DateTime' @@ -772,9 +773,9 @@ export interface NexusGenFieldTypeNames { updatedAt: 'DateTime' } Link: { // field return type name - title: 'String' - url: 'String' - } + title: 'String'; + url: 'String'; + }; Mutation: { // field return type name actOnReport: 'Report' assignRole: 'Void' @@ -796,21 +797,21 @@ export interface NexusGenFieldTypeNames { whitelistCommon: 'Boolean' } Notification: { // field return type name - common: 'Common' - commonId: 'UUID' - createdAt: 'DateTime' - discussion: 'Discussion' - discussionId: 'UUID' - id: 'UUID' - proposal: 'Proposal' - proposalId: 'UUID' - seenStatus: 'NotificationSeenStatus' - show: 'Boolean' - type: 'NotificationType' - updatedAt: 'DateTime' - user: 'User' - userId: 'UUID' - } + common: 'Common'; + commonId: 'UUID'; + createdAt: 'DateTime'; + discussion: 'Discussion'; + discussionId: 'UUID'; + id: 'UUID'; + proposal: 'Proposal'; + proposalId: 'UUID'; + seenStatus: 'NotificationSeenStatus'; + show: 'Boolean'; + type: 'NotificationType'; + updatedAt: 'DateTime'; + user: 'User'; + userId: 'UUID'; + }; Proposal: { // field return type name createdAt: 'DateTime' description: 'String' @@ -875,10 +876,10 @@ export interface NexusGenFieldTypeNames { users: 'Int' } Subscription: { // field return type name - discussionMessageCreated: 'DiscussionMessage' - notificationCreated: 'Notification' - onProposalChange: 'Proposal' - } + discussionMessageCreated: 'DiscussionMessage'; + notificationCreated: 'Notification'; + onProposalChange: 'Proposal'; + }; User: { // field return type name createdAt: 'DateTime' discussionSubscriptions: 'DiscussionSubscription' @@ -896,25 +897,25 @@ export interface NexusGenFieldTypeNames { updatedAt: 'DateTime' } UserNotificationToken: { // field return type name - createdAt: 'DateTime' - description: 'String' - id: 'UUID' - lastUsed: 'DateTime' - lastVerified: 'DateTime' - state: 'UserNotificationTokenState' - token: 'String' - updatedAt: 'DateTime' - } + createdAt: 'DateTime'; + description: 'String'; + id: 'UUID'; + lastUsed: 'DateTime'; + lastVerified: 'DateTime'; + state: 'UserNotificationTokenState'; + token: 'String'; + updatedAt: 'DateTime'; + }; Vote: { // field return type name - createdAt: 'DateTime' - id: 'ID' - updatedAt: 'DateTime' - } + createdAt: 'DateTime'; + id: 'ID'; + updatedAt: 'DateTime'; + }; BaseEntity: { // field return type name - createdAt: 'DateTime' - id: 'UUID' - updatedAt: 'DateTime' - } + createdAt: 'DateTime'; + id: 'UUID'; + updatedAt: 'DateTime'; + }; } export interface NexusGenArgTypes { @@ -922,17 +923,17 @@ export interface NexusGenArgTypes { discussions: { // args skip?: number | null; // Int take?: number | null; // Int - } + }; events: { // args orderBy?: NexusGenInputs['EventOrderByInput'] | null; // EventOrderByInput skip?: number | null; // Int take: number | null; // Int - } + }; members: { // args orderBy?: NexusGenInputs['CommonMemberOrderByInput'] | null; // CommonMemberOrderByInput skip?: number | null; // Int take?: number | null; // Int - } + }; proposals: { // args paginate?: NexusGenInputs['PaginateInput'] | null; // PaginateInput where?: NexusGenInputs['ProposalWhereInput'] | null; // ProposalWhereInput @@ -946,15 +947,15 @@ export interface NexusGenArgTypes { skip?: number | null; // Int take: number | null; // Int where?: NexusGenInputs['ProposalWhereInput'] | null; // ProposalWhereInput - } - } + }; + }; Discussion: { messages: { // args orderBy: NexusGenInputs['DiscussionMessagesOrderByInput'] | null; // DiscussionMessagesOrderByInput skip?: number | null; // Int take: number | null; // Int - } - } + }; + }; Mutation: { actOnReport: { // args input: NexusGenInputs['ActOnReportInput']; // ActOnReportInput! @@ -966,22 +967,22 @@ export interface NexusGenArgTypes { changeDiscussionSubscriptionType: { // args id: string; // ID! type: NexusGenEnums['DiscussionSubscriptionType']; // DiscussionSubscriptionType! - } + }; createCard: { // args input: NexusGenInputs['CreateCardInput']; // CreateCardInput! - } + }; createCommon: { // args input: NexusGenInputs['CreateCommonInput']; // CreateCommonInput! - } + }; createDiscussion: { // args input: NexusGenInputs['CreateDiscussionInput']; // CreateDiscussionInput! - } + }; createDiscussionMessage: { // args input: NexusGenInputs['CreateDiscussionMessageInput']; // CreateDiscussionMessageInput! - } + }; createFundingProposal: { // args input: NexusGenInputs['CreateFundingProposalInput']; // CreateFundingProposalInput! - } + }; createJoinProposal: { // args input: NexusGenInputs['CreateJoinProposalInput']; // CreateJoinProposalInput! } @@ -990,16 +991,16 @@ export interface NexusGenArgTypes { } createUser: { // args input: NexusGenInputs['CreateUserInput']; // CreateUserInput! - } + }; createUserNotificationToken: { // args input: NexusGenInputs['CreateUserNotificationTokenInput']; // CreateUserNotificationTokenInput! - } + }; createVote: { // args input: NexusGenInputs['CreateVoteInput']; // CreateVoteInput! - } + }; finalizeProposal: { // args proposalId: string; // ID! - } + }; reportDiscussionMessage: { // args input: NexusGenInputs['ReportDiscussionMessageInput']; // ReportDiscussionMessageInput! } @@ -1018,8 +1019,8 @@ export interface NexusGenArgTypes { discussions: { // args skip?: number | null; // Int take?: number | null; // Int - } - } + }; + }; Query: { common: { // args where: NexusGenInputs['CommonWhereUniqueInput']; // CommonWhereUniqueInput! @@ -1047,39 +1048,39 @@ export interface NexusGenArgTypes { } user: { // args userId?: string | null; // ID - } - } + }; + }; Subscription: { discussionMessageCreated: { // args discussionId: string; // ID! - } + }; onProposalChange: { // args proposalId: string; // ID! - } - } + }; + }; User: { discussionSubscriptions: { // args orderBy?: NexusGenInputs['DiscussionSubscriptionOrderByInput'] | null; // DiscussionSubscriptionOrderByInput skip?: number | null; // Int take: number | null; // Int - } + }; events: { // args orderBy?: NexusGenInputs['EventOrderByInput'] | null; // EventOrderByInput skip?: number | null; // Int take: number | null; // Int - } + }; notifications: { // args cursor?: NexusGenInputs['NotificationWhereUniqueInput'] | null; // NotificationWhereUniqueInput orderBy: NexusGenInputs['NotificationOrderByInput'] | null; // NotificationOrderByInput skip?: number | null; // Int take: number | null; // Int - } + }; proposals: { // args skip?: number | null; // Int take: number | null; // Int where?: NexusGenInputs['ProposalWhereInput'] | null; // ProposalWhereInput - } - } + }; + }; } export interface NexusGenAbstractTypeMembers { @@ -1118,10 +1119,10 @@ export type NexusGenAbstractsUsingStrategyResolveType = "BaseEntity"; export type NexusGenFeaturesConfig = { abstractTypeStrategies: { - isTypeOf: false - resolveType: true - __typename: false - } + isTypeOf: false; + resolveType: true; + __typename: false; + }; } export interface NexusGenTypes { @@ -1142,7 +1143,7 @@ export interface NexusGenTypes { unionNames: NexusGenUnionNames; allInputTypes: NexusGenTypes['inputNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['scalarNames']; allOutputTypes: NexusGenTypes['objectNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['unionNames'] | NexusGenTypes['interfaceNames'] | NexusGenTypes['scalarNames']; - allNamedTypes: NexusGenTypes['allInputTypes'] | NexusGenTypes['allOutputTypes'] + allNamedTypes: NexusGenTypes['allInputTypes'] | NexusGenTypes['allOutputTypes']; abstractTypes: NexusGenTypes['interfaceNames'] | NexusGenTypes['unionNames']; abstractTypeMembers: NexusGenAbstractTypeMembers; objectsUsingAbstractStrategyIsTypeOf: NexusGenObjectsUsingAbstractStrategyIsTypeOf; @@ -1160,7 +1161,7 @@ declare global { * or a function that returns a number to specify the * complexity for this field. */ - complexity?: QueryComplexity + complexity?: QueryComplexity; /** * Authorization for an individual field. Returning "true" * or "Promise" means the field can be accessed. @@ -1169,7 +1170,7 @@ declare global { * Returning or throwing an error will also prevent the * resolver from executing. */ - authorize?: FieldAuthorizeResolver + authorize?: FieldAuthorizeResolver; } interface NexusGenPluginInputFieldConfig { } diff --git a/packages/graphql/src/schema/Types/Proposals/Queries/GetProposals.query.ts b/packages/graphql/src/schema/Types/Proposals/Queries/GetProposals.query.ts new file mode 100644 index 000000000..2157f5258 --- /dev/null +++ b/packages/graphql/src/schema/Types/Proposals/Queries/GetProposals.query.ts @@ -0,0 +1,26 @@ +import { extendType, nonNull, idArg } from 'nexus'; +import { prisma } from '@common/core'; + +export const GetProposalsQuery = extendType({ + type: 'Query', + definition(t) { + t.nonNull.list.field('proposals', { + type: 'Proposal', + args: { + id: nonNull(idArg()) + }, + resolve: async (root, args) => { + return await prisma.common + .findUnique({ + where: { + id: args.id + } + }); + + // eslint-disable-next-line no-console + // console.log('commin', common); + // return common; + } + }); + } +}); \ No newline at end of file diff --git a/packages/graphql/src/schema/Types/Proposals/index.ts b/packages/graphql/src/schema/Types/Proposals/index.ts index 52cec35f0..86932d760 100644 --- a/packages/graphql/src/schema/Types/Proposals/index.ts +++ b/packages/graphql/src/schema/Types/Proposals/index.ts @@ -19,6 +19,7 @@ import { FundingStateEnum } from './Enums/FundingState.enum'; import { PaymentStateEnum } from './Enums/PaymentState.enum'; import { GetProposalQuery } from './Queries/GetProposal.query'; +import { GetProposalsQuery } from './Queries/GetProposals.query'; import { ProposalDiscussionsExtension } from './Extensions/ProposalDiscussions.extension'; import { ProposalFundingExtension } from './Extensions/ProposalFunding.extension'; @@ -50,6 +51,7 @@ export const ProposalTypes = [ PaymentStateEnum, GetProposalQuery, + GetProposalsQuery, ProposalWhereUniqueInput, diff --git a/packages/web/.eslintrc.js b/packages/web/.eslintrc.js index db47ceb3b..fca1337b5 100644 --- a/packages/web/.eslintrc.js +++ b/packages/web/.eslintrc.js @@ -39,21 +39,23 @@ module.exports = { "import/namespace": 2, "import/default": 2, "import/export": 2, - "import/order": [ - "error", - { - groups: [ - "builtin", // Built-in types are first - "external", - ["sibling", "parent"], // Then sibling and parent types. They can be mingled together - "index", // Then the index file - "object", - // Then the rest: internal and external type - ], - "newlines-between": "always", - }, - ], - }, + // "import/order": [ + // "error", + // { + // groups: [ + // "builtin", // Built-in types are first + // "external", + // ["sibling", "parent"], // Then sibling and parent types. They can be mingled together + // "index", // Then the index file + // "object", + // // Then the rest: internal and external type + // ], + // "newlines-between": "always", + // }, + // ], + // }, + "import/order": 0, + } settings: { react: { version: "latest", diff --git a/packages/web/package.json b/packages/web/package.json index 75ce86afe..36c980e95 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -3,6 +3,8 @@ "version": "1.9.11-rc.0", "private": true, "dependencies": { + "@apollo/client": "^3.3.15", + "apollo-link-context": "^1.0.20", "axios": "^0.21.0", "connected-react-router": "^6.8.0", "firebase": "^8.3.2", diff --git a/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx b/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx index d83caf3fd..08e06d2b7 100644 --- a/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx +++ b/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx @@ -1,12 +1,11 @@ -import React, { useEffect } from "react"; +/* eslint-disable import/order */ import { push } from "connected-react-router"; -import { useSelector, useDispatch } from "react-redux"; - -import { authentificated } from "../../store/selectors"; - +import React, { useEffect } from "react"; +import { useDispatch, useSelector } from "react-redux"; import { SocialLoginButton } from "../../../../shared/components"; -import { AuthWrapper } from "./styles"; import { socialLogin } from "../../store/actions"; +import { authentificated } from "../../store/selectors"; +import { AuthWrapper } from "./styles"; const AuthContainer = () => { const isAuthorized = useSelector(authentificated()); diff --git a/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx b/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx index 9f3a11580..9145890c0 100644 --- a/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx +++ b/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Link } from "react-router-dom"; -import { Common } from "../../../../../shared/models"; +import { Common } from '../../../../../graphql'; import { formatPrice } from "../../../../../shared/utils"; import "./index.scss"; diff --git a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx index e3e116f89..001fd2287 100644 --- a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx @@ -61,6 +61,8 @@ export default function CommonDetail() { const discussions = useSelector(selectDiscussions()); const isDiscussionsLoaded = useSelector(selectIsDiscussionsLoaded()); + console.log('proposals',proposals); + const dispatch = useDispatch(); const { isShowing, onOpen, onClose } = useModal(false); diff --git a/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx b/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx index 38a2f10a1..9fb39301a 100644 --- a/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx @@ -7,6 +7,7 @@ import { getLoading } from "../../../../shared/store/selectors"; import { CommonListItem } from "../../components"; import { COMMON_PAGE_SIZE } from "../../constants"; import { getCommonsList, updatePage } from "../../store/actions"; +import { useGetCommonDataQuery} from '../../../../graphql'; import { selectCurrentPage, selectCommonList } from "../../store/selectors"; import "./index.scss"; @@ -18,19 +19,11 @@ const options = { }; export default function CommonListContainer() { - const commons = useSelector(selectCommonList()); + const {loading, data} = useGetCommonDataQuery(); const page = useSelector(selectCurrentPage()); - const loading = useSelector(getLoading()); const dispatch = useDispatch(); const loader = useRef(null); - useEffect(() => { - dispatch(getCommonsList.request()); - return () => { - dispatch(getCommonsList.success([])); - }; - }, [dispatch]); - const handleObserver = useCallback( (entities: any[]) => { const target = entities[0]; @@ -42,14 +35,15 @@ export default function CommonListContainer() { [dispatch, page], ); + useEffect(() => { const observer = new IntersectionObserver(handleObserver, options); if (loader.current) { observer.observe(loader.current as any); } - }, [handleObserver, commons]); + }, [handleObserver, data?.commons]); - const currentCommons = useMemo(() => [...commons].splice(0, COMMON_PAGE_SIZE * page), [commons, page]); + const currentCommons = useMemo(() => [...(data?.commons ?? [])].splice(0, COMMON_PAGE_SIZE * page), [data?.commons, page]); return (
@@ -65,7 +59,7 @@ export default function CommonListContainer() {
)} - {commons.length !== currentCommons.length && ( + {data?.commons?.length !== currentCommons.length && (
Load More
diff --git a/packages/web/src/containers/Common/store/api.tsx b/packages/web/src/containers/Common/store/api.tsx index 71e129255..6f9676e51 100644 --- a/packages/web/src/containers/Common/store/api.tsx +++ b/packages/web/src/containers/Common/store/api.tsx @@ -22,6 +22,7 @@ export async function fetchCommonProposals(commonId: string) { export async function fetchCommonList(): Promise { const commons = await firebase.firestore().collection("daos").get(); + console.log('commons',commons); const data = transformFirebaseDataList(commons); return data; } diff --git a/packages/web/src/containers/Common/store/reducer.tsx b/packages/web/src/containers/Common/store/reducer.tsx index f2a1b28b0..9fdd2f198 100644 --- a/packages/web/src/containers/Common/store/reducer.tsx +++ b/packages/web/src/containers/Common/store/reducer.tsx @@ -18,6 +18,7 @@ type Action = ActionType; const reducer = createReducer(initialState) .handleAction(actions.getCommonsList.success, (state, action) => produce(state, (nextState) => { + console.log('action.payload',action.payload); nextState.commons = action.payload; }), ) diff --git a/packages/web/src/context/AuthContext.tsx b/packages/web/src/context/AuthContext.tsx new file mode 100644 index 000000000..54bc8abde --- /dev/null +++ b/packages/web/src/context/AuthContext.tsx @@ -0,0 +1,56 @@ +import firebase from 'firebase/app'; +import React, { PropsWithChildren } from 'react'; + +interface IAuthContext { + token?: string | null; + loaded: boolean; + userInfo?: firebase.UserInfo | null; + authenticated?: boolean; +} + +const defaultAppContext: IAuthContext = { + loaded: false +}; + +const AuthContext = React.createContext(defaultAppContext); + +export const useAuthContext = () => { + return React.useContext(AuthContext); +}; + +export const AuthContextProvider: React.FC> = ({ children }) => { + const [context, setContext] = React.useState(defaultAppContext); + + React.useEffect(() => { + return firebase.auth().onIdTokenChanged(async (user) => { + if (user) { + const token = await user.getIdToken(); + + setContext((prevContext) => ({ + ...prevContext, + + token, + loaded: true, + userInfo: user, + authenticated: true + })); + } else { + setContext((prevContext) => ({ + ...prevContext, + + token: null, + loaded: true, + userInfo: null, + authenticated: false + })); + } + }); + }, []); + + + return ( + + {children} + + ); +}; \ No newline at end of file diff --git a/packages/web/src/context/PermissionsContext.tsx b/packages/web/src/context/PermissionsContext.tsx new file mode 100644 index 000000000..54ef2664c --- /dev/null +++ b/packages/web/src/context/PermissionsContext.tsx @@ -0,0 +1,62 @@ +import { gql } from '@apollo/client'; +import React, { PropsWithChildren } from 'react'; +import { useAuthContext } from './AuthContext'; +import { useGetUserPermissionsQuery } from '../graphql'; + +interface IPermissionsContext { + loaded: boolean; + permissions: any; +} + +const defaultPermissionsContext: IPermissionsContext = { + loaded: false, + permissions: [] +}; + +const PermissionsContext = React.createContext(defaultPermissionsContext); + +export const usePermissionsContext = () => { + return React.useContext(PermissionsContext); +}; + +const LoadPermissionsQuery = gql` + query getUserPermissions($userId: ID!) { + user(id: $userId) { + permissions + } + } +`; + +export const PermissionsContextProvider: React.FC> = ({ children }) => { + const authContext = useAuthContext(); + + const { data, loading } = useGetUserPermissionsQuery({ + skip: !authContext.loaded && !authContext.authenticated, + pollInterval: 120 * 1000, + variables: { + userId: authContext.userInfo?.uid || '' + } + }); + + const [context, setContext] = React.useState(defaultPermissionsContext); + + React.useEffect(() => { + if (authContext.authenticated && data?.user) { + setContext({ + loaded: true, + permissions: data.user?.permissions + }); + } else { + setContext({ + loaded: !loading && authContext.authenticated || false, + permissions: [] + }); + } + }, [authContext, data, loading]); + + return ( + + {children} + + ); +}; \ No newline at end of file diff --git a/packages/web/src/context/index.ts b/packages/web/src/context/index.ts new file mode 100644 index 000000000..7dd4b2061 --- /dev/null +++ b/packages/web/src/context/index.ts @@ -0,0 +1,2 @@ +export * from './AuthContext'; +export * from './PermissionsContext'; \ No newline at end of file diff --git a/packages/web/src/graphql/index.ts b/packages/web/src/graphql/index.ts new file mode 100644 index 000000000..fdae737d8 --- /dev/null +++ b/packages/web/src/graphql/index.ts @@ -0,0 +1,252 @@ +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +export type Maybe = T | null; +export type Exact = { [K in keyof T]: T[K] }; +export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + Date: any; + }; + + export enum ProposalType { + FundingRequest = 'fundingRequest', + Join = 'join' + } + + export enum ProposalState { + PassedInsufficientBalance = 'passedInsufficientBalance', + Countdown = 'countdown', + Passed = 'passed', + Failed = 'failed' + } + + export enum ProposalVoteOutcome { + Approved = 'approved', + Rejected = 'rejected' + } + + export enum ProposalPaymentState { + NotAttempted = 'notAttempted', + NotRelevant = 'notRelevant', + Confirmed = 'confirmed', + Pending = 'pending', + Failed = 'failed' + } + + export enum ProposalFundingState { + NotRelevant = 'notRelevant', + NotAvailable = 'notAvailable', + Available = 'available', + Funded = 'funded' + } + + /** The proposals type */ + export type Proposal = { + __typename?: 'Proposal'; + id: Scalars['ID']; + createdAt: Scalars['Date']; + updatedAt: Scalars['Date']; + commonId: Scalars['ID']; + proposerId: Scalars['ID']; + votesFor: Scalars['Int']; + votesAgainst: Scalars['Int']; + state: ProposalState; + description: ProposalDescription; + type: ProposalType; + paymentState?: Maybe; + fundingState?: Maybe; + /** Details about the funding request. Exists only on funding request proposals */ + fundingRequest?: Maybe; + /** Details about the join request. Exists only on join request proposals */ + join?: Maybe; + votes?: Maybe>>; + common: Common; + proposer: User; + }; + + export type ProposalDescription = { + __typename?: 'ProposalDescription'; + title?: Maybe; + description: Scalars['String']; + }; + + export type ProposalFunding = { + __typename?: 'ProposalFunding'; + amount: Scalars['Int']; + }; + + export type ProposalJoin = { + __typename?: 'ProposalJoin'; + cardId: Scalars['ID']; + funding: Scalars['Int']; + fundingType?: Maybe; + }; + + export type ProposalVote = { + __typename?: 'ProposalVote'; + voteId: Scalars['ID']; + voterId: Scalars['ID']; + outcome: ProposalVoteOutcome; + voter?: Maybe; + }; + + export enum SubscriptionStatus { + Pending = 'pending', + Active = 'active', + CanceledByUser = 'canceledByUser', + CanceledByPaymentFailure = 'canceledByPaymentFailure', + PaymentFailed = 'paymentFailed' + } + + export type Subscription = { + __typename?: 'Subscription'; + id: Scalars['ID']; + cardId: Scalars['ID']; + userId: Scalars['ID']; + proposalId: Scalars['ID']; + createdAt: Scalars['Date']; + updatedAt: Scalars['Date']; + charges: Scalars['Int']; + amount: Scalars['Int']; + lastChargedAt?: Maybe; + dueDate?: Maybe; + revoked: Scalars['Boolean']; + status: SubscriptionStatus; + metadata: SubscriptionMetadata; + }; + + export type SubscriptionMetadata = { + __typename?: 'SubscriptionMetadata'; + common?: Maybe; + }; + + export type SubscriptionMetadataCommon = { + __typename?: 'SubscriptionMetadataCommon'; + id?: Maybe; + name?: Maybe; + }; + + export type User = { + __typename?: 'User'; + id: Scalars['ID']; + firstName?: Maybe; + lastName?: Maybe; + email?: Maybe; + photoURL?: Maybe; + createdAt?: Maybe; + tokens?: Maybe>>; + permissions?: Maybe>>; + proposals?: Maybe>>; + subscriptions?: Maybe>>; + }; + + export enum CommonContributionType { + OneTime = 'oneTime', + Monthly = 'monthly' + } + + export type CommonMetadata = { + __typename?: 'CommonMetadata'; + byline: Scalars['String']; + description: Scalars['String']; + founderId: Scalars['String']; + minFeeToJoin: Scalars['Int']; + contributionType: CommonContributionType; + action: Scalars['String']; + }; + + + export type CommonMember = { + __typename?: 'CommonMember'; + /** The user ID of the member */ + userId: Scalars['ID']; + /** The date, at witch the member joined the common */ + joinedAt?: Maybe; + }; + +/** The common type */ +export type Common = { + __typename?: 'Common'; + /** The unique identifier of the common */ + id: Scalars['ID']; + /** The date, at which the common was created */ + createdAt?: Maybe; + /** The date, at which the common was last updated */ + updatedAt?: Maybe; + /** The display name of the common */ + name: Scalars['String']; + /** The currently available funds of the common */ + balance: Scalars['Int']; + /** The total amount of money, raised by the common */ + raised: Scalars['Int']; + metadata: CommonMetadata; + members: Array; + proposals?: Maybe>>; + openJoinRequests: Scalars['Int']; + openFundingRequests: Scalars['Int']; + image: Scalars['String']; + register: Scalars['String']; + }; + + + +export type GetCommonsDataQuery = ( + { __typename?: 'Query' } + & { commons?: Array<( + { __typename?: 'Common' } + & Common + & { members?: Maybe + )>>>} + )> } + ); + +export const GetCommonsDataDocument = gql` +query getCommonsHomescreenData { + commons { + id + name + createdAt + updatedAt + whitelisted + members { + userId + } + proposals { + id + } + } + } +`; + +export const GetUserPermissionsDocument = gql` + query getUserPermissions($userId: ID!) { + user(id: $userId) { + permissions + } +} + `; + + export type GetUserPermissionsQuery = ( + { __typename?: 'Query' } + & { user?: Maybe<( + { __typename?: 'User' } + & Pick + )> } + ); + + export function useGetCommonDataQuery() { + return Apollo.useQuery(GetCommonsDataDocument); + } + + export type GetUserPermissionsQueryVariables = Exact<{ + userId: Scalars['ID']; + }>; + + export function useGetUserPermissionsQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetUserPermissionsDocument, baseOptions); + } \ No newline at end of file diff --git a/packages/web/src/graphql/indexx.ts b/packages/web/src/graphql/indexx.ts new file mode 100644 index 000000000..4b3e0e1c8 --- /dev/null +++ b/packages/web/src/graphql/indexx.ts @@ -0,0 +1,2154 @@ +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +export type Maybe = T | null; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + Date: any; +}; + + +export enum CardNetwork { + Visa = 'visa', + Mastercard = 'mastercard' +} + +export type Card = { + __typename?: 'Card'; + /** The ID of the payment */ + id: Scalars['ID']; + /** The date at witch the payment was created */ + createdAt: Scalars['Date']; + /** The date at witch the payment was last updated */ + updatedAt: Scalars['Date']; + circleCardId: Scalars['ID']; + ownerId: Scalars['ID']; + metadata?: Maybe; + verification?: Maybe; +}; + +export type CardMetadata = { + __typename?: 'CardMetadata'; + digits?: Maybe; + network?: Maybe; + billingDetails?: Maybe; +}; + +export type CardVerification = { + __typename?: 'CardVerification'; + cvv?: Maybe; +}; + +export type CardBillingDetails = { + __typename?: 'CardBillingDetails'; + name?: Maybe; + city?: Maybe; + country?: Maybe; + postalCode?: Maybe; + district?: Maybe; + line1?: Maybe; +}; + +export type User = { + __typename?: 'User'; + id: Scalars['ID']; + firstName?: Maybe; + lastName?: Maybe; + email?: Maybe; + photoURL?: Maybe; + createdAt?: Maybe; + tokens?: Maybe>>; + permissions?: Maybe>>; + proposals?: Maybe>>; + subscriptions?: Maybe>>; +}; + + +export type UserProposalsArgs = { + page?: Maybe; +}; + + +export type UserSubscriptionsArgs = { + page?: Maybe; + status?: Maybe; +}; + +export type Wire = { + __typename?: 'Wire'; + /** The local ID of the payout */ + id: Scalars['ID']; + createdAt?: Maybe; + updatedAt?: Maybe; + description?: Maybe; + bank?: Maybe; + billingDetails?: Maybe; +}; + +export type WireBank = { + __typename?: 'WireBank'; + bankName?: Maybe; + city?: Maybe; + country?: Maybe; +}; + +export type WireBillingDetailsType = { + __typename?: 'WireBillingDetailsType'; + city?: Maybe; + country?: Maybe; + line1?: Maybe; + line2?: Maybe; + name?: Maybe; + postalCode?: Maybe; +}; + +export enum EventType { + CommonCreated = 'commonCreated', + CommonCreationFailed = 'commonCreationFailed', + CommonWhitelisted = 'commonWhitelisted', + CommonMemberAdded = 'commonMemberAdded', + CommonMemberRemoved = 'commonMemberRemoved', + CommonUpdated = 'commonUpdated', + RequestToJoinCreated = 'requestToJoinCreated', + RequestToJoinAccepted = 'requestToJoinAccepted', + RequestToJoinRejected = 'requestToJoinRejected', + RequestToJoinExecuted = 'requestToJoinExecuted', + FundingRequestCreated = 'fundingRequestCreated', + FundingRequestRejected = 'fundingRequestRejected', + FundingRequestExecuted = 'fundingRequestExecuted', + FundingRequestAccepted = 'fundingRequestAccepted', + FundingRequestAcceptedInsufficientFunds = 'fundingRequestAcceptedInsufficientFunds', + VoteCreated = 'voteCreated', + PaymentCreated = 'paymentCreated', + PaymentConfirmed = 'paymentConfirmed', + PaymentFailed = 'paymentFailed', + PaymentPaid = 'paymentPaid', + PayoutCreated = 'payoutCreated', + PayoutApproved = 'payoutApproved', + PayoutExecuted = 'payoutExecuted', + PayoutVoided = 'payoutVoided', + PayoutCompleted = 'payoutCompleted', + PayoutFailed = 'payoutFailed', + CardCreated = 'cardCreated', + DiscussionCreated = 'discussionCreated', + MessageCreated = 'messageCreated', + SubscriptionCreated = 'subscriptionCreated', + SubscriptionPaymentCreated = 'subscriptionPaymentCreated', + SubscriptionPaymentFailed = 'subscriptionPaymentFailed', + SubscriptionPaymentConfirmed = 'subscriptionPaymentConfirmed', + SubscriptionPaymentStuck = 'subscriptionPaymentStuck', + SubscriptionCanceledByUser = 'subscriptionCanceledByUser', + SubscriptionCanceledByPaymentFailure = 'subscriptionCanceledByPaymentFailure', + MembershipRevoked = 'membershipRevoked', + DiscussionMessageReported = 'discussionMessageReported', + ProposalReported = 'proposalReported', + DiscussionReported = 'discussionReported' +} + +export type Event = { + __typename?: 'Event'; + /** The unique identifier of the event */ + id: Scalars['ID']; + /** The type of the event */ + type: EventType; + /** The date, at which the event was created */ + createdAt: Scalars['Date']; + /** The date, at which the event was last updated */ + updatedAt: Scalars['Date']; + /** The id of the object on which was acted to created the event */ + objectId?: Maybe; + /** The id of the actor */ + userId?: Maybe; + user?: Maybe; +}; + +export enum CommonContributionType { + OneTime = 'oneTime', + Monthly = 'monthly' +} + +export type CommonMember = { + __typename?: 'CommonMember'; + /** The user ID of the member */ + userId: Scalars['ID']; + /** The date, at witch the member joined the common */ + joinedAt?: Maybe; + user?: Maybe; +}; + +export type CommonMetadata = { + __typename?: 'CommonMetadata'; + byline: Scalars['String']; + description: Scalars['String']; + founderId: Scalars['String']; + minFeeToJoin: Scalars['Int']; + contributionType?: Maybe; +}; + +export type Payout = { + __typename?: 'Payout'; + id: Scalars['ID']; + createdAt: Scalars['Date']; + updatedAt: Scalars['Date']; + circlePayoutId?: Maybe; + amount: Scalars['Int']; + executed?: Maybe; + voided?: Maybe; + status?: Maybe; + security?: Maybe>>; + proposalIds?: Maybe>>; + proposals?: Maybe>>; +}; + +export type PayoutSecurity = { + __typename?: 'PayoutSecurity'; + id?: Maybe; + redemptionAttempts?: Maybe; + redeemed?: Maybe; +}; + +export enum PayoutStatus { + Pending = 'pending', + Complete = 'complete', + Failed = 'failed' +} + +export type ExecutePayoutInput = { + /** The ID of the the wire to witch the payout will be made */ + wireId: Scalars['ID']; + /** List of the all proposals IDs that are in this batch */ + proposalIds: Array; +}; + +export enum PaymentType { + OneTime = 'oneTime', + Subscription = 'subscription' +} + +export enum PaymentSourceType { + Card = 'card' +} + +export enum PaymentStatus { + Pending = 'pending', + Confirmed = 'confirmed', + Paid = 'paid', + Failed = 'failed' +} + +export enum PaymentCurrency { + Usd = 'USD' +} + +export type Payment = { + __typename?: 'Payment'; + /** The ID of the payment */ + id: Scalars['ID']; + /** The date at witch the payment was created */ + createdAt: Scalars['Date']; + /** The date at witch the payment was last updated */ + updatedAt: Scalars['Date']; + type: PaymentType; + status: PaymentStatus; + /** The source from witch the payment was funded */ + source: PaymentSource; + amount: PaymentAmount; + /** The fees on the payment */ + fees?: Maybe; + circlePaymentId: Scalars['ID']; + proposalId: Scalars['ID']; + userId: Scalars['ID']; + subscriptionId?: Maybe; + user?: Maybe; + card?: Maybe; + common?: Maybe; + proposal?: Maybe; + subscription?: Maybe; +}; + +export type PaymentFees = { + __typename?: 'PaymentFees'; + amount?: Maybe; + currency?: Maybe; +}; + +export type PaymentSource = { + __typename?: 'PaymentSource'; + type: PaymentSourceType; + id?: Maybe; +}; + +export type PaymentAmount = { + __typename?: 'PaymentAmount'; + currency?: Maybe; + amount?: Maybe; +}; + +export type Balance = { + __typename?: 'Balance'; + available?: Maybe; + unsettled?: Maybe; +}; + +export type Amount = { + __typename?: 'Amount'; + amount?: Maybe; + currency?: Maybe; +}; + +export enum ProposalType { + FundingRequest = 'fundingRequest', + Join = 'join' +} + +export enum ProposalState { + PassedInsufficientBalance = 'passedInsufficientBalance', + Countdown = 'countdown', + Passed = 'passed', + Failed = 'failed' +} + +export enum ProposalVoteOutcome { + Approved = 'approved', + Rejected = 'rejected' +} + +export enum ProposalPaymentState { + NotAttempted = 'notAttempted', + NotRelevant = 'notRelevant', + Confirmed = 'confirmed', + Pending = 'pending', + Failed = 'failed' +} + +export enum ProposalFundingState { + NotRelevant = 'notRelevant', + NotAvailable = 'notAvailable', + Available = 'available', + Funded = 'funded' +} + +/** The proposals type */ +export type Proposal = { + __typename?: 'Proposal'; + id: Scalars['ID']; + createdAt: Scalars['Date']; + updatedAt: Scalars['Date']; + commonId: Scalars['ID']; + proposerId: Scalars['ID']; + votesFor: Scalars['Int']; + votesAgainst: Scalars['Int']; + state: ProposalState; + description: ProposalDescription; + type: ProposalType; + paymentState?: Maybe; + fundingState?: Maybe; + /** Details about the funding request. Exists only on funding request proposals */ + fundingRequest?: Maybe; + /** Details about the join request. Exists only on join request proposals */ + join?: Maybe; + votes?: Maybe>>; + common: Common; + proposer: User; +}; + +export type ProposalDescription = { + __typename?: 'ProposalDescription'; + title?: Maybe; + description: Scalars['String']; +}; + +export type ProposalFunding = { + __typename?: 'ProposalFunding'; + amount: Scalars['Int']; +}; + +export type ProposalJoin = { + __typename?: 'ProposalJoin'; + cardId: Scalars['ID']; + funding: Scalars['Int']; + fundingType?: Maybe; +}; + +export type ProposalVote = { + __typename?: 'ProposalVote'; + voteId: Scalars['ID']; + voterId: Scalars['ID']; + outcome: ProposalVoteOutcome; + voter?: Maybe; +}; + +export type Intention = { + __typename?: 'Intention'; + id: Scalars['ID']; + createdAt: Scalars['Date']; + updatedAt: Scalars['Date']; + type: IntentionType; + intention: Scalars['String']; +}; + +export enum IntentionType { + Access = 'access', + Request = 'request' +} + +export type CreateIntentionInput = { + type: IntentionType; + intention: Scalars['String']; +}; + +export enum SubscriptionStatus { + Pending = 'pending', + Active = 'active', + CanceledByUser = 'canceledByUser', + CanceledByPaymentFailure = 'canceledByPaymentFailure', + PaymentFailed = 'paymentFailed' +} + +export type Subscription = { + __typename?: 'Subscription'; + id: Scalars['ID']; + cardId: Scalars['ID']; + userId: Scalars['ID']; + proposalId: Scalars['ID']; + createdAt: Scalars['Date']; + updatedAt: Scalars['Date']; + charges: Scalars['Int']; + amount: Scalars['Int']; + lastChargedAt?: Maybe; + dueDate?: Maybe; + revoked: Scalars['Boolean']; + status: SubscriptionStatus; + metadata: SubscriptionMetadata; +}; + +export type SubscriptionMetadata = { + __typename?: 'SubscriptionMetadata'; + common?: Maybe; +}; + +export type SubscriptionMetadataCommon = { + __typename?: 'SubscriptionMetadataCommon'; + id?: Maybe; + name?: Maybe; +}; + +export type Statistics = { + __typename?: 'Statistics'; + /** Commons, created on that date */ + newCommons?: Maybe; + /** The amount of proposals with join type, created on that date */ + newJoinRequests?: Maybe; + /** The amount of proposals with funding type, created on that date */ + newFundingRequests?: Maybe; + /** The amount of discussions, started on that date */ + newDiscussions?: Maybe; + /** The amount of new discussion messages, send on that date */ + newDiscussionMessages?: Maybe; + commons?: Maybe; + joinRequests?: Maybe; + fundingRequests?: Maybe; + users?: Maybe; +}; + + +export type StatisticsJoinRequestsArgs = { + onlyOpen?: Maybe; +}; + + +export type StatisticsFundingRequestsArgs = { + onlyOpen?: Maybe; +}; + +/** The common type */ +export type Common = { + __typename?: 'Common'; + /** The unique identifier of the common */ + id: Scalars['ID']; + /** The date, at which the common was created */ + createdAt?: Maybe; + /** The date, at which the common was last updated */ + updatedAt?: Maybe; + /** The display name of the common */ + name: Scalars['String']; + /** The currently available funds of the common */ + balance: Scalars['Int']; + /** The total amount of money, raised by the common */ + raised: Scalars['Int']; + metadata: CommonMetadata; + members?: Maybe>>; + proposals?: Maybe>>; + openJoinRequests: Scalars['Int']; + openFundingRequests: Scalars['Int']; +}; + + +/** The common type */ +export type CommonProposalsArgs = { + page?: Maybe; + type?: Maybe; + state?: Maybe; + paymentState?: Maybe; +}; + +export type Query = { + __typename?: 'Query'; + user?: Maybe; + users?: Maybe>>; + wires?: Maybe>>; + event?: Maybe; + events?: Maybe>>; + common?: Maybe; + commons?: Maybe>>; + payout?: Maybe; + payouts?: Maybe>>; + payment?: Maybe; + payments?: Maybe>>; + balance?: Maybe; + proposal?: Maybe; + proposals?: Maybe>>; + statistics?: Maybe; +}; + + +export type QueryUserArgs = { + id: Scalars['ID']; +}; + + +export type QueryUsersArgs = { + page?: Maybe; + perPage?: Maybe; +}; + + +export type QueryWiresArgs = { + page?: Maybe; +}; + + +export type QueryEventArgs = { + eventId: Scalars['ID']; +}; + + +export type QueryEventsArgs = { + last?: Maybe; + after?: Maybe; + type?: Maybe; + objectId?: Maybe; +}; + + +export type QueryCommonArgs = { + commonId: Scalars['ID']; +}; + + +export type QueryCommonsArgs = { + last?: Maybe; + after?: Maybe; +}; + + +export type QueryPayoutArgs = { + id: Scalars['ID']; +}; + + +export type QueryPayoutsArgs = { + page?: Maybe; +}; + + +export type QueryPaymentArgs = { + id: Scalars['ID']; +}; + + +export type QueryPaymentsArgs = { + page?: Maybe; + hanging?: Maybe; +}; + + +export type QueryProposalArgs = { + id: Scalars['ID']; +}; + + +export type QueryProposalsArgs = { + ids?: Maybe>>; + page?: Maybe; + pageItems?: Maybe; + type?: Maybe; + fundingState?: Maybe; +}; + +export type Mutation = { + __typename?: 'Mutation'; + whitelistCommon?: Maybe; + /** Refresh the common members from the events. Returns the new common member count */ + refreshCommonMembers?: Maybe; + executePayouts?: Maybe; + approvePayout?: Maybe; + updatePaymentData?: Maybe; + updatePaymentsCommonId?: Maybe; + createIntention?: Maybe; +}; + + +export type MutationWhitelistCommonArgs = { + commonId: Scalars['ID']; +}; + + +export type MutationRefreshCommonMembersArgs = { + commonId: Scalars['ID']; +}; + + +export type MutationExecutePayoutsArgs = { + input: ExecutePayoutInput; +}; + + +export type MutationApprovePayoutArgs = { + payoutId: Scalars['ID']; + index: Scalars['Int']; + token: Scalars['String']; +}; + + +export type MutationUpdatePaymentDataArgs = { + id: Scalars['ID']; + trackId?: Maybe; +}; + + +export type MutationCreateIntentionArgs = { + input: CreateIntentionInput; +}; + +export type WhitelistCommonMutationVariables = Exact<{ + commonId: Scalars['ID']; +}>; + + +export type WhitelistCommonMutation = ( + { __typename?: 'Mutation' } + & Pick +); + +export type GetLatestEventsQueryVariables = Exact<{ + last?: Maybe; + after?: Maybe; +}>; + + +export type GetLatestEventsQuery = ( + { __typename?: 'Query' } + & { events?: Maybe + & { user?: Maybe<( + { __typename?: 'User' } + & Pick + )> } + )>>> } +); + +export type GetPaymentsQueryVariables = Exact<{ + page?: Maybe; +}>; + + +export type GetPaymentsQuery = ( + { __typename?: 'Query' } + & { payments?: Maybe + & { user?: Maybe<( + { __typename?: 'User' } + & Pick + )>, amount: ( + { __typename?: 'PaymentAmount' } + & Pick + ) } + )>>> } +); + +export type GetPaymentDetailsQueryVariables = Exact<{ + paymentId: Scalars['ID']; +}>; + + +export type GetPaymentDetailsQuery = ( + { __typename?: 'Query' } + & { payment?: Maybe<( + { __typename?: 'Payment' } + & Pick + & { common?: Maybe<( + { __typename?: 'Common' } + & Pick + )>, amount: ( + { __typename?: 'PaymentAmount' } + & Pick + ), fees?: Maybe<( + { __typename?: 'PaymentFees' } + & Pick + )>, card?: Maybe<( + { __typename?: 'Card' } + & Pick + & { metadata?: Maybe<( + { __typename?: 'CardMetadata' } + & Pick + )> } + )> } + )> } +); + +export type GetUserPermissionsQueryVariables = Exact<{ + userId: Scalars['ID']; +}>; + + +export type GetUserPermissionsQuery = ( + { __typename?: 'Query' } + & { user?: Maybe<( + { __typename?: 'User' } + & Pick + )> } +); + +export type GetCommonDetailsQueryVariables = Exact<{ + commonId: Scalars['ID']; + page: Scalars['Int']; +}>; + + +export type GetCommonDetailsQuery = ( + { __typename?: 'Query' } + & { common?: Maybe<( + { __typename?: 'Common' } + & Pick + & { metadata: ( + { __typename?: 'CommonMetadata' } + & Pick + ), members?: Maybe + & { user?: Maybe<( + { __typename?: 'User' } + & Pick + )> } + )>>>, proposals?: Maybe + & { fundingRequest?: Maybe<( + { __typename?: 'ProposalFunding' } + & Pick + )>, join?: Maybe<( + { __typename?: 'ProposalJoin' } + & Pick + )>, description: ( + { __typename?: 'ProposalDescription' } + & Pick + ) } + )>>> } + )> } +); + +export type GetCommonsHomescreenDataQueryVariables = Exact<{ + last?: Maybe; + after?: Maybe; +}>; + + +export type GetCommonsHomescreenDataQuery = ( + { __typename?: 'Query' } + & { commons?: Maybe + & { members?: Maybe + )>>>, metadata: ( + { __typename?: 'CommonMetadata' } + & Pick + ) } + )>>> } +); + +export type GetDashboardDataQueryVariables = Exact<{ [key: string]: never; }>; + + +export type GetDashboardDataQuery = ( + { __typename?: 'Query' } + & { statistics?: Maybe<( + { __typename?: 'Statistics' } + & Pick + )> } +); + +export type StatisticsQueryVariables = Exact<{ [key: string]: never; }>; + + +export type StatisticsQuery = ( + { __typename?: 'Query' } + & { statistics?: Maybe<( + { __typename?: 'Statistics' } + & Pick + )> } +); + +export type CreateIntentionMutationVariables = Exact<{ + type: IntentionType; + intention: Scalars['String']; +}>; + + +export type CreateIntentionMutation = ( + { __typename?: 'Mutation' } + & { createIntention?: Maybe<( + { __typename?: 'Intention' } + & Pick + )> } +); + +export type GetFinancialsDataQueryVariables = Exact<{ [key: string]: never; }>; + + +export type GetFinancialsDataQuery = ( + { __typename?: 'Query' } + & { balance?: Maybe<( + { __typename?: 'Balance' } + & { available?: Maybe<( + { __typename?: 'Amount' } + & Pick + )>, unsettled?: Maybe<( + { __typename?: 'Amount' } + & Pick + )> } + )>, hangingPayments?: Maybe + )>>> } +); + +export type GetPaymentsHomeScreenDataQueryVariables = Exact<{ [key: string]: never; }>; + + +export type GetPaymentsHomeScreenDataQuery = ( + { __typename?: 'Query' } + & { hangingPayments?: Maybe + )>>> } +); + +export type UpdatePaymentDataMutationVariables = Exact<{ + paymentId: Scalars['ID']; +}>; + + +export type UpdatePaymentDataMutation = ( + { __typename?: 'Mutation' } + & Pick +); + +export type GetConfirmPayoutDataQueryVariables = Exact<{ + payoutId: Scalars['ID']; +}>; + + +export type GetConfirmPayoutDataQuery = ( + { __typename?: 'Query' } + & { payout?: Maybe<( + { __typename?: 'Payout' } + & Pick + & { proposals?: Maybe + & { description: ( + { __typename?: 'ProposalDescription' } + & Pick + ), fundingRequest?: Maybe<( + { __typename?: 'ProposalFunding' } + & Pick + )> } + )>>> } + )> } +); + +export type ApprovePayoutMutationVariables = Exact<{ + payoutId: Scalars['ID']; + token: Scalars['String']; + index: Scalars['Int']; +}>; + + +export type ApprovePayoutMutation = ( + { __typename?: 'Mutation' } + & Pick +); + +export type GetProposalsSelectedForBatchQueryVariables = Exact<{ + ids: Array | Scalars['String']; +}>; + + +export type GetProposalsSelectedForBatchQuery = ( + { __typename?: 'Query' } + & { proposals?: Maybe + & { proposer: ( + { __typename?: 'User' } + & Pick + ), description: ( + { __typename?: 'ProposalDescription' } + & Pick + ), common: ( + { __typename?: 'Common' } + & Pick + ), fundingRequest?: Maybe<( + { __typename?: 'ProposalFunding' } + & Pick + )> } + )>>>, wires?: Maybe + & { billingDetails?: Maybe<( + { __typename?: 'WireBillingDetailsType' } + & Pick + )> } + )>>> } +); + +export type ExecutePayoutMutationVariables = Exact<{ + input: ExecutePayoutInput; +}>; + + +export type ExecutePayoutMutation = ( + { __typename?: 'Mutation' } + & { executePayouts?: Maybe<( + { __typename?: 'Payout' } + & Pick + )> } +); + +export type GetPayoutDetailsQueryVariables = Exact<{ + payoutId: Scalars['ID']; +}>; + + +export type GetPayoutDetailsQuery = ( + { __typename?: 'Query' } + & { payout?: Maybe<( + { __typename?: 'Payout' } + & Pick + & { proposals?: Maybe + & { fundingRequest?: Maybe<( + { __typename?: 'ProposalFunding' } + & Pick + )>, description: ( + { __typename?: 'ProposalDescription' } + & Pick + ) } + )>>>, security?: Maybe + )>>> } + )> } +); + +export type GetPayoutsPageDataQueryVariables = Exact<{ + fundingState?: Maybe; + fundingRequestPage?: Maybe; +}>; + + +export type GetPayoutsPageDataQuery = ( + { __typename?: 'Query' } + & { proposals?: Maybe + & { description: ( + { __typename?: 'ProposalDescription' } + & Pick + ), fundingRequest?: Maybe<( + { __typename?: 'ProposalFunding' } + & Pick + )> } + )>>>, payouts?: Maybe + )>>> } +); + +export type GetProposalDetailsQueryVariables = Exact<{ + proposalId: Scalars['ID']; +}>; + + +export type GetProposalDetailsQuery = ( + { __typename?: 'Query' } + & { proposal?: Maybe<( + { __typename?: 'Proposal' } + & Pick + & { join?: Maybe<( + { __typename?: 'ProposalJoin' } + & Pick + )>, fundingRequest?: Maybe<( + { __typename?: 'ProposalFunding' } + & Pick + )>, proposer: ( + { __typename?: 'User' } + & Pick + ), common: ( + { __typename?: 'Common' } + & { members?: Maybe + )>>> } + ), description: ( + { __typename?: 'ProposalDescription' } + & Pick + ), votes?: Maybe + & { voter?: Maybe<( + { __typename?: 'User' } + & Pick + )> } + )>>> } + )> } +); + +export type GetProposalsHomescreenQueryVariables = Exact<{ + fundingPage?: Maybe; + joinPage?: Maybe; +}>; + + +export type GetProposalsHomescreenQuery = ( + { __typename?: 'Query' } + & { funding?: Maybe + & { votes?: Maybe + )>>>, description: ( + { __typename?: 'ProposalDescription' } + & Pick + ), fundingRequest?: Maybe<( + { __typename?: 'ProposalFunding' } + & Pick + )> } + )>>>, join?: Maybe + & { description: ( + { __typename?: 'ProposalDescription' } + & Pick + ), join?: Maybe<( + { __typename?: 'ProposalJoin' } + & Pick + )> } + )>>> } +); + +export type GetUserDetailsQueryQueryVariables = Exact<{ + userId: Scalars['ID']; +}>; + + +export type GetUserDetailsQueryQuery = ( + { __typename?: 'Query' } + & { user?: Maybe<( + { __typename?: 'User' } + & Pick + & { proposals?: Maybe + & { description: ( + { __typename?: 'ProposalDescription' } + & Pick + ) } + )>>>, subscriptions?: Maybe + & { metadata: ( + { __typename?: 'SubscriptionMetadata' } + & { common?: Maybe<( + { __typename?: 'SubscriptionMetadataCommon' } + & Pick + )> } + ) } + )>>> } + )> } +); + +export type GetUsersHomepageDataQueryVariables = Exact<{ + page?: Maybe; + perPage?: Maybe; +}>; + + +export type GetUsersHomepageDataQuery = ( + { __typename?: 'Query' } + & { users?: Maybe + )>>> } +); + + +export const WhitelistCommonDocument = gql` + mutation whitelistCommon($commonId: ID!) { + whitelistCommon(commonId: $commonId) +} + `; +export type WhitelistCommonMutationFn = Apollo.MutationFunction; + +/** + * __useWhitelistCommonMutation__ + * + * To run a mutation, you first call `useWhitelistCommonMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useWhitelistCommonMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [whitelistCommonMutation, { data, loading, error }] = useWhitelistCommonMutation({ + * variables: { + * commonId: // value for 'commonId' + * }, + * }); + */ +export function useWhitelistCommonMutation(baseOptions?: Apollo.MutationHookOptions) { + return Apollo.useMutation(WhitelistCommonDocument, baseOptions); + } +export type WhitelistCommonMutationHookResult = ReturnType; +export type WhitelistCommonMutationResult = Apollo.MutationResult; +export type WhitelistCommonMutationOptions = Apollo.BaseMutationOptions; +export const GetLatestEventsDocument = gql` + query GetLatestEvents($last: Int = 10, $after: Int = 0) { + events(last: $last, after: $after) { + id + createdAt + type + user { + id + firstName + lastName + photoURL + } + } +} + `; + +/** + * __useGetLatestEventsQuery__ + * + * To run a query within a React component, call `useGetLatestEventsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetLatestEventsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetLatestEventsQuery({ + * variables: { + * last: // value for 'last' + * after: // value for 'after' + * }, + * }); + */ +export function useGetLatestEventsQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetLatestEventsDocument, baseOptions); + } +export function useGetLatestEventsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetLatestEventsDocument, baseOptions); + } +export type GetLatestEventsQueryHookResult = ReturnType; +export type GetLatestEventsLazyQueryHookResult = ReturnType; +export type GetLatestEventsQueryResult = Apollo.QueryResult; +export const GetPaymentsDocument = gql` + query GetPayments($page: Int = 1) { + payments: payments(page: $page) { + id + type + status + user { + id + firstName + lastName + photoURL + email + } + amount { + amount + currency + } + } +} + `; + +/** + * __useGetPaymentsQuery__ + * + * To run a query within a React component, call `useGetPaymentsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetPaymentsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetPaymentsQuery({ + * variables: { + * page: // value for 'page' + * }, + * }); + */ +export function useGetPaymentsQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetPaymentsDocument, baseOptions); + } +export function useGetPaymentsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetPaymentsDocument, baseOptions); + } +export type GetPaymentsQueryHookResult = ReturnType; +export type GetPaymentsLazyQueryHookResult = ReturnType; +export type GetPaymentsQueryResult = Apollo.QueryResult; +export const GetPaymentDetailsDocument = gql` + query GetPaymentDetails($paymentId: ID!) { + payment(id: $paymentId) { + type + common { + id + name + } + amount { + amount + currency + } + fees { + amount + currency + } + card { + id + metadata { + digits + network + } + } + } +} + `; + +/** + * __useGetPaymentDetailsQuery__ + * + * To run a query within a React component, call `useGetPaymentDetailsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetPaymentDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetPaymentDetailsQuery({ + * variables: { + * paymentId: // value for 'paymentId' + * }, + * }); + */ +export function useGetPaymentDetailsQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetPaymentDetailsDocument, baseOptions); + } +export function useGetPaymentDetailsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetPaymentDetailsDocument, baseOptions); + } +export type GetPaymentDetailsQueryHookResult = ReturnType; +export type GetPaymentDetailsLazyQueryHookResult = ReturnType; +export type GetPaymentDetailsQueryResult = Apollo.QueryResult; +export const GetUserPermissionsDocument = gql` + query getUserPermissions($userId: ID!) { + user(id: $userId) { + permissions + } +} + `; + +/** + * __useGetUserPermissionsQuery__ + * + * To run a query within a React component, call `useGetUserPermissionsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetUserPermissionsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetUserPermissionsQuery({ + * variables: { + * userId: // value for 'userId' + * }, + * }); + */ +export function useGetUserPermissionsQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetUserPermissionsDocument, baseOptions); + } +export function useGetUserPermissionsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetUserPermissionsDocument, baseOptions); + } +export type GetUserPermissionsQueryHookResult = ReturnType; +export type GetUserPermissionsLazyQueryHookResult = ReturnType; +export type GetUserPermissionsQueryResult = Apollo.QueryResult; +export const GetCommonDetailsDocument = gql` + query getCommonDetails($commonId: ID!, $page: Int!) { + common(commonId: $commonId) { + name + createdAt + updatedAt + balance + raised + openFundingRequests + openJoinRequests + metadata { + byline + description + founderId + contributionType + } + members { + userId + joinedAt + user { + firstName + lastName + } + } + proposals(page: $page) { + id + type + fundingRequest { + amount + } + join { + fundingType + funding + } + description { + description + } + } + } +} + `; + +/** + * __useGetCommonDetailsQuery__ + * + * To run a query within a React component, call `useGetCommonDetailsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetCommonDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetCommonDetailsQuery({ + * variables: { + * commonId: // value for 'commonId' + * page: // value for 'page' + * }, + * }); + */ +export function useGetCommonDetailsQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetCommonDetailsDocument, baseOptions); + } +export function useGetCommonDetailsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetCommonDetailsDocument, baseOptions); + } +export type GetCommonDetailsQueryHookResult = ReturnType; +export type GetCommonDetailsLazyQueryHookResult = ReturnType; +export type GetCommonDetailsQueryResult = Apollo.QueryResult; +export const GetCommonsHomescreenDataDocument = gql` + query getCommonsHomescreenData($last: Int, $after: Int) { + commons(last: $last, after: $after) { + id + name + raised + balance + createdAt + updatedAt + members { + userId + } + metadata { + byline + description + contributionType + } + } +} + `; + +/** + * __useGetCommonsHomescreenDataQuery__ + * + * To run a query within a React component, call `useGetCommonsHomescreenDataQuery` and pass it any options that fit your needs. + * When your component renders, `useGetCommonsHomescreenDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetCommonsHomescreenDataQuery({ + * variables: { + * last: // value for 'last' + * after: // value for 'after' + * }, + * }); + */ +export function useGetCommonsHomescreenDataQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetCommonsHomescreenDataDocument, baseOptions); + } +export function useGetCommonsHomescreenDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetCommonsHomescreenDataDocument, baseOptions); + } +export type GetCommonsHomescreenDataQueryHookResult = ReturnType; +export type GetCommonsHomescreenDataLazyQueryHookResult = ReturnType; +export type GetCommonsHomescreenDataQueryResult = Apollo.QueryResult; +export const GetDashboardDataDocument = gql` + query getDashboardData { + statistics { + newCommons + newJoinRequests + newFundingRequests + newDiscussions + newDiscussionMessages + } +} + `; + +/** + * __useGetDashboardDataQuery__ + * + * To run a query within a React component, call `useGetDashboardDataQuery` and pass it any options that fit your needs. + * When your component renders, `useGetDashboardDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetDashboardDataQuery({ + * variables: { + * }, + * }); + */ +export function useGetDashboardDataQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetDashboardDataDocument, baseOptions); + } +export function useGetDashboardDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetDashboardDataDocument, baseOptions); + } +export type GetDashboardDataQueryHookResult = ReturnType; +export type GetDashboardDataLazyQueryHookResult = ReturnType; +export type GetDashboardDataQueryResult = Apollo.QueryResult; +export const StatisticsDocument = gql` + query Statistics { + statistics { + users + commons + joinRequests + fundingRequests + } +} + `; + +/** + * __useStatisticsQuery__ + * + * To run a query within a React component, call `useStatisticsQuery` and pass it any options that fit your needs. + * When your component renders, `useStatisticsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useStatisticsQuery({ + * variables: { + * }, + * }); + */ +export function useStatisticsQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(StatisticsDocument, baseOptions); + } +export function useStatisticsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(StatisticsDocument, baseOptions); + } +export type StatisticsQueryHookResult = ReturnType; +export type StatisticsLazyQueryHookResult = ReturnType; +export type StatisticsQueryResult = Apollo.QueryResult; +export const CreateIntentionDocument = gql` + mutation createIntention($type: IntentionType!, $intention: String!) { + createIntention(input: {type: $type, intention: $intention}) { + id + } +} + `; +export type CreateIntentionMutationFn = Apollo.MutationFunction; + +/** + * __useCreateIntentionMutation__ + * + * To run a mutation, you first call `useCreateIntentionMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useCreateIntentionMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [createIntentionMutation, { data, loading, error }] = useCreateIntentionMutation({ + * variables: { + * type: // value for 'type' + * intention: // value for 'intention' + * }, + * }); + */ +export function useCreateIntentionMutation(baseOptions?: Apollo.MutationHookOptions) { + return Apollo.useMutation(CreateIntentionDocument, baseOptions); + } +export type CreateIntentionMutationHookResult = ReturnType; +export type CreateIntentionMutationResult = Apollo.MutationResult; +export type CreateIntentionMutationOptions = Apollo.BaseMutationOptions; +export const GetFinancialsDataDocument = gql` + query GetFinancialsData { + balance { + available { + amount + currency + } + unsettled { + amount + currency + } + } + hangingPayments: payments(hanging: true) { + id + createdAt + updatedAt + status + } +} + `; + +/** + * __useGetFinancialsDataQuery__ + * + * To run a query within a React component, call `useGetFinancialsDataQuery` and pass it any options that fit your needs. + * When your component renders, `useGetFinancialsDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetFinancialsDataQuery({ + * variables: { + * }, + * }); + */ +export function useGetFinancialsDataQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetFinancialsDataDocument, baseOptions); + } +export function useGetFinancialsDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetFinancialsDataDocument, baseOptions); + } +export type GetFinancialsDataQueryHookResult = ReturnType; +export type GetFinancialsDataLazyQueryHookResult = ReturnType; +export type GetFinancialsDataQueryResult = Apollo.QueryResult; +export const GetPaymentsHomeScreenDataDocument = gql` + query GetPaymentsHomeScreenData { + hangingPayments: payments(hanging: true) { + id + createdAt + updatedAt + status + } +} + `; + +/** + * __useGetPaymentsHomeScreenDataQuery__ + * + * To run a query within a React component, call `useGetPaymentsHomeScreenDataQuery` and pass it any options that fit your needs. + * When your component renders, `useGetPaymentsHomeScreenDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetPaymentsHomeScreenDataQuery({ + * variables: { + * }, + * }); + */ +export function useGetPaymentsHomeScreenDataQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetPaymentsHomeScreenDataDocument, baseOptions); + } +export function useGetPaymentsHomeScreenDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetPaymentsHomeScreenDataDocument, baseOptions); + } +export type GetPaymentsHomeScreenDataQueryHookResult = ReturnType; +export type GetPaymentsHomeScreenDataLazyQueryHookResult = ReturnType; +export type GetPaymentsHomeScreenDataQueryResult = Apollo.QueryResult; +export const UpdatePaymentDataDocument = gql` + mutation UpdatePaymentData($paymentId: ID!) { + updatePaymentData(id: $paymentId) +} + `; +export type UpdatePaymentDataMutationFn = Apollo.MutationFunction; + +/** + * __useUpdatePaymentDataMutation__ + * + * To run a mutation, you first call `useUpdatePaymentDataMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useUpdatePaymentDataMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [updatePaymentDataMutation, { data, loading, error }] = useUpdatePaymentDataMutation({ + * variables: { + * paymentId: // value for 'paymentId' + * }, + * }); + */ +export function useUpdatePaymentDataMutation(baseOptions?: Apollo.MutationHookOptions) { + return Apollo.useMutation(UpdatePaymentDataDocument, baseOptions); + } +export type UpdatePaymentDataMutationHookResult = ReturnType; +export type UpdatePaymentDataMutationResult = Apollo.MutationResult; +export type UpdatePaymentDataMutationOptions = Apollo.BaseMutationOptions; +export const GetConfirmPayoutDataDocument = gql` + query GetConfirmPayoutData($payoutId: ID!) { + payout(id: $payoutId) { + amount + proposals { + id + description { + title + description + } + fundingRequest { + amount + } + } + } +} + `; + +/** + * __useGetConfirmPayoutDataQuery__ + * + * To run a query within a React component, call `useGetConfirmPayoutDataQuery` and pass it any options that fit your needs. + * When your component renders, `useGetConfirmPayoutDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetConfirmPayoutDataQuery({ + * variables: { + * payoutId: // value for 'payoutId' + * }, + * }); + */ +export function useGetConfirmPayoutDataQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetConfirmPayoutDataDocument, baseOptions); + } +export function useGetConfirmPayoutDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetConfirmPayoutDataDocument, baseOptions); + } +export type GetConfirmPayoutDataQueryHookResult = ReturnType; +export type GetConfirmPayoutDataLazyQueryHookResult = ReturnType; +export type GetConfirmPayoutDataQueryResult = Apollo.QueryResult; +export const ApprovePayoutDocument = gql` + mutation ApprovePayout($payoutId: ID!, $token: String!, $index: Int!) { + approvePayout(payoutId: $payoutId, token: $token, index: $index) +} + `; +export type ApprovePayoutMutationFn = Apollo.MutationFunction; + +/** + * __useApprovePayoutMutation__ + * + * To run a mutation, you first call `useApprovePayoutMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useApprovePayoutMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [approvePayoutMutation, { data, loading, error }] = useApprovePayoutMutation({ + * variables: { + * payoutId: // value for 'payoutId' + * token: // value for 'token' + * index: // value for 'index' + * }, + * }); + */ +export function useApprovePayoutMutation(baseOptions?: Apollo.MutationHookOptions) { + return Apollo.useMutation(ApprovePayoutDocument, baseOptions); + } +export type ApprovePayoutMutationHookResult = ReturnType; +export type ApprovePayoutMutationResult = Apollo.MutationResult; +export type ApprovePayoutMutationOptions = Apollo.BaseMutationOptions; +export const GetProposalsSelectedForBatchDocument = gql` + query getProposalsSelectedForBatch($ids: [String!]!) { + proposals(ids: $ids) { + id + state + fundingState + proposer { + firstName + lastName + } + description { + title + description + } + common { + name + } + fundingRequest { + amount + } + } + wires { + id + description + billingDetails { + city + country + name + } + } +} + `; + +/** + * __useGetProposalsSelectedForBatchQuery__ + * + * To run a query within a React component, call `useGetProposalsSelectedForBatchQuery` and pass it any options that fit your needs. + * When your component renders, `useGetProposalsSelectedForBatchQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetProposalsSelectedForBatchQuery({ + * variables: { + * ids: // value for 'ids' + * }, + * }); + */ +export function useGetProposalsSelectedForBatchQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetProposalsSelectedForBatchDocument, baseOptions); + } +export function useGetProposalsSelectedForBatchLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetProposalsSelectedForBatchDocument, baseOptions); + } +export type GetProposalsSelectedForBatchQueryHookResult = ReturnType; +export type GetProposalsSelectedForBatchLazyQueryHookResult = ReturnType; +export type GetProposalsSelectedForBatchQueryResult = Apollo.QueryResult; +export const ExecutePayoutDocument = gql` + mutation ExecutePayout($input: ExecutePayoutInput!) { + executePayouts(input: $input) { + id + } +} + `; +export type ExecutePayoutMutationFn = Apollo.MutationFunction; + +/** + * __useExecutePayoutMutation__ + * + * To run a mutation, you first call `useExecutePayoutMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useExecutePayoutMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [executePayoutMutation, { data, loading, error }] = useExecutePayoutMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useExecutePayoutMutation(baseOptions?: Apollo.MutationHookOptions) { + return Apollo.useMutation(ExecutePayoutDocument, baseOptions); + } +export type ExecutePayoutMutationHookResult = ReturnType; +export type ExecutePayoutMutationResult = Apollo.MutationResult; +export type ExecutePayoutMutationOptions = Apollo.BaseMutationOptions; +export const GetPayoutDetailsDocument = gql` + query GetPayoutDetails($payoutId: ID!) { + payout(id: $payoutId) { + voided + executed + status + proposals { + id + fundingRequest { + amount + } + description { + title + description + } + } + security { + id + redeemed + redemptionAttempts + } + } +} + `; + +/** + * __useGetPayoutDetailsQuery__ + * + * To run a query within a React component, call `useGetPayoutDetailsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetPayoutDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetPayoutDetailsQuery({ + * variables: { + * payoutId: // value for 'payoutId' + * }, + * }); + */ +export function useGetPayoutDetailsQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetPayoutDetailsDocument, baseOptions); + } +export function useGetPayoutDetailsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetPayoutDetailsDocument, baseOptions); + } +export type GetPayoutDetailsQueryHookResult = ReturnType; +export type GetPayoutDetailsLazyQueryHookResult = ReturnType; +export type GetPayoutDetailsQueryResult = Apollo.QueryResult; +export const GetPayoutsPageDataDocument = gql` + query getPayoutsPageData($fundingState: ProposalFundingState, $fundingRequestPage: Int) { + proposals( + type: fundingRequest + page: $fundingRequestPage + fundingState: $fundingState + ) { + id + commonId + proposerId + type + description { + title + } + fundingRequest { + amount + } + createdAt + updatedAt + state + fundingState + } + payouts { + id + amount + voided + executed + status + proposalIds + } +} + `; + +/** + * __useGetPayoutsPageDataQuery__ + * + * To run a query within a React component, call `useGetPayoutsPageDataQuery` and pass it any options that fit your needs. + * When your component renders, `useGetPayoutsPageDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetPayoutsPageDataQuery({ + * variables: { + * fundingState: // value for 'fundingState' + * fundingRequestPage: // value for 'fundingRequestPage' + * }, + * }); + */ +export function useGetPayoutsPageDataQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetPayoutsPageDataDocument, baseOptions); + } +export function useGetPayoutsPageDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetPayoutsPageDataDocument, baseOptions); + } +export type GetPayoutsPageDataQueryHookResult = ReturnType; +export type GetPayoutsPageDataLazyQueryHookResult = ReturnType; +export type GetPayoutsPageDataQueryResult = Apollo.QueryResult; +export const GetProposalDetailsDocument = gql` + query getProposalDetails($proposalId: ID!) { + proposal(id: $proposalId) { + id + join { + funding + fundingType + } + fundingRequest { + amount + } + type + createdAt + updatedAt + votesFor + votesAgainst + state + paymentState + proposer { + id + firstName + lastName + } + common { + members { + userId + } + } + description { + description + } + votes { + outcome + voter { + id + firstName + lastName + } + } + } +} + `; + +/** + * __useGetProposalDetailsQuery__ + * + * To run a query within a React component, call `useGetProposalDetailsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetProposalDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetProposalDetailsQuery({ + * variables: { + * proposalId: // value for 'proposalId' + * }, + * }); + */ +export function useGetProposalDetailsQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetProposalDetailsDocument, baseOptions); + } +export function useGetProposalDetailsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetProposalDetailsDocument, baseOptions); + } +export type GetProposalDetailsQueryHookResult = ReturnType; +export type GetProposalDetailsLazyQueryHookResult = ReturnType; +export type GetProposalDetailsQueryResult = Apollo.QueryResult; +export const GetProposalsHomescreenDocument = gql` + query getProposalsHomescreen($fundingPage: Int, $joinPage: Int) { + funding: proposals(type: fundingRequest, page: $fundingPage) { + id + commonId + votes { + outcome + } + votesFor + votesAgainst + description { + title + description + } + fundingRequest { + amount + } + } + join: proposals(type: join, page: $joinPage) { + id + commonId + description { + title + description + } + join { + funding + fundingType + } + } +} + `; + +/** + * __useGetProposalsHomescreenQuery__ + * + * To run a query within a React component, call `useGetProposalsHomescreenQuery` and pass it any options that fit your needs. + * When your component renders, `useGetProposalsHomescreenQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetProposalsHomescreenQuery({ + * variables: { + * fundingPage: // value for 'fundingPage' + * joinPage: // value for 'joinPage' + * }, + * }); + */ +export function useGetProposalsHomescreenQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetProposalsHomescreenDocument, baseOptions); + } +export function useGetProposalsHomescreenLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetProposalsHomescreenDocument, baseOptions); + } +export type GetProposalsHomescreenQueryHookResult = ReturnType; +export type GetProposalsHomescreenLazyQueryHookResult = ReturnType; +export type GetProposalsHomescreenQueryResult = Apollo.QueryResult; +export const GetUserDetailsQueryDocument = gql` + query getUserDetailsQuery($userId: ID!) { + user(id: $userId) { + id + firstName + lastName + email + createdAt + photoURL + proposals { + id + type + state + paymentState + description { + title + } + } + subscriptions { + id + amount + metadata { + common { + id + name + } + } + status + revoked + createdAt + updatedAt + lastChargedAt + dueDate + } + } +} + `; + +/** + * __useGetUserDetailsQueryQuery__ + * + * To run a query within a React component, call `useGetUserDetailsQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useGetUserDetailsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetUserDetailsQueryQuery({ + * variables: { + * userId: // value for 'userId' + * }, + * }); + */ +export function useGetUserDetailsQueryQuery(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetUserDetailsQueryDocument, baseOptions); + } +export function useGetUserDetailsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetUserDetailsQueryDocument, baseOptions); + } +export type GetUserDetailsQueryQueryHookResult = ReturnType; +export type GetUserDetailsQueryLazyQueryHookResult = ReturnType; +export type GetUserDetailsQueryQueryResult = Apollo.QueryResult; +export const GetUsersHomepageDataDocument = gql` + query getUsersHomepageData($page: Int = 1, $perPage: Int = 15) { + users(page: $page, perPage: $perPage) { + id + photoURL + email + firstName + lastName + createdAt + } +} + `; + +/** + * __useGetUsersHomepageDataQuery__ + * + * To run a query within a React component, call `useGetUsersHomepageDataQuery` and pass it any options that fit your needs. + * When your component renders, `useGetUsersHomepageDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useGetUsersHomepageDataQuery({ + * variables: { + * page: // value for 'page' + * perPage: // value for 'perPage' + * }, + * }); + */ +export function useGetUsersHomepageDataQuery(baseOptions?: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetUsersHomepageDataDocument, baseOptions); + } +export function useGetUsersHomepageDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + return Apollo.useLazyQuery(GetUsersHomepageDataDocument, baseOptions); + } +export type GetUsersHomepageDataQueryHookResult = ReturnType; +export type GetUsersHomepageDataLazyQueryHookResult = ReturnType; +export type GetUsersHomepageDataQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/packages/web/src/graphql/schema.graphql b/packages/web/src/graphql/schema.graphql new file mode 100644 index 000000000..1007624db --- /dev/null +++ b/packages/web/src/graphql/schema.graphql @@ -0,0 +1,416 @@ +schema { + query: Query + mutation: Mutation + subscription: Subscription +} +scalar Date +enum CardNetwork { + visa + mastercard +} +type Card { + """The ID of the payment""" + id: ID! + """The date at witch the payment was created""" + createdAt: Date! + """The date at witch the payment was last updated""" + updatedAt: Date! + circleCardId: ID! + ownerId: ID! + metadata: CardMetadata + verification: CardVerification +} +type CardMetadata { + digits: String + network: CardNetwork + billingDetails: CardBillingDetails +} +type CardVerification { + cvv: String +} +type CardBillingDetails { + name: String + city: String + country: String + postalCode: String + district: String + line1: String +} +type User { + id: ID! + firstName: String + lastName: String + email: String + photoURL: String + createdAt: Date + tokens: [String] + permissions: [String] + proposals(page: Int = 1): [Proposal] + subscriptions(page: Int = 1, status: SubscriptionStatus): [Subscription] +} +type Wire { + """The local ID of the payout""" + id: ID! + createdAt: Date + updatedAt: Date + description: String + bank: WireBank + billingDetails: WireBillingDetailsType +} +type WireBank { + bankName: String + city: String + country: String +} +type WireBillingDetailsType { + city: String + country: String + line1: String + line2: String + name: String + postalCode: String +} +enum EventType { + commonCreated + commonCreationFailed + commonWhitelisted + commonMemberAdded + commonMemberRemoved + commonUpdated + requestToJoinCreated + requestToJoinAccepted + requestToJoinRejected + requestToJoinExecuted + fundingRequestCreated + fundingRequestRejected + fundingRequestExecuted + fundingRequestAccepted + fundingRequestAcceptedInsufficientFunds + voteCreated + paymentCreated + paymentConfirmed + paymentFailed + paymentPaid + payoutCreated + payoutApproved + payoutExecuted + payoutVoided + payoutCompleted + payoutFailed + cardCreated + discussionCreated + messageCreated + subscriptionCreated + subscriptionPaymentCreated + subscriptionPaymentFailed + subscriptionPaymentConfirmed + subscriptionPaymentStuck + subscriptionCanceledByUser + subscriptionCanceledByPaymentFailure + membershipRevoked + discussionMessageReported + proposalReported + discussionReported +} +type Event { + """The unique identifier of the event""" + id: ID! + """The type of the event""" + type: EventType! + """The date, at which the event was created""" + createdAt: Date! + """The date, at which the event was last updated""" + updatedAt: Date! + """The id of the object on which was acted to created the event""" + objectId: ID + """The id of the actor""" + userId: ID + user: User +} +enum CommonContributionType { + oneTime + monthly +} +type CommonMember { + """The user ID of the member""" + userId: ID! + """The date, at witch the member joined the common""" + joinedAt: Date + user: User +} +type CommonMetadata { + byline: String! + description: String! + founderId: String! + minFeeToJoin: Int! + contributionType: CommonContributionType +} +type Payout { + id: ID! + createdAt: Date! + updatedAt: Date! + circlePayoutId: String + amount: Int! + executed: Boolean + voided: Boolean + status: PayoutStatus + security: [PayoutSecurity] + proposalIds: [String] + proposals: [Proposal] +} +type PayoutSecurity { + id: Int + redemptionAttempts: Int + redeemed: Boolean +} +enum PayoutStatus { + pending + complete + failed +} +input ExecutePayoutInput { + """The ID of the the wire to witch the payout will be made""" + wireId: ID! + """List of the all proposals IDs that are in this batch""" + proposalIds: [ID!]! +} +enum PaymentType { + oneTime + subscription +} +enum PaymentSourceType { + card +} +enum PaymentStatus { + pending + confirmed + paid + failed +} +enum PaymentCurrency { + USD +} +type Payment { + """The ID of the payment""" + id: ID! + """The date at witch the payment was created""" + createdAt: Date! + """The date at witch the payment was last updated""" + updatedAt: Date! + type: PaymentType! + status: PaymentStatus! + """The source from witch the payment was funded""" + source: PaymentSource! + amount: PaymentAmount! + """The fees on the payment""" + fees: PaymentFees + circlePaymentId: ID! + proposalId: ID! + userId: ID! + subscriptionId: ID + user: User + card: Card + common: Common + proposal: Proposal + subscription: Subscription +} +type PaymentFees { + amount: Int + currency: PaymentCurrency +} +type PaymentSource { + type: PaymentSourceType! + id: ID +} +type PaymentAmount { + currency: PaymentCurrency + amount: Int +} +type Balance { + available: Amount + unsettled: Amount +} +type Amount { + amount: String + currency: String +} +enum ProposalType { + fundingRequest + join +} +enum ProposalState { + passedInsufficientBalance + countdown + passed + failed +} +enum ProposalVoteOutcome { + approved + rejected +} +enum ProposalPaymentState { + notAttempted + notRelevant + confirmed + pending + failed +} +enum ProposalFundingState { + notRelevant + notAvailable + available + funded +} +"""The proposals type""" +type Proposal { + id: ID! + createdAt: Date! + updatedAt: Date! + commonId: ID! + proposerId: ID! + votesFor: Int! + votesAgainst: Int! + state: ProposalState! + description: ProposalDescription! + type: ProposalType! + paymentState: ProposalPaymentState + fundingState: ProposalFundingState + """Details about the funding request. Exists only on funding request proposals""" + fundingRequest: ProposalFunding + """Details about the join request. Exists only on join request proposals""" + join: ProposalJoin + votes: [ProposalVote] + common: Common! + proposer: User! +} +type ProposalDescription { + title: String + description: String! +} +type ProposalFunding { + amount: Int! +} +type ProposalJoin { + cardId: ID! + funding: Int! + fundingType: CommonContributionType +} +type ProposalVote { + voteId: ID! + voterId: ID! + outcome: ProposalVoteOutcome! + voter: User +} +type Intention { + id: ID! + createdAt: Date! + updatedAt: Date! + type: IntentionType! + intention: String! +} +enum IntentionType { + access + request +} +input CreateIntentionInput { + type: IntentionType! + intention: String! +} +enum SubscriptionStatus { + pending + active + canceledByUser + canceledByPaymentFailure + paymentFailed +} +type Subscription { + id: ID! + cardId: ID! + userId: ID! + proposalId: ID! + createdAt: Date! + updatedAt: Date! + charges: Int! + amount: Int! + lastChargedAt: Date + dueDate: Date + revoked: Boolean! + status: SubscriptionStatus! + metadata: SubscriptionMetadata! +} +type SubscriptionMetadata { + common: SubscriptionMetadataCommon +} +type SubscriptionMetadataCommon { + id: ID + name: String +} +type Statistics { + """Commons, created on that date""" + newCommons: Int + """The amount of proposals with join type, created on that date""" + newJoinRequests: Int + """The amount of proposals with funding type, created on that date""" + newFundingRequests: Int + """The amount of discussions, started on that date""" + newDiscussions: Int + """The amount of new discussion messages, send on that date""" + newDiscussionMessages: Int + commons: Int + joinRequests(onlyOpen: Boolean = false): Int + fundingRequests(onlyOpen: Boolean = false): Int + users: Int +} +"""The common type""" +type Common { + """The unique identifier of the common""" + id: ID! + """The date, at which the common was created""" + createdAt: Date + """The date, at which the common was last updated""" + updatedAt: Date + """The display name of the common""" + name: String! + """The currently available funds of the common""" + balance: Int! + """The total amount of money, raised by the common""" + raised: Int! + metadata: CommonMetadata! + members: [CommonMember] + proposals(page: Int, type: ProposalType, state: ProposalState, paymentState: ProposalPaymentState): [Proposal] + openJoinRequests: Int! + openFundingRequests: Int! +} +type Query { + user(id: ID!): User + users(page: Int = 1, perPage: Int = 10): [User] + wires(page: Int = 1): [Wire] + event(eventId: ID!): Event + events(last: Int = 10, after: Int = 0, type: EventType, objectId: ID): [Event] + common( + """The ID of the common, that you want to retrieve""" + commonId: ID! + ): Common + commons(last: Int = 10, after: Int = 0): [Common] + payout(id: ID!): Payout + payouts(page: Int = 1): [Payout] + payment(id: ID!): Payment + payments(page: Int = 1, hanging: Boolean): [Payment] + balance: Balance + proposal(id: ID!): Proposal + proposals(ids: [String], page: Int = 1, pageItems: Int = 10, type: ProposalType, fundingState: ProposalFundingState): [Proposal] + statistics: Statistics +} +type Mutation { + whitelistCommon(commonId: ID!): Boolean + """Refresh the common members from the events. Returns the new common member count""" + refreshCommonMembers( + """The common id to refresh""" + commonId: ID! + ): Int + executePayouts(input: ExecutePayoutInput!): Payout + approvePayout(payoutId: ID!, index: Int!, token: String!): Boolean + updatePaymentData(id: ID!, trackId: ID = "7f4fe0bd-590a-455d-b3cd-fe6045d36066"): Boolean + updatePaymentsCommonId: Boolean + createIntention(input: CreateIntentionInput!): Intention +} \ No newline at end of file diff --git a/packages/web/src/graphql/schema.json b/packages/web/src/graphql/schema.json new file mode 100644 index 000000000..070a5174e --- /dev/null +++ b/packages/web/src/graphql/schema.json @@ -0,0 +1,5345 @@ +{ + "__schema": { + "queryType": { + "name": "Query" + }, + "mutationType": { + "name": "Mutation" + }, + "subscriptionType": { + "name": "Subscription" + }, + "types": [ + { + "kind": "SCALAR", + "name": "Date", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "CardNetwork", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "visa", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mastercard", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Card", + "description": null, + "fields": [ + { + "name": "id", + "description": "The ID of the payment", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "The date at witch the payment was created", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "The date at witch the payment was last updated", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "circleCardId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ownerId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metadata", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "CardMetadata", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "verification", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "CardVerification", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "ID", + "description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CardMetadata", + "description": null, + "fields": [ + { + "name": "digits", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "network", + "description": null, + "args": [], + "type": { + "kind": "ENUM", + "name": "CardNetwork", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "billingDetails", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "CardBillingDetails", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "String", + "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CardVerification", + "description": null, + "fields": [ + { + "name": "cvv", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CardBillingDetails", + "description": null, + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "city", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "country", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "postalCode", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "district", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "line1", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "User", + "description": null, + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "firstName", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastName", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "email", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "photoURL", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tokens", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permissions", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposals", + "description": null, + "args": [ + { + "name": "page", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "1", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Proposal", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptions", + "description": null, + "args": [ + { + "name": "page", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "1", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": null, + "type": { + "kind": "ENUM", + "name": "SubscriptionStatus", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Subscription", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Int", + "description": "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Wire", + "description": null, + "fields": [ + { + "name": "id", + "description": "The local ID of the payout", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bank", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "WireBank", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "billingDetails", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "WireBillingDetailsType", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "WireBank", + "description": null, + "fields": [ + { + "name": "bankName", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "city", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "country", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "WireBillingDetailsType", + "description": null, + "fields": [ + { + "name": "city", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "country", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "line1", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "line2", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "postalCode", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "EventType", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "commonCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commonCreationFailed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commonWhitelisted", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commonMemberAdded", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commonMemberRemoved", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commonUpdated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestToJoinCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestToJoinAccepted", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestToJoinRejected", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestToJoinExecuted", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingRequestCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingRequestRejected", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingRequestExecuted", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingRequestAccepted", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingRequestAcceptedInsufficientFunds", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "voteCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "paymentCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "paymentConfirmed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "paymentFailed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "paymentPaid", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payoutCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payoutApproved", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payoutExecuted", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payoutVoided", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payoutCompleted", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payoutFailed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cardCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "discussionCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "messageCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionPaymentCreated", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionPaymentFailed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionPaymentConfirmed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionPaymentStuck", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionCanceledByUser", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionCanceledByPaymentFailure", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "membershipRevoked", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "discussionMessageReported", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposalReported", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "discussionReported", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Event", + "description": null, + "fields": [ + { + "name": "id", + "description": "The unique identifier of the event", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "The type of the event", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "EventType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "The date, at which the event was created", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "The date, at which the event was last updated", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "objectId", + "description": "The id of the object on which was acted to created the event", + "args": [], + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userId", + "description": "The id of the actor", + "args": [], + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "CommonContributionType", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "oneTime", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "monthly", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommonMember", + "description": null, + "fields": [ + { + "name": "userId", + "description": "The user ID of the member", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "joinedAt", + "description": "The date, at witch the member joined the common", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommonMetadata", + "description": null, + "fields": [ + { + "name": "byline", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "founderId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "minFeeToJoin", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "contributionType", + "description": null, + "args": [], + "type": { + "kind": "ENUM", + "name": "CommonContributionType", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Payout", + "description": null, + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "circlePayoutId", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "amount", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "executed", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "voided", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": null, + "args": [], + "type": { + "kind": "ENUM", + "name": "PayoutStatus", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "security", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PayoutSecurity", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposalIds", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposals", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Proposal", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Boolean", + "description": "The `Boolean` scalar type represents `true` or `false`.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PayoutSecurity", + "description": null, + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "redemptionAttempts", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "redeemed", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PayoutStatus", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "pending", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "complete", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "failed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ExecutePayoutInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "wireId", + "description": "The ID of the the wire to witch the payout will be made", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposalIds", + "description": "List of the all proposals IDs that are in this batch", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PaymentType", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "oneTime", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscription", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PaymentSourceType", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "card", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PaymentStatus", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "pending", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "confirmed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "paid", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "failed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PaymentCurrency", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "USD", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Payment", + "description": null, + "fields": [ + { + "name": "id", + "description": "The ID of the payment", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "The date at witch the payment was created", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "The date at witch the payment was last updated", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PaymentType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PaymentStatus", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "The source from witch the payment was funded", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PaymentSource", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "amount", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PaymentAmount", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fees", + "description": "The fees on the payment", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PaymentFees", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "circlePaymentId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposalId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionId", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "card", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Card", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "common", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Common", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposal", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Proposal", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscription", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Subscription", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PaymentFees", + "description": null, + "fields": [ + { + "name": "amount", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "currency", + "description": null, + "args": [], + "type": { + "kind": "ENUM", + "name": "PaymentCurrency", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PaymentSource", + "description": null, + "fields": [ + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PaymentSourceType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PaymentAmount", + "description": null, + "fields": [ + { + "name": "currency", + "description": null, + "args": [], + "type": { + "kind": "ENUM", + "name": "PaymentCurrency", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "amount", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Balance", + "description": null, + "fields": [ + { + "name": "available", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Amount", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "unsettled", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Amount", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Amount", + "description": null, + "fields": [ + { + "name": "amount", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "currency", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProposalType", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "fundingRequest", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "join", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProposalState", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "passedInsufficientBalance", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "countdown", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "passed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "failed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProposalVoteOutcome", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "approved", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rejected", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProposalPaymentState", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "notAttempted", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "notRelevant", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "confirmed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pending", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "failed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProposalFundingState", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "notRelevant", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "notAvailable", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "available", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "funded", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Proposal", + "description": "The proposals type", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commonId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposerId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "votesFor", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "votesAgainst", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProposalState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProposalDescription", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProposalType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "paymentState", + "description": null, + "args": [], + "type": { + "kind": "ENUM", + "name": "ProposalPaymentState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingState", + "description": null, + "args": [], + "type": { + "kind": "ENUM", + "name": "ProposalFundingState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingRequest", + "description": "Details about the funding request. Exists only on funding request proposals", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProposalFunding", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "join", + "description": "Details about the join request. Exists only on join request proposals", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProposalJoin", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "votes", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProposalVote", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "common", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Common", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposer", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProposalDescription", + "description": null, + "fields": [ + { + "name": "title", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProposalFunding", + "description": null, + "fields": [ + { + "name": "amount", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProposalJoin", + "description": null, + "fields": [ + { + "name": "cardId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "funding", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingType", + "description": null, + "args": [], + "type": { + "kind": "ENUM", + "name": "CommonContributionType", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProposalVote", + "description": null, + "fields": [ + { + "name": "voteId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "voterId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "outcome", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProposalVoteOutcome", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "voter", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Intention", + "description": null, + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IntentionType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "intention", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "IntentionType", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "access", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "request", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CreateIntentionInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "type", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IntentionType", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "intention", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SubscriptionStatus", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "pending", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "active", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "canceledByUser", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "canceledByPaymentFailure", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "paymentFailed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Subscription", + "description": null, + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cardId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposalId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "charges", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "amount", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastChargedAt", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dueDate", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "revoked", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SubscriptionStatus", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metadata", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SubscriptionMetadata", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SubscriptionMetadata", + "description": null, + "fields": [ + { + "name": "common", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "SubscriptionMetadataCommon", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SubscriptionMetadataCommon", + "description": null, + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Statistics", + "description": null, + "fields": [ + { + "name": "newCommons", + "description": "Commons, created on that date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "newJoinRequests", + "description": "The amount of proposals with join type, created on that date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "newFundingRequests", + "description": "The amount of proposals with funding type, created on that date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "newDiscussions", + "description": "The amount of discussions, started on that date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "newDiscussionMessages", + "description": "The amount of new discussion messages, send on that date", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commons", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "joinRequests", + "description": null, + "args": [ + { + "name": "onlyOpen", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingRequests", + "description": null, + "args": [ + { + "name": "onlyOpen", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "users", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Common", + "description": "The common type", + "fields": [ + { + "name": "id", + "description": "The unique identifier of the common", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "The date, at which the common was created", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "The date, at which the common was last updated", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The display name of the common", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "balance", + "description": "The currently available funds of the common", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "raised", + "description": "The total amount of money, raised by the common", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metadata", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommonMetadata", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "members", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommonMember", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposals", + "description": null, + "args": [ + { + "name": "page", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "type": { + "kind": "ENUM", + "name": "ProposalType", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": null, + "type": { + "kind": "ENUM", + "name": "ProposalState", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "paymentState", + "description": null, + "type": { + "kind": "ENUM", + "name": "ProposalPaymentState", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Proposal", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "openJoinRequests", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "openFundingRequests", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Query", + "description": null, + "fields": [ + { + "name": "user", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "users", + "description": null, + "args": [ + { + "name": "page", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "1", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "perPage", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "10", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "wires", + "description": null, + "args": [ + { + "name": "page", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "1", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Wire", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "event", + "description": null, + "args": [ + { + "name": "eventId", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Event", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "events", + "description": null, + "args": [ + { + "name": "last", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "10", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "after", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "0", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "type": { + "kind": "ENUM", + "name": "EventType", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "objectId", + "description": null, + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Event", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "common", + "description": null, + "args": [ + { + "name": "commonId", + "description": "The ID of the common, that you want to retrieve", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Common", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commons", + "description": null, + "args": [ + { + "name": "last", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "10", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "after", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "0", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Common", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payout", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Payout", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payouts", + "description": null, + "args": [ + { + "name": "page", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "1", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Payout", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payment", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Payment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payments", + "description": null, + "args": [ + { + "name": "page", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "1", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hanging", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Payment", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "balance", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Balance", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposal", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Proposal", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "proposals", + "description": null, + "args": [ + { + "name": "ids", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "page", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "1", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageItems", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "10", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "type": { + "kind": "ENUM", + "name": "ProposalType", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fundingState", + "description": null, + "type": { + "kind": "ENUM", + "name": "ProposalFundingState", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Proposal", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "statistics", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "Statistics", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Mutation", + "description": null, + "fields": [ + { + "name": "whitelistCommon", + "description": null, + "args": [ + { + "name": "commonId", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "refreshCommonMembers", + "description": "Refresh the common members from the events. Returns the new common member count", + "args": [ + { + "name": "commonId", + "description": "The common id to refresh", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "executePayouts", + "description": null, + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ExecutePayoutInput", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Payout", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "approvePayout", + "description": null, + "args": [ + { + "name": "payoutId", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "index", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "token", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatePaymentData", + "description": null, + "args": [ + { + "name": "id", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "trackId", + "description": null, + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": "\"8185aa06-1fe0-44e7-936e-cd262fdc22f9\"", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatePaymentsCommonId", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createIntention", + "description": null, + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CreateIntentionInput", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Intention", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Schema", + "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", + "fields": [ + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "types", + "description": "A list of all types supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryType", + "description": "The type that query operations will be rooted at.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mutationType", + "description": "If this server supports mutation, the type that mutation operations will be rooted at.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionType", + "description": "If this server support subscription, the type that subscription operations will be rooted at.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "directives", + "description": "A list of all directives supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Directive", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Type", + "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", + "fields": [ + { + "name": "kind", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "__TypeKind", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "specifiedByUrl", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Field", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "interfaces", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "possibleTypes", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "enumValues", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__EnumValue", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inputFields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ofType", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__TypeKind", + "description": "An enum describing what kind of type a given `__Type` is.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SCALAR", + "description": "Indicates this type is a scalar.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Indicates this type is a union. `possibleTypes` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Indicates this type is an enum. `enumValues` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Indicates this type is an input object. `inputFields` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LIST", + "description": "Indicates this type is a list. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NON_NULL", + "description": "Indicates this type is a non-null. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Field", + "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__InputValue", + "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "defaultValue", + "description": "A GraphQL-formatted string representing the default value for this input value.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__EnumValue", + "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Directive", + "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isRepeatable", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locations", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "__DirectiveLocation", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__DirectiveLocation", + "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "QUERY", + "description": "Location adjacent to a query operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MUTATION", + "description": "Location adjacent to a mutation operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIPTION", + "description": "Location adjacent to a subscription operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD", + "description": "Location adjacent to a field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_DEFINITION", + "description": "Location adjacent to a fragment definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_SPREAD", + "description": "Location adjacent to a fragment spread.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INLINE_FRAGMENT", + "description": "Location adjacent to an inline fragment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "VARIABLE_DEFINITION", + "description": "Location adjacent to a variable definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCHEMA", + "description": "Location adjacent to a schema definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCALAR", + "description": "Location adjacent to a scalar definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Location adjacent to an object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD_DEFINITION", + "description": "Location adjacent to a field definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ARGUMENT_DEFINITION", + "description": "Location adjacent to an argument definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Location adjacent to an interface definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Location adjacent to a union definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Location adjacent to an enum definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM_VALUE", + "description": "Location adjacent to an enum value definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Location adjacent to an input object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_FIELD_DEFINITION", + "description": "Location adjacent to an input object field definition.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + } + ], + "directives": [ + { + "name": "include", + "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", + "isRepeatable": false, + "locations": [ + "FIELD", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT" + ], + "args": [ + { + "name": "if", + "description": "Included when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ] + }, + { + "name": "skip", + "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", + "isRepeatable": false, + "locations": [ + "FIELD", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT" + ], + "args": [ + { + "name": "if", + "description": "Skipped when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ] + }, + { + "name": "deprecated", + "description": "Marks an element of a GraphQL schema as no longer supported.", + "isRepeatable": false, + "locations": [ + "FIELD_DEFINITION", + "ARGUMENT_DEFINITION", + "INPUT_FIELD_DEFINITION", + "ENUM_VALUE" + ], + "args": [ + { + "name": "reason", + "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"No longer supported\"", + "isDeprecated": false, + "deprecationReason": null + } + ] + }, + { + "name": "specifiedBy", + "description": "Exposes a URL that specifies the behaviour of this scalar.", + "isRepeatable": false, + "locations": [ + "SCALAR" + ], + "args": [ + { + "name": "url", + "description": "The URL that specifies the behaviour of this scalar.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ] + } + ] + } +} \ No newline at end of file diff --git a/packages/web/src/helpers/apolloHelper.ts b/packages/web/src/helpers/apolloHelper.ts new file mode 100644 index 000000000..332b5ac13 --- /dev/null +++ b/packages/web/src/helpers/apolloHelper.ts @@ -0,0 +1,22 @@ +import { ApolloClient, HttpLink, InMemoryCache } from "@apollo/client"; +import { setContext } from "apollo-link-context"; + +export const createApolloClient = (uri: string, token?: string) => { + const baseLink = new HttpLink({ + uri + }); + + const withToken = setContext(async () => { + return { + headers: { + authorization: token + } + }; + }); + + return new ApolloClient({ + ssrMode: typeof window === 'undefined', + cache: new InMemoryCache(), + link: withToken.concat(baseLink as any) as any + }); +} \ No newline at end of file diff --git a/packages/web/src/hooks/index.ts b/packages/web/src/hooks/index.ts new file mode 100644 index 000000000..0e1d3034e --- /dev/null +++ b/packages/web/src/hooks/index.ts @@ -0,0 +1 @@ +export { useApollo } from './useApollo'; \ No newline at end of file diff --git a/packages/web/src/hooks/useApollo.ts b/packages/web/src/hooks/useApollo.ts new file mode 100644 index 000000000..d6553ec90 --- /dev/null +++ b/packages/web/src/hooks/useApollo.ts @@ -0,0 +1,8 @@ +import React from 'react'; +import { createApolloClient } from '../helpers/apolloHelper'; + +export const useApollo = (uri: string, token?: string) => { + return React.useMemo(() => { + return createApolloClient(uri, token) + }, [uri, token]); +}; diff --git a/packages/web/src/index.tsx b/packages/web/src/index.tsx index ee679e3b4..54e14a751 100644 --- a/packages/web/src/index.tsx +++ b/packages/web/src/index.tsx @@ -2,6 +2,7 @@ import React from "react"; import ReactDOM from "react-dom"; import { Provider } from "react-redux"; import { Router } from "react-router-dom"; +import { ApolloProvider } from './providers/ApolloProvider'; import configureStore from "./store"; import "./index.scss"; @@ -19,7 +20,9 @@ if (process.env.REACT_APP_ENV === "dev") { ReactDOM.render( - + + + , document.getElementById("root"), diff --git a/packages/web/src/providers/ApolloProvider.tsx b/packages/web/src/providers/ApolloProvider.tsx new file mode 100644 index 000000000..f66e81ebf --- /dev/null +++ b/packages/web/src/providers/ApolloProvider.tsx @@ -0,0 +1,17 @@ +import React, { PropsWithChildren } from 'react'; + +import { ApolloProvider as BareApolloProvider } from '@apollo/client'; +import { useApollo } from '../hooks'; +import { useAuthContext } from '../context'; + +export const ApolloProvider: React.FC> = ({ children, ...rest }) => { + const authContext = useAuthContext(); + console.log('authContext',authContext) + const apollo = useApollo('http://localhost:4000/graphql' || '', authContext.token || ''); + + return ( + + {React.isValidElement(children) && React.cloneElement(children, { ...rest })} + + ); +}; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 57ed8ea2b..7ee04f273 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11,6 +11,25 @@ call-me-maybe "^1.0.1" js-yaml "^3.13.1" +"@apollo/client@^3.3.15": + version "3.3.15" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.3.15.tgz#bdd230894aac4beb8ade2b472a1d3c9ea6152812" + integrity sha512-/WQmNvLEZMA0mA3u+FkEPTXKzxZD/KhyO7WlbKcy3zKGrXKza83tAbNMzsitQE7DTcSc3DLEcIu1Z5Rc7PFq0Q== + dependencies: + "@graphql-typed-document-node/core" "^3.0.0" + "@types/zen-observable" "^0.8.0" + "@wry/context" "^0.6.0" + "@wry/equality" "^0.4.0" + fast-json-stable-stringify "^2.0.0" + graphql-tag "^2.12.0" + hoist-non-react-statics "^3.3.2" + optimism "^0.15.0" + prop-types "^15.7.2" + symbol-observable "^2.0.0" + ts-invariant "^0.7.0" + tslib "^1.10.0" + zen-observable "^0.8.14" + "@apollo/client@^3.3.8": version "3.3.15" resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.3.15.tgz#bdd230894aac4beb8ade2b472a1d3c9ea6152812" @@ -5422,6 +5441,13 @@ dependencies: tslib "^2.1.0" +"@wry/context@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.6.0.tgz#f903eceb89d238ef7e8168ed30f4511f92d83e06" + integrity sha512-sAgendOXR8dM7stJw3FusRxFHF/ZinU0lffsA2YTyyIOfic86JX02qlPqPVqJNZJPAxFt+2EE8bvq6ZlS0Kf+Q== + dependencies: + tslib "^2.1.0" + "@wry/equality@^0.1.2": version "0.1.11" resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.1.11.tgz#35cb156e4a96695aa81a9ecc4d03787bc17f1790" @@ -5443,6 +5469,13 @@ dependencies: tslib "^2.1.0" +"@wry/trie@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.3.0.tgz#3245e74988c4e3033299e479a1bf004430752463" + integrity sha512-Yw1akIogPhAT6XPYsRHlZZIS0tIGmAl9EYXHi2scf7LPKKqdqmow/Hu4kEqP2cJR3EjaU/9L0ZlAjFf3hFxmug== + dependencies: + tslib "^2.1.0" + "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -17633,6 +17666,14 @@ optimism@^0.15.0: "@wry/context" "^0.6.0" "@wry/trie" "^0.3.0" +optimism@^0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.15.0.tgz#c65e694bec7ce439f41e9cb8fc261a72d798125b" + integrity sha512-KLKl3Kb7hH++s9ewRcBhmfpXgXF0xQ+JZ3xQFuPjnoT6ib2TDmYyVkKENmGxivsN2G3VRxpXuauCkB4GYOhtPw== + dependencies: + "@wry/context" "^0.6.0" + "@wry/trie" "^0.3.0" + optimist@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -22936,6 +22977,13 @@ ts-invariant@^0.7.0: dependencies: tslib "^2.1.0" +ts-invariant@^0.7.0: + version "0.7.3" + resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.7.3.tgz#13aae22a4a165393aaf5cecdee45ef4128d358b8" + integrity sha512-UWDDeovyUTIMWj+45g5nhnl+8oo+GhxL5leTaHn5c8FkQWfh8v66gccLd2/YzVmV5hoQUjCEjhrXnQqVDJdvKA== + dependencies: + tslib "^2.1.0" + ts-jest@^26.4.4: version "26.4.4" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.4.4.tgz#61f13fb21ab400853c532270e52cc0ed7e502c49" From 1db2dc65db44baa3100182fd2a0900c60a305b98 Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Fri, 7 May 2021 16:31:23 +0300 Subject: [PATCH 2/5] Added links and rules to commonService create --- packages/core/src/domain/validation/index.ts | 1 + .../domain/validation/schemas/Link.schema.ts | 10 + .../commons/command/createCommonCommand.ts | 16 +- .../graphql/src/generated/nexus-typegen.ts | 352 ++++++++++-------- packages/graphql/src/generated/schema.graphql | 20 + .../Types/Commons/Inputs/CommonLink.input.ts | 9 + .../Mutations/CreateCommon.mutation.ts | 6 + .../schema/Types/Commons/Types/Common.type.ts | 3 + .../graphql/src/schema/Types/Commons/index.ts | 3 + .../Extensions/DiscussionOwner.extension.ts | 21 ++ .../Inputs/DiscussionWhere.input.ts | 10 + .../Queries/GetDiscussions.query.ts | 20 + .../Types/Discussion/Types/Discussion.type.ts | 8 + .../src/schema/Types/Discussion/index.ts | 6 + .../src/schema/Types/Proposals/index.ts | 1 - .../DiscussionDetailModal.tsx | 2 +- .../CommonDetailContainer.tsx | 35 +- packages/web/src/graphql/index.ts | 180 +++++++++ 18 files changed, 532 insertions(+), 171 deletions(-) create mode 100644 packages/core/src/domain/validation/schemas/Link.schema.ts create mode 100644 packages/graphql/src/schema/Types/Commons/Inputs/CommonLink.input.ts create mode 100644 packages/graphql/src/schema/Types/Discussion/Extensions/DiscussionOwner.extension.ts create mode 100644 packages/graphql/src/schema/Types/Discussion/Inputs/DiscussionWhere.input.ts create mode 100644 packages/graphql/src/schema/Types/Discussion/Queries/GetDiscussions.query.ts diff --git a/packages/core/src/domain/validation/index.ts b/packages/core/src/domain/validation/index.ts index 4ed7f758b..39d3b12a2 100644 --- a/packages/core/src/domain/validation/index.ts +++ b/packages/core/src/domain/validation/index.ts @@ -1,6 +1,7 @@ import * as z from 'zod'; export { ProposalLinkSchema } from './schemas/ProposalLink.schema'; +export { LinkSchema } from './schemas/Link.schema'; export { BillingDetailsSchema } from './schemas/BillingDetails.schema'; export { ProposalImageSchema } from './schemas/ProposalImage.schema'; export { ProposalFileSchema } from './schemas/ProposalFile.schema'; diff --git a/packages/core/src/domain/validation/schemas/Link.schema.ts b/packages/core/src/domain/validation/schemas/Link.schema.ts new file mode 100644 index 000000000..bfda5f51b --- /dev/null +++ b/packages/core/src/domain/validation/schemas/Link.schema.ts @@ -0,0 +1,10 @@ +import * as z from 'zod'; + +export const LinkSchema = z.object({ + title: z.string() + .nonempty(), + + url: z.string() + .nonempty() + .url() +}); diff --git a/packages/core/src/services/commons/command/createCommonCommand.ts b/packages/core/src/services/commons/command/createCommonCommand.ts index fef5c6f11..ab78d65ce 100644 --- a/packages/core/src/services/commons/command/createCommonCommand.ts +++ b/packages/core/src/services/commons/command/createCommonCommand.ts @@ -3,6 +3,7 @@ import { FundingType, Common, CommonMemberRole, EventType } from '@prisma/client import { prisma } from '@toolkits'; import { eventService } from '@services'; +import { LinkSchema } from '@validation'; import { createCommonMemberCommand } from './createCommonMemberCommand'; import { addCommonMemberRoleCommand } from './addCommonMemberRoleCommand'; @@ -32,7 +33,15 @@ const schema = z.object({ .max(100000), founderId: z.string() - .nonempty() + .nonempty(), + + links: z.array(LinkSchema) + .nullable() + .optional(), + + rules: z.array(LinkSchema) + .nullable() + .optional(), }); export const createCommonCommand = async (command: z.infer): Promise => { @@ -46,7 +55,10 @@ export const createCommonCommand = async (command: z.infer): Prom image: command.image, fundingType: command.fundingType, - fundingMinimumAmount: command.fundingMinimumAmount + fundingMinimumAmount: command.fundingMinimumAmount, + links: command.links, + rules: command.rules, + byline: command.byline, } }); diff --git a/packages/graphql/src/generated/nexus-typegen.ts b/packages/graphql/src/generated/nexus-typegen.ts index 2ab8b9e2c..12bb5e6f0 100644 --- a/packages/graphql/src/generated/nexus-typegen.ts +++ b/packages/graphql/src/generated/nexus-typegen.ts @@ -1,29 +1,27 @@ -/* eslint-disable @typescript-eslint/no-empty-interface */ /** * This file was generated by Nexus Schema * Do not make changes to this file directly */ -import { IRequestContext } from './../context'; -import { QueryComplexity } from 'nexus/dist/plugins/queryComplexityPlugin'; -import { FieldAuthorizeResolver } from 'nexus/dist/plugins/fieldAuthorizePlugin'; -import { core } from 'nexus'; - +import { IRequestContext } from "./../context" +import { QueryComplexity } from "nexus/dist/plugins/queryComplexityPlugin" +import { FieldAuthorizeResolver } from "nexus/dist/plugins/fieldAuthorizePlugin" +import { core } from "nexus" declare global { interface NexusGenCustomInputMethods { /** * A field whose value conforms to the standard URL format as specified in RFC3986: https://www.ietf.org/rfc/rfc3986.txt. */ - url(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void; // "URL"; + url(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void // "URL"; /** * A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */ - date(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void; // "DateTime"; + date(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void // "DateTime"; /** * The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */ - json(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void; // "JSON"; + json(fieldName: FieldName, opts?: core.CommonInputFieldConfig): void // "JSON"; /** * A field whose value is a generic Universally Unique Identifier: https://en.wikipedia.org/wiki/Universally_unique_identifier. */ @@ -36,15 +34,15 @@ declare global { /** * A field whose value conforms to the standard URL format as specified in RFC3986: https://www.ietf.org/rfc/rfc3986.txt. */ - url(fieldName: FieldName, ...opts: core.ScalarOutSpread): void; // "URL"; + url(fieldName: FieldName, ...opts: core.ScalarOutSpread): void // "URL"; /** * A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */ - date(fieldName: FieldName, ...opts: core.ScalarOutSpread): void; // "DateTime"; + date(fieldName: FieldName, ...opts: core.ScalarOutSpread): void // "DateTime"; /** * The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */ - json(fieldName: FieldName, ...opts: core.ScalarOutSpread): void; // "JSON"; + json(fieldName: FieldName, ...opts: core.ScalarOutSpread): void // "JSON"; /** * A field whose value is a generic Universally Unique Identifier: https://en.wikipedia.org/wiki/Universally_unique_identifier. */ @@ -71,20 +69,24 @@ export interface NexusGenInputs { line2?: string | null; // String name: string; // String! postalCode: string; // String! - }; + } + CommonLinkInput: { // input type + title: string; // String! + url: string; // String! + } CommonMemberOrderByInput: { // input type createdAt: NexusGenEnums['SortOrder']; // SortOrder! - }; + } CommonWhereUniqueInput: { // input type id: string; // ID! - }; + } CreateCardInput: { // input type billingDetails: NexusGenInputs['BillingDetailsInput']; // BillingDetailsInput! encryptedData: string; // String! expMonth: number; // Int! expYear: number; // Int! keyId: string; // String! - }; + } CreateCommonInput: { // input type action?: string | null; // String byline?: string | null; // String @@ -92,18 +94,20 @@ export interface NexusGenInputs { fundingMinimumAmount: number; // Int! fundingType: NexusGenEnums['FundingType']; // FundingType! image: string; // String! + links?: NexusGenInputs['CommonLinkInput'][] | null; // [CommonLinkInput!] name: string; // String! - }; + rules?: NexusGenInputs['CommonLinkInput'][] | null; // [CommonLinkInput!] + } CreateDiscussionInput: { // input type commonId: string; // ID! description: string; // String! proposalId?: string | null; // ID topic: string; // String! - }; + } CreateDiscussionMessageInput: { // input type discussionId: string; // ID! message: string; // String! - }; + } CreateFundingProposalInput: { // input type amount: number; // Int! commonId: string; // ID! @@ -112,7 +116,7 @@ export interface NexusGenInputs { images?: NexusGenInputs['ProposalImageInput'][] | null; // [ProposalImageInput!] links?: NexusGenInputs['ProposalLinkInput'][] | null; // [ProposalLinkInput!] title: string; // String! - }; + } CreateJoinProposalInput: { // input type cardId: string; // String! commonId: string; // String! @@ -136,33 +140,38 @@ export interface NexusGenInputs { CreateUserNotificationTokenInput: { // input type description: string; // String! token: string; // String! - }; + } CreateVoteInput: { // input type outcome: NexusGenEnums['VoteOutcome']; // VoteOutcome! proposalId: string; // ID! - }; + } DiscussionMessagesOrderByInput: { // input type createdAt?: NexusGenEnums['SortOrder'] | null; // SortOrder updatedAt?: NexusGenEnums['SortOrder'] | null; // SortOrder - }; + } DiscussionSubscriptionOrderByInput: { // input type createdAt?: NexusGenEnums['SortOrder'] | null; // SortOrder updatedAt?: NexusGenEnums['SortOrder'] | null; // SortOrder - }; + } + DiscussionWhereInput: { // input type + commonId?: NexusGenScalars['UUID'] | null; // UUID + commonMemberId?: NexusGenScalars['UUID'] | null; // UUID + userId?: string | null; // ID + } EventOrderByInput: { // input type createdAt?: NexusGenEnums['SortOrder'] | null; // SortOrder type?: NexusGenEnums['SortOrder'] | null; // SortOrder updatedAt?: NexusGenEnums['SortOrder'] | null; // SortOrder - }; + } LinkInput: { // input type title: string; // String! url: string; // String! - }; + } NotificationOrderByInput: { // input type createdAt?: NexusGenEnums['SortOrder'] | null; // SortOrder status?: NexusGenEnums['SortOrder'] | null; // SortOrder updatedAt?: NexusGenEnums['SortOrder'] | null; // SortOrder - }; + } NotificationWhereInput: { // input type commonId?: NexusGenScalars['UUID'] | null; // UUID discussionId?: NexusGenScalars['UUID'] | null; // UUID @@ -170,7 +179,7 @@ export interface NexusGenInputs { seenStatus?: NexusGenEnums['NotificationSeenStatus'] | null; // NotificationSeenStatus type?: NexusGenEnums['NotificationType'] | null; // NotificationType userId?: string | null; // ID - }; + } NotificationWhereUniqueInput: { // input type id?: NexusGenScalars['UUID'] | null; // UUID } @@ -180,23 +189,24 @@ export interface NexusGenInputs { } ProposalFileInput: { // input type value: string; // String! - }; + } ProposalImageInput: { // input type value: string; // String! - }; + } ProposalLinkInput: { // input type title: string; // String! url: string; // String! - }; + } ProposalWhereInput: { // input type commonId?: NexusGenScalars['UUID'] | null; // UUID commonMemberId?: NexusGenScalars['UUID'] | null; // UUID state?: NexusGenEnums['ProposalState'] | null; // ProposalState type?: NexusGenEnums['ProposalType'] | null; // ProposalType - }; + userId?: string | null; // ID + } ProposalWhereUniqueInput: { // input type id: NexusGenScalars['UUID']; // UUID! - }; + } ReportDiscussionMessageInput: { // input type for: NexusGenEnums['ReportFor']; // ReportFor! messageId: NexusGenScalars['UUID']; // UUID! @@ -224,7 +234,7 @@ export interface NexusGenInputs { lte?: string | null; // String notIn?: string[] | null; // [String!] startsWith?: string | null; // String - }; + } } export interface NexusGenEnums { @@ -269,7 +279,7 @@ export interface NexusGenObjects { createdAt: NexusGenScalars['DateTime']; // DateTime! id: string; // ID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } Common: { // root type action?: string | null; // String balance: number; // Int! @@ -280,11 +290,13 @@ export interface NexusGenObjects { fundingType: NexusGenEnums['FundingType']; // FundingType! id: string; // ID! image: string; // String! + links?: NexusGenScalars['JSON'] | null; // JSON name: string; // String! raised: number; // Int! + rules?: NexusGenScalars['JSON'] | null; // JSON updatedAt: NexusGenScalars['DateTime']; // DateTime! whitelisted: boolean; // Boolean! - }; + } CommonMember: { // root type commonId: string; // ID! createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -292,7 +304,7 @@ export interface NexusGenObjects { roles: NexusGenEnums['CommonMemberRole'][]; // [CommonMemberRole!]! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId: string; // ID! - }; + } Discussion: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string; // String! @@ -301,7 +313,8 @@ export interface NexusGenObjects { topic: string; // String! type: NexusGenEnums['DiscussionType']; // DiscussionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + userId: string; // String! + } DiscussionMessage: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! flag: NexusGenEnums['DiscussionMessageFlag']; // DiscussionMessageFlag! @@ -309,7 +322,7 @@ export interface NexusGenObjects { message: string; // String! type: NexusGenEnums['DiscussionMessageType']; // DiscussionMessageType! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } DiscussionSubscription: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! discussionId: NexusGenScalars['UUID']; // UUID! @@ -317,7 +330,7 @@ export interface NexusGenObjects { type: NexusGenEnums['DiscussionSubscriptionType']; // DiscussionSubscriptionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId: string; // String! - }; + } Event: { // root type commonId?: string | null; // ID createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -326,14 +339,14 @@ export interface NexusGenObjects { type: NexusGenEnums['EventType']; // EventType! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId?: string | null; // ID - }; + } FundingProposal: { // root type amount: number; // Int! createdAt: NexusGenScalars['DateTime']; // DateTime! fundingState: NexusGenEnums['FundingState']; // FundingState! id: NexusGenScalars['UUID']; // UUID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } JoinProposal: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! funding: number; // Int! @@ -341,11 +354,11 @@ export interface NexusGenObjects { id: NexusGenScalars['UUID']; // UUID! paymentState: NexusGenEnums['PaymentState']; // PaymentState! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } Link: { // root type title: string; // String! url: string; // String! - }; + } Mutation: {}; Notification: { // root type commonId?: NexusGenScalars['UUID'] | null; // UUID @@ -358,7 +371,7 @@ export interface NexusGenObjects { type: NexusGenEnums['NotificationType']; // NotificationType! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId: NexusGenScalars['UUID']; // UUID! - }; + } Proposal: { // root type commonId: NexusGenScalars['UUID']; // UUID! createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -418,7 +431,7 @@ export interface NexusGenObjects { permissions: string[]; // [String!]! photo: string; // String! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } UserNotificationToken: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string; // String! @@ -427,12 +440,12 @@ export interface NexusGenObjects { lastVerified: NexusGenScalars['DateTime']; // DateTime! state: NexusGenEnums['UserNotificationTokenState']; // UserNotificationTokenState! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } Vote: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! id: string; // ID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } } export interface NexusGenInterfaces { @@ -451,7 +464,7 @@ export interface NexusGenFieldTypes { createdAt: NexusGenScalars['DateTime']; // DateTime! id: string; // ID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } Common: { // field return type action: string | null; // String activeFundingProposals: number; // Int! @@ -467,14 +480,16 @@ export interface NexusGenFieldTypes { fundingType: NexusGenEnums['FundingType']; // FundingType! id: string; // ID! image: string; // String! + links: NexusGenScalars['JSON'] | null; // JSON members: Array; // [CommonMember]! name: string; // String! proposals: NexusGenRootTypes['Proposal'][]; // [Proposal!]! raised: number; // Int! reports: NexusGenRootTypes['Report'][]; // [Report!]! + rules: NexusGenScalars['JSON'] | null; // JSON updatedAt: NexusGenScalars['DateTime']; // DateTime! whitelisted: boolean; // Boolean! - }; + } CommonMember: { // field return type common: NexusGenRootTypes['Common'] | null; // Common commonId: string; // ID! @@ -485,17 +500,19 @@ export interface NexusGenFieldTypes { updatedAt: NexusGenScalars['DateTime']; // DateTime! user: NexusGenRootTypes['User'] | null; // User userId: string; // ID! - }; + } Discussion: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string; // String! id: NexusGenScalars['UUID']; // UUID! latestMessage: NexusGenScalars['DateTime']; // DateTime! messages: NexusGenRootTypes['DiscussionMessage'][]; // [DiscussionMessage!]! + owner: NexusGenRootTypes['User'] | null; // User topic: string; // String! type: NexusGenEnums['DiscussionType']; // DiscussionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + userId: string; // String! + } DiscussionMessage: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! flag: NexusGenEnums['DiscussionMessageFlag']; // DiscussionMessageFlag! @@ -504,7 +521,7 @@ export interface NexusGenFieldTypes { reports: NexusGenRootTypes['Report'][]; // [Report!]! type: NexusGenEnums['DiscussionMessageType']; // DiscussionMessageType! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } DiscussionSubscription: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! discussion: NexusGenRootTypes['Discussion']; // Discussion! @@ -513,7 +530,7 @@ export interface NexusGenFieldTypes { type: NexusGenEnums['DiscussionSubscriptionType']; // DiscussionSubscriptionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! userId: string; // String! - }; + } Event: { // field return type commonId: string | null; // ID createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -523,14 +540,14 @@ export interface NexusGenFieldTypes { updatedAt: NexusGenScalars['DateTime']; // DateTime! user: NexusGenRootTypes['User'] | null; // User userId: string | null; // ID - }; + } FundingProposal: { // field return type amount: number; // Int! createdAt: NexusGenScalars['DateTime']; // DateTime! fundingState: NexusGenEnums['FundingState']; // FundingState! id: NexusGenScalars['UUID']; // UUID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } JoinProposal: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! funding: number; // Int! @@ -538,11 +555,11 @@ export interface NexusGenFieldTypes { id: NexusGenScalars['UUID']; // UUID! paymentState: NexusGenEnums['PaymentState']; // PaymentState! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } Link: { // field return type title: string; // String! url: string; // String! - }; + } Mutation: { // field return type actOnReport: NexusGenRootTypes['Report'] | null; // Report assignRole: NexusGenScalars['Void'] | null; // Void @@ -579,7 +596,7 @@ export interface NexusGenFieldTypes { updatedAt: NexusGenScalars['DateTime']; // DateTime! user: NexusGenRootTypes['User']; // User! userId: NexusGenScalars['UUID']; // UUID! - }; + } Proposal: { // field return type common: NexusGenRootTypes['Common']; // Common! commonId: NexusGenScalars['UUID']; // UUID! @@ -607,6 +624,7 @@ export interface NexusGenFieldTypes { common: NexusGenRootTypes['Common'] | null; // Common commons: Array | null; // [Common] discussion: NexusGenRootTypes['Discussion'] | null; // Discussion + discussions: Array | null; // [Discussion] events: Array | null; // [Event] generateUserAuthToken: string; // String! getStatistics: Array | null; // [Statistic] @@ -614,7 +632,7 @@ export interface NexusGenFieldTypes { proposals: Array | null; // [Proposal] roles: Array | null; // [Role] user: NexusGenRootTypes['User'] | null; // User - }; + } Report: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! for: NexusGenEnums['ReportFor']; // ReportFor! @@ -650,7 +668,7 @@ export interface NexusGenFieldTypes { discussionMessageCreated: NexusGenRootTypes['DiscussionMessage'] | null; // DiscussionMessage notificationCreated: NexusGenRootTypes['Notification'] | null; // Notification onProposalChange: NexusGenRootTypes['Proposal'] | null; // Proposal - }; + } User: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! discussionSubscriptions: NexusGenRootTypes['DiscussionSubscription'][]; // [DiscussionSubscription!]! @@ -666,7 +684,7 @@ export interface NexusGenFieldTypes { photo: string; // String! proposals: NexusGenRootTypes['Proposal'][]; // [Proposal!]! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } UserNotificationToken: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! description: string; // String! @@ -676,25 +694,25 @@ export interface NexusGenFieldTypes { state: NexusGenEnums['UserNotificationTokenState']; // UserNotificationTokenState! token: string; // String! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } Vote: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! id: string; // ID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } BaseEntity: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! id: NexusGenScalars['UUID']; // UUID! updatedAt: NexusGenScalars['DateTime']; // DateTime! - }; + } } export interface NexusGenFieldTypeNames { Card: { // field return type name - createdAt: 'DateTime'; - id: 'ID'; - updatedAt: 'DateTime'; - }; + createdAt: 'DateTime' + id: 'ID' + updatedAt: 'DateTime' + } Common: { // field return type name action: 'String' activeFundingProposals: 'Int' @@ -710,11 +728,13 @@ export interface NexusGenFieldTypeNames { fundingType: 'FundingType' id: 'ID' image: 'String' + links: 'JSON' members: 'CommonMember' name: 'String' proposals: 'Proposal' raised: 'Int' reports: 'Report' + rules: 'JSON' updatedAt: 'DateTime' whitelisted: 'Boolean' } @@ -730,15 +750,17 @@ export interface NexusGenFieldTypeNames { userId: 'ID' } Discussion: { // field return type name - createdAt: 'DateTime'; - description: 'String'; - id: 'UUID'; - latestMessage: 'DateTime'; - messages: 'DiscussionMessage'; - topic: 'String'; - type: 'DiscussionType'; - updatedAt: 'DateTime'; - }; + createdAt: 'DateTime' + description: 'String' + id: 'UUID' + latestMessage: 'DateTime' + messages: 'DiscussionMessage' + owner: 'User' + topic: 'String' + type: 'DiscussionType' + updatedAt: 'DateTime' + userId: 'String' + } DiscussionMessage: { // field return type name createdAt: 'DateTime' flag: 'DiscussionMessageFlag' @@ -749,14 +771,14 @@ export interface NexusGenFieldTypeNames { updatedAt: 'DateTime' } DiscussionSubscription: { // field return type name - createdAt: 'DateTime'; - discussion: 'Discussion'; - discussionId: 'UUID'; - id: 'UUID'; - type: 'DiscussionSubscriptionType'; - updatedAt: 'DateTime'; - userId: 'String'; - }; + createdAt: 'DateTime' + discussion: 'Discussion' + discussionId: 'UUID' + id: 'UUID' + type: 'DiscussionSubscriptionType' + updatedAt: 'DateTime' + userId: 'String' + } Event: { // field return type name commonId: 'ID' createdAt: 'DateTime' @@ -783,9 +805,9 @@ export interface NexusGenFieldTypeNames { updatedAt: 'DateTime' } Link: { // field return type name - title: 'String'; - url: 'String'; - }; + title: 'String' + url: 'String' + } Mutation: { // field return type name actOnReport: 'Report' assignRole: 'Void' @@ -808,21 +830,21 @@ export interface NexusGenFieldTypeNames { whitelistCommon: 'Boolean' } Notification: { // field return type name - common: 'Common'; - commonId: 'UUID'; - createdAt: 'DateTime'; - discussion: 'Discussion'; - discussionId: 'UUID'; - id: 'UUID'; - proposal: 'Proposal'; - proposalId: 'UUID'; - seenStatus: 'NotificationSeenStatus'; - show: 'Boolean'; - type: 'NotificationType'; - updatedAt: 'DateTime'; - user: 'User'; - userId: 'UUID'; - }; + common: 'Common' + commonId: 'UUID' + createdAt: 'DateTime' + discussion: 'Discussion' + discussionId: 'UUID' + id: 'UUID' + proposal: 'Proposal' + proposalId: 'UUID' + seenStatus: 'NotificationSeenStatus' + show: 'Boolean' + type: 'NotificationType' + updatedAt: 'DateTime' + user: 'User' + userId: 'UUID' + } Proposal: { // field return type name common: 'Common' commonId: 'UUID' @@ -850,6 +872,7 @@ export interface NexusGenFieldTypeNames { common: 'Common' commons: 'Common' discussion: 'Discussion' + discussions: 'Discussion' events: 'Event' generateUserAuthToken: 'String' getStatistics: 'Statistic' @@ -890,10 +913,10 @@ export interface NexusGenFieldTypeNames { users: 'Int' } Subscription: { // field return type name - discussionMessageCreated: 'DiscussionMessage'; - notificationCreated: 'Notification'; - onProposalChange: 'Proposal'; - }; + discussionMessageCreated: 'DiscussionMessage' + notificationCreated: 'Notification' + onProposalChange: 'Proposal' + } User: { // field return type name createdAt: 'DateTime' discussionSubscriptions: 'DiscussionSubscription' @@ -911,25 +934,25 @@ export interface NexusGenFieldTypeNames { updatedAt: 'DateTime' } UserNotificationToken: { // field return type name - createdAt: 'DateTime'; - description: 'String'; - id: 'UUID'; - lastUsed: 'DateTime'; - lastVerified: 'DateTime'; - state: 'UserNotificationTokenState'; - token: 'String'; - updatedAt: 'DateTime'; - }; + createdAt: 'DateTime' + description: 'String' + id: 'UUID' + lastUsed: 'DateTime' + lastVerified: 'DateTime' + state: 'UserNotificationTokenState' + token: 'String' + updatedAt: 'DateTime' + } Vote: { // field return type name - createdAt: 'DateTime'; - id: 'ID'; - updatedAt: 'DateTime'; - }; + createdAt: 'DateTime' + id: 'ID' + updatedAt: 'DateTime' + } BaseEntity: { // field return type name - createdAt: 'DateTime'; - id: 'UUID'; - updatedAt: 'DateTime'; - }; + createdAt: 'DateTime' + id: 'UUID' + updatedAt: 'DateTime' + } } export interface NexusGenArgTypes { @@ -937,17 +960,17 @@ export interface NexusGenArgTypes { discussions: { // args skip?: number | null; // Int take?: number | null; // Int - }; + } events: { // args orderBy?: NexusGenInputs['EventOrderByInput'] | null; // EventOrderByInput skip?: number | null; // Int take: number | null; // Int - }; + } members: { // args orderBy?: NexusGenInputs['CommonMemberOrderByInput'] | null; // CommonMemberOrderByInput skip?: number | null; // Int take?: number | null; // Int - }; + } proposals: { // args paginate?: NexusGenInputs['PaginateInput'] | null; // PaginateInput where?: NexusGenInputs['ProposalWhereInput'] | null; // ProposalWhereInput @@ -961,15 +984,15 @@ export interface NexusGenArgTypes { skip?: number | null; // Int take: number | null; // Int where?: NexusGenInputs['ProposalWhereInput'] | null; // ProposalWhereInput - }; - }; + } + } Discussion: { messages: { // args orderBy: NexusGenInputs['DiscussionMessagesOrderByInput'] | null; // DiscussionMessagesOrderByInput skip?: number | null; // Int take: number | null; // Int - }; - }; + } + } Mutation: { actOnReport: { // args input: NexusGenInputs['ActOnReportInput']; // ActOnReportInput! @@ -981,22 +1004,22 @@ export interface NexusGenArgTypes { changeDiscussionSubscriptionType: { // args id: string; // ID! type: NexusGenEnums['DiscussionSubscriptionType']; // DiscussionSubscriptionType! - }; + } createCard: { // args input: NexusGenInputs['CreateCardInput']; // CreateCardInput! - }; + } createCommon: { // args input: NexusGenInputs['CreateCommonInput']; // CreateCommonInput! - }; + } createDiscussion: { // args input: NexusGenInputs['CreateDiscussionInput']; // CreateDiscussionInput! - }; + } createDiscussionMessage: { // args input: NexusGenInputs['CreateDiscussionMessageInput']; // CreateDiscussionMessageInput! - }; + } createFundingProposal: { // args input: NexusGenInputs['CreateFundingProposalInput']; // CreateFundingProposalInput! - }; + } createJoinProposal: { // args input: NexusGenInputs['CreateJoinProposalInput']; // CreateJoinProposalInput! } @@ -1005,16 +1028,19 @@ export interface NexusGenArgTypes { } createUser: { // args input: NexusGenInputs['CreateUserInput']; // CreateUserInput! - }; + } createUserNotificationToken: { // args input: NexusGenInputs['CreateUserNotificationTokenInput']; // CreateUserNotificationTokenInput! - }; + } createVote: { // args input: NexusGenInputs['CreateVoteInput']; // CreateVoteInput! - }; + } + delistCommon: { // args + commonId: string; // String! + } finalizeProposal: { // args proposalId: string; // ID! - }; + } reportDiscussionMessage: { // args input: NexusGenInputs['ReportDiscussionMessageInput']; // ReportDiscussionMessageInput! } @@ -1033,8 +1059,8 @@ export interface NexusGenArgTypes { discussions: { // args skip?: number | null; // Int take?: number | null; // Int - }; - }; + } + } Query: { common: { // args where: NexusGenInputs['CommonWhereUniqueInput']; // CommonWhereUniqueInput! @@ -1045,6 +1071,10 @@ export interface NexusGenArgTypes { discussion: { // args id: string; // ID! } + discussions: { // args + paginate?: NexusGenInputs['PaginateInput'] | null; // PaginateInput + where?: NexusGenInputs['DiscussionWhereInput'] | null; // DiscussionWhereInput + } events: { // args paginate?: NexusGenInputs['PaginateInput'] | null; // PaginateInput } @@ -1066,39 +1096,39 @@ export interface NexusGenArgTypes { } user: { // args userId?: string | null; // ID - }; - }; + } + } Subscription: { discussionMessageCreated: { // args discussionId: string; // ID! - }; + } onProposalChange: { // args proposalId: string; // ID! - }; - }; + } + } User: { discussionSubscriptions: { // args orderBy?: NexusGenInputs['DiscussionSubscriptionOrderByInput'] | null; // DiscussionSubscriptionOrderByInput skip?: number | null; // Int take: number | null; // Int - }; + } events: { // args orderBy?: NexusGenInputs['EventOrderByInput'] | null; // EventOrderByInput skip?: number | null; // Int take: number | null; // Int - }; + } notifications: { // args cursor?: NexusGenInputs['NotificationWhereUniqueInput'] | null; // NotificationWhereUniqueInput orderBy: NexusGenInputs['NotificationOrderByInput'] | null; // NotificationOrderByInput skip?: number | null; // Int take: number | null; // Int - }; + } proposals: { // args skip?: number | null; // Int take: number | null; // Int where?: NexusGenInputs['ProposalWhereInput'] | null; // ProposalWhereInput - }; - }; + } + } } export interface NexusGenAbstractTypeMembers { @@ -1137,10 +1167,10 @@ export type NexusGenAbstractsUsingStrategyResolveType = "BaseEntity"; export type NexusGenFeaturesConfig = { abstractTypeStrategies: { - isTypeOf: false; - resolveType: true; - __typename: false; - }; + isTypeOf: false + resolveType: true + __typename: false + } } export interface NexusGenTypes { @@ -1161,7 +1191,7 @@ export interface NexusGenTypes { unionNames: NexusGenUnionNames; allInputTypes: NexusGenTypes['inputNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['scalarNames']; allOutputTypes: NexusGenTypes['objectNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['unionNames'] | NexusGenTypes['interfaceNames'] | NexusGenTypes['scalarNames']; - allNamedTypes: NexusGenTypes['allInputTypes'] | NexusGenTypes['allOutputTypes']; + allNamedTypes: NexusGenTypes['allInputTypes'] | NexusGenTypes['allOutputTypes'] abstractTypes: NexusGenTypes['interfaceNames'] | NexusGenTypes['unionNames']; abstractTypeMembers: NexusGenAbstractTypeMembers; objectsUsingAbstractStrategyIsTypeOf: NexusGenObjectsUsingAbstractStrategyIsTypeOf; @@ -1179,7 +1209,7 @@ declare global { * or a function that returns a number to specify the * complexity for this field. */ - complexity?: QueryComplexity; + complexity?: QueryComplexity /** * Authorization for an individual field. Returning "true" * or "Promise" means the field can be accessed. @@ -1188,7 +1218,7 @@ declare global { * Returning or throwing an error will also prevent the * resolver from executing. */ - authorize?: FieldAuthorizeResolver; + authorize?: FieldAuthorizeResolver } interface NexusGenPluginInputFieldConfig { } diff --git a/packages/graphql/src/generated/schema.graphql b/packages/graphql/src/generated/schema.graphql index 4d107ac9e..765d60b1e 100644 --- a/packages/graphql/src/generated/schema.graphql +++ b/packages/graphql/src/generated/schema.graphql @@ -64,6 +64,7 @@ type Common { """The main identifier of the item""" id: ID! image: String! + links: JSON members(orderBy: CommonMemberOrderByInput, skip: Int, take: Int): [CommonMember]! """The name of the common as provided""" @@ -73,6 +74,7 @@ type Common { """The total amount of money that the common has raised. In cents""" raised: Int! reports(where: ReportWhereInput = {status: {in: [Active]}}): [Report!]! + rules: JSON """The date, at which the item was last modified""" updatedAt: DateTime! @@ -81,6 +83,11 @@ type Common { whitelisted: Boolean! } +input CommonLinkInput { + title: String! + url: String! +} + type CommonMember implements BaseEntity { common: Common commonId: ID! @@ -131,7 +138,9 @@ input CreateCommonInput { fundingMinimumAmount: Int! fundingType: FundingType! image: String! + links: [CommonLinkInput!] name: String! + rules: [CommonLinkInput!] } input CreateDiscussionInput { @@ -220,12 +229,16 @@ type Discussion implements BaseEntity { latestMessage: DateTime! messages(orderBy: DiscussionMessagesOrderByInput = {createdAt: asc}, skip: Int = 0, take: Int = 10): [DiscussionMessage!]! + """The discussion creator""" + owner: User + """What this discussion is about""" topic: String! type: DiscussionType! """The date, at which the item was last modified""" updatedAt: DateTime! + userId: String! } type DiscussionMessage implements BaseEntity { @@ -289,6 +302,12 @@ enum DiscussionType { ProposalDiscussion } +input DiscussionWhereInput { + commonId: UUID + commonMemberId: UUID + userId: ID +} + type Event { """The ID of the common, for whom the event was created""" commonId: ID @@ -622,6 +641,7 @@ type Query { common(where: CommonWhereUniqueInput!): Common commons(paginate: PaginateInput): [Common] discussion(id: ID!): Discussion + discussions(paginate: PaginateInput, where: DiscussionWhereInput): [Discussion] events(paginate: PaginateInput): [Event] generateUserAuthToken(authId: String!): String! getStatistics(where: StatisticsWhereInput): [Statistic] diff --git a/packages/graphql/src/schema/Types/Commons/Inputs/CommonLink.input.ts b/packages/graphql/src/schema/Types/Commons/Inputs/CommonLink.input.ts new file mode 100644 index 000000000..f41b7739e --- /dev/null +++ b/packages/graphql/src/schema/Types/Commons/Inputs/CommonLink.input.ts @@ -0,0 +1,9 @@ +import { inputObjectType } from 'nexus'; + +export const CommonLinkInput = inputObjectType({ + name: 'CommonLinkInput', + definition(t) { + t.nonNull.string('title'); + t.nonNull.string('url'); + } +}); \ No newline at end of file diff --git a/packages/graphql/src/schema/Types/Commons/Mutations/CreateCommon.mutation.ts b/packages/graphql/src/schema/Types/Commons/Mutations/CreateCommon.mutation.ts index cbe0a4152..dd5721aa5 100644 --- a/packages/graphql/src/schema/Types/Commons/Mutations/CreateCommon.mutation.ts +++ b/packages/graphql/src/schema/Types/Commons/Mutations/CreateCommon.mutation.ts @@ -18,6 +18,12 @@ export const CreateCommonInput = inputObjectType({ t.string('action'); t.string('byline'); t.string('description'); + t.list.nonNull.field('links', { + type: 'CommonLinkInput' + }); + t.list.nonNull.field('rules', { + type: 'CommonLinkInput' + }); } }); diff --git a/packages/graphql/src/schema/Types/Commons/Types/Common.type.ts b/packages/graphql/src/schema/Types/Commons/Types/Common.type.ts index b092ddb6b..e2c13e456 100644 --- a/packages/graphql/src/schema/Types/Commons/Types/Common.type.ts +++ b/packages/graphql/src/schema/Types/Commons/Types/Common.type.ts @@ -31,6 +31,9 @@ export const CommonType = objectType({ description: 'The total amount of money that the common has raised. In cents' }); + t.json('links'); + t.json('rules'); + t.nonNull.string('image'); t.string('description'); t.string('action'); diff --git a/packages/graphql/src/schema/Types/Commons/index.ts b/packages/graphql/src/schema/Types/Commons/index.ts index 0fe56d151..cae50f490 100644 --- a/packages/graphql/src/schema/Types/Commons/index.ts +++ b/packages/graphql/src/schema/Types/Commons/index.ts @@ -16,6 +16,8 @@ import { CommonActiveProposalsExtension } from './Extensions/CommonActiveProposa import { CommonType } from './Types/Common.type'; import { CommonWhereUniqueInput } from './Inputs/CommonWhereUnique.input'; +import { CommonLinkInput } from './Inputs/CommonLink.input'; + export const CommonTypes = [ CommonType, @@ -31,6 +33,7 @@ export const CommonTypes = [ WhitelistCommonMutation, CommonWhereUniqueInput, + CommonLinkInput, CommonEventsExtension, CommonReportsExtension, diff --git a/packages/graphql/src/schema/Types/Discussion/Extensions/DiscussionOwner.extension.ts b/packages/graphql/src/schema/Types/Discussion/Extensions/DiscussionOwner.extension.ts new file mode 100644 index 000000000..2f1cc7c4e --- /dev/null +++ b/packages/graphql/src/schema/Types/Discussion/Extensions/DiscussionOwner.extension.ts @@ -0,0 +1,21 @@ +import { prisma } from '@common/core'; +import { extendType } from 'nexus'; + + +export const DiscussionOwnerExtension = extendType({ + type: 'Discussion', + definition(t) { + t.field('owner', { + type: 'User', + complexity: 10, + description: 'The discussion creator', + resolve: async (root, args) => { + return await prisma.user.findUnique({ + where: { + id: root.userId + } + }); + } + }); + } +}); \ No newline at end of file diff --git a/packages/graphql/src/schema/Types/Discussion/Inputs/DiscussionWhere.input.ts b/packages/graphql/src/schema/Types/Discussion/Inputs/DiscussionWhere.input.ts new file mode 100644 index 000000000..176dcb4c8 --- /dev/null +++ b/packages/graphql/src/schema/Types/Discussion/Inputs/DiscussionWhere.input.ts @@ -0,0 +1,10 @@ +import { inputObjectType } from 'nexus'; + +export const DiscussionWhereInput = inputObjectType({ + name: 'DiscussionWhereInput', + definition(t) { + t.uuid('commonId'); + t.uuid('commonMemberId'); + t.id('userId'); + } +}); \ No newline at end of file diff --git a/packages/graphql/src/schema/Types/Discussion/Queries/GetDiscussions.query.ts b/packages/graphql/src/schema/Types/Discussion/Queries/GetDiscussions.query.ts new file mode 100644 index 000000000..71daef9e6 --- /dev/null +++ b/packages/graphql/src/schema/Types/Discussion/Queries/GetDiscussions.query.ts @@ -0,0 +1,20 @@ +import { prisma } from '@common/core'; +import { arg, list, queryField } from 'nexus'; + +export const GetDiscussionsQuery = queryField('discussions', { + type: list('Discussion'), + args: { + where: arg({ + type: 'DiscussionWhereInput' + }), + paginate: arg({ + type: 'PaginateInput' + }) + }, + resolve: (root, args) => { + return prisma.discussion.findMany({ + where: args.where as any, + ...args.paginate + }); + } + }); \ No newline at end of file diff --git a/packages/graphql/src/schema/Types/Discussion/Types/Discussion.type.ts b/packages/graphql/src/schema/Types/Discussion/Types/Discussion.type.ts index a3684e42f..510313126 100644 --- a/packages/graphql/src/schema/Types/Discussion/Types/Discussion.type.ts +++ b/packages/graphql/src/schema/Types/Discussion/Types/Discussion.type.ts @@ -20,5 +20,13 @@ export const DiscussionType = objectType({ t.nonNull.field('type', { type: 'DiscussionType' }); + + t.nonNull.string('userId'); + + t.nonNull.field('owner', { + type: 'User' + }); + + } }); \ No newline at end of file diff --git a/packages/graphql/src/schema/Types/Discussion/index.ts b/packages/graphql/src/schema/Types/Discussion/index.ts index 6b566a135..956df6532 100644 --- a/packages/graphql/src/schema/Types/Discussion/index.ts +++ b/packages/graphql/src/schema/Types/Discussion/index.ts @@ -8,13 +8,16 @@ import { DiscussionMessageFlagEnum } from './Enums/DiscussionMessageFlag.enum'; import { DiscussionSubscriptionTypeEnum } from './Enums/DiscussionSubscriptionType.enum'; import { GetDiscussionQuery } from './Queries/GetDiscussion.query'; +import { GetDiscussionsQuery } from './Queries/GetDiscussions.query'; import { DiscussionMessagesOrderByInput } from './Inputs/DiscussionMessagesOrderBy.input'; import { DiscussionSubscriptionOrderByInput } from './Inputs/DiscussionSubscriptionOrderBy.input'; +import { DiscussionWhereInput } from './Inputs/DiscussionWhere.input'; import { DiscussionMessagesExtension } from './Extensions/DiscussionMessages.extension'; import { DiscussionMessageReportsExtension } from './Extensions/DiscussionMessageReports.extension'; import { DiscussionSubscriptionDiscussionExtension } from './Extensions/DiscussionSubscriptionDiscussion.extension'; +import { DiscussionOwnerExtension } from './Extensions/DiscussionOwner.extension'; import { DiscussionMessageCreatedSubscription } from './Subscriptions/DiscussionMessageCreated.subscription'; @@ -38,13 +41,16 @@ export const DiscussionTypes = [ DiscussionSubscriptionTypeEnum, GetDiscussionQuery, + GetDiscussionsQuery, DiscussionMessagesOrderByInput, DiscussionSubscriptionOrderByInput, + DiscussionWhereInput, DiscussionMessagesExtension, DiscussionMessageReportsExtension, DiscussionSubscriptionDiscussionExtension, + DiscussionOwnerExtension, CreateDiscussionInput, CreateDiscussionMutation, diff --git a/packages/graphql/src/schema/Types/Proposals/index.ts b/packages/graphql/src/schema/Types/Proposals/index.ts index 4d36cef12..d22978b8d 100644 --- a/packages/graphql/src/schema/Types/Proposals/index.ts +++ b/packages/graphql/src/schema/Types/Proposals/index.ts @@ -27,7 +27,6 @@ import { ProposalCommonExtension } from './Extensions/ProposalCommon.extension'; import { ProposalJoinExtension } from './Extensions/ProposalJoin.extension'; import { ProposalChangeSubscription } from './Subscriptions/ProposalChange.subscription'; -import { GetProposalsQuery } from './Queries/GetProposals.query'; export const ProposalTypes = [ ProposalType, diff --git a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx index 70825e757..fe2f80ae3 100644 --- a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx +++ b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx @@ -6,7 +6,7 @@ import "./index.scss"; interface DiscussionDetailModalProps { disscussion: Discussion | null; - common: Common; + common: any; } export default function DiscussionDetailModal({ disscussion, common }: DiscussionDetailModalProps) { diff --git a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx index 001fd2287..9af11485b 100644 --- a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx @@ -27,6 +27,8 @@ import { selectIsDiscussionsLoaded, selectCurrentDisscussion, } from "../../store/selectors"; +import { useGetCommonProposals, useGetCommonDiscussions, useGetCommonById } from '../../../../graphql'; + import "./index.scss"; interface CommonDetailRouterParams { id: string; @@ -55,13 +57,32 @@ export default function CommonDetail() { const { id } = useParams(); const [tab, setTab] = useState("about"); const loading = useSelector(getLoading()); - const common = useSelector(selectCommonDetail()); + // const common = useSelector(selectCommonDetail()); const currentDisscussion = useSelector(selectCurrentDisscussion()); const proposals = useSelector(selectProposals()); - const discussions = useSelector(selectDiscussions()); const isDiscussionsLoaded = useSelector(selectIsDiscussionsLoaded()); - console.log('proposals',proposals); + const {data} = useGetCommonProposals({variables: { + where: { + commonId: id + }, + }}); + + const {data: discussionsData} = useGetCommonDiscussions({variables: { + where: { + commonId: id + }, + }}) + + const {data: commonData, error} = useGetCommonById({variables: { + where: { + id, + }, + }}) + + const common = commonData?.common; + console.log('proposals',data, discussionsData?.discussions, commonData); + console.log('error',error) const dispatch = useDispatch(); const { isShowing, onOpen, onClose } = useModal(false); @@ -82,10 +103,10 @@ export default function CommonDetail() { ); const latestDiscussions = useMemo( () => - [...discussions].splice(0, 5).map((d) => { + [...(discussionsData?.discussions || [])].splice(0, 5).map((d) => { return { id: d.id, value: d.title }; }), - [discussions], + [discussionsData?.discussions], ); const changeTabHandler = useCallback( @@ -118,6 +139,8 @@ export default function CommonDetail() { dispatch(clearCurrentDiscussion()); }, [onClose, dispatch]); + console.log('common',common) + return loading && !common ? ( ) : ( @@ -183,7 +206,7 @@ export default function CommonDetail() { {tab === "about" && } {tab === "discussions" && (isDiscussionsLoaded ? ( - + ) : ( ))} diff --git a/packages/web/src/graphql/index.ts b/packages/web/src/graphql/index.ts index fdae737d8..1abbb67f7 100644 --- a/packages/web/src/graphql/index.ts +++ b/packages/web/src/graphql/index.ts @@ -11,6 +11,72 @@ export type Scalars = { Date: any; }; + export enum DiscussionMessageType { + Message = 'Message' + } + + export enum DiscussionMessageFlag { + Clear = 'Clear', + Reported = 'Reported', + Hidden = 'Hidden' + } + + export type BaseEntity = { + id: Scalars['ID']; + createdAt: Scalars['Date']; + updatedAt: Scalars['Date']; + } + + export enum DiscussionType { + ProposalDiscussion = 'ProposalDiscussion', + CommonDiscussion = 'CommonDiscussion' + }; + + export type DiscussionMessage = BaseEntity & { + id: Scalars['ID']; + message: Scalars['String']; + type: DiscussionMessageType; + flag: DiscussionMessageFlag; + reports: Array; + } + + export enum ReportFor { + Nudity = 'Nudity', + Violance = 'Violance', + Harassment = 'Harassment', + FalseNews = 'FalseNews', + Spam = 'Spam', + Hate ='Hate', + Other = 'Other' + } + + enum ReportStatus { + Active = 'Active', + Clossed = 'Clossed' + } + + export type Report = BaseEntity & { + status: ReportStatus; + for: ReportFor; + note: Scalars['String']; + reviewedOn: Scalars['Date']; + reporterId:Scalars['ID']; + reporter: User; + messageId: Scalars['ID']; + } + + export type Discussion = BaseEntity & { + __typename?: 'Discussion'; + id: Scalars['ID']; + createTime: Scalars['Date']; + updatedAt: Scalars['Date']; + messages: Array; + title: Scalars['String']; + description: Scalars['String']; + userId: Scalars['ID']; + owner: User + } + export enum ProposalType { FundingRequest = 'fundingRequest', Join = 'join' @@ -223,6 +289,56 @@ query getCommonsHomescreenData { } `; +export const GetCommonProposals = gql` +query getCommonProposals($where: ProposalWhereInput, $paginate: PaginateInput! = { take: 10, skip: 0}) { + proposals(where: $where, paginate: $paginate) { + id + state + } +} +`; + +export type DiscussionWhereInput = { + commonId: Scalars['ID']; +}; + +export type GetCommonDiscussionsQueryVariables = Exact<{ + where: DiscussionWhereInput; +}>; + +export const GetCommonDiscussions = gql` +query getCommonDiscussions($where: DiscussionWhereInput, $paginate: PaginateInput! = { take: 10, skip: 0} ) { + discussions(where: $where, paginate: $paginate) { + id + createTime: createdAt + messages { + message + } + title: topic + description + userId + owner { + firstName + lastName + displayName + photo + } + } +} +` +export type GetCommonDiscussionsQuery = ( + { discussions?: Maybe> } +); + +export function useGetCommonDiscussions(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetCommonDiscussions, baseOptions); +} + + +export type GetCommonProposalsQuery = ( + { proposals?: Maybe> } +); + export const GetUserPermissionsDocument = gql` query getUserPermissions($userId: ID!) { user(id: $userId) { @@ -231,6 +347,44 @@ export const GetUserPermissionsDocument = gql` } `; + export type GetCommonByIdQuery = ( + { common?: Maybe } + ); + + export type CommonWhereUniqueInput = { + id: Scalars['ID']; + }; + + export type GetCommonByIdQueryVariables = Exact<{ + where: CommonWhereUniqueInput; + }>; + + +export const GetCommonById = gql` +query getCommon($where: CommonWhereUniqueInput!) { + common(where: $where) { + id + description + links + image + name + byline + balance + fundingMinimumAmount + fundingType + raised + members { + id + user { + firstName + lastName + displayName + } + } + } +} +` + export type GetUserPermissionsQuery = ( { __typename?: 'Query' } & { user?: Maybe<( @@ -247,6 +401,32 @@ export const GetUserPermissionsDocument = gql` userId: Scalars['ID']; }>; + export type Pagination = { + skip: Scalars['Int'], + take: Scalars['Int'] + } + + export type GetCommonProposalsQueryVariables = Exact<{ + where: { + type?: ProposalType, + state?: ProposalState, + commonId?: Scalars['ID'], + commonMemberId?: Scalars['ID'], + userId?: Scalars['ID'], + }, + paginate?: Pagination + }>; + + + export function useGetUserPermissionsQuery(baseOptions: Apollo.QueryHookOptions) { return Apollo.useQuery(GetUserPermissionsDocument, baseOptions); + } + + export function useGetCommonProposals(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetCommonProposals, baseOptions); + } + + export function useGetCommonById(baseOptions: Apollo.QueryHookOptions) { + return Apollo.useQuery(GetCommonById, baseOptions); } \ No newline at end of file From 7ac4654638e8306539e64297b1dc2e0d0addac17 Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Thu, 13 May 2021 15:06:34 +0300 Subject: [PATCH 3/5] Migrate to Graphql from firebase. Refactoring code --- .../graphql/src/generated/nexus-typegen.ts | 5 + packages/graphql/src/generated/schema.graphql | 2 + .../DiscussionMessagesOwner.extension.ts | 18 + .../Types/DiscussionMessage.type.ts | 2 + .../src/schema/Types/Discussion/index.ts | 2 + packages/web/.eslintrc.js | 45 +- packages/web/package.json | 1 + packages/web/src/containers/App/App.test.jsx | 11 +- packages/web/src/containers/App/App.tsx | 13 +- .../AuthContainer/AuthContainer.tsx | 31 +- .../web/src/containers/Auth/store/saga.tsx | 4 +- .../AboutTabComponent/AboutTabComponent.tsx | 8 +- .../DiscussionDetailModal.tsx | 32 +- .../DiscussionsComponent.tsx | 20 +- .../PreviewInformationList.tsx | 10 +- .../CommonListItem/CommonListItem.tsx | 4 +- .../CommonDetailContainer.tsx | 288 ++- .../CommonListContainer.tsx | 32 +- .../Common/interfaces/CommonsStateType.tsx | 2 +- .../src/containers/Common/store/actions.tsx | 38 - .../web/src/containers/Common/store/api.tsx | 89 - .../src/containers/Common/store/constants.tsx | 27 - .../web/src/containers/Common/store/index.tsx | 9 - .../src/containers/Common/store/reducer.tsx | 77 - .../web/src/containers/Common/store/saga.tsx | 108 - .../src/containers/Common/store/selectors.tsx | 12 - packages/web/src/context/AuthContext.tsx | 19 +- .../web/src/context/PermissionsContext.tsx | 35 +- packages/web/src/context/UserContext.tsx | 55 + packages/web/src/context/index.ts | 4 +- packages/web/src/graphql/index.ts | 862 ++++--- packages/web/src/graphql/indexx.ts | 2154 ----------------- packages/web/src/index.tsx | 26 +- .../src/providers/AuthenticationProvider.tsx | 51 + packages/web/src/shared/utils/shared.tsx | 8 +- packages/web/src/store/index.tsx | 1 - packages/web/src/store/reducer.tsx | 21 - packages/web/src/store/saga.tsx | 10 - packages/web/src/store/store.tsx | 66 - 39 files changed, 922 insertions(+), 3280 deletions(-) create mode 100644 packages/graphql/src/schema/Types/Discussion/Extensions/DiscussionMessagesOwner.extension.ts delete mode 100644 packages/web/src/containers/Common/store/actions.tsx delete mode 100644 packages/web/src/containers/Common/store/api.tsx delete mode 100644 packages/web/src/containers/Common/store/constants.tsx delete mode 100644 packages/web/src/containers/Common/store/index.tsx delete mode 100644 packages/web/src/containers/Common/store/reducer.tsx delete mode 100644 packages/web/src/containers/Common/store/saga.tsx delete mode 100644 packages/web/src/containers/Common/store/selectors.tsx create mode 100644 packages/web/src/context/UserContext.tsx delete mode 100644 packages/web/src/graphql/indexx.ts create mode 100644 packages/web/src/providers/AuthenticationProvider.tsx delete mode 100644 packages/web/src/store/index.tsx delete mode 100755 packages/web/src/store/reducer.tsx delete mode 100755 packages/web/src/store/saga.tsx delete mode 100755 packages/web/src/store/store.tsx diff --git a/packages/graphql/src/generated/nexus-typegen.ts b/packages/graphql/src/generated/nexus-typegen.ts index 12bb5e6f0..dbebddea6 100644 --- a/packages/graphql/src/generated/nexus-typegen.ts +++ b/packages/graphql/src/generated/nexus-typegen.ts @@ -322,6 +322,7 @@ export interface NexusGenObjects { message: string; // String! type: NexusGenEnums['DiscussionMessageType']; // DiscussionMessageType! updatedAt: NexusGenScalars['DateTime']; // DateTime! + userId: string; // String! } DiscussionSubscription: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -518,9 +519,11 @@ export interface NexusGenFieldTypes { flag: NexusGenEnums['DiscussionMessageFlag']; // DiscussionMessageFlag! id: NexusGenScalars['UUID']; // UUID! message: string; // String! + owner: NexusGenRootTypes['User']; // User! reports: NexusGenRootTypes['Report'][]; // [Report!]! type: NexusGenEnums['DiscussionMessageType']; // DiscussionMessageType! updatedAt: NexusGenScalars['DateTime']; // DateTime! + userId: string; // String! } DiscussionSubscription: { // field return type createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -766,9 +769,11 @@ export interface NexusGenFieldTypeNames { flag: 'DiscussionMessageFlag' id: 'UUID' message: 'String' + owner: 'User' reports: 'Report' type: 'DiscussionMessageType' updatedAt: 'DateTime' + userId: 'String' } DiscussionSubscription: { // field return type name createdAt: 'DateTime' diff --git a/packages/graphql/src/generated/schema.graphql b/packages/graphql/src/generated/schema.graphql index 765d60b1e..533290de2 100644 --- a/packages/graphql/src/generated/schema.graphql +++ b/packages/graphql/src/generated/schema.graphql @@ -249,11 +249,13 @@ type DiscussionMessage implements BaseEntity { """The main identifier of the item""" id: UUID! message: String! + owner: User! reports: [Report!]! type: DiscussionMessageType! """The date, at which the item was last modified""" updatedAt: DateTime! + userId: String! } enum DiscussionMessageFlag { diff --git a/packages/graphql/src/schema/Types/Discussion/Extensions/DiscussionMessagesOwner.extension.ts b/packages/graphql/src/schema/Types/Discussion/Extensions/DiscussionMessagesOwner.extension.ts new file mode 100644 index 000000000..7dfb54db8 --- /dev/null +++ b/packages/graphql/src/schema/Types/Discussion/Extensions/DiscussionMessagesOwner.extension.ts @@ -0,0 +1,18 @@ +import { extendType } from 'nexus'; +import { prisma } from '@common/core'; + +export const DiscussionMessageOwnerExtension = extendType({ + type: 'DiscussionMessage', + definition(t) { + t.nonNull.field('owner', { + type: 'User', + resolve: (root) => { + return prisma.user.findUnique({ + where: { + id: root.userId + } + }); + } + }); + } +}); \ No newline at end of file diff --git a/packages/graphql/src/schema/Types/Discussion/Types/DiscussionMessage.type.ts b/packages/graphql/src/schema/Types/Discussion/Types/DiscussionMessage.type.ts index c2b3af56a..cf98698dd 100644 --- a/packages/graphql/src/schema/Types/Discussion/Types/DiscussionMessage.type.ts +++ b/packages/graphql/src/schema/Types/Discussion/Types/DiscussionMessage.type.ts @@ -14,5 +14,7 @@ export const DiscussionMessageType = objectType({ t.nonNull.field('flag', { type: 'DiscussionMessageFlag' }); + + t.nonNull.string('userId'); } }); \ No newline at end of file diff --git a/packages/graphql/src/schema/Types/Discussion/index.ts b/packages/graphql/src/schema/Types/Discussion/index.ts index 956df6532..96a38ac18 100644 --- a/packages/graphql/src/schema/Types/Discussion/index.ts +++ b/packages/graphql/src/schema/Types/Discussion/index.ts @@ -18,6 +18,7 @@ import { DiscussionMessagesExtension } from './Extensions/DiscussionMessages.ext import { DiscussionMessageReportsExtension } from './Extensions/DiscussionMessageReports.extension'; import { DiscussionSubscriptionDiscussionExtension } from './Extensions/DiscussionSubscriptionDiscussion.extension'; import { DiscussionOwnerExtension } from './Extensions/DiscussionOwner.extension'; +import { DiscussionMessageOwnerExtension } from './Extensions/DiscussionMessagesOwner.extension'; import { DiscussionMessageCreatedSubscription } from './Subscriptions/DiscussionMessageCreated.subscription'; @@ -51,6 +52,7 @@ export const DiscussionTypes = [ DiscussionMessageReportsExtension, DiscussionSubscriptionDiscussionExtension, DiscussionOwnerExtension, + DiscussionMessageOwnerExtension, CreateDiscussionInput, CreateDiscussionMutation, diff --git a/packages/web/.eslintrc.js b/packages/web/.eslintrc.js index fca1337b5..2c4150488 100644 --- a/packages/web/.eslintrc.js +++ b/packages/web/.eslintrc.js @@ -39,26 +39,29 @@ module.exports = { "import/namespace": 2, "import/default": 2, "import/export": 2, - // "import/order": [ - // "error", - // { - // groups: [ - // "builtin", // Built-in types are first - // "external", - // ["sibling", "parent"], // Then sibling and parent types. They can be mingled together - // "index", // Then the index file - // "object", - // // Then the rest: internal and external type - // ], - // "newlines-between": "always", - // }, - // ], - // }, - "import/order": 0, - } - settings: { - react: { - version: "latest", - }, + "eslint@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-explicit-any": 0, + "no-console": 1, + // "import/order": [ + // "error", + // { + // groups: [ + // "builtin", // Built-in types are first + // "external", + // ["sibling", "parent"], // Then sibling and parent types. They can be mingled together + // "index", // Then the index file + // "object", + // // Then the rest: internal and external type + // ], + // "newlines-between": "always", + // }, + // ], + // }, + "import/order": 0, }, + // settings: { + // react: { + // version: "latest", + // }, + // }, }; diff --git a/packages/web/package.json b/packages/web/package.json index 36c980e95..807bd84a3 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@apollo/client": "^3.3.15", + "@react-firebase/auth": "^0.2.10", "apollo-link-context": "^1.0.20", "axios": "^0.21.0", "connected-react-router": "^6.8.0", diff --git a/packages/web/src/containers/App/App.test.jsx b/packages/web/src/containers/App/App.test.jsx index d262d1c0f..fb29f383d 100644 --- a/packages/web/src/containers/App/App.test.jsx +++ b/packages/web/src/containers/App/App.test.jsx @@ -1,21 +1,16 @@ import React from "react"; import { mount } from "enzyme"; import { ConnectedRouter } from "connected-react-router"; -import { Provider } from "react-redux"; import App from "./App"; import history from "../../shared/history"; -import configureStore from "../../store/store"; -const { store } = configureStore(history); describe("", () => { it("Renders with out crashing", () => { const app = mount( - - - - - , + + + , ); expect(app.find(".App").length).toBe(1); }); diff --git a/packages/web/src/containers/App/App.tsx b/packages/web/src/containers/App/App.tsx index 367d964bb..5701185ff 100755 --- a/packages/web/src/containers/App/App.tsx +++ b/packages/web/src/containers/App/App.tsx @@ -1,16 +1,13 @@ import React from "react"; import { Route, Switch } from "react-router-dom"; -import { useSelector } from "react-redux"; - +import { Content, Dashboard, Footer, Header, NotFound } from "../../shared/components"; +import { ROUTE_PATHS } from "../../shared/constants"; import { AuthContainer } from "../Auth"; -import PrivateRoute from "./PrivateRoute"; -import { authentificated } from "../Auth/store/selectors"; -import { Content, NotFound, Footer, Header, Dashboard } from "../../shared/components"; import { CommonContainer } from "../Common"; -import { ROUTE_PATHS } from "../../shared/constants"; +import PrivateRoute from "./PrivateRoute"; + const App = () => { - const is_authorized = useSelector(authentificated()); return (
@@ -18,7 +15,7 @@ const App = () => { - + diff --git a/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx b/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx index 08e06d2b7..e5a26db46 100644 --- a/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx +++ b/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx @@ -1,34 +1,29 @@ /* eslint-disable import/order */ -import { push } from "connected-react-router"; -import React, { useEffect } from "react"; -import { useDispatch, useSelector } from "react-redux"; -import { SocialLoginButton } from "../../../../shared/components"; -import { socialLogin } from "../../store/actions"; -import { authentificated } from "../../store/selectors"; +import React from "react"; import { AuthWrapper } from "./styles"; const AuthContainer = () => { - const isAuthorized = useSelector(authentificated()); + // const isAuthorized = useSelector(authentificated()); - const dispatch = useDispatch(); + // const dispatch = useDispatch(); - useEffect(() => { - if (isAuthorized) { - dispatch(push("/")); - } - }, [isAuthorized, dispatch]); + // useEffect(() => { + // if (isAuthorized) { + // dispatch(push("/")); + // } + // }, [isAuthorized, dispatch]); - const socialLoginHandler = (provider: string) => { - dispatch(socialLogin.request(provider)); - }; + // const socialLoginHandler = (provider: string) => { + // dispatch(socialLogin.request(provider)); + // }; return (
- + {/* - + */}
diff --git a/packages/web/src/containers/Auth/store/saga.tsx b/packages/web/src/containers/Auth/store/saga.tsx index b66cd73a5..c9282f403 100755 --- a/packages/web/src/containers/Auth/store/saga.tsx +++ b/packages/web/src/containers/Auth/store/saga.tsx @@ -7,10 +7,11 @@ import * as actions from "./actions"; import firebase from "../../../shared/utils/firebase"; import { startLoading, stopLoading } from "../../../shared/store/actions"; -import store from "../../../index"; import { User } from "../../../shared/models"; import { GoogleAuthResultInterface } from "../interface"; + + function* socialLoginSaga({ payload }: AnyAction & { payload: string }) { try { yield put(startLoading()); @@ -27,7 +28,6 @@ function* socialLoginSaga({ payload }: AnyAction & { payload: string }) { tokenHandler.set(credentials.oauthAccessToken); tokenHandler.setUser(user); history.push("/"); - store.dispatch(actions.socialLogin.success()); } }); } catch (error) { diff --git a/packages/web/src/containers/Common/components/CommonDetailContainer/AboutTabComponent/AboutTabComponent.tsx b/packages/web/src/containers/Common/components/CommonDetailContainer/AboutTabComponent/AboutTabComponent.tsx index 24a036950..ee4323054 100644 --- a/packages/web/src/containers/Common/components/CommonDetailContainer/AboutTabComponent/AboutTabComponent.tsx +++ b/packages/web/src/containers/Common/components/CommonDetailContainer/AboutTabComponent/AboutTabComponent.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { Common } from "../../../../../shared/models"; import { formatPrice } from "../../../../../shared/utils"; +import { Common } from "../../../../../graphql"; import "./index.scss"; interface AboutTabComponentProps { @@ -10,12 +10,12 @@ interface AboutTabComponentProps { export default function AboutTabComponent({ common }: AboutTabComponentProps) { return (
-
{common.metadata.description}
+
{common.description}
{common?.links?.length > 0 && (
Links
{common.links.map((link) => ( - + {link.title} ))} @@ -27,7 +27,7 @@ export default function AboutTabComponent({ common }: AboutTabComponentProps) {
Minimum contribution for new members:
- {formatPrice(common.metadata.minFeeToJoin) + " " + common.metadata.contributionType + " contribution"} + {formatPrice(common.fundingMinimumAmount) + " " + common.fundingType + " contribution"}
Join the effort
diff --git a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx index fe2f80ae3..a6f035c95 100644 --- a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx +++ b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx @@ -1,17 +1,17 @@ import React from "react"; import { Loader } from "../../../../../shared/components"; -import { Common, Discussion } from "../../../../../shared/models"; +import { Common, Discussion } from "../../../../../graphql"; import { formatPrice, getDaysAgo, getUserInitials, getUserName } from "../../../../../shared/utils"; import "./index.scss"; interface DiscussionDetailModalProps { - disscussion: Discussion | null; - common: any; + discussion?: Discussion | null; + common: Common; } -export default function DiscussionDetailModal({ disscussion, common }: DiscussionDetailModalProps) { +export default function DiscussionDetailModal({ discussion, common }: DiscussionDetailModalProps) { const date = new Date(); - return !disscussion ? ( + return !discussion ? ( ) : (
@@ -25,13 +25,13 @@ export default function DiscussionDetailModal({ disscussion, common }: Discussio
- {getUserName(disscussion.owner)} + {getUserName(discussion.owner)}
-
{getUserName(disscussion.owner)}
-
{getDaysAgo(date, disscussion.createTime)}
+
{getUserName(discussion.owner)}
+
{getDaysAgo(date, discussion.createdAt)}
-
{disscussion.title}
+
{discussion.title}
Requested amount
{formatPrice(common.balance)}
@@ -39,18 +39,18 @@ export default function DiscussionDetailModal({ disscussion, common }: Discussio
-

{disscussion.message}

+

{discussion.description}

- {disscussion.discussionMessage?.map((m) => { - const mDate = new Date(m.createTime.seconds * 1000); + {discussion.messages?.map((m: any) => { + const mDate = new Date(m.createdAt); return ( -
+
- {disscussion.owner?.photoURL ? ( - {getUserName(m.owner)} + {discussion.owner?.photo ? ( + {getUserName(m.owner)} ) : (
{getUserName(m.owner)}
-
{m.text}
+
{m.message}
{mDate.toLocaleDateString() + "," + mDate.toLocaleTimeString()}
diff --git a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionsComponent/DiscussionsComponent.tsx b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionsComponent/DiscussionsComponent.tsx index 79b779c80..308c67ec8 100644 --- a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionsComponent/DiscussionsComponent.tsx +++ b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionsComponent/DiscussionsComponent.tsx @@ -1,41 +1,41 @@ import React from "react"; -import { Discussion } from "../../../../../shared/models"; +import { Discussion } from "../../../../../graphql"; import { getDaysAgo, getUserName } from "../../../../../shared/utils"; import "./index.scss"; interface DiscussionsComponentProps { discussions: Discussion[]; - loadDisscussionDetail: Function; + loadDiscussionDetail: (value: Discussion) => void; } -export default function DiscussionsComponent({ discussions, loadDisscussionDetail }: DiscussionsComponentProps) { +export default function DiscussionsComponent({ discussions, loadDiscussionDetail }: DiscussionsComponentProps) { const date = new Date(); return (
{discussions.map((d) => ( -
+
loadDiscussionDetail(d)}>
- {getUserName(d.owner)} + {getUserName(d.owner)}
{getUserName(d.owner)}
-
{getDaysAgo(date, d.createTime)}
+
{getDaysAgo(date, d.createdAt)}
{d.title}
-
{d.message}
+
{d.description}
{/*
Read More
*/}
discussions -
{d.discussionMessage?.length || 0}
+
{d.messages?.length || 0}
- {(d?.discussionMessage?.length || 0) > 0 && ( -
loadDisscussionDetail(d)}> + {(d?.messages?.length || 0) > 0 && ( +
loadDiscussionDetail(d)}> View discussions
)} diff --git a/packages/web/src/containers/Common/components/CommonDetailContainer/PreviewInformationList/PreviewInformationList.tsx b/packages/web/src/containers/Common/components/CommonDetailContainer/PreviewInformationList/PreviewInformationList.tsx index fb2d94ba5..511891495 100644 --- a/packages/web/src/containers/Common/components/CommonDetailContainer/PreviewInformationList/PreviewInformationList.tsx +++ b/packages/web/src/containers/Common/components/CommonDetailContainer/PreviewInformationList/PreviewInformationList.tsx @@ -1,23 +1,23 @@ import React from "react"; import "./index.scss"; -interface PreviedData { +interface PreviewData { id: string; value: string; } interface PreviewInformationListProps { title: string; - data: PreviedData[]; - vievAllHandler: () => void; + data: PreviewData[]; + viewAllHandler: () => void; } export default function PreviewInformationList(props: PreviewInformationListProps) { - const { title, data, vievAllHandler } = props; + const { title, data, viewAllHandler } = props; return (
{title}
-
+
View All
diff --git a/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx b/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx index 9145890c0..99fe6dd33 100644 --- a/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx +++ b/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Link } from "react-router-dom"; -import { Common } from '../../../../../graphql'; +import { Common } from "../../../../../graphql"; import { formatPrice } from "../../../../../shared/utils"; import "./index.scss"; @@ -16,7 +16,7 @@ export default function CommonListItem({ common }: CommonListItemInterface) { {common.name}
{common.name}
- {common.metadata?.description &&
{common.metadata?.description}
} +
{common?.description}
diff --git a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx index 9af11485b..7a9979e73 100644 --- a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx @@ -1,35 +1,25 @@ -import React, { useCallback, useEffect, useMemo, useState } from "react"; -import { useSelector, useDispatch } from "react-redux"; +import React, { useCallback, useMemo, useState } from "react"; import { useParams } from "react-router-dom"; +import { + Discussion, + GetDiscussionById, + useGetCommonById, + useGetCommonDiscussions, + useGetCommonProposals, +} from "../../../../graphql"; +import { useApollo } from "../../../../hooks/useApollo"; import { Loader } from "../../../../shared/components"; import { Modal } from "../../../../shared/components/Modal"; import { useModal } from "../../../../shared/hooks"; -import { Discussion } from "../../../../shared/models"; -import { getLoading } from "../../../../shared/store/selectors"; import { formatPrice } from "../../../../shared/utils"; import { AboutTabComponent, - PreviewInformationList, - DiscussionsComponent, DiscussionDetailModal, + DiscussionsComponent, + PreviewInformationList, } from "../../components/CommonDetailContainer"; -import { - clearCurrentDiscussion, - closeCurrentCommon, - getCommonDetail, - loadCommonDiscussionList, - loadDisscussionDetail, -} from "../../store/actions"; -import { - selectCommonDetail, - selectProposals, - selectDiscussions, - selectIsDiscussionsLoaded, - selectCurrentDisscussion, -} from "../../store/selectors"; -import { useGetCommonProposals, useGetCommonDiscussions, useGetCommonById } from '../../../../graphql'; - import "./index.scss"; + interface CommonDetailRouterParams { id: string; } @@ -56,177 +46,169 @@ const tabs = [ export default function CommonDetail() { const { id } = useParams(); const [tab, setTab] = useState("about"); - const loading = useSelector(getLoading()); - // const common = useSelector(selectCommonDetail()); - const currentDisscussion = useSelector(selectCurrentDisscussion()); - const proposals = useSelector(selectProposals()); - const isDiscussionsLoaded = useSelector(selectIsDiscussionsLoaded()); - - const {data} = useGetCommonProposals({variables: { - where: { - commonId: id + const apolloClient = useApollo("http://localhost:4000/graphql"); + const [currentDiscussion, setCurrentDiscussion] = useState(null); + + const { data: proposalsData } = useGetCommonProposals({ + variables: { + where: { + commonId: id, + }, }, - }}); + }); - const {data: discussionsData} = useGetCommonDiscussions({variables: { - where: { - commonId: id + const { data: discussionsData, loading: isDiscussionsLoaded } = useGetCommonDiscussions({ + variables: { + where: { + commonId: id, + }, }, - }}) + }); - const {data: commonData, error} = useGetCommonById({variables: { - where: { - id, + const { data: commonData, loading: isCommonLoading } = useGetCommonById({ + variables: { + where: { + id, + }, }, - }}) + }); const common = commonData?.common; - console.log('proposals',data, discussionsData?.discussions, commonData); - console.log('error',error) - const dispatch = useDispatch(); const { isShowing, onOpen, onClose } = useModal(false); - useEffect(() => { - dispatch(getCommonDetail.request(id)); - return () => { - dispatch(closeCurrentCommon()); - }; - }, [dispatch, id]); - - const lastestProposals = useMemo( + const latestProposals = useMemo( () => - [...proposals].splice(0, 5).map((p) => { - return { id: p.id, value: p.description.title }; + [...(proposalsData?.proposals || [])].splice(0, 5).map((p) => { + return { id: p.id, value: p.title }; }), - [proposals], + [proposalsData], ); + const latestDiscussions = useMemo( () => [...(discussionsData?.discussions || [])].splice(0, 5).map((d) => { return { id: d.id, value: d.title }; }), - [discussionsData?.discussions], + [discussionsData], ); - const changeTabHandler = useCallback( - (tab: string) => { - switch (tab) { - case "discussions": - if (!isDiscussionsLoaded) { - dispatch(loadCommonDiscussionList.request()); - } - break; - - default: - break; + const changeTabHandler = (tab: string) => setTab(tab); + + const getDiscussionDetail = useCallback( + async (payload: Discussion) => { + try { + const { data } = await apolloClient.query({ + query: GetDiscussionById, + variables: { + id: payload.id, + }, + }); + setCurrentDiscussion(data.discussion); + onOpen(); + } catch (error) { + onClose(); } - setTab(tab); }, - [dispatch, isDiscussionsLoaded], - ); - - const getDisscussionDetail = useCallback( - (payload: Discussion) => { - dispatch(loadDisscussionDetail.request(payload)); - onOpen(); - }, - [dispatch, onOpen], + [onOpen, apolloClient, onClose], ); const closeModalHandler = useCallback(() => { onClose(); - dispatch(clearCurrentDiscussion()); - }, [onClose, dispatch]); - - console.log('common',common) + setCurrentDiscussion(null); + }, [onClose]); - return loading && !common ? ( + return isCommonLoading && !common ? ( ) : ( - common && ( - <> - - - -
-
-
-
- {common?.name} -
-
-
-
{common?.name}
-
{common?.metadata.byline}
+ <> + {common && ( + <> + + + +
+
+
+
+ {common?.name}
-
-
-
{formatPrice(common?.balance)}
-
Available Funds
+
+
+
{common?.name}
+
{common?.byline}
-
-
{formatPrice(common?.raised)}
-
Total Raised
+
+
+
{formatPrice(common?.balance)}
+
Available Funds
+
+
+
{formatPrice(common?.raised)}
+
Total Raised
+
+
+
{common?.members.length}
+
Members
+
+
+
0
+
Active Proposals
+
-
-
{common?.members.length}
-
Members
+
+
+
+
+ {tabs.map((t) => ( +
changeTabHandler(t.key)} + > + {t.name} + {tab === t.key && } +
+ ))}
-
-
0
-
Active Proposals
+
+
-
-
-
- {tabs.map((t) => ( -
changeTabHandler(t.key)} - > - {t.name} - {tab === t.key && } -
- ))} +
+
+
{tab}
+
+
+ {tab === "about" && } + {tab === "discussions" && + (!isDiscussionsLoaded ? ( + + ) : ( + + ))}
-
- +
+ setTab("discussions")} + /> + setTab("proposals")} + />
-
-
{tab}
-
-
- {tab === "about" && } - {tab === "discussions" && - (isDiscussionsLoaded ? ( - - ) : ( - - ))} -
-
- setTab("discussions")} - /> - setTab("proposals")} - /> -
-
-
-
- - ) + + )} + ); } diff --git a/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx b/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx index 9fb39301a..9841261dc 100644 --- a/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx @@ -1,14 +1,10 @@ -import React, { useCallback, useEffect, useMemo, useRef } from "react"; +import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { useDispatch, useSelector } from "react-redux"; import { Loader } from "../../../../shared/components"; -import { getLoading } from "../../../../shared/store/selectors"; import { CommonListItem } from "../../components"; import { COMMON_PAGE_SIZE } from "../../constants"; -import { getCommonsList, updatePage } from "../../store/actions"; -import { useGetCommonDataQuery} from '../../../../graphql'; -import { selectCurrentPage, selectCommonList } from "../../store/selectors"; +import { useGetCommonDataQuery } from "../../../../graphql"; import "./index.scss"; @@ -18,10 +14,19 @@ const options = { threshold: 1.0, }; +const TAKE_AMOUNT = 10; // TODO: Change as needed + export default function CommonListContainer() { - const {loading, data} = useGetCommonDataQuery(); - const page = useSelector(selectCurrentPage()); - const dispatch = useDispatch(); + const [page, setPage] = useState(0); + const { loading, data } = useGetCommonDataQuery({ + variables: { + paginate: { + take: TAKE_AMOUNT, + skip: 0 + page * TAKE_AMOUNT, + }, + }, + }); + const loader = useRef(null); const handleObserver = useCallback( @@ -29,21 +34,20 @@ export default function CommonListContainer() { const target = entities[0]; if (target.isIntersecting) { - dispatch(updatePage(page + 1)); + setPage(page + 1); } }, - [dispatch, page], + [page], ); - useEffect(() => { const observer = new IntersectionObserver(handleObserver, options); if (loader.current) { observer.observe(loader.current as any); } - }, [handleObserver, data?.commons]); + }, [handleObserver, data, loader]); - const currentCommons = useMemo(() => [...(data?.commons ?? [])].splice(0, COMMON_PAGE_SIZE * page), [data?.commons, page]); + const currentCommons = useMemo(() => [...(data?.commons ?? [])].splice(0, COMMON_PAGE_SIZE * page), [data, page]); return (
diff --git a/packages/web/src/containers/Common/interfaces/CommonsStateType.tsx b/packages/web/src/containers/Common/interfaces/CommonsStateType.tsx index 64634d373..18ec0c300 100644 --- a/packages/web/src/containers/Common/interfaces/CommonsStateType.tsx +++ b/packages/web/src/containers/Common/interfaces/CommonsStateType.tsx @@ -1,4 +1,4 @@ -import { Common, Proposal, Discussion } from "../../../shared/models"; +import { Common, Proposal, Discussion } from "../../../graphql"; export interface CommonsStateType { commons: Common[]; diff --git a/packages/web/src/containers/Common/store/actions.tsx b/packages/web/src/containers/Common/store/actions.tsx deleted file mode 100644 index 0ebf4f112..000000000 --- a/packages/web/src/containers/Common/store/actions.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { createAsyncAction, createStandardAction } from "typesafe-actions"; - -import { Common, Proposal, Discussion } from "../../../shared/models"; -import { CommonsActionTypes } from "./constants"; - -export const getCommonsList = createAsyncAction( - CommonsActionTypes.GET_COMMONS_LIST, - CommonsActionTypes.GET_COMMONS_LIST_SUCCESS, - CommonsActionTypes.GET_COMMONS_LIST_FAILURE, -)(); - -export const getCommonDetail = createAsyncAction( - CommonsActionTypes.GET_COMMON_DETAIL, - CommonsActionTypes.GET_COMMON_DETAIL_SUCCESS, - CommonsActionTypes.GET_COMMON_DETAIL_FAILURE, -)(); - -export const updatePage = createStandardAction(CommonsActionTypes.UPDATE_PAGE)(); - -export const setDiscussion = createStandardAction(CommonsActionTypes.SET_DISCUSSION)(); - -export const setProposals = createStandardAction(CommonsActionTypes.SET_PROPOSALS)(); - -export const clearCurrentDiscussion = createStandardAction(CommonsActionTypes.CLEAR_CURRENT_DISCUSSION)(); - -export const loadCommonDiscussionList = createAsyncAction( - CommonsActionTypes.LOAD_COMMON_DISCUSSIONS, - CommonsActionTypes.LOAD_COMMON_DISCUSSIONS_SUCCESS, - CommonsActionTypes.LOAD_COMMON_DISCUSSIONS_FAILURE, -)(); - -export const loadDisscussionDetail = createAsyncAction( - CommonsActionTypes.LOAD_DISCUSSION_DETAIL, - CommonsActionTypes.LOAD_DISCUSSION_DETAIL_SUCCESS, - CommonsActionTypes.LOAD_DISCUSSION_DETAIL_FAILURE, -)(); - -export const closeCurrentCommon = createStandardAction(CommonsActionTypes.CLOSE_CURRENT_COMMON)(); diff --git a/packages/web/src/containers/Common/store/api.tsx b/packages/web/src/containers/Common/store/api.tsx deleted file mode 100644 index 6f9676e51..000000000 --- a/packages/web/src/containers/Common/store/api.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { Common, Discussion, DiscussionMessage, Proposal, User } from "../../../shared/models"; -import { transformFirebaseDataList, transformFirebaseDataSingle } from "../../../shared/utils"; -import firebase from "../../../shared/utils/firebase"; - -export async function fetchCommonDiscussions(commonId: string) { - const commons = await firebase.firestore().collection("discussion").where("commonId", "==", commonId).get(); - const data = transformFirebaseDataList(commons); - - return data.sort( - (proposal: Discussion, prevProposal: Discussion) => prevProposal.createTime?.seconds - proposal.createTime?.seconds, - ); -} - -export async function fetchCommonProposals(commonId: string) { - const commons = await firebase.firestore().collection("proposals").where("commonId", "==", commonId).get(); - const data = transformFirebaseDataList(commons); - - return data.sort( - (proposal: Proposal, prevProposal: Proposal) => prevProposal.createdAt?.seconds - proposal.createdAt?.seconds, - ); -} - -export async function fetchCommonList(): Promise { - const commons = await firebase.firestore().collection("daos").get(); - console.log('commons',commons); - const data = transformFirebaseDataList(commons); - return data; -} - -export async function fetchCommonDetail(id: string): Promise { - const common = await firebase.firestore().collection("daos").doc(id).get(); - const data = transformFirebaseDataSingle(common); - return data; -} - -export async function fetchOwners(ownerids: string[]) { - const idsChunks = ownerids.reduce((resultArray: any, item, index) => { - const chunkIndex = Math.floor(index / 10); - - if (!resultArray[chunkIndex]) { - resultArray[chunkIndex] = []; - } - - resultArray[chunkIndex].push(item); - - return resultArray; - }, []); - const users = await Promise.all( - idsChunks.map((ids: string[]) => firebase.firestore().collection("users").where("uid", "in", ownerids).get()), - ); - - const data = (users as unknown[]) - .map((d: any) => transformFirebaseDataList(d)) - .reduce((resultArray: any, item) => { - resultArray.push(...item); - return resultArray; - }, []); - - return data; -} - -export async function fetchDiscussionsMessages(dIds: string[]) { - const idsChunks = dIds.reduce((resultArray: any, item, index) => { - const chunkIndex = Math.floor(index / 10); - - if (!resultArray[chunkIndex]) { - resultArray[chunkIndex] = []; - } - - resultArray[chunkIndex].push(item); - - return resultArray; - }, []); - - const discussions = await Promise.all( - idsChunks.map((ids: string[]) => - firebase.firestore().collection("discussionMessage").where("discussionId", "in", ids).get(), - ), - ); - const data = (discussions as unknown[]) - .map((d: any) => transformFirebaseDataList(d)) - .reduce((resultArray: any, item) => { - resultArray.push(...item); - return resultArray; - }, []) - .sort((m: DiscussionMessage, mP: DiscussionMessage) => m.createTime?.seconds - mP.createTime?.seconds); - - return data; -} diff --git a/packages/web/src/containers/Common/store/constants.tsx b/packages/web/src/containers/Common/store/constants.tsx deleted file mode 100644 index e4eef7ea2..000000000 --- a/packages/web/src/containers/Common/store/constants.tsx +++ /dev/null @@ -1,27 +0,0 @@ -export enum CommonsActionTypes { - GET_COMMONS_LIST = "@COMMONS/GET_COMMONS_LIST", - GET_COMMONS_LIST_SUCCESS = "@COMMONS/GET_COMMONS_LIST_SUCCESS", - GET_COMMONS_LIST_FAILURE = "@COMMONS/GET_COMMONS_LIST_FAILURE", - - GET_COMMON_DETAIL = "@COMMONS/GET_COMMON_DETAIL", - GET_COMMON_DETAIL_SUCCESS = "@COMMONS/GET_COMMON_DETAIL_SUCCESS", - GET_COMMON_DETAIL_FAILURE = "@COMMONS/GET_COMMON_DETAIL_FAILURE", - - UPDATE_PAGE = "@COMMONS/UPDATE_PAGE", - - SET_DISCUSSION = "@COMMONS/SET_DISCUSSIONS", - - SET_PROPOSALS = "@COMMONS/SET_PROPOSALS", - - LOAD_COMMON_DISCUSSIONS = "@COMMONS/LOAD_COMMON_DISCUSSIONS", - LOAD_COMMON_DISCUSSIONS_SUCCESS = "@COMMONS/LOAD_COMMON_DISCUSSIONS_SUCCESS", - LOAD_COMMON_DISCUSSIONS_FAILURE = "@COMMONS/LOAD_COMMON_DISCUSSIONS_FAILURE", - - LOAD_DISCUSSION_DETAIL = "@COMMONS/LOAD_DISCUSSION_DETAIL", - LOAD_DISCUSSION_DETAIL_SUCCESS = "@COMMONS/LOAD_DISCUSSION_DETAIL_SUCCESS", - LOAD_DISCUSSION_DETAIL_FAILURE = "@COMMONS/LOAD_DISCUSSION_DETAIL_FAILURE", - - CLEAR_CURRENT_DISCUSSION = "@COMMONS/CLEAR_CURRENT_DISCUSSION", - - CLOSE_CURRENT_COMMON = "@COMMONS/CLOSE_CURRENT_COMMON", -} diff --git a/packages/web/src/containers/Common/store/index.tsx b/packages/web/src/containers/Common/store/index.tsx deleted file mode 100644 index f3c92a4c5..000000000 --- a/packages/web/src/containers/Common/store/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import * as allActions from "./actions"; -import * as allConstants from "./constants"; -import * as allSelectors from "./selectors"; -export { default as commonsSaga } from "./saga"; -export { default as commonsReducer } from "./reducer"; - -export const actions = allActions; -export const constants = allConstants; -export const selectors = allSelectors; diff --git a/packages/web/src/containers/Common/store/reducer.tsx b/packages/web/src/containers/Common/store/reducer.tsx deleted file mode 100644 index 9fdd2f198..000000000 --- a/packages/web/src/containers/Common/store/reducer.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import produce from "immer"; -import { ActionType, createReducer } from "typesafe-actions"; -import { CommonsStateType } from "../interfaces"; -import * as actions from "./actions"; - -const initialState: CommonsStateType = { - commons: [], - common: null, - page: 1, - proposals: [], - discussions: [], - isDiscussionsLoaded: false, - currentDiscussion: null, -}; - -type Action = ActionType; - -const reducer = createReducer(initialState) - .handleAction(actions.getCommonsList.success, (state, action) => - produce(state, (nextState) => { - console.log('action.payload',action.payload); - nextState.commons = action.payload; - }), - ) - .handleAction(actions.updatePage, (state, action) => - produce(state, (nextState) => { - nextState.page = action.payload; - }), - ) - .handleAction(actions.getCommonDetail.success, (state, action) => - produce(state, (nextState) => { - nextState.common = action.payload; - }), - ) - .handleAction(actions.setDiscussion, (state, action) => - produce(state, (nextState) => { - nextState.discussions = action.payload; - }), - ) - .handleAction(actions.setProposals, (state, action) => - produce(state, (nextState) => { - nextState.proposals = action.payload; - }), - ) - .handleAction(actions.loadCommonDiscussionList.success, (state, action) => - produce(state, (nextState) => { - nextState.discussions = action.payload; - nextState.isDiscussionsLoaded = true; - }), - ) - .handleAction(actions.loadDisscussionDetail.success, (state, action) => - produce(state, (nextState) => { - const disscussion = { ...action.payload }; - const { discussions } = state; - disscussion.isLoaded = true; - const index = discussions.findIndex((d) => d.id === disscussion.id); - discussions[index] = disscussion; - nextState.discussions = discussions; - nextState.currentDiscussion = disscussion; - }), - ) - .handleAction(actions.clearCurrentDiscussion, (state, action) => - produce(state, (nextState) => { - nextState.currentDiscussion = null; - }), - ) - .handleAction(actions.closeCurrentCommon, (state, action) => - produce(state, (nextState) => { - nextState.currentDiscussion = null; - nextState.common = null; - nextState.discussions = []; - nextState.proposals = []; - nextState.isDiscussionsLoaded = false; - }), - ); - -export default reducer; diff --git a/packages/web/src/containers/Common/store/saga.tsx b/packages/web/src/containers/Common/store/saga.tsx deleted file mode 100644 index 73a3ca614..000000000 --- a/packages/web/src/containers/Common/store/saga.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import { call, put, select, takeLatest } from "redux-saga/effects"; -import { actions } from "."; -import { Common, Discussion, User, DiscussionMessage } from "../../../shared/models"; -import { startLoading, stopLoading } from "../../../shared/store/actions"; -import { - fetchCommonList, - fetchCommonDetail, - fetchCommonDiscussions, - fetchCommonProposals, - fetchOwners, - fetchDiscussionsMessages, -} from "./api"; - -import { selectDiscussions } from "./selectors"; - -export function* getCommonsList(): Generator { - try { - yield put(startLoading()); - const commons = yield call(fetchCommonList); - - yield put(actions.getCommonsList.success(commons as Common[])); - yield put(stopLoading()); - } catch (e) { - yield put(actions.getCommonsList.failure(e)); - yield put(stopLoading()); - } -} - -export function* getCommonDetail(action: ReturnType): Generator { - try { - yield put(startLoading()); - const common = yield call(fetchCommonDetail, action.payload); - - const [discussions, proposals] = (yield Promise.all([ - fetchCommonDiscussions((common as Common).id), - fetchCommonProposals((common as Common).id), - ])) as any[]; - - yield put(actions.getCommonDetail.success(common as Common)); - yield put(actions.setDiscussion(discussions)); - yield put(actions.setProposals(proposals)); - - yield put(stopLoading()); - } catch (e) { - yield put(actions.getCommonDetail.failure(e)); - yield put(stopLoading()); - } -} - -export function* loadCommonDiscussionList( - action: ReturnType, -): Generator { - try { - yield put(startLoading()); - const discussions: Discussion[] = (yield select(selectDiscussions())) as Discussion[]; - - const ownerIds = Array.from(new Set(discussions.map((d) => d.ownerId))); - const discussions_ids = discussions.map((d) => d.id); - - const owners = (yield fetchOwners(ownerIds)) as User[]; - const dMessages = (yield fetchDiscussionsMessages(discussions_ids)) as DiscussionMessage[]; - - const loadedDiscussions = discussions.map((d) => { - d.discussionMessage = dMessages.filter((dM) => dM.discussionId === d.id); - d.owner = owners.find((o) => o.uid === d.ownerId); - return d; - }); - - yield put(actions.loadCommonDiscussionList.success(loadedDiscussions)); - yield put(stopLoading()); - } catch (e) { - yield put(actions.loadCommonDiscussionList.failure(e)); - yield put(stopLoading()); - } -} - -export function* loadDiscussionDetail(action: ReturnType): Generator { - try { - yield put(startLoading()); - const discussion = { ...action.payload }; - if (!discussion.isLoaded) { - const { discussionMessage } = action.payload; - - const ownerIds = Array.from(new Set(discussionMessage?.map((d) => d.ownerId))); - const owners = (yield fetchOwners(ownerIds)) as User[]; - const loadedDisscussionMessage = discussionMessage?.map((d) => { - d.owner = owners.find((o) => o.uid === d.ownerId); - return d; - }); - discussion.discussionMessage = loadedDisscussionMessage; - } - - yield put(actions.loadDisscussionDetail.success(discussion)); - yield put(stopLoading()); - } catch (e) { - yield put(actions.loadDisscussionDetail.failure(e)); - yield put(stopLoading()); - } -} - -function* commonsSaga() { - yield takeLatest(actions.getCommonsList.request, getCommonsList); - yield takeLatest(actions.getCommonDetail.request, getCommonDetail); - yield takeLatest(actions.loadCommonDiscussionList.request, loadCommonDiscussionList); - yield takeLatest(actions.loadDisscussionDetail.request, loadDiscussionDetail); -} - -export default commonsSaga; diff --git a/packages/web/src/containers/Common/store/selectors.tsx b/packages/web/src/containers/Common/store/selectors.tsx deleted file mode 100644 index 735c216bf..000000000 --- a/packages/web/src/containers/Common/store/selectors.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createSelector } from "reselect"; -import { AppState } from "../../../shared/interfaces"; - -const selectCommons = (state: AppState) => state.commons; - -export const selectCommonList = () => createSelector(selectCommons, (state) => state.commons); -export const selectCommonDetail = () => createSelector(selectCommons, (state) => state.common); -export const selectCurrentPage = () => createSelector(selectCommons, (state) => state.page); -export const selectProposals = () => createSelector(selectCommons, (state) => state.proposals); -export const selectDiscussions = () => createSelector(selectCommons, (state) => state.discussions); -export const selectIsDiscussionsLoaded = () => createSelector(selectCommons, (state) => state.isDiscussionsLoaded); -export const selectCurrentDisscussion = () => createSelector(selectCommons, (state) => state.currentDiscussion); diff --git a/packages/web/src/context/AuthContext.tsx b/packages/web/src/context/AuthContext.tsx index 54bc8abde..84857c80c 100644 --- a/packages/web/src/context/AuthContext.tsx +++ b/packages/web/src/context/AuthContext.tsx @@ -1,5 +1,5 @@ -import firebase from 'firebase/app'; -import React, { PropsWithChildren } from 'react'; +import firebase from "firebase/app"; +import React, { PropsWithChildren } from "react"; interface IAuthContext { token?: string | null; @@ -9,7 +9,7 @@ interface IAuthContext { } const defaultAppContext: IAuthContext = { - loaded: false + loaded: false, }; const AuthContext = React.createContext(defaultAppContext); @@ -32,7 +32,7 @@ export const AuthContextProvider: React.FC> = ({ children token, loaded: true, userInfo: user, - authenticated: true + authenticated: true, })); } else { setContext((prevContext) => ({ @@ -41,16 +41,11 @@ export const AuthContextProvider: React.FC> = ({ children token: null, loaded: true, userInfo: null, - authenticated: false + authenticated: false, })); } }); }, []); - - return ( - - {children} - - ); -}; \ No newline at end of file + return {children}; +}; diff --git a/packages/web/src/context/PermissionsContext.tsx b/packages/web/src/context/PermissionsContext.tsx index 54ef2664c..24b5e51ea 100644 --- a/packages/web/src/context/PermissionsContext.tsx +++ b/packages/web/src/context/PermissionsContext.tsx @@ -1,7 +1,6 @@ -import { gql } from '@apollo/client'; -import React, { PropsWithChildren } from 'react'; -import { useAuthContext } from './AuthContext'; -import { useGetUserPermissionsQuery } from '../graphql'; +import React, { PropsWithChildren } from "react"; +import { useAuthContext } from "./AuthContext"; +import { useGetUserPermissionsQuery } from "../graphql"; interface IPermissionsContext { loaded: boolean; @@ -10,7 +9,7 @@ interface IPermissionsContext { const defaultPermissionsContext: IPermissionsContext = { loaded: false, - permissions: [] + permissions: [], }; const PermissionsContext = React.createContext(defaultPermissionsContext); @@ -19,14 +18,6 @@ export const usePermissionsContext = () => { return React.useContext(PermissionsContext); }; -const LoadPermissionsQuery = gql` - query getUserPermissions($userId: ID!) { - user(id: $userId) { - permissions - } - } -`; - export const PermissionsContextProvider: React.FC> = ({ children }) => { const authContext = useAuthContext(); @@ -34,8 +25,8 @@ export const PermissionsContextProvider: React.FC> = ({ c skip: !authContext.loaded && !authContext.authenticated, pollInterval: 120 * 1000, variables: { - userId: authContext.userInfo?.uid || '' - } + userId: authContext.userInfo?.uid || "", + }, }); const [context, setContext] = React.useState(defaultPermissionsContext); @@ -44,19 +35,15 @@ export const PermissionsContextProvider: React.FC> = ({ c if (authContext.authenticated && data?.user) { setContext({ loaded: true, - permissions: data.user?.permissions + permissions: data.user?.permissions, }); } else { setContext({ - loaded: !loading && authContext.authenticated || false, - permissions: [] + loaded: (!loading && authContext.authenticated) || false, + permissions: [], }); } }, [authContext, data, loading]); - return ( - - {children} - - ); -}; \ No newline at end of file + return {children}; +}; diff --git a/packages/web/src/context/UserContext.tsx b/packages/web/src/context/UserContext.tsx new file mode 100644 index 000000000..29ca7eaa1 --- /dev/null +++ b/packages/web/src/context/UserContext.tsx @@ -0,0 +1,55 @@ +import React from "react"; + +import { useLoadUserContextQuery } from "../graphql"; +import { Loader } from "../shared/components"; + +interface UserContext { + loaded: boolean; + + id?: string; + + firstName?: string; + lastName?: string; + + displayName?: string; + + email?: string; + photo?: string; + + permissions?: string[]; +} + +const defaultUserContext: UserContext = { + loaded: false, +}; + +const UserContext = React.createContext(defaultUserContext); + +export const useUserContext = () => { + return React.useContext(UserContext); +}; + +export const UserContextProvider: React.FC> = ({ children }) => { + // State + const [context, setContext] = React.useState(defaultUserContext); + + // Data Fetching + const { data } = useLoadUserContextQuery(); + + // Effects + React.useEffect(() => { + if (data?.user) { + setContext({ + loaded: true, + ...data.user, + }); + } + }, [data]); + + // Render + return ( + + {context.loaded ? {children} : } + + ); +}; diff --git a/packages/web/src/context/index.ts b/packages/web/src/context/index.ts index 7dd4b2061..c24a4cec5 100644 --- a/packages/web/src/context/index.ts +++ b/packages/web/src/context/index.ts @@ -1,2 +1,2 @@ -export * from './AuthContext'; -export * from './PermissionsContext'; \ No newline at end of file +export * from "./AuthContext"; +export * from "./PermissionsContext"; diff --git a/packages/web/src/graphql/index.ts b/packages/web/src/graphql/index.ts index 1abbb67f7..d09527d7d 100644 --- a/packages/web/src/graphql/index.ts +++ b/packages/web/src/graphql/index.ts @@ -1,279 +1,296 @@ -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; +import { gql } from "@apollo/client"; +import * as Apollo from "@apollo/client"; export type Maybe = T | null; export type Exact = { [K in keyof T]: T[K] }; export type Scalars = { - ID: string; - String: string; - Boolean: boolean; - Int: number; - Float: number; - Date: any; - }; + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + Date: any; +}; - export enum DiscussionMessageType { - Message = 'Message' - } +export enum DiscussionMessageType { + Message = "Message", +} - export enum DiscussionMessageFlag { - Clear = 'Clear', - Reported = 'Reported', - Hidden = 'Hidden' - } +export enum DiscussionMessageFlag { + Clear = "Clear", + Reported = "Reported", + Hidden = "Hidden", +} - export type BaseEntity = { - id: Scalars['ID']; - createdAt: Scalars['Date']; - updatedAt: Scalars['Date']; - } +export type BaseEntity = { + id: Scalars["ID"]; + createdAt: Scalars["Date"]; + updatedAt: Scalars["Date"]; +}; - export enum DiscussionType { - ProposalDiscussion = 'ProposalDiscussion', - CommonDiscussion = 'CommonDiscussion' - }; +export enum DiscussionType { + ProposalDiscussion = "ProposalDiscussion", + CommonDiscussion = "CommonDiscussion", +} - export type DiscussionMessage = BaseEntity & { - id: Scalars['ID']; - message: Scalars['String']; - type: DiscussionMessageType; - flag: DiscussionMessageFlag; - reports: Array; - } +export type DiscussionMessage = BaseEntity & { + id: Scalars["ID"]; + message: Scalars["String"]; + type: DiscussionMessageType; + flag: DiscussionMessageFlag; + reports: Array; +}; - export enum ReportFor { - Nudity = 'Nudity', - Violance = 'Violance', - Harassment = 'Harassment', - FalseNews = 'FalseNews', - Spam = 'Spam', - Hate ='Hate', - Other = 'Other' - } - - enum ReportStatus { - Active = 'Active', - Clossed = 'Clossed' - } +export enum ReportFor { + Nudity = "Nudity", + Violance = "Violance", + Harassment = "Harassment", + FalseNews = "FalseNews", + Spam = "Spam", + Hate = "Hate", + Other = "Other", +} - export type Report = BaseEntity & { - status: ReportStatus; - for: ReportFor; - note: Scalars['String']; - reviewedOn: Scalars['Date']; - reporterId:Scalars['ID']; - reporter: User; - messageId: Scalars['ID']; - } +enum ReportStatus { + Active = "Active", + Clossed = "Clossed", +} - export type Discussion = BaseEntity & { - __typename?: 'Discussion'; - id: Scalars['ID']; - createTime: Scalars['Date']; - updatedAt: Scalars['Date']; - messages: Array; - title: Scalars['String']; - description: Scalars['String']; - userId: Scalars['ID']; - owner: User - } +export type Report = BaseEntity & { + status: ReportStatus; + for: ReportFor; + note: Scalars["String"]; + reviewedOn: Scalars["Date"]; + reporterId: Scalars["ID"]; + reporter: User; + messageId: Scalars["ID"]; +}; - export enum ProposalType { - FundingRequest = 'fundingRequest', - Join = 'join' - } - - export enum ProposalState { - PassedInsufficientBalance = 'passedInsufficientBalance', - Countdown = 'countdown', - Passed = 'passed', - Failed = 'failed' - } - - export enum ProposalVoteOutcome { - Approved = 'approved', - Rejected = 'rejected' - } - - export enum ProposalPaymentState { - NotAttempted = 'notAttempted', - NotRelevant = 'notRelevant', - Confirmed = 'confirmed', - Pending = 'pending', - Failed = 'failed' - } - - export enum ProposalFundingState { - NotRelevant = 'notRelevant', - NotAvailable = 'notAvailable', - Available = 'available', - Funded = 'funded' - } - - /** The proposals type */ - export type Proposal = { - __typename?: 'Proposal'; - id: Scalars['ID']; - createdAt: Scalars['Date']; - updatedAt: Scalars['Date']; - commonId: Scalars['ID']; - proposerId: Scalars['ID']; - votesFor: Scalars['Int']; - votesAgainst: Scalars['Int']; - state: ProposalState; - description: ProposalDescription; - type: ProposalType; - paymentState?: Maybe; - fundingState?: Maybe; - /** Details about the funding request. Exists only on funding request proposals */ - fundingRequest?: Maybe; - /** Details about the join request. Exists only on join request proposals */ - join?: Maybe; - votes?: Maybe>>; - common: Common; - proposer: User; - }; - - export type ProposalDescription = { - __typename?: 'ProposalDescription'; - title?: Maybe; - description: Scalars['String']; - }; - - export type ProposalFunding = { - __typename?: 'ProposalFunding'; - amount: Scalars['Int']; - }; - - export type ProposalJoin = { - __typename?: 'ProposalJoin'; - cardId: Scalars['ID']; - funding: Scalars['Int']; - fundingType?: Maybe; - }; - - export type ProposalVote = { - __typename?: 'ProposalVote'; - voteId: Scalars['ID']; - voterId: Scalars['ID']; - outcome: ProposalVoteOutcome; - voter?: Maybe; - }; +export type Discussion = BaseEntity & { + __typename?: "Discussion"; + id: Scalars["ID"]; + messages: Array; + title: Scalars["String"]; + description: Scalars["String"]; + userId: Scalars["ID"]; + owner: User; +}; - export enum SubscriptionStatus { - Pending = 'pending', - Active = 'active', - CanceledByUser = 'canceledByUser', - CanceledByPaymentFailure = 'canceledByPaymentFailure', - PaymentFailed = 'paymentFailed' - } - - export type Subscription = { - __typename?: 'Subscription'; - id: Scalars['ID']; - cardId: Scalars['ID']; - userId: Scalars['ID']; - proposalId: Scalars['ID']; - createdAt: Scalars['Date']; - updatedAt: Scalars['Date']; - charges: Scalars['Int']; - amount: Scalars['Int']; - lastChargedAt?: Maybe; - dueDate?: Maybe; - revoked: Scalars['Boolean']; - status: SubscriptionStatus; - metadata: SubscriptionMetadata; - }; - - export type SubscriptionMetadata = { - __typename?: 'SubscriptionMetadata'; - common?: Maybe; - }; - - export type SubscriptionMetadataCommon = { - __typename?: 'SubscriptionMetadataCommon'; - id?: Maybe; - name?: Maybe; - }; +export enum ProposalType { + FundingRequest = "fundingRequest", + Join = "join", +} - export type User = { - __typename?: 'User'; - id: Scalars['ID']; - firstName?: Maybe; - lastName?: Maybe; - email?: Maybe; - photoURL?: Maybe; - createdAt?: Maybe; - tokens?: Maybe>>; - permissions?: Maybe>>; - proposals?: Maybe>>; - subscriptions?: Maybe>>; - }; +export enum ProposalState { + PassedInsufficientBalance = "passedInsufficientBalance", + Countdown = "countdown", + Passed = "passed", + Failed = "failed", +} - export enum CommonContributionType { - OneTime = 'oneTime', - Monthly = 'monthly' - } +export enum ProposalVoteOutcome { + Approved = "approved", + Rejected = "rejected", +} - export type CommonMetadata = { - __typename?: 'CommonMetadata'; - byline: Scalars['String']; - description: Scalars['String']; - founderId: Scalars['String']; - minFeeToJoin: Scalars['Int']; - contributionType: CommonContributionType; - action: Scalars['String']; - }; +export enum ProposalPaymentState { + NotAttempted = "notAttempted", + NotRelevant = "notRelevant", + Confirmed = "confirmed", + Pending = "pending", + Failed = "failed", +} +export enum ProposalFundingState { + NotRelevant = "notRelevant", + NotAvailable = "notAvailable", + Available = "available", + Funded = "funded", +} - export type CommonMember = { - __typename?: 'CommonMember'; - /** The user ID of the member */ - userId: Scalars['ID']; - /** The date, at witch the member joined the common */ - joinedAt?: Maybe; - }; +/** The proposals type */ +export type Proposal = { + __typename?: "Proposal"; + id: Scalars["ID"]; + title: Scalars["String"]; + createdAt: Scalars["Date"]; + updatedAt: Scalars["Date"]; + commonId: Scalars["ID"]; + proposerId: Scalars["ID"]; + votesFor: Scalars["Int"]; + votesAgainst: Scalars["Int"]; + state: ProposalState; + description: ProposalDescription; + type: ProposalType; + paymentState?: Maybe; + fundingState?: Maybe; + /** Details about the funding request. Exists only on funding request proposals */ + funding?: Maybe; + /** Details about the join request. Exists only on join request proposals */ + join?: Maybe; + votes?: Maybe>>; + common: Common; + proposer: User; +}; + +// countdownPeriod: number; +// createdAt: Time; +// description: { description: string; links: Rules[]; images: File[]; files: File[]; title: string }; +// fundingRequest: { funded: boolean; amount: number }; +// fundingState: string; +// id: string; +// moderation: Moderation; +// paymentState: string; +// proposerId: string; +// quietEndingPeriod: 10800; +// state: string; +// type: string; +// updatedAt: Time; + +export type ProposalDescription = { + __typename?: "ProposalDescription"; + title?: Maybe; + description: Scalars["String"]; +}; + +export type ProposalFunding = { + __typename?: "ProposalFunding"; + amount: Scalars["Int"]; +}; + +export type ProposalJoin = { + __typename?: "ProposalJoin"; + cardId: Scalars["ID"]; + funding: Scalars["Int"]; + fundingType?: Maybe; +}; + +export type ProposalVote = { + __typename?: "ProposalVote"; + voteId: Scalars["ID"]; + voterId: Scalars["ID"]; + outcome: ProposalVoteOutcome; + voter?: Maybe; +}; + +export enum SubscriptionStatus { + Pending = "pending", + Active = "active", + CanceledByUser = "canceledByUser", + CanceledByPaymentFailure = "canceledByPaymentFailure", + PaymentFailed = "paymentFailed", +} + +export type Subscription = { + __typename?: "Subscription"; + id: Scalars["ID"]; + cardId: Scalars["ID"]; + userId: Scalars["ID"]; + proposalId: Scalars["ID"]; + createdAt: Scalars["Date"]; + updatedAt: Scalars["Date"]; + charges: Scalars["Int"]; + amount: Scalars["Int"]; + lastChargedAt?: Maybe; + dueDate?: Maybe; + revoked: Scalars["Boolean"]; + status: SubscriptionStatus; + metadata: SubscriptionMetadata; +}; + +export type SubscriptionMetadata = { + __typename?: "SubscriptionMetadata"; + common?: Maybe; +}; + +export type SubscriptionMetadataCommon = { + __typename?: "SubscriptionMetadataCommon"; + id?: Maybe; + name?: Maybe; +}; + +export type User = { + __typename?: "User"; + id: Scalars["ID"]; + displayName?: Scalars["String"]; + firstName?: Scalars["String"]; + lastName?: Scalars["String"]; + email?: Scalars["String"]; + photo?: Scalars["String"]; + createdAt?: Maybe; + tokens?: Maybe>>; + permissions?: Array; + proposals?: Maybe>>; + subscriptions?: Maybe>>; +}; + +export enum CommonContributionType { + OneTime = "oneTime", + Monthly = "monthly", +} + +export type CommonMetadata = { + __typename?: "CommonMetadata"; + byline: Scalars["String"]; + description: Scalars["String"]; + founderId: Scalars["String"]; + minFeeToJoin: Scalars["Int"]; + contributionType: CommonContributionType; + action: Scalars["String"]; +}; + +export type CommonMember = { + __typename?: "CommonMember"; + /** The user ID of the member */ + userId: Scalars["ID"]; + /** The date, at witch the member joined the common */ + joinedAt?: Maybe; +}; + +export type Link = { + title: Scalars["String"]; + url: Scalars["String"]; +}; /** The common type */ export type Common = { - __typename?: 'Common'; - /** The unique identifier of the common */ - id: Scalars['ID']; - /** The date, at which the common was created */ - createdAt?: Maybe; - /** The date, at which the common was last updated */ - updatedAt?: Maybe; - /** The display name of the common */ - name: Scalars['String']; - /** The currently available funds of the common */ - balance: Scalars['Int']; - /** The total amount of money, raised by the common */ - raised: Scalars['Int']; - metadata: CommonMetadata; - members: Array; - proposals?: Maybe>>; - openJoinRequests: Scalars['Int']; - openFundingRequests: Scalars['Int']; - image: Scalars['String']; - register: Scalars['String']; - }; + __typename?: "Common"; + /** The unique identifier of the common */ + id: Scalars["ID"]; + /** The date, at which the common was created */ + createdAt?: Maybe; + /** The date, at which the common was last updated */ + updatedAt?: Maybe; + /** The display name of the common */ + name: Scalars["String"]; + /** The currently available funds of the common */ + balance: Scalars["Int"]; + /** The total amount of money, raised by the common */ + raised: Scalars["Int"]; + byline: Scalars["String"]; + description: Scalars["String"]; + fundingMinimumAmount: Scalars["Int"]; + links: Array; + fundingType: CommonContributionType; + members: Array; + proposals?: Maybe>>; + openJoinRequests: Scalars["Int"]; + openFundingRequests: Scalars["Int"]; + image: Scalars["String"]; + register: Scalars["String"]; +}; - - -export type GetCommonsDataQuery = ( - { __typename?: 'Query' } - & { commons?: Array<( - { __typename?: 'Common' } - & Common - & { members?: Maybe - )>>>} - )> } - ); +export type GetCommonsDataQuery = { __typename?: "Query" } & { + commons?: Array< + { __typename?: "Common" } & Common & { + members?: Maybe>>>; + } + >; +}; export const GetCommonsDataDocument = gql` -query getCommonsHomescreenData { - commons { + query getCommonsHomescreenData($paginate: PaginateInput! = { take: 10, skip: 0 }) { + commons(paginate: $paginate) { id name createdAt @@ -290,16 +307,66 @@ query getCommonsHomescreenData { `; export const GetCommonProposals = gql` -query getCommonProposals($where: ProposalWhereInput, $paginate: PaginateInput! = { take: 10, skip: 0}) { - proposals(where: $where, paginate: $paginate) { - id - state + query getCommonProposals($where: ProposalWhereInput, $paginate: PaginateInput! = { take: 10, skip: 0 }) { + proposals(where: $where, paginate: $paginate) { + id + state + createdAt + updatedAt + links + files + images + votesFor + votesAgainst + title + description + discussions { + id + topic + description + latestMessage + type + userId + owner { + id + displayName + lastName + firstName + } + messages { + message + type + flag + reports { + status + message { + message + type + flag + } + for + note + reporterId + } + } + } + funding { + id + fundingState + amount + } + join { + id + funding + fundingType + paymentState + } + } } -} `; export type DiscussionWhereInput = { - commonId: Scalars['ID']; + commonId: Scalars["ID"]; }; export type GetCommonDiscussionsQueryVariables = Exact<{ @@ -307,126 +374,211 @@ export type GetCommonDiscussionsQueryVariables = Exact<{ }>; export const GetCommonDiscussions = gql` -query getCommonDiscussions($where: DiscussionWhereInput, $paginate: PaginateInput! = { take: 10, skip: 0} ) { - discussions(where: $where, paginate: $paginate) { - id - createTime: createdAt - messages { - message - } - title: topic - description - userId - owner { - firstName - lastName - displayName - photo + query getCommonDiscussions($where: DiscussionWhereInput, $paginate: PaginateInput! = { take: 10, skip: 0 }) { + discussions(where: $where, paginate: $paginate) { + id + createdAt + messages { + id + message + createdAt + updatedAt + type + flag + owner { + displayName + firstName + lastName + photo + } + } + title: topic + description + userId + owner { + firstName + lastName + displayName + photo + } } } -} -` -export type GetCommonDiscussionsQuery = ( - { discussions?: Maybe> } -); +`; +export type GetCommonDiscussionsQuery = { + discussions?: Maybe>; +}; -export function useGetCommonDiscussions(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetCommonDiscussions, baseOptions); +export function useGetCommonDiscussions( + baseOptions: Apollo.QueryHookOptions, +) { + return Apollo.useQuery( + GetCommonDiscussions, + baseOptions, + ); } +export const GetDiscussionById = gql` + query getDiscussionById($id: ID!) { + discussion(id: $id) { + id + createdAt + messages { + id + message + createdAt + updatedAt + type + flag + owner { + displayName + firstName + lastName + photo + } + } + title: topic + description + userId + owner { + firstName + lastName + displayName + photo + } + } + } +`; -export type GetCommonProposalsQuery = ( - { proposals?: Maybe> } -); +export type GetCommonProposalsQuery = { + proposals?: Maybe>; +}; export const GetUserPermissionsDocument = gql` - query getUserPermissions($userId: ID!) { - user(id: $userId) { - permissions + query getUserPermissions($userId: ID!) { + user(id: $userId) { + permissions + } } -} - `; +`; + +export type GetCommonByIdQuery = { + common?: Maybe; +}; - export type GetCommonByIdQuery = ( - { common?: Maybe } - ); +export type CommonWhereUniqueInput = { + id: Scalars["ID"]; +}; - export type CommonWhereUniqueInput = { - id: Scalars['ID']; - }; - - export type GetCommonByIdQueryVariables = Exact<{ - where: CommonWhereUniqueInput; - }>; - +export type GetCommonByIdQueryVariables = Exact<{ + where: CommonWhereUniqueInput; +}>; export const GetCommonById = gql` -query getCommon($where: CommonWhereUniqueInput!) { - common(where: $where) { - id - description - links - image - name - byline - balance - fundingMinimumAmount - fundingType - raised - members { + query getCommon($where: CommonWhereUniqueInput!) { + common(where: $where) { id - user { - firstName - lastName - displayName + description + links + image + name + byline + balance + fundingMinimumAmount + fundingType + raised + members { + id + user { + firstName + lastName + displayName + } } } } +`; + +export type GetUserPermissionsQuery = { __typename?: "Query" } & { + user?: Maybe<{ __typename?: "User" } & Pick>; +}; + +export type GetCommonDataQueryVariables = Exact<{ + paginate?: Pagination; +}>; + +export type GetCommonDataQuery = { + commons?: Maybe>; +}; + +export function useGetCommonDataQuery( + baseOptions: Apollo.QueryHookOptions, +) { + return Apollo.useQuery(GetCommonsDataDocument, baseOptions); } -` - - export type GetUserPermissionsQuery = ( - { __typename?: 'Query' } - & { user?: Maybe<( - { __typename?: 'User' } - & Pick - )> } - ); - - export function useGetCommonDataQuery() { - return Apollo.useQuery(GetCommonsDataDocument); - } - export type GetUserPermissionsQueryVariables = Exact<{ - userId: Scalars['ID']; - }>; +export type GetUserPermissionsQueryVariables = Exact<{ + userId: Scalars["ID"]; +}>; - export type Pagination = { - skip: Scalars['Int'], - take: Scalars['Int'] - } +export type Pagination = { + skip: Scalars["Int"]; + take: Scalars["Int"]; +}; - export type GetCommonProposalsQueryVariables = Exact<{ - where: { - type?: ProposalType, - state?: ProposalState, - commonId?: Scalars['ID'], - commonMemberId?: Scalars['ID'], - userId?: Scalars['ID'], - }, - paginate?: Pagination - }>; +export type GetCommonProposalsQueryVariables = Exact<{ + where: { + type?: ProposalType; + state?: ProposalState; + commonId?: Scalars["ID"]; + commonMemberId?: Scalars["ID"]; + userId?: Scalars["ID"]; + }; + paginate?: Pagination; +}>; +export function useGetUserPermissionsQuery( + baseOptions: Apollo.QueryHookOptions, +) { + return Apollo.useQuery( + GetUserPermissionsDocument, + baseOptions, + ); +} +export function useGetCommonProposals( + baseOptions: Apollo.QueryHookOptions, +) { + return Apollo.useQuery(GetCommonProposals, baseOptions); +} - export function useGetUserPermissionsQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetUserPermissionsDocument, baseOptions); - } +export function useGetCommonById( + baseOptions: Apollo.QueryHookOptions, +) { + return Apollo.useQuery(GetCommonById, baseOptions); +} - export function useGetCommonProposals(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetCommonProposals, baseOptions); - } +export const LoadUserContextDocument = gql` + query loadUserContext { + user { + id + firstName + lastName + displayName + email + photo + permissions + } + } +`; + +export type LoadUserContextQuery = { + user?: Pick; +}; - export function useGetCommonById(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetCommonById, baseOptions); - } \ No newline at end of file +export type LoadUserContextQueryVariables = Exact<{ [key: string]: never }>; + +export function useLoadUserContextQuery( + baseOptions?: Apollo.QueryHookOptions, +) { + return Apollo.useQuery(LoadUserContextDocument, baseOptions); +} diff --git a/packages/web/src/graphql/indexx.ts b/packages/web/src/graphql/indexx.ts deleted file mode 100644 index 4b3e0e1c8..000000000 --- a/packages/web/src/graphql/indexx.ts +++ /dev/null @@ -1,2154 +0,0 @@ -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -export type Maybe = T | null; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -/** All built-in and custom scalars, mapped to their actual values */ -export type Scalars = { - ID: string; - String: string; - Boolean: boolean; - Int: number; - Float: number; - Date: any; -}; - - -export enum CardNetwork { - Visa = 'visa', - Mastercard = 'mastercard' -} - -export type Card = { - __typename?: 'Card'; - /** The ID of the payment */ - id: Scalars['ID']; - /** The date at witch the payment was created */ - createdAt: Scalars['Date']; - /** The date at witch the payment was last updated */ - updatedAt: Scalars['Date']; - circleCardId: Scalars['ID']; - ownerId: Scalars['ID']; - metadata?: Maybe; - verification?: Maybe; -}; - -export type CardMetadata = { - __typename?: 'CardMetadata'; - digits?: Maybe; - network?: Maybe; - billingDetails?: Maybe; -}; - -export type CardVerification = { - __typename?: 'CardVerification'; - cvv?: Maybe; -}; - -export type CardBillingDetails = { - __typename?: 'CardBillingDetails'; - name?: Maybe; - city?: Maybe; - country?: Maybe; - postalCode?: Maybe; - district?: Maybe; - line1?: Maybe; -}; - -export type User = { - __typename?: 'User'; - id: Scalars['ID']; - firstName?: Maybe; - lastName?: Maybe; - email?: Maybe; - photoURL?: Maybe; - createdAt?: Maybe; - tokens?: Maybe>>; - permissions?: Maybe>>; - proposals?: Maybe>>; - subscriptions?: Maybe>>; -}; - - -export type UserProposalsArgs = { - page?: Maybe; -}; - - -export type UserSubscriptionsArgs = { - page?: Maybe; - status?: Maybe; -}; - -export type Wire = { - __typename?: 'Wire'; - /** The local ID of the payout */ - id: Scalars['ID']; - createdAt?: Maybe; - updatedAt?: Maybe; - description?: Maybe; - bank?: Maybe; - billingDetails?: Maybe; -}; - -export type WireBank = { - __typename?: 'WireBank'; - bankName?: Maybe; - city?: Maybe; - country?: Maybe; -}; - -export type WireBillingDetailsType = { - __typename?: 'WireBillingDetailsType'; - city?: Maybe; - country?: Maybe; - line1?: Maybe; - line2?: Maybe; - name?: Maybe; - postalCode?: Maybe; -}; - -export enum EventType { - CommonCreated = 'commonCreated', - CommonCreationFailed = 'commonCreationFailed', - CommonWhitelisted = 'commonWhitelisted', - CommonMemberAdded = 'commonMemberAdded', - CommonMemberRemoved = 'commonMemberRemoved', - CommonUpdated = 'commonUpdated', - RequestToJoinCreated = 'requestToJoinCreated', - RequestToJoinAccepted = 'requestToJoinAccepted', - RequestToJoinRejected = 'requestToJoinRejected', - RequestToJoinExecuted = 'requestToJoinExecuted', - FundingRequestCreated = 'fundingRequestCreated', - FundingRequestRejected = 'fundingRequestRejected', - FundingRequestExecuted = 'fundingRequestExecuted', - FundingRequestAccepted = 'fundingRequestAccepted', - FundingRequestAcceptedInsufficientFunds = 'fundingRequestAcceptedInsufficientFunds', - VoteCreated = 'voteCreated', - PaymentCreated = 'paymentCreated', - PaymentConfirmed = 'paymentConfirmed', - PaymentFailed = 'paymentFailed', - PaymentPaid = 'paymentPaid', - PayoutCreated = 'payoutCreated', - PayoutApproved = 'payoutApproved', - PayoutExecuted = 'payoutExecuted', - PayoutVoided = 'payoutVoided', - PayoutCompleted = 'payoutCompleted', - PayoutFailed = 'payoutFailed', - CardCreated = 'cardCreated', - DiscussionCreated = 'discussionCreated', - MessageCreated = 'messageCreated', - SubscriptionCreated = 'subscriptionCreated', - SubscriptionPaymentCreated = 'subscriptionPaymentCreated', - SubscriptionPaymentFailed = 'subscriptionPaymentFailed', - SubscriptionPaymentConfirmed = 'subscriptionPaymentConfirmed', - SubscriptionPaymentStuck = 'subscriptionPaymentStuck', - SubscriptionCanceledByUser = 'subscriptionCanceledByUser', - SubscriptionCanceledByPaymentFailure = 'subscriptionCanceledByPaymentFailure', - MembershipRevoked = 'membershipRevoked', - DiscussionMessageReported = 'discussionMessageReported', - ProposalReported = 'proposalReported', - DiscussionReported = 'discussionReported' -} - -export type Event = { - __typename?: 'Event'; - /** The unique identifier of the event */ - id: Scalars['ID']; - /** The type of the event */ - type: EventType; - /** The date, at which the event was created */ - createdAt: Scalars['Date']; - /** The date, at which the event was last updated */ - updatedAt: Scalars['Date']; - /** The id of the object on which was acted to created the event */ - objectId?: Maybe; - /** The id of the actor */ - userId?: Maybe; - user?: Maybe; -}; - -export enum CommonContributionType { - OneTime = 'oneTime', - Monthly = 'monthly' -} - -export type CommonMember = { - __typename?: 'CommonMember'; - /** The user ID of the member */ - userId: Scalars['ID']; - /** The date, at witch the member joined the common */ - joinedAt?: Maybe; - user?: Maybe; -}; - -export type CommonMetadata = { - __typename?: 'CommonMetadata'; - byline: Scalars['String']; - description: Scalars['String']; - founderId: Scalars['String']; - minFeeToJoin: Scalars['Int']; - contributionType?: Maybe; -}; - -export type Payout = { - __typename?: 'Payout'; - id: Scalars['ID']; - createdAt: Scalars['Date']; - updatedAt: Scalars['Date']; - circlePayoutId?: Maybe; - amount: Scalars['Int']; - executed?: Maybe; - voided?: Maybe; - status?: Maybe; - security?: Maybe>>; - proposalIds?: Maybe>>; - proposals?: Maybe>>; -}; - -export type PayoutSecurity = { - __typename?: 'PayoutSecurity'; - id?: Maybe; - redemptionAttempts?: Maybe; - redeemed?: Maybe; -}; - -export enum PayoutStatus { - Pending = 'pending', - Complete = 'complete', - Failed = 'failed' -} - -export type ExecutePayoutInput = { - /** The ID of the the wire to witch the payout will be made */ - wireId: Scalars['ID']; - /** List of the all proposals IDs that are in this batch */ - proposalIds: Array; -}; - -export enum PaymentType { - OneTime = 'oneTime', - Subscription = 'subscription' -} - -export enum PaymentSourceType { - Card = 'card' -} - -export enum PaymentStatus { - Pending = 'pending', - Confirmed = 'confirmed', - Paid = 'paid', - Failed = 'failed' -} - -export enum PaymentCurrency { - Usd = 'USD' -} - -export type Payment = { - __typename?: 'Payment'; - /** The ID of the payment */ - id: Scalars['ID']; - /** The date at witch the payment was created */ - createdAt: Scalars['Date']; - /** The date at witch the payment was last updated */ - updatedAt: Scalars['Date']; - type: PaymentType; - status: PaymentStatus; - /** The source from witch the payment was funded */ - source: PaymentSource; - amount: PaymentAmount; - /** The fees on the payment */ - fees?: Maybe; - circlePaymentId: Scalars['ID']; - proposalId: Scalars['ID']; - userId: Scalars['ID']; - subscriptionId?: Maybe; - user?: Maybe; - card?: Maybe; - common?: Maybe; - proposal?: Maybe; - subscription?: Maybe; -}; - -export type PaymentFees = { - __typename?: 'PaymentFees'; - amount?: Maybe; - currency?: Maybe; -}; - -export type PaymentSource = { - __typename?: 'PaymentSource'; - type: PaymentSourceType; - id?: Maybe; -}; - -export type PaymentAmount = { - __typename?: 'PaymentAmount'; - currency?: Maybe; - amount?: Maybe; -}; - -export type Balance = { - __typename?: 'Balance'; - available?: Maybe; - unsettled?: Maybe; -}; - -export type Amount = { - __typename?: 'Amount'; - amount?: Maybe; - currency?: Maybe; -}; - -export enum ProposalType { - FundingRequest = 'fundingRequest', - Join = 'join' -} - -export enum ProposalState { - PassedInsufficientBalance = 'passedInsufficientBalance', - Countdown = 'countdown', - Passed = 'passed', - Failed = 'failed' -} - -export enum ProposalVoteOutcome { - Approved = 'approved', - Rejected = 'rejected' -} - -export enum ProposalPaymentState { - NotAttempted = 'notAttempted', - NotRelevant = 'notRelevant', - Confirmed = 'confirmed', - Pending = 'pending', - Failed = 'failed' -} - -export enum ProposalFundingState { - NotRelevant = 'notRelevant', - NotAvailable = 'notAvailable', - Available = 'available', - Funded = 'funded' -} - -/** The proposals type */ -export type Proposal = { - __typename?: 'Proposal'; - id: Scalars['ID']; - createdAt: Scalars['Date']; - updatedAt: Scalars['Date']; - commonId: Scalars['ID']; - proposerId: Scalars['ID']; - votesFor: Scalars['Int']; - votesAgainst: Scalars['Int']; - state: ProposalState; - description: ProposalDescription; - type: ProposalType; - paymentState?: Maybe; - fundingState?: Maybe; - /** Details about the funding request. Exists only on funding request proposals */ - fundingRequest?: Maybe; - /** Details about the join request. Exists only on join request proposals */ - join?: Maybe; - votes?: Maybe>>; - common: Common; - proposer: User; -}; - -export type ProposalDescription = { - __typename?: 'ProposalDescription'; - title?: Maybe; - description: Scalars['String']; -}; - -export type ProposalFunding = { - __typename?: 'ProposalFunding'; - amount: Scalars['Int']; -}; - -export type ProposalJoin = { - __typename?: 'ProposalJoin'; - cardId: Scalars['ID']; - funding: Scalars['Int']; - fundingType?: Maybe; -}; - -export type ProposalVote = { - __typename?: 'ProposalVote'; - voteId: Scalars['ID']; - voterId: Scalars['ID']; - outcome: ProposalVoteOutcome; - voter?: Maybe; -}; - -export type Intention = { - __typename?: 'Intention'; - id: Scalars['ID']; - createdAt: Scalars['Date']; - updatedAt: Scalars['Date']; - type: IntentionType; - intention: Scalars['String']; -}; - -export enum IntentionType { - Access = 'access', - Request = 'request' -} - -export type CreateIntentionInput = { - type: IntentionType; - intention: Scalars['String']; -}; - -export enum SubscriptionStatus { - Pending = 'pending', - Active = 'active', - CanceledByUser = 'canceledByUser', - CanceledByPaymentFailure = 'canceledByPaymentFailure', - PaymentFailed = 'paymentFailed' -} - -export type Subscription = { - __typename?: 'Subscription'; - id: Scalars['ID']; - cardId: Scalars['ID']; - userId: Scalars['ID']; - proposalId: Scalars['ID']; - createdAt: Scalars['Date']; - updatedAt: Scalars['Date']; - charges: Scalars['Int']; - amount: Scalars['Int']; - lastChargedAt?: Maybe; - dueDate?: Maybe; - revoked: Scalars['Boolean']; - status: SubscriptionStatus; - metadata: SubscriptionMetadata; -}; - -export type SubscriptionMetadata = { - __typename?: 'SubscriptionMetadata'; - common?: Maybe; -}; - -export type SubscriptionMetadataCommon = { - __typename?: 'SubscriptionMetadataCommon'; - id?: Maybe; - name?: Maybe; -}; - -export type Statistics = { - __typename?: 'Statistics'; - /** Commons, created on that date */ - newCommons?: Maybe; - /** The amount of proposals with join type, created on that date */ - newJoinRequests?: Maybe; - /** The amount of proposals with funding type, created on that date */ - newFundingRequests?: Maybe; - /** The amount of discussions, started on that date */ - newDiscussions?: Maybe; - /** The amount of new discussion messages, send on that date */ - newDiscussionMessages?: Maybe; - commons?: Maybe; - joinRequests?: Maybe; - fundingRequests?: Maybe; - users?: Maybe; -}; - - -export type StatisticsJoinRequestsArgs = { - onlyOpen?: Maybe; -}; - - -export type StatisticsFundingRequestsArgs = { - onlyOpen?: Maybe; -}; - -/** The common type */ -export type Common = { - __typename?: 'Common'; - /** The unique identifier of the common */ - id: Scalars['ID']; - /** The date, at which the common was created */ - createdAt?: Maybe; - /** The date, at which the common was last updated */ - updatedAt?: Maybe; - /** The display name of the common */ - name: Scalars['String']; - /** The currently available funds of the common */ - balance: Scalars['Int']; - /** The total amount of money, raised by the common */ - raised: Scalars['Int']; - metadata: CommonMetadata; - members?: Maybe>>; - proposals?: Maybe>>; - openJoinRequests: Scalars['Int']; - openFundingRequests: Scalars['Int']; -}; - - -/** The common type */ -export type CommonProposalsArgs = { - page?: Maybe; - type?: Maybe; - state?: Maybe; - paymentState?: Maybe; -}; - -export type Query = { - __typename?: 'Query'; - user?: Maybe; - users?: Maybe>>; - wires?: Maybe>>; - event?: Maybe; - events?: Maybe>>; - common?: Maybe; - commons?: Maybe>>; - payout?: Maybe; - payouts?: Maybe>>; - payment?: Maybe; - payments?: Maybe>>; - balance?: Maybe; - proposal?: Maybe; - proposals?: Maybe>>; - statistics?: Maybe; -}; - - -export type QueryUserArgs = { - id: Scalars['ID']; -}; - - -export type QueryUsersArgs = { - page?: Maybe; - perPage?: Maybe; -}; - - -export type QueryWiresArgs = { - page?: Maybe; -}; - - -export type QueryEventArgs = { - eventId: Scalars['ID']; -}; - - -export type QueryEventsArgs = { - last?: Maybe; - after?: Maybe; - type?: Maybe; - objectId?: Maybe; -}; - - -export type QueryCommonArgs = { - commonId: Scalars['ID']; -}; - - -export type QueryCommonsArgs = { - last?: Maybe; - after?: Maybe; -}; - - -export type QueryPayoutArgs = { - id: Scalars['ID']; -}; - - -export type QueryPayoutsArgs = { - page?: Maybe; -}; - - -export type QueryPaymentArgs = { - id: Scalars['ID']; -}; - - -export type QueryPaymentsArgs = { - page?: Maybe; - hanging?: Maybe; -}; - - -export type QueryProposalArgs = { - id: Scalars['ID']; -}; - - -export type QueryProposalsArgs = { - ids?: Maybe>>; - page?: Maybe; - pageItems?: Maybe; - type?: Maybe; - fundingState?: Maybe; -}; - -export type Mutation = { - __typename?: 'Mutation'; - whitelistCommon?: Maybe; - /** Refresh the common members from the events. Returns the new common member count */ - refreshCommonMembers?: Maybe; - executePayouts?: Maybe; - approvePayout?: Maybe; - updatePaymentData?: Maybe; - updatePaymentsCommonId?: Maybe; - createIntention?: Maybe; -}; - - -export type MutationWhitelistCommonArgs = { - commonId: Scalars['ID']; -}; - - -export type MutationRefreshCommonMembersArgs = { - commonId: Scalars['ID']; -}; - - -export type MutationExecutePayoutsArgs = { - input: ExecutePayoutInput; -}; - - -export type MutationApprovePayoutArgs = { - payoutId: Scalars['ID']; - index: Scalars['Int']; - token: Scalars['String']; -}; - - -export type MutationUpdatePaymentDataArgs = { - id: Scalars['ID']; - trackId?: Maybe; -}; - - -export type MutationCreateIntentionArgs = { - input: CreateIntentionInput; -}; - -export type WhitelistCommonMutationVariables = Exact<{ - commonId: Scalars['ID']; -}>; - - -export type WhitelistCommonMutation = ( - { __typename?: 'Mutation' } - & Pick -); - -export type GetLatestEventsQueryVariables = Exact<{ - last?: Maybe; - after?: Maybe; -}>; - - -export type GetLatestEventsQuery = ( - { __typename?: 'Query' } - & { events?: Maybe - & { user?: Maybe<( - { __typename?: 'User' } - & Pick - )> } - )>>> } -); - -export type GetPaymentsQueryVariables = Exact<{ - page?: Maybe; -}>; - - -export type GetPaymentsQuery = ( - { __typename?: 'Query' } - & { payments?: Maybe - & { user?: Maybe<( - { __typename?: 'User' } - & Pick - )>, amount: ( - { __typename?: 'PaymentAmount' } - & Pick - ) } - )>>> } -); - -export type GetPaymentDetailsQueryVariables = Exact<{ - paymentId: Scalars['ID']; -}>; - - -export type GetPaymentDetailsQuery = ( - { __typename?: 'Query' } - & { payment?: Maybe<( - { __typename?: 'Payment' } - & Pick - & { common?: Maybe<( - { __typename?: 'Common' } - & Pick - )>, amount: ( - { __typename?: 'PaymentAmount' } - & Pick - ), fees?: Maybe<( - { __typename?: 'PaymentFees' } - & Pick - )>, card?: Maybe<( - { __typename?: 'Card' } - & Pick - & { metadata?: Maybe<( - { __typename?: 'CardMetadata' } - & Pick - )> } - )> } - )> } -); - -export type GetUserPermissionsQueryVariables = Exact<{ - userId: Scalars['ID']; -}>; - - -export type GetUserPermissionsQuery = ( - { __typename?: 'Query' } - & { user?: Maybe<( - { __typename?: 'User' } - & Pick - )> } -); - -export type GetCommonDetailsQueryVariables = Exact<{ - commonId: Scalars['ID']; - page: Scalars['Int']; -}>; - - -export type GetCommonDetailsQuery = ( - { __typename?: 'Query' } - & { common?: Maybe<( - { __typename?: 'Common' } - & Pick - & { metadata: ( - { __typename?: 'CommonMetadata' } - & Pick - ), members?: Maybe - & { user?: Maybe<( - { __typename?: 'User' } - & Pick - )> } - )>>>, proposals?: Maybe - & { fundingRequest?: Maybe<( - { __typename?: 'ProposalFunding' } - & Pick - )>, join?: Maybe<( - { __typename?: 'ProposalJoin' } - & Pick - )>, description: ( - { __typename?: 'ProposalDescription' } - & Pick - ) } - )>>> } - )> } -); - -export type GetCommonsHomescreenDataQueryVariables = Exact<{ - last?: Maybe; - after?: Maybe; -}>; - - -export type GetCommonsHomescreenDataQuery = ( - { __typename?: 'Query' } - & { commons?: Maybe - & { members?: Maybe - )>>>, metadata: ( - { __typename?: 'CommonMetadata' } - & Pick - ) } - )>>> } -); - -export type GetDashboardDataQueryVariables = Exact<{ [key: string]: never; }>; - - -export type GetDashboardDataQuery = ( - { __typename?: 'Query' } - & { statistics?: Maybe<( - { __typename?: 'Statistics' } - & Pick - )> } -); - -export type StatisticsQueryVariables = Exact<{ [key: string]: never; }>; - - -export type StatisticsQuery = ( - { __typename?: 'Query' } - & { statistics?: Maybe<( - { __typename?: 'Statistics' } - & Pick - )> } -); - -export type CreateIntentionMutationVariables = Exact<{ - type: IntentionType; - intention: Scalars['String']; -}>; - - -export type CreateIntentionMutation = ( - { __typename?: 'Mutation' } - & { createIntention?: Maybe<( - { __typename?: 'Intention' } - & Pick - )> } -); - -export type GetFinancialsDataQueryVariables = Exact<{ [key: string]: never; }>; - - -export type GetFinancialsDataQuery = ( - { __typename?: 'Query' } - & { balance?: Maybe<( - { __typename?: 'Balance' } - & { available?: Maybe<( - { __typename?: 'Amount' } - & Pick - )>, unsettled?: Maybe<( - { __typename?: 'Amount' } - & Pick - )> } - )>, hangingPayments?: Maybe - )>>> } -); - -export type GetPaymentsHomeScreenDataQueryVariables = Exact<{ [key: string]: never; }>; - - -export type GetPaymentsHomeScreenDataQuery = ( - { __typename?: 'Query' } - & { hangingPayments?: Maybe - )>>> } -); - -export type UpdatePaymentDataMutationVariables = Exact<{ - paymentId: Scalars['ID']; -}>; - - -export type UpdatePaymentDataMutation = ( - { __typename?: 'Mutation' } - & Pick -); - -export type GetConfirmPayoutDataQueryVariables = Exact<{ - payoutId: Scalars['ID']; -}>; - - -export type GetConfirmPayoutDataQuery = ( - { __typename?: 'Query' } - & { payout?: Maybe<( - { __typename?: 'Payout' } - & Pick - & { proposals?: Maybe - & { description: ( - { __typename?: 'ProposalDescription' } - & Pick - ), fundingRequest?: Maybe<( - { __typename?: 'ProposalFunding' } - & Pick - )> } - )>>> } - )> } -); - -export type ApprovePayoutMutationVariables = Exact<{ - payoutId: Scalars['ID']; - token: Scalars['String']; - index: Scalars['Int']; -}>; - - -export type ApprovePayoutMutation = ( - { __typename?: 'Mutation' } - & Pick -); - -export type GetProposalsSelectedForBatchQueryVariables = Exact<{ - ids: Array | Scalars['String']; -}>; - - -export type GetProposalsSelectedForBatchQuery = ( - { __typename?: 'Query' } - & { proposals?: Maybe - & { proposer: ( - { __typename?: 'User' } - & Pick - ), description: ( - { __typename?: 'ProposalDescription' } - & Pick - ), common: ( - { __typename?: 'Common' } - & Pick - ), fundingRequest?: Maybe<( - { __typename?: 'ProposalFunding' } - & Pick - )> } - )>>>, wires?: Maybe - & { billingDetails?: Maybe<( - { __typename?: 'WireBillingDetailsType' } - & Pick - )> } - )>>> } -); - -export type ExecutePayoutMutationVariables = Exact<{ - input: ExecutePayoutInput; -}>; - - -export type ExecutePayoutMutation = ( - { __typename?: 'Mutation' } - & { executePayouts?: Maybe<( - { __typename?: 'Payout' } - & Pick - )> } -); - -export type GetPayoutDetailsQueryVariables = Exact<{ - payoutId: Scalars['ID']; -}>; - - -export type GetPayoutDetailsQuery = ( - { __typename?: 'Query' } - & { payout?: Maybe<( - { __typename?: 'Payout' } - & Pick - & { proposals?: Maybe - & { fundingRequest?: Maybe<( - { __typename?: 'ProposalFunding' } - & Pick - )>, description: ( - { __typename?: 'ProposalDescription' } - & Pick - ) } - )>>>, security?: Maybe - )>>> } - )> } -); - -export type GetPayoutsPageDataQueryVariables = Exact<{ - fundingState?: Maybe; - fundingRequestPage?: Maybe; -}>; - - -export type GetPayoutsPageDataQuery = ( - { __typename?: 'Query' } - & { proposals?: Maybe - & { description: ( - { __typename?: 'ProposalDescription' } - & Pick - ), fundingRequest?: Maybe<( - { __typename?: 'ProposalFunding' } - & Pick - )> } - )>>>, payouts?: Maybe - )>>> } -); - -export type GetProposalDetailsQueryVariables = Exact<{ - proposalId: Scalars['ID']; -}>; - - -export type GetProposalDetailsQuery = ( - { __typename?: 'Query' } - & { proposal?: Maybe<( - { __typename?: 'Proposal' } - & Pick - & { join?: Maybe<( - { __typename?: 'ProposalJoin' } - & Pick - )>, fundingRequest?: Maybe<( - { __typename?: 'ProposalFunding' } - & Pick - )>, proposer: ( - { __typename?: 'User' } - & Pick - ), common: ( - { __typename?: 'Common' } - & { members?: Maybe - )>>> } - ), description: ( - { __typename?: 'ProposalDescription' } - & Pick - ), votes?: Maybe - & { voter?: Maybe<( - { __typename?: 'User' } - & Pick - )> } - )>>> } - )> } -); - -export type GetProposalsHomescreenQueryVariables = Exact<{ - fundingPage?: Maybe; - joinPage?: Maybe; -}>; - - -export type GetProposalsHomescreenQuery = ( - { __typename?: 'Query' } - & { funding?: Maybe - & { votes?: Maybe - )>>>, description: ( - { __typename?: 'ProposalDescription' } - & Pick - ), fundingRequest?: Maybe<( - { __typename?: 'ProposalFunding' } - & Pick - )> } - )>>>, join?: Maybe - & { description: ( - { __typename?: 'ProposalDescription' } - & Pick - ), join?: Maybe<( - { __typename?: 'ProposalJoin' } - & Pick - )> } - )>>> } -); - -export type GetUserDetailsQueryQueryVariables = Exact<{ - userId: Scalars['ID']; -}>; - - -export type GetUserDetailsQueryQuery = ( - { __typename?: 'Query' } - & { user?: Maybe<( - { __typename?: 'User' } - & Pick - & { proposals?: Maybe - & { description: ( - { __typename?: 'ProposalDescription' } - & Pick - ) } - )>>>, subscriptions?: Maybe - & { metadata: ( - { __typename?: 'SubscriptionMetadata' } - & { common?: Maybe<( - { __typename?: 'SubscriptionMetadataCommon' } - & Pick - )> } - ) } - )>>> } - )> } -); - -export type GetUsersHomepageDataQueryVariables = Exact<{ - page?: Maybe; - perPage?: Maybe; -}>; - - -export type GetUsersHomepageDataQuery = ( - { __typename?: 'Query' } - & { users?: Maybe - )>>> } -); - - -export const WhitelistCommonDocument = gql` - mutation whitelistCommon($commonId: ID!) { - whitelistCommon(commonId: $commonId) -} - `; -export type WhitelistCommonMutationFn = Apollo.MutationFunction; - -/** - * __useWhitelistCommonMutation__ - * - * To run a mutation, you first call `useWhitelistCommonMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useWhitelistCommonMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [whitelistCommonMutation, { data, loading, error }] = useWhitelistCommonMutation({ - * variables: { - * commonId: // value for 'commonId' - * }, - * }); - */ -export function useWhitelistCommonMutation(baseOptions?: Apollo.MutationHookOptions) { - return Apollo.useMutation(WhitelistCommonDocument, baseOptions); - } -export type WhitelistCommonMutationHookResult = ReturnType; -export type WhitelistCommonMutationResult = Apollo.MutationResult; -export type WhitelistCommonMutationOptions = Apollo.BaseMutationOptions; -export const GetLatestEventsDocument = gql` - query GetLatestEvents($last: Int = 10, $after: Int = 0) { - events(last: $last, after: $after) { - id - createdAt - type - user { - id - firstName - lastName - photoURL - } - } -} - `; - -/** - * __useGetLatestEventsQuery__ - * - * To run a query within a React component, call `useGetLatestEventsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetLatestEventsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetLatestEventsQuery({ - * variables: { - * last: // value for 'last' - * after: // value for 'after' - * }, - * }); - */ -export function useGetLatestEventsQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetLatestEventsDocument, baseOptions); - } -export function useGetLatestEventsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetLatestEventsDocument, baseOptions); - } -export type GetLatestEventsQueryHookResult = ReturnType; -export type GetLatestEventsLazyQueryHookResult = ReturnType; -export type GetLatestEventsQueryResult = Apollo.QueryResult; -export const GetPaymentsDocument = gql` - query GetPayments($page: Int = 1) { - payments: payments(page: $page) { - id - type - status - user { - id - firstName - lastName - photoURL - email - } - amount { - amount - currency - } - } -} - `; - -/** - * __useGetPaymentsQuery__ - * - * To run a query within a React component, call `useGetPaymentsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetPaymentsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetPaymentsQuery({ - * variables: { - * page: // value for 'page' - * }, - * }); - */ -export function useGetPaymentsQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetPaymentsDocument, baseOptions); - } -export function useGetPaymentsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetPaymentsDocument, baseOptions); - } -export type GetPaymentsQueryHookResult = ReturnType; -export type GetPaymentsLazyQueryHookResult = ReturnType; -export type GetPaymentsQueryResult = Apollo.QueryResult; -export const GetPaymentDetailsDocument = gql` - query GetPaymentDetails($paymentId: ID!) { - payment(id: $paymentId) { - type - common { - id - name - } - amount { - amount - currency - } - fees { - amount - currency - } - card { - id - metadata { - digits - network - } - } - } -} - `; - -/** - * __useGetPaymentDetailsQuery__ - * - * To run a query within a React component, call `useGetPaymentDetailsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetPaymentDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetPaymentDetailsQuery({ - * variables: { - * paymentId: // value for 'paymentId' - * }, - * }); - */ -export function useGetPaymentDetailsQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetPaymentDetailsDocument, baseOptions); - } -export function useGetPaymentDetailsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetPaymentDetailsDocument, baseOptions); - } -export type GetPaymentDetailsQueryHookResult = ReturnType; -export type GetPaymentDetailsLazyQueryHookResult = ReturnType; -export type GetPaymentDetailsQueryResult = Apollo.QueryResult; -export const GetUserPermissionsDocument = gql` - query getUserPermissions($userId: ID!) { - user(id: $userId) { - permissions - } -} - `; - -/** - * __useGetUserPermissionsQuery__ - * - * To run a query within a React component, call `useGetUserPermissionsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetUserPermissionsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetUserPermissionsQuery({ - * variables: { - * userId: // value for 'userId' - * }, - * }); - */ -export function useGetUserPermissionsQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetUserPermissionsDocument, baseOptions); - } -export function useGetUserPermissionsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetUserPermissionsDocument, baseOptions); - } -export type GetUserPermissionsQueryHookResult = ReturnType; -export type GetUserPermissionsLazyQueryHookResult = ReturnType; -export type GetUserPermissionsQueryResult = Apollo.QueryResult; -export const GetCommonDetailsDocument = gql` - query getCommonDetails($commonId: ID!, $page: Int!) { - common(commonId: $commonId) { - name - createdAt - updatedAt - balance - raised - openFundingRequests - openJoinRequests - metadata { - byline - description - founderId - contributionType - } - members { - userId - joinedAt - user { - firstName - lastName - } - } - proposals(page: $page) { - id - type - fundingRequest { - amount - } - join { - fundingType - funding - } - description { - description - } - } - } -} - `; - -/** - * __useGetCommonDetailsQuery__ - * - * To run a query within a React component, call `useGetCommonDetailsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetCommonDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetCommonDetailsQuery({ - * variables: { - * commonId: // value for 'commonId' - * page: // value for 'page' - * }, - * }); - */ -export function useGetCommonDetailsQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetCommonDetailsDocument, baseOptions); - } -export function useGetCommonDetailsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetCommonDetailsDocument, baseOptions); - } -export type GetCommonDetailsQueryHookResult = ReturnType; -export type GetCommonDetailsLazyQueryHookResult = ReturnType; -export type GetCommonDetailsQueryResult = Apollo.QueryResult; -export const GetCommonsHomescreenDataDocument = gql` - query getCommonsHomescreenData($last: Int, $after: Int) { - commons(last: $last, after: $after) { - id - name - raised - balance - createdAt - updatedAt - members { - userId - } - metadata { - byline - description - contributionType - } - } -} - `; - -/** - * __useGetCommonsHomescreenDataQuery__ - * - * To run a query within a React component, call `useGetCommonsHomescreenDataQuery` and pass it any options that fit your needs. - * When your component renders, `useGetCommonsHomescreenDataQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetCommonsHomescreenDataQuery({ - * variables: { - * last: // value for 'last' - * after: // value for 'after' - * }, - * }); - */ -export function useGetCommonsHomescreenDataQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetCommonsHomescreenDataDocument, baseOptions); - } -export function useGetCommonsHomescreenDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetCommonsHomescreenDataDocument, baseOptions); - } -export type GetCommonsHomescreenDataQueryHookResult = ReturnType; -export type GetCommonsHomescreenDataLazyQueryHookResult = ReturnType; -export type GetCommonsHomescreenDataQueryResult = Apollo.QueryResult; -export const GetDashboardDataDocument = gql` - query getDashboardData { - statistics { - newCommons - newJoinRequests - newFundingRequests - newDiscussions - newDiscussionMessages - } -} - `; - -/** - * __useGetDashboardDataQuery__ - * - * To run a query within a React component, call `useGetDashboardDataQuery` and pass it any options that fit your needs. - * When your component renders, `useGetDashboardDataQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetDashboardDataQuery({ - * variables: { - * }, - * }); - */ -export function useGetDashboardDataQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetDashboardDataDocument, baseOptions); - } -export function useGetDashboardDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetDashboardDataDocument, baseOptions); - } -export type GetDashboardDataQueryHookResult = ReturnType; -export type GetDashboardDataLazyQueryHookResult = ReturnType; -export type GetDashboardDataQueryResult = Apollo.QueryResult; -export const StatisticsDocument = gql` - query Statistics { - statistics { - users - commons - joinRequests - fundingRequests - } -} - `; - -/** - * __useStatisticsQuery__ - * - * To run a query within a React component, call `useStatisticsQuery` and pass it any options that fit your needs. - * When your component renders, `useStatisticsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useStatisticsQuery({ - * variables: { - * }, - * }); - */ -export function useStatisticsQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(StatisticsDocument, baseOptions); - } -export function useStatisticsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(StatisticsDocument, baseOptions); - } -export type StatisticsQueryHookResult = ReturnType; -export type StatisticsLazyQueryHookResult = ReturnType; -export type StatisticsQueryResult = Apollo.QueryResult; -export const CreateIntentionDocument = gql` - mutation createIntention($type: IntentionType!, $intention: String!) { - createIntention(input: {type: $type, intention: $intention}) { - id - } -} - `; -export type CreateIntentionMutationFn = Apollo.MutationFunction; - -/** - * __useCreateIntentionMutation__ - * - * To run a mutation, you first call `useCreateIntentionMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useCreateIntentionMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [createIntentionMutation, { data, loading, error }] = useCreateIntentionMutation({ - * variables: { - * type: // value for 'type' - * intention: // value for 'intention' - * }, - * }); - */ -export function useCreateIntentionMutation(baseOptions?: Apollo.MutationHookOptions) { - return Apollo.useMutation(CreateIntentionDocument, baseOptions); - } -export type CreateIntentionMutationHookResult = ReturnType; -export type CreateIntentionMutationResult = Apollo.MutationResult; -export type CreateIntentionMutationOptions = Apollo.BaseMutationOptions; -export const GetFinancialsDataDocument = gql` - query GetFinancialsData { - balance { - available { - amount - currency - } - unsettled { - amount - currency - } - } - hangingPayments: payments(hanging: true) { - id - createdAt - updatedAt - status - } -} - `; - -/** - * __useGetFinancialsDataQuery__ - * - * To run a query within a React component, call `useGetFinancialsDataQuery` and pass it any options that fit your needs. - * When your component renders, `useGetFinancialsDataQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetFinancialsDataQuery({ - * variables: { - * }, - * }); - */ -export function useGetFinancialsDataQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetFinancialsDataDocument, baseOptions); - } -export function useGetFinancialsDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetFinancialsDataDocument, baseOptions); - } -export type GetFinancialsDataQueryHookResult = ReturnType; -export type GetFinancialsDataLazyQueryHookResult = ReturnType; -export type GetFinancialsDataQueryResult = Apollo.QueryResult; -export const GetPaymentsHomeScreenDataDocument = gql` - query GetPaymentsHomeScreenData { - hangingPayments: payments(hanging: true) { - id - createdAt - updatedAt - status - } -} - `; - -/** - * __useGetPaymentsHomeScreenDataQuery__ - * - * To run a query within a React component, call `useGetPaymentsHomeScreenDataQuery` and pass it any options that fit your needs. - * When your component renders, `useGetPaymentsHomeScreenDataQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetPaymentsHomeScreenDataQuery({ - * variables: { - * }, - * }); - */ -export function useGetPaymentsHomeScreenDataQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetPaymentsHomeScreenDataDocument, baseOptions); - } -export function useGetPaymentsHomeScreenDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetPaymentsHomeScreenDataDocument, baseOptions); - } -export type GetPaymentsHomeScreenDataQueryHookResult = ReturnType; -export type GetPaymentsHomeScreenDataLazyQueryHookResult = ReturnType; -export type GetPaymentsHomeScreenDataQueryResult = Apollo.QueryResult; -export const UpdatePaymentDataDocument = gql` - mutation UpdatePaymentData($paymentId: ID!) { - updatePaymentData(id: $paymentId) -} - `; -export type UpdatePaymentDataMutationFn = Apollo.MutationFunction; - -/** - * __useUpdatePaymentDataMutation__ - * - * To run a mutation, you first call `useUpdatePaymentDataMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useUpdatePaymentDataMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [updatePaymentDataMutation, { data, loading, error }] = useUpdatePaymentDataMutation({ - * variables: { - * paymentId: // value for 'paymentId' - * }, - * }); - */ -export function useUpdatePaymentDataMutation(baseOptions?: Apollo.MutationHookOptions) { - return Apollo.useMutation(UpdatePaymentDataDocument, baseOptions); - } -export type UpdatePaymentDataMutationHookResult = ReturnType; -export type UpdatePaymentDataMutationResult = Apollo.MutationResult; -export type UpdatePaymentDataMutationOptions = Apollo.BaseMutationOptions; -export const GetConfirmPayoutDataDocument = gql` - query GetConfirmPayoutData($payoutId: ID!) { - payout(id: $payoutId) { - amount - proposals { - id - description { - title - description - } - fundingRequest { - amount - } - } - } -} - `; - -/** - * __useGetConfirmPayoutDataQuery__ - * - * To run a query within a React component, call `useGetConfirmPayoutDataQuery` and pass it any options that fit your needs. - * When your component renders, `useGetConfirmPayoutDataQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetConfirmPayoutDataQuery({ - * variables: { - * payoutId: // value for 'payoutId' - * }, - * }); - */ -export function useGetConfirmPayoutDataQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetConfirmPayoutDataDocument, baseOptions); - } -export function useGetConfirmPayoutDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetConfirmPayoutDataDocument, baseOptions); - } -export type GetConfirmPayoutDataQueryHookResult = ReturnType; -export type GetConfirmPayoutDataLazyQueryHookResult = ReturnType; -export type GetConfirmPayoutDataQueryResult = Apollo.QueryResult; -export const ApprovePayoutDocument = gql` - mutation ApprovePayout($payoutId: ID!, $token: String!, $index: Int!) { - approvePayout(payoutId: $payoutId, token: $token, index: $index) -} - `; -export type ApprovePayoutMutationFn = Apollo.MutationFunction; - -/** - * __useApprovePayoutMutation__ - * - * To run a mutation, you first call `useApprovePayoutMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useApprovePayoutMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [approvePayoutMutation, { data, loading, error }] = useApprovePayoutMutation({ - * variables: { - * payoutId: // value for 'payoutId' - * token: // value for 'token' - * index: // value for 'index' - * }, - * }); - */ -export function useApprovePayoutMutation(baseOptions?: Apollo.MutationHookOptions) { - return Apollo.useMutation(ApprovePayoutDocument, baseOptions); - } -export type ApprovePayoutMutationHookResult = ReturnType; -export type ApprovePayoutMutationResult = Apollo.MutationResult; -export type ApprovePayoutMutationOptions = Apollo.BaseMutationOptions; -export const GetProposalsSelectedForBatchDocument = gql` - query getProposalsSelectedForBatch($ids: [String!]!) { - proposals(ids: $ids) { - id - state - fundingState - proposer { - firstName - lastName - } - description { - title - description - } - common { - name - } - fundingRequest { - amount - } - } - wires { - id - description - billingDetails { - city - country - name - } - } -} - `; - -/** - * __useGetProposalsSelectedForBatchQuery__ - * - * To run a query within a React component, call `useGetProposalsSelectedForBatchQuery` and pass it any options that fit your needs. - * When your component renders, `useGetProposalsSelectedForBatchQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetProposalsSelectedForBatchQuery({ - * variables: { - * ids: // value for 'ids' - * }, - * }); - */ -export function useGetProposalsSelectedForBatchQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetProposalsSelectedForBatchDocument, baseOptions); - } -export function useGetProposalsSelectedForBatchLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetProposalsSelectedForBatchDocument, baseOptions); - } -export type GetProposalsSelectedForBatchQueryHookResult = ReturnType; -export type GetProposalsSelectedForBatchLazyQueryHookResult = ReturnType; -export type GetProposalsSelectedForBatchQueryResult = Apollo.QueryResult; -export const ExecutePayoutDocument = gql` - mutation ExecutePayout($input: ExecutePayoutInput!) { - executePayouts(input: $input) { - id - } -} - `; -export type ExecutePayoutMutationFn = Apollo.MutationFunction; - -/** - * __useExecutePayoutMutation__ - * - * To run a mutation, you first call `useExecutePayoutMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useExecutePayoutMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [executePayoutMutation, { data, loading, error }] = useExecutePayoutMutation({ - * variables: { - * input: // value for 'input' - * }, - * }); - */ -export function useExecutePayoutMutation(baseOptions?: Apollo.MutationHookOptions) { - return Apollo.useMutation(ExecutePayoutDocument, baseOptions); - } -export type ExecutePayoutMutationHookResult = ReturnType; -export type ExecutePayoutMutationResult = Apollo.MutationResult; -export type ExecutePayoutMutationOptions = Apollo.BaseMutationOptions; -export const GetPayoutDetailsDocument = gql` - query GetPayoutDetails($payoutId: ID!) { - payout(id: $payoutId) { - voided - executed - status - proposals { - id - fundingRequest { - amount - } - description { - title - description - } - } - security { - id - redeemed - redemptionAttempts - } - } -} - `; - -/** - * __useGetPayoutDetailsQuery__ - * - * To run a query within a React component, call `useGetPayoutDetailsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetPayoutDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetPayoutDetailsQuery({ - * variables: { - * payoutId: // value for 'payoutId' - * }, - * }); - */ -export function useGetPayoutDetailsQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetPayoutDetailsDocument, baseOptions); - } -export function useGetPayoutDetailsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetPayoutDetailsDocument, baseOptions); - } -export type GetPayoutDetailsQueryHookResult = ReturnType; -export type GetPayoutDetailsLazyQueryHookResult = ReturnType; -export type GetPayoutDetailsQueryResult = Apollo.QueryResult; -export const GetPayoutsPageDataDocument = gql` - query getPayoutsPageData($fundingState: ProposalFundingState, $fundingRequestPage: Int) { - proposals( - type: fundingRequest - page: $fundingRequestPage - fundingState: $fundingState - ) { - id - commonId - proposerId - type - description { - title - } - fundingRequest { - amount - } - createdAt - updatedAt - state - fundingState - } - payouts { - id - amount - voided - executed - status - proposalIds - } -} - `; - -/** - * __useGetPayoutsPageDataQuery__ - * - * To run a query within a React component, call `useGetPayoutsPageDataQuery` and pass it any options that fit your needs. - * When your component renders, `useGetPayoutsPageDataQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetPayoutsPageDataQuery({ - * variables: { - * fundingState: // value for 'fundingState' - * fundingRequestPage: // value for 'fundingRequestPage' - * }, - * }); - */ -export function useGetPayoutsPageDataQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetPayoutsPageDataDocument, baseOptions); - } -export function useGetPayoutsPageDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetPayoutsPageDataDocument, baseOptions); - } -export type GetPayoutsPageDataQueryHookResult = ReturnType; -export type GetPayoutsPageDataLazyQueryHookResult = ReturnType; -export type GetPayoutsPageDataQueryResult = Apollo.QueryResult; -export const GetProposalDetailsDocument = gql` - query getProposalDetails($proposalId: ID!) { - proposal(id: $proposalId) { - id - join { - funding - fundingType - } - fundingRequest { - amount - } - type - createdAt - updatedAt - votesFor - votesAgainst - state - paymentState - proposer { - id - firstName - lastName - } - common { - members { - userId - } - } - description { - description - } - votes { - outcome - voter { - id - firstName - lastName - } - } - } -} - `; - -/** - * __useGetProposalDetailsQuery__ - * - * To run a query within a React component, call `useGetProposalDetailsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetProposalDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetProposalDetailsQuery({ - * variables: { - * proposalId: // value for 'proposalId' - * }, - * }); - */ -export function useGetProposalDetailsQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetProposalDetailsDocument, baseOptions); - } -export function useGetProposalDetailsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetProposalDetailsDocument, baseOptions); - } -export type GetProposalDetailsQueryHookResult = ReturnType; -export type GetProposalDetailsLazyQueryHookResult = ReturnType; -export type GetProposalDetailsQueryResult = Apollo.QueryResult; -export const GetProposalsHomescreenDocument = gql` - query getProposalsHomescreen($fundingPage: Int, $joinPage: Int) { - funding: proposals(type: fundingRequest, page: $fundingPage) { - id - commonId - votes { - outcome - } - votesFor - votesAgainst - description { - title - description - } - fundingRequest { - amount - } - } - join: proposals(type: join, page: $joinPage) { - id - commonId - description { - title - description - } - join { - funding - fundingType - } - } -} - `; - -/** - * __useGetProposalsHomescreenQuery__ - * - * To run a query within a React component, call `useGetProposalsHomescreenQuery` and pass it any options that fit your needs. - * When your component renders, `useGetProposalsHomescreenQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetProposalsHomescreenQuery({ - * variables: { - * fundingPage: // value for 'fundingPage' - * joinPage: // value for 'joinPage' - * }, - * }); - */ -export function useGetProposalsHomescreenQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetProposalsHomescreenDocument, baseOptions); - } -export function useGetProposalsHomescreenLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetProposalsHomescreenDocument, baseOptions); - } -export type GetProposalsHomescreenQueryHookResult = ReturnType; -export type GetProposalsHomescreenLazyQueryHookResult = ReturnType; -export type GetProposalsHomescreenQueryResult = Apollo.QueryResult; -export const GetUserDetailsQueryDocument = gql` - query getUserDetailsQuery($userId: ID!) { - user(id: $userId) { - id - firstName - lastName - email - createdAt - photoURL - proposals { - id - type - state - paymentState - description { - title - } - } - subscriptions { - id - amount - metadata { - common { - id - name - } - } - status - revoked - createdAt - updatedAt - lastChargedAt - dueDate - } - } -} - `; - -/** - * __useGetUserDetailsQueryQuery__ - * - * To run a query within a React component, call `useGetUserDetailsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useGetUserDetailsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetUserDetailsQueryQuery({ - * variables: { - * userId: // value for 'userId' - * }, - * }); - */ -export function useGetUserDetailsQueryQuery(baseOptions: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetUserDetailsQueryDocument, baseOptions); - } -export function useGetUserDetailsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetUserDetailsQueryDocument, baseOptions); - } -export type GetUserDetailsQueryQueryHookResult = ReturnType; -export type GetUserDetailsQueryLazyQueryHookResult = ReturnType; -export type GetUserDetailsQueryQueryResult = Apollo.QueryResult; -export const GetUsersHomepageDataDocument = gql` - query getUsersHomepageData($page: Int = 1, $perPage: Int = 15) { - users(page: $page, perPage: $perPage) { - id - photoURL - email - firstName - lastName - createdAt - } -} - `; - -/** - * __useGetUsersHomepageDataQuery__ - * - * To run a query within a React component, call `useGetUsersHomepageDataQuery` and pass it any options that fit your needs. - * When your component renders, `useGetUsersHomepageDataQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetUsersHomepageDataQuery({ - * variables: { - * page: // value for 'page' - * perPage: // value for 'perPage' - * }, - * }); - */ -export function useGetUsersHomepageDataQuery(baseOptions?: Apollo.QueryHookOptions) { - return Apollo.useQuery(GetUsersHomepageDataDocument, baseOptions); - } -export function useGetUsersHomepageDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - return Apollo.useLazyQuery(GetUsersHomepageDataDocument, baseOptions); - } -export type GetUsersHomepageDataQueryHookResult = ReturnType; -export type GetUsersHomepageDataLazyQueryHookResult = ReturnType; -export type GetUsersHomepageDataQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/packages/web/src/index.tsx b/packages/web/src/index.tsx index 54e14a751..f839a3d3d 100644 --- a/packages/web/src/index.tsx +++ b/packages/web/src/index.tsx @@ -1,16 +1,15 @@ import React from "react"; import ReactDOM from "react-dom"; -import { Provider } from "react-redux"; +import { IfFirebaseAuthed, IfFirebaseUnAuthed } from '@react-firebase/auth'; import { Router } from "react-router-dom"; import { ApolloProvider } from './providers/ApolloProvider'; +import { AuthenticationProvider } from './providers/AuthenticationProvider'; +import { UserContextProvider } from './context/UserContext'; -import configureStore from "./store"; import "./index.scss"; import App from "./containers/App/App"; import history from "./shared/history"; -const { store } = configureStore(history); - if (process.env.REACT_APP_ENV === "dev") { // eslint-disable-next-line @typescript-eslint/no-var-requires const whyDidYouRender = require("@welldone-software/why-did-you-render"); @@ -19,13 +18,22 @@ if (process.env.REACT_APP_ENV === "dev") { ReactDOM.render( - + - + + {() => ( + + + + )} + + + + {() => } + + - + , document.getElementById("root"), ); - -export default store; diff --git a/packages/web/src/providers/AuthenticationProvider.tsx b/packages/web/src/providers/AuthenticationProvider.tsx new file mode 100644 index 000000000..369dd5033 --- /dev/null +++ b/packages/web/src/providers/AuthenticationProvider.tsx @@ -0,0 +1,51 @@ +import "firebase/auth"; + +import React from "react"; +import firebase from "firebase/app"; +import { FirebaseAuthProvider, IfFirebaseUnAuthed, IfFirebaseAuthed } from "@react-firebase/auth"; + +import { useAuthState } from "react-firebase-hooks/auth"; + +// TODO: Replace with actual firebase creds +const config = { + apiKey: "process.env['NEXT_PUBLIC_Firebase.ApiKey']", + projectId: "process.env['NEXT_PUBLIC_Firebase.ProjectId']", + authDomain: "process.env['NEXT_PUBLIC_Firebase.AuthDomain']", + databaseURL: "process.env['NEXT_PUBLIC_Firebase.DatabaseUrl']", +}; + +export const AuthenticationProvider: React.FC> = ({ children }) => { + return ( + + + {children} + + + + + ); +}; + +const AuthenticationRedirection = () => { + const [user, loading, error] = useAuthState(firebase.auth()); + + return ( + + + {() => { + // If the user is not authenticated and is not on the login + // page redirect it to that page + console.log("Redirected unauthenticated user to the login page", loading, user, error); + }} + + + + {() => { + // If the user is authenticated and is on the login page + // redirect it to the homepage + console.log("Redirected unauthenticated user to the login page", loading, user, error); + }} + + + ); +}; diff --git a/packages/web/src/shared/utils/shared.tsx b/packages/web/src/shared/utils/shared.tsx index b78f22bff..d3a9e5b41 100644 --- a/packages/web/src/shared/utils/shared.tsx +++ b/packages/web/src/shared/utils/shared.tsx @@ -1,4 +1,4 @@ -import { Time, User } from "../models"; +import { User } from '../../graphql'; export const formatPrice = (price?: number) => { if (price) return `$${price.toLocaleString("en")}`; @@ -12,11 +12,11 @@ export const getUserName = (user: User | undefined) => { export const getUserInitials = (user: User | undefined) => { if (!user) return ""; - return user.displayName || `${user.firstName[0]}${user.lastName[0]}`; + return user.displayName || `${user.firstName?.[0]}${user.lastName?.[0]}`; }; -export const getDaysAgo = (currentDate: Date, time: Time) => { - const previousDate = new Date(time.seconds * 1000); +export const getDaysAgo = (currentDate: Date, time: Date) => { + const previousDate = new Date(time); const differenceInTime = currentDate.getTime() - previousDate.getTime(); const differenceInDays = differenceInTime / (1000 * 3600 * 24); if (differenceInDays < 1) { diff --git a/packages/web/src/store/index.tsx b/packages/web/src/store/index.tsx deleted file mode 100644 index 40dab3335..000000000 --- a/packages/web/src/store/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./store"; diff --git a/packages/web/src/store/reducer.tsx b/packages/web/src/store/reducer.tsx deleted file mode 100755 index be21d9d7d..000000000 --- a/packages/web/src/store/reducer.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { AnyAction, combineReducers } from "redux"; -import { History } from "history"; -import { connectRouter } from "connected-react-router"; - -import { AuthReducer } from "../containers/Auth/store/reducer"; -import { AppState } from "../shared/interfaces/State"; -import { SharedReducer } from "../shared/store/reducer"; -import { commonsReducer } from "../containers/Common/store"; - -export default (history: History) => { - const appReducer = combineReducers({ - auth: AuthReducer, - shared: SharedReducer, - commons: commonsReducer, - router: connectRouter(history), - }); - - return (state: AppState | undefined, action: AnyAction) => { - return appReducer(state, action); - }; -}; diff --git a/packages/web/src/store/saga.tsx b/packages/web/src/store/saga.tsx deleted file mode 100755 index d1e111e62..000000000 --- a/packages/web/src/store/saga.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { all, fork } from "redux-saga/effects"; - -import { saga as authSaga } from "../containers/Auth/store"; -import { commonsSaga } from "../containers/Common/store"; - -const allSagas = [authSaga, commonsSaga]; - -export default function* appSagas() { - yield all(allSagas.map(fork)); -} diff --git a/packages/web/src/store/store.tsx b/packages/web/src/store/store.tsx deleted file mode 100755 index 9d00cfa19..000000000 --- a/packages/web/src/store/store.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { createStore, applyMiddleware, compose, Middleware, Dispatch } from "redux"; -import { History } from "history"; -import { routerMiddleware } from "connected-react-router"; -import { composeWithDevTools } from "redux-devtools-extension"; -import freeze from "redux-freeze"; -import createSagaMiddleware from "redux-saga"; - -import appSagas from "./saga"; -import rootReducer from "./reducer"; - -const sagaMiddleware = createSagaMiddleware(); -let middleware: Array; -// eslint-disable-next-line @typescript-eslint/ban-types -let composer: Function; - -if (process.env.NODE_ENV === "development") { - middleware = [freeze, sagaMiddleware]; - composer = composeWithDevTools({ trace: true, traceLimit: 25 }); -} else { - middleware = [sagaMiddleware]; - composer = compose; -} - -const errorHandlerMiddleware: Middleware = () => (next: Dispatch) => (action) => { - if (action.type.includes("FAILURE")) { - // next( - // showNotification({ - // message: action.payload.error || action.payload.message, - // appearance: "error", - // }), - // ); - - if (action.payload && (action.payload.code === 401 || action.payload.code === 403)) { - localStorage.clear(); - } - } - - if (action.type.includes("SUCCESS") && action.payload && action.payload.message) { - // next( - // showNotification({ - // message: action.payload.message, - // appearance: "success", - // }), - // ); - } - - return next(action); -}; - -export default function configureStore(history: History) { - const store = createStore( - rootReducer(history), - undefined, - composer(applyMiddleware(...middleware, routerMiddleware(history), errorHandlerMiddleware)), - ); - - sagaMiddleware.run(appSagas); - - // eslint-disable-next-line - if ((module as any).hot) { - // eslint-disable-next-line - (module as any).hot.accept(() => store.replaceReducer(rootReducer(history))); - } - - return { store }; -} From d8eaa40c45dac9bfdc5b9ae3a3352df19667e6c8 Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Thu, 13 May 2021 15:14:52 +0300 Subject: [PATCH 4/5] Fix eslint --- packages/web/.eslintrc.js | 40 +++++++++---------- .../AboutTabComponent/AboutTabComponent.tsx | 1 + .../DiscussionDetailModal.tsx | 1 + .../DiscussionsComponent.tsx | 1 + .../CommonListItem/CommonListItem.tsx | 1 + .../CommoContainer/CommonContainer.tsx | 1 + .../CommonDetailContainer.tsx | 1 + .../CommonListContainer.tsx | 1 - .../web/src/context/PermissionsContext.tsx | 1 + .../src/providers/AuthenticationProvider.tsx | 1 - 10 files changed, 26 insertions(+), 23 deletions(-) diff --git a/packages/web/.eslintrc.js b/packages/web/.eslintrc.js index 2c4150488..2c2f57957 100644 --- a/packages/web/.eslintrc.js +++ b/packages/web/.eslintrc.js @@ -42,26 +42,24 @@ module.exports = { "eslint@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/no-explicit-any": 0, "no-console": 1, - // "import/order": [ - // "error", - // { - // groups: [ - // "builtin", // Built-in types are first - // "external", - // ["sibling", "parent"], // Then sibling and parent types. They can be mingled together - // "index", // Then the index file - // "object", - // // Then the rest: internal and external type - // ], - // "newlines-between": "always", - // }, - // ], - // }, - "import/order": 0, + "import/order": [ + "error", + { + groups: [ + "builtin", // Built-in types are first + "external", + ["sibling", "parent"], // Then sibling and parent types. They can be mingled together + "index", // Then the index file + "object", + // Then the rest: internal and external type + ], + "newlines-between": "always", + }, + ], + }, + settings: { + react: { + version: "latest", + }, }, - // settings: { - // react: { - // version: "latest", - // }, - // }, }; diff --git a/packages/web/src/containers/Common/components/CommonDetailContainer/AboutTabComponent/AboutTabComponent.tsx b/packages/web/src/containers/Common/components/CommonDetailContainer/AboutTabComponent/AboutTabComponent.tsx index ee4323054..d00204bdb 100644 --- a/packages/web/src/containers/Common/components/CommonDetailContainer/AboutTabComponent/AboutTabComponent.tsx +++ b/packages/web/src/containers/Common/components/CommonDetailContainer/AboutTabComponent/AboutTabComponent.tsx @@ -1,4 +1,5 @@ import React from "react"; + import { formatPrice } from "../../../../../shared/utils"; import { Common } from "../../../../../graphql"; import "./index.scss"; diff --git a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx index a6f035c95..4a8c9d8f9 100644 --- a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx +++ b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionDetailModal/DiscussionDetailModal.tsx @@ -1,4 +1,5 @@ import React from "react"; + import { Loader } from "../../../../../shared/components"; import { Common, Discussion } from "../../../../../graphql"; import { formatPrice, getDaysAgo, getUserInitials, getUserName } from "../../../../../shared/utils"; diff --git a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionsComponent/DiscussionsComponent.tsx b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionsComponent/DiscussionsComponent.tsx index 308c67ec8..6657cda19 100644 --- a/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionsComponent/DiscussionsComponent.tsx +++ b/packages/web/src/containers/Common/components/CommonDetailContainer/DiscussionsComponent/DiscussionsComponent.tsx @@ -1,4 +1,5 @@ import React from "react"; + import { Discussion } from "../../../../../graphql"; import { getDaysAgo, getUserName } from "../../../../../shared/utils"; import "./index.scss"; diff --git a/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx b/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx index 99fe6dd33..827c0c20c 100644 --- a/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx +++ b/packages/web/src/containers/Common/components/CommonListContainer/CommonListItem/CommonListItem.tsx @@ -1,5 +1,6 @@ import React from "react"; import { Link } from "react-router-dom"; + import { Common } from "../../../../../graphql"; import { formatPrice } from "../../../../../shared/utils"; import "./index.scss"; diff --git a/packages/web/src/containers/Common/containers/CommoContainer/CommonContainer.tsx b/packages/web/src/containers/Common/containers/CommoContainer/CommonContainer.tsx index 1ec824c5b..277825060 100644 --- a/packages/web/src/containers/Common/containers/CommoContainer/CommonContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommoContainer/CommonContainer.tsx @@ -1,5 +1,6 @@ import React from "react"; import { Route } from "react-router-dom"; + import { ROUTE_PATHS } from "../../../../shared/constants"; import { CommonListContainer, CommonDetailContainer } from ".."; diff --git a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx index 7a9979e73..3f8314d3f 100644 --- a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx @@ -1,5 +1,6 @@ import React, { useCallback, useMemo, useState } from "react"; import { useParams } from "react-router-dom"; + import { Discussion, GetDiscussionById, diff --git a/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx b/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx index 9841261dc..f35562a45 100644 --- a/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx @@ -1,7 +1,6 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { Loader } from "../../../../shared/components"; - import { CommonListItem } from "../../components"; import { COMMON_PAGE_SIZE } from "../../constants"; import { useGetCommonDataQuery } from "../../../../graphql"; diff --git a/packages/web/src/context/PermissionsContext.tsx b/packages/web/src/context/PermissionsContext.tsx index 24b5e51ea..1563c9c16 100644 --- a/packages/web/src/context/PermissionsContext.tsx +++ b/packages/web/src/context/PermissionsContext.tsx @@ -1,4 +1,5 @@ import React, { PropsWithChildren } from "react"; + import { useAuthContext } from "./AuthContext"; import { useGetUserPermissionsQuery } from "../graphql"; diff --git a/packages/web/src/providers/AuthenticationProvider.tsx b/packages/web/src/providers/AuthenticationProvider.tsx index 369dd5033..4906d7295 100644 --- a/packages/web/src/providers/AuthenticationProvider.tsx +++ b/packages/web/src/providers/AuthenticationProvider.tsx @@ -3,7 +3,6 @@ import "firebase/auth"; import React from "react"; import firebase from "firebase/app"; import { FirebaseAuthProvider, IfFirebaseUnAuthed, IfFirebaseAuthed } from "@react-firebase/auth"; - import { useAuthState } from "react-firebase-hooks/auth"; // TODO: Replace with actual firebase creds From 49cd4219eae475e5f2f96c54d739ba722295380e Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Sat, 15 May 2021 11:29:45 +0300 Subject: [PATCH 5/5] Remove unnecessary console.log. Fix spaces --- .../Queries/GetDiscussions.query.ts | 30 +++++++++---------- packages/web/src/providers/ApolloProvider.tsx | 1 - 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/graphql/src/schema/Types/Discussion/Queries/GetDiscussions.query.ts b/packages/graphql/src/schema/Types/Discussion/Queries/GetDiscussions.query.ts index 71daef9e6..dccfc86f2 100644 --- a/packages/graphql/src/schema/Types/Discussion/Queries/GetDiscussions.query.ts +++ b/packages/graphql/src/schema/Types/Discussion/Queries/GetDiscussions.query.ts @@ -3,18 +3,18 @@ import { arg, list, queryField } from 'nexus'; export const GetDiscussionsQuery = queryField('discussions', { type: list('Discussion'), - args: { - where: arg({ - type: 'DiscussionWhereInput' - }), - paginate: arg({ - type: 'PaginateInput' - }) - }, - resolve: (root, args) => { - return prisma.discussion.findMany({ - where: args.where as any, - ...args.paginate - }); - } - }); \ No newline at end of file + args: { + where: arg({ + type: 'DiscussionWhereInput' + }), + paginate: arg({ + type: 'PaginateInput' + }) + }, + resolve: (root, args) => { + return prisma.discussion.findMany({ + where: args.where as any, + ...args.paginate + }); + } +}); \ No newline at end of file diff --git a/packages/web/src/providers/ApolloProvider.tsx b/packages/web/src/providers/ApolloProvider.tsx index f66e81ebf..4364a39ec 100644 --- a/packages/web/src/providers/ApolloProvider.tsx +++ b/packages/web/src/providers/ApolloProvider.tsx @@ -6,7 +6,6 @@ import { useAuthContext } from '../context'; export const ApolloProvider: React.FC> = ({ children, ...rest }) => { const authContext = useAuthContext(); - console.log('authContext',authContext) const apollo = useApollo('http://localhost:4000/graphql' || '', authContext.token || ''); return (