diff --git a/packages/core/src/domain/validation/index.ts b/packages/core/src/domain/validation/index.ts index ccea4032c..095e318d7 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 232209944..7c961b658 100644 --- a/packages/graphql/src/generated/nexus-typegen.ts +++ b/packages/graphql/src/generated/nexus-typegen.ts @@ -70,6 +70,10 @@ export interface NexusGenInputs { name: string; // String! postalCode: string; // String! } + CommonLinkInput: { // input type + title: string; // String! + url: string; // String! + } CommonMemberOrderByInput: { // input type createdAt: NexusGenEnums['SortOrder']; // SortOrder! } @@ -90,7 +94,9 @@ 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! @@ -155,6 +161,11 @@ export interface NexusGenInputs { 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 @@ -304,8 +315,10 @@ 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! } @@ -336,6 +349,7 @@ export interface NexusGenObjects { topic: string; // String! type: NexusGenEnums['DiscussionType']; // DiscussionType! updatedAt: NexusGenScalars['DateTime']; // DateTime! + userId: string; // String! } DiscussionMessage: { // root type createdAt: NexusGenScalars['DateTime']; // DateTime! @@ -344,6 +358,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! @@ -531,11 +546,13 @@ 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! } @@ -568,18 +585,22 @@ export interface NexusGenFieldTypes { 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! 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! @@ -715,6 +736,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] @@ -826,11 +848,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' } @@ -863,18 +887,22 @@ export interface NexusGenFieldTypeNames { 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' id: 'UUID' message: 'String' + owner: 'User' reports: 'Report' type: 'DiscussionMessageType' updatedAt: 'DateTime' + userId: 'String' } DiscussionSubscription: { // field return type name createdAt: 'DateTime' @@ -1010,6 +1038,7 @@ export interface NexusGenFieldTypeNames { common: 'Common' commons: 'Common' discussion: 'Discussion' + discussions: 'Discussion' events: 'Event' generateUserAuthToken: 'String' getStatistics: 'Statistic' @@ -1219,6 +1248,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 } diff --git a/packages/graphql/src/generated/schema.graphql b/packages/graphql/src/generated/schema.graphql index 323e389fa..a24011f8c 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! @@ -150,7 +157,9 @@ input CreateCommonInput { fundingMinimumAmount: Int! fundingType: FundingType! image: String! + links: [CommonLinkInput!] name: String! + rules: [CommonLinkInput!] } input CreateDiscussionInput { @@ -248,12 +257,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 { @@ -264,11 +277,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 { @@ -317,6 +332,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 @@ -721,6 +742,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/Common/Mutations/CreateCommon.mutation.ts b/packages/graphql/src/schema/Types/Common/Mutations/CreateCommon.mutation.ts index cbe0a4152..dd5721aa5 100644 --- a/packages/graphql/src/schema/Types/Common/Mutations/CreateCommon.mutation.ts +++ b/packages/graphql/src/schema/Types/Common/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/Common/Types/Common.type.ts b/packages/graphql/src/schema/Types/Common/Types/Common.type.ts index b092ddb6b..e2c13e456 100644 --- a/packages/graphql/src/schema/Types/Common/Types/Common.type.ts +++ b/packages/graphql/src/schema/Types/Common/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/Common/index.ts b/packages/graphql/src/schema/Types/Common/index.ts index 0fe56d151..cae50f490 100644 --- a/packages/graphql/src/schema/Types/Common/index.ts +++ b/packages/graphql/src/schema/Types/Common/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/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/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/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..dccfc86f2 --- /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/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 6b566a135..96a38ac18 100644 --- a/packages/graphql/src/schema/Types/Discussion/index.ts +++ b/packages/graphql/src/schema/Types/Discussion/index.ts @@ -8,13 +8,17 @@ 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 { DiscussionMessageOwnerExtension } from './Extensions/DiscussionMessagesOwner.extension'; import { DiscussionMessageCreatedSubscription } from './Subscriptions/DiscussionMessageCreated.subscription'; @@ -38,13 +42,17 @@ export const DiscussionTypes = [ DiscussionSubscriptionTypeEnum, GetDiscussionQuery, + GetDiscussionsQuery, DiscussionMessagesOrderByInput, DiscussionSubscriptionOrderByInput, + DiscussionWhereInput, DiscussionMessagesExtension, DiscussionMessageReportsExtension, DiscussionSubscriptionDiscussionExtension, + DiscussionOwnerExtension, + DiscussionMessageOwnerExtension, CreateDiscussionInput, CreateDiscussionMutation, diff --git a/packages/graphql/src/schema/Types/Proposals/index.ts b/packages/graphql/src/schema/Types/Proposals/index.ts index 09f0d9bd1..b187e7151 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'; diff --git a/packages/web/.eslintrc.js b/packages/web/.eslintrc.js index db47ceb3b..2c2f57957 100644 --- a/packages/web/.eslintrc.js +++ b/packages/web/.eslintrc.js @@ -39,6 +39,9 @@ module.exports = { "import/namespace": 2, "import/default": 2, "import/export": 2, + "eslint@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-explicit-any": 0, + "no-console": 1, "import/order": [ "error", { diff --git a/packages/web/package.json b/packages/web/package.json index 12948d6eb..e704fbec2 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -3,6 +3,9 @@ "version": "1.9.11-rc.1", "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", "firebase": "^8.3.2", 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 d83caf3fd..e5a26db46 100644 --- a/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx +++ b/packages/web/src/containers/Auth/containers/AuthContainer/AuthContainer.tsx @@ -1,35 +1,29 @@ -import React, { useEffect } from "react"; -import { push } from "connected-react-router"; -import { useSelector, useDispatch } from "react-redux"; - -import { authentificated } from "../../store/selectors"; - -import { SocialLoginButton } from "../../../../shared/components"; +/* eslint-disable import/order */ +import React from "react"; import { AuthWrapper } from "./styles"; -import { socialLogin } from "../../store/actions"; 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..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,6 +1,7 @@ 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 +11,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 +28,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 70825e757..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,17 +1,18 @@ 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; + 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 +26,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 +40,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..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,41 +1,42 @@ 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 9f3a11580..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,6 +1,7 @@ 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"; @@ -16,7 +17,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/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 e3e116f89..3f8314d3f 100644 --- a/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonDetailContainer/CommonDetailContainer.tsx @@ -1,33 +1,26 @@ -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 "./index.scss"; + interface CommonDetailRouterParams { id: string; } @@ -54,154 +47,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 discussions = useSelector(selectDiscussions()); - const isDiscussionsLoaded = useSelector(selectIsDiscussionsLoaded()); + const apolloClient = useApollo("http://localhost:4000/graphql"); + const [currentDiscussion, setCurrentDiscussion] = useState(null); - const dispatch = useDispatch(); - const { isShowing, onOpen, onClose } = useModal(false); + const { data: proposalsData } = useGetCommonProposals({ + variables: { + where: { + commonId: id, + }, + }, + }); + + const { data: discussionsData, loading: isDiscussionsLoaded } = useGetCommonDiscussions({ + variables: { + where: { + commonId: id, + }, + }, + }); - useEffect(() => { - dispatch(getCommonDetail.request(id)); - return () => { - dispatch(closeCurrentCommon()); - }; - }, [dispatch, id]); + const { data: commonData, loading: isCommonLoading } = useGetCommonById({ + variables: { + where: { + id, + }, + }, + }); + + const common = commonData?.common; + + const { isShowing, onOpen, onClose } = useModal(false); - 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( () => - [...discussions].splice(0, 5).map((d) => { + [...(discussionsData?.discussions || [])].splice(0, 5).map((d) => { return { id: d.id, value: d.title }; }), - [discussions], + [discussionsData], ); - const changeTabHandler = useCallback( - (tab: string) => { - switch (tab) { - case "discussions": - if (!isDiscussionsLoaded) { - dispatch(loadCommonDiscussionList.request()); - } - break; + const changeTabHandler = (tab: string) => setTab(tab); - default: - break; + 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]); + 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 38a2f10a1..f35562a45 100644 --- a/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx +++ b/packages/web/src/containers/Common/containers/CommonListContainer/CommonListContainer.tsx @@ -1,13 +1,9 @@ -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 { selectCurrentPage, selectCommonList } from "../../store/selectors"; +import { useGetCommonDataQuery } from "../../../../graphql"; import "./index.scss"; @@ -17,29 +13,30 @@ const options = { threshold: 1.0, }; +const TAKE_AMOUNT = 10; // TODO: Change as needed + export default function CommonListContainer() { - const commons = useSelector(selectCommonList()); - const page = useSelector(selectCurrentPage()); - const loading = useSelector(getLoading()); - const dispatch = useDispatch(); - const loader = useRef(null); + const [page, setPage] = useState(0); + const { loading, data } = useGetCommonDataQuery({ + variables: { + paginate: { + take: TAKE_AMOUNT, + skip: 0 + page * TAKE_AMOUNT, + }, + }, + }); - useEffect(() => { - dispatch(getCommonsList.request()); - return () => { - dispatch(getCommonsList.success([])); - }; - }, [dispatch]); + const loader = useRef(null); const handleObserver = useCallback( (entities: any[]) => { const target = entities[0]; if (target.isIntersecting) { - dispatch(updatePage(page + 1)); + setPage(page + 1); } }, - [dispatch, page], + [page], ); useEffect(() => { @@ -47,9 +44,9 @@ export default function CommonListContainer() { if (loader.current) { observer.observe(loader.current as any); } - }, [handleObserver, commons]); + }, [handleObserver, data, loader]); - const currentCommons = useMemo(() => [...commons].splice(0, COMMON_PAGE_SIZE * page), [commons, page]); + const currentCommons = useMemo(() => [...(data?.commons ?? [])].splice(0, COMMON_PAGE_SIZE * page), [data, page]); return (
@@ -65,7 +62,7 @@ export default function CommonListContainer() {
)} - {commons.length !== currentCommons.length && ( + {data?.commons?.length !== currentCommons.length && (
Load More
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 71e129255..000000000 --- a/packages/web/src/containers/Common/store/api.tsx +++ /dev/null @@ -1,88 +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(); - 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 f2a1b28b0..000000000 --- a/packages/web/src/containers/Common/store/reducer.tsx +++ /dev/null @@ -1,76 +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) => { - 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 new file mode 100644 index 000000000..84857c80c --- /dev/null +++ b/packages/web/src/context/AuthContext.tsx @@ -0,0 +1,51 @@ +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}; +}; diff --git a/packages/web/src/context/PermissionsContext.tsx b/packages/web/src/context/PermissionsContext.tsx new file mode 100644 index 000000000..1563c9c16 --- /dev/null +++ b/packages/web/src/context/PermissionsContext.tsx @@ -0,0 +1,50 @@ +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); +}; + +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}; +}; 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 new file mode 100644 index 000000000..c24a4cec5 --- /dev/null +++ b/packages/web/src/context/index.ts @@ -0,0 +1,2 @@ +export * from "./AuthContext"; +export * from "./PermissionsContext"; diff --git a/packages/web/src/graphql/index.ts b/packages/web/src/graphql/index.ts new file mode 100644 index 000000000..d09527d7d --- /dev/null +++ b/packages/web/src/graphql/index.ts @@ -0,0 +1,584 @@ +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; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + 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"]; + messages: Array; + title: Scalars["String"]; + description: Scalars["String"]; + userId: Scalars["ID"]; + owner: User; +}; + +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"]; + 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"]; + 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 const GetCommonsDataDocument = gql` + query getCommonsHomescreenData($paginate: PaginateInput! = { take: 10, skip: 0 }) { + commons(paginate: $paginate) { + id + name + createdAt + updatedAt + whitelisted + members { + userId + } + proposals { + id + } + } + } +`; + +export const GetCommonProposals = gql` + 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"]; +}; + +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 + 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 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 const GetUserPermissionsDocument = gql` + query getUserPermissions($userId: ID!) { + user(id: $userId) { + permissions + } + } +`; + +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<{ __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 GetUserPermissionsQueryVariables = Exact<{ + 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); +} + +export const LoadUserContextDocument = gql` + query loadUserContext { + user { + id + firstName + lastName + displayName + email + photo + permissions + } + } +`; + +export type LoadUserContextQuery = { + user?: Pick; +}; + +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/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..f839a3d3d 100644 --- a/packages/web/src/index.tsx +++ b/packages/web/src/index.tsx @@ -1,15 +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"); @@ -18,11 +18,22 @@ if (process.env.REACT_APP_ENV === "dev") { ReactDOM.render( - - - + + + + {() => ( + + + + )} + + + + {() => } + + + + , document.getElementById("root"), ); - -export default store; diff --git a/packages/web/src/providers/ApolloProvider.tsx b/packages/web/src/providers/ApolloProvider.tsx new file mode 100644 index 000000000..4364a39ec --- /dev/null +++ b/packages/web/src/providers/ApolloProvider.tsx @@ -0,0 +1,16 @@ +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(); + 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/packages/web/src/providers/AuthenticationProvider.tsx b/packages/web/src/providers/AuthenticationProvider.tsx new file mode 100644 index 000000000..4906d7295 --- /dev/null +++ b/packages/web/src/providers/AuthenticationProvider.tsx @@ -0,0 +1,50 @@ +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 }; -} 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"