(false);
+
+ return (
+ setH(true)}
+ onMouseLeave={() => setH(false)}
+ style={{
+ backgroundColor: h
+ ? palette.accents_1
+ : palette.background,
+
+ borderRadius: 8,
+ padding: 8
+ }}
+ >
+ {children}
+
+ );
+};
\ No newline at end of file
diff --git a/packages/admin/src/components/helpers/ClientOnly.tsx b/packages/admin/src/components/helpers/ClientOnly.tsx
new file mode 100644
index 000000000..626eff4fb
--- /dev/null
+++ b/packages/admin/src/components/helpers/ClientOnly.tsx
@@ -0,0 +1,19 @@
+import React, { useEffect, useState, PropsWithChildren } from 'react';
+
+export const ClientOnly: React.FC> = ({ children }) => {
+ const [hasMounted, setHasMounted] = useState(false);
+
+ useEffect(() => {
+ setHasMounted(true);
+ }, []);
+
+ if (!hasMounted) {
+ return null;
+ }
+
+ return (
+
+ {children}
+
+ );
+};
\ No newline at end of file
diff --git a/packages/admin/src/components/helpers/index.ts b/packages/admin/src/components/helpers/index.ts
new file mode 100644
index 000000000..292fba2d1
--- /dev/null
+++ b/packages/admin/src/components/helpers/index.ts
@@ -0,0 +1 @@
+export { ClientOnly } from './ClientOnly';
\ No newline at end of file
diff --git a/packages/admin/src/components/layout/AuthenticatedLayout.tsx b/packages/admin/src/components/layout/AuthenticatedLayout.tsx
new file mode 100644
index 000000000..a02d0f9c0
--- /dev/null
+++ b/packages/admin/src/components/layout/AuthenticatedLayout.tsx
@@ -0,0 +1,21 @@
+import React from 'react';
+import { Page, Spacer } from '@geist-ui/react';
+
+import { Header } from '@components/Header';
+import { useUserContext } from '@core/context';
+
+export const AuthenticatedLayout: React.FC> = ({ children, ...rest }) => {
+ const userContext = useUserContext();
+
+ return (
+
+
+
+
+
+
+ {React.isValidElement(children) && React.cloneElement(children, { ...rest })}
+
+
+ );
+};
\ No newline at end of file
diff --git a/packages/admin/src/components/layout/AuthenticationBasedLayout.tsx b/packages/admin/src/components/layout/AuthenticationBasedLayout.tsx
deleted file mode 100644
index 7dfa05da5..000000000
--- a/packages/admin/src/components/layout/AuthenticationBasedLayout.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React, { PropsWithChildren } from 'react';
-import { Page, Spacer } from '@geist-ui/react';
-
-
-import { PermissionsContextProvider, useAuthContext } from '@context';
-
-import { ApolloProvider } from '@components/providers/ApolloProvider';
-import { Header } from '@components/Header';
-
-export const AuthenticationBasedLayout: React.FC> = ({ children, ...rest }) => {
- const authContext = useAuthContext();
-
- return (
-
- {authContext.loaded && (
-
- {(authContext.authenticated) ? (
-
-
-
-
-
-
-
-
- {React.isValidElement(children) && React.cloneElement(children, { ...rest })}
-
-
-
-
- ) : (
-
- {React.isValidElement(children) && React.cloneElement(children, { ...rest })}
-
- )}
-
- )}
-
- );
-};
\ No newline at end of file
diff --git a/packages/admin/src/components/modals/SearchEverywhere.tsx b/packages/admin/src/components/modals/SearchEverywhere.tsx
new file mode 100644
index 000000000..531887593
--- /dev/null
+++ b/packages/admin/src/components/modals/SearchEverywhere.tsx
@@ -0,0 +1,78 @@
+import React from 'react';
+import { Text, Keyboard, Modal, Spacer, useTheme } from '@geist-ui/react';
+
+export const SearchEverywhere = () => {
+ const { palette } = useTheme();
+
+ const [open, setOpen] = React.useState();
+
+ React.useEffect(() => {
+ const handleKeyboardEvent = (event: KeyboardEvent) => {
+ if ((event.metaKey || event.ctrlKey) && event.code === 'KeyK') {
+ event.preventDefault();
+
+ onOpen();
+ } else if (event.key === 'Escape') {
+ event.preventDefault();
+
+ onClose();
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyboardEvent);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyboardEvent);
+ };
+ }, []);
+
+
+ const onOpen = () => {
+ setOpen(true);
+ };
+
+ const onClose = () => {
+ setOpen(false);
+ };
+
+ return (
+
+
+
+ Search
+
+ Full search is coming soon.
+
+
+
+
+
+ );
+};
\ No newline at end of file
diff --git a/packages/admin/src/components/providers/ApolloProvider.tsx b/packages/admin/src/components/providers/ApolloProvider.tsx
index 8bb513ca6..3dde9ede3 100644
--- a/packages/admin/src/components/providers/ApolloProvider.tsx
+++ b/packages/admin/src/components/providers/ApolloProvider.tsx
@@ -1,16 +1,49 @@
-import React, { PropsWithChildren } from 'react';
+import React from 'react';
-import { ApolloProvider as BareApolloProvider } from '@apollo/client';
-import { useApollo } from '@hooks';
-import { useAuthContext } from '@context';
+import { setContext } from '@apollo/client/link/context';
+import { ApolloClient, InMemoryCache, ApolloProvider, ApolloLink, HttpLink } from '@apollo/client';
-export const ApolloProvider: React.FC> = ({ children, ...rest }) => {
- const authContext = useAuthContext();
- const apollo = useApollo(process.env.NEXT_PUBLIC_ADMIN_GRAPH_ENDPOINT, authContext.token);
+import firebase from 'firebase/app';
+const cache = new InMemoryCache();
+
+const authLink = setContext(async (_, { headers }) => {
+ const token = await firebase.auth()
+ .currentUser
+ .getIdToken();
+
+ return {
+ headers: {
+ ...headers,
+ authorization: token
+ }
+ };
+});
+
+const generateClient = () => {
+ const links: any[] = [
+ authLink
+ ];
+
+ console.log('Creating GraphQL Client');
+
+ return new ApolloClient({
+ cache,
+ link: ApolloLink.from([
+ ...links,
+ new HttpLink({
+ uri: process.env['NEXT_PUBLIC_GraphQl.Endpoint'] as string
+ })
+ ])
+ });
+};
+
+const client = generateClient();
+
+export const CommonApolloProvider: React.FC> = ({ children }) => {
return (
-
- {React.isValidElement(children) && React.cloneElement(children, { ...rest })}
-
+
+ {children}
+
);
};
\ No newline at end of file
diff --git a/packages/admin/src/components/providers/AuthenticationProvider.tsx b/packages/admin/src/components/providers/AuthenticationProvider.tsx
new file mode 100644
index 000000000..aef2f6e01
--- /dev/null
+++ b/packages/admin/src/components/providers/AuthenticationProvider.tsx
@@ -0,0 +1,69 @@
+import 'firebase/auth';
+
+import React from 'react';
+import firebase from 'firebase/app';
+import { useRouter } from 'next/router';
+import { FirebaseAuthProvider, IfFirebaseUnAuthed, IfFirebaseAuthed } from '@react-firebase/auth';
+
+import { Paths } from '@core/constants';
+import { useAuthState } from 'react-firebase-hooks/auth';
+
+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 router = useRouter();
+ 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
+ if (router.pathname !== Paths.auth.login && !loading) {
+ router.push(Paths.auth.login)
+ .then(() => {
+ 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
+ if (router.pathname === Paths.auth.login) {
+ router.push(Paths.dashboard)
+ .then(() => {
+ console.log(
+ 'Redirected authenticated user away ' +
+ 'from the login page'
+ );
+ });
+ }
+ }}
+
+
+ );
+};
\ No newline at end of file
diff --git a/packages/admin/src/components/providers/index.ts b/packages/admin/src/components/providers/index.ts
new file mode 100644
index 000000000..4e44cec0d
--- /dev/null
+++ b/packages/admin/src/components/providers/index.ts
@@ -0,0 +1,2 @@
+export { CommonApolloProvider } from './ApolloProvider';
+export { AuthenticationProvider } from './AuthenticationProvider';
\ No newline at end of file
diff --git a/packages/admin/src/components/tables/LatestEventsTable.tsx b/packages/admin/src/components/tables/LatestEventsTable.tsx
index ce54a919a..9b4e6f29f 100644
--- a/packages/admin/src/components/tables/LatestEventsTable.tsx
+++ b/packages/admin/src/components/tables/LatestEventsTable.tsx
@@ -1,32 +1,27 @@
import React from 'react';
-
-import { gql } from '@apollo/client';
-import { Avatar, Table, Tag, Text, useToasts } from '@geist-ui/react';
+import { Table, Text, Tag, Avatar } from '@geist-ui/react';
import { HasPermission } from '@components/HasPermission';
-import { useGetLatestEventsQuery } from '@graphql';
-import useSound from 'use-sound';
import { useRouter } from 'next/router';
+import { gql } from '@apollo/client';
+import { useGetLatestEventsQuery } from '@core/graphql';
const GetLatestEventsQuery = gql`
- query GetLatestEvents($last: Int = 10, $after: Int = 0) {
- events(
- last: $last,
- after: $after
- ) {
+ query GetLatestEvents($take: Int = 10, $skip: Int = 0) {
+ events(paginate: {
+ take: $take,
+ skip: $skip
+ }) {
id
createdAt
-
type
user {
- id
-
firstName
lastName
- photoURL
+ photo
}
}
}
@@ -41,36 +36,8 @@ interface ILatestEventsTableProps {
export const LatestEventsTable: React.FC = ({ pagination, refresh, notify }) => {
const router = useRouter();
- const [toasts, setToast] = useToasts();
- const [play] = useSound('assets/sounds/notification.mp3');
-
-
- const { data, previousData } = useGetLatestEventsQuery({
- pollInterval: 5 * 1000
- });
+ const { data } = useGetLatestEventsQuery();
- React.useEffect(() => {
- if (notify && !refresh) {
- console.warn('No notification will be sent when refresh is falsy!');
- }
- }, [refresh, notify]);
-
- React.useEffect(() => {
- if (previousData?.events?.length && notify) {
- const newEvents = data.events.filter(e => !previousData.events.includes(e));
-
- if (newEvents) {
- play();
-
- newEvents.forEach((e) => {
- setToast({
- text: `New event: ${e.type}`,
- delay: 2000
- });
- });
- }
- }
- }, [data, previousData]);
const transformDataForTable = () => {
return data.events.map((e) => ({
@@ -88,7 +55,7 @@ export const LatestEventsTable: React.FC = ({ paginatio
{e.user ? (
-
+
{e.user.firstName} {e.user.lastName}
@@ -108,8 +75,7 @@ export const LatestEventsTable: React.FC = ({ paginatio
};
return (
-
- {console.log('data', data)}
+
{data && (
Latest events
diff --git a/packages/admin/src/components/tables/PaymentsTable.tsx b/packages/admin/src/components/tables/PaymentsTable.tsx
index f75c1ac61..ed8f9e43b 100644
--- a/packages/admin/src/components/tables/PaymentsTable.tsx
+++ b/packages/admin/src/components/tables/PaymentsTable.tsx
@@ -5,7 +5,7 @@ import { Link } from '@components/Link';
import { Card, Row, Col, Text, Spacer, Tag, User, Divider, useTheme } from '@geist-ui/react';
import { ChevronLeftCircle, ChevronRightCircle, ChevronDownCircle, ChevronUpCircle } from '@geist-ui/react-icons';
import { gql } from '@apollo/client';
-import { useGetPaymentDetailsLazyQuery, useGetPaymentsQuery } from '@graphql';
+import { useGetPaymentDetailsLazyQuery, useGetPaymentsQuery } from '@core/graphql';
import { useRouter } from 'next/router';
diff --git a/packages/admin/src/context/AuthContext.tsx b/packages/admin/src/context/AuthContext.tsx
deleted file mode 100644
index 316bab152..000000000
--- a/packages/admin/src/context/AuthContext.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import firebase from 'firebase/app';
-import React, { PropsWithChildren } from 'react';
-
-interface IAuthContext {
- token?: string;
- loaded: boolean;
- userInfo?: firebase.UserInfo;
- authenticated?: boolean;
-}
-
-const defaultAppContext: IAuthContext = {
- loaded: false
-};
-
-const AuthContext = React.createContext(defaultAppContext);
-
-export const useAuthContext = () => {
- return React.useContext(AuthContext);
-};
-
-export const AuthContextProvider: React.FC> = ({ children }) => {
- const [context, setContext] = React.useState(defaultAppContext);
-
- React.useEffect(() => {
- return firebase.auth().onIdTokenChanged(async (user) => {
- if (user) {
- const token = await user.getIdToken();
-
- setContext((prevContext) => ({
- ...prevContext,
-
- token,
- loaded: true,
- userInfo: user,
- authenticated: true
- }));
- } else {
- setContext((prevContext) => ({
- ...prevContext,
-
- token: null,
- loaded: true,
- userInfo: null,
- authenticated: false
- }));
- }
- });
- }, []);
-
-
- return (
-
- {children}
-
- );
-};
\ No newline at end of file
diff --git a/packages/admin/src/context/PermissionsContext.tsx b/packages/admin/src/context/PermissionsContext.tsx
deleted file mode 100644
index 67bc8528d..000000000
--- a/packages/admin/src/context/PermissionsContext.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import { gql } from '@apollo/client';
-import React, { PropsWithChildren } from 'react';
-import { useAuthContext } from './AuthContext';
-import { useGetUserPermissionsQuery } from '@graphql';
-
-interface IPermissionsContext {
- loaded: boolean;
- permissions: string[];
-}
-
-const defaultPermissionsContext: IPermissionsContext = {
- loaded: false,
- permissions: []
-};
-
-const PermissionsContext = React.createContext(defaultPermissionsContext);
-
-export const usePermissionsContext = () => {
- return React.useContext(PermissionsContext);
-};
-
-const LoadPermissionsQuery = gql`
- query getUserPermissions($userId: ID!) {
- user(id: $userId) {
- permissions
- }
- }
-`;
-
-export const PermissionsContextProvider: React.FC> = ({ children }) => {
- const authContext = useAuthContext();
-
- const { data, loading } = useGetUserPermissionsQuery({
- skip: !authContext.loaded && !authContext.authenticated,
- pollInterval: 120 * 1000,
- variables: {
- userId: authContext.userInfo?.uid
- }
- });
-
- const [context, setContext] = React.useState(defaultPermissionsContext);
-
- React.useEffect(() => {
- if (authContext.authenticated && data?.user) {
- setContext({
- loaded: true,
- permissions: data.user.permissions
- });
- } else {
- setContext({
- loaded: !loading && authContext.authenticated,
- permissions: []
- });
- }
- }, [authContext, data]);
-
- return (
-
- {children}
-
- );
-};
\ No newline at end of file
diff --git a/packages/admin/src/context/index.ts b/packages/admin/src/context/index.ts
deleted file mode 100644
index 7dd4b2061..000000000
--- a/packages/admin/src/context/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './AuthContext';
-export * from './PermissionsContext';
\ No newline at end of file
diff --git a/packages/admin/src/core/constants/index.ts b/packages/admin/src/core/constants/index.ts
new file mode 100644
index 000000000..f7f228ba3
--- /dev/null
+++ b/packages/admin/src/core/constants/index.ts
@@ -0,0 +1,6 @@
+export const Paths = {
+ dashboard: '/',
+ auth: {
+ login: '/accounts/login'
+ }
+};
\ No newline at end of file
diff --git a/packages/admin/src/core/context/UserContext.tsx b/packages/admin/src/core/context/UserContext.tsx
new file mode 100644
index 000000000..6f23b5dbe
--- /dev/null
+++ b/packages/admin/src/core/context/UserContext.tsx
@@ -0,0 +1,82 @@
+import React from 'react';
+import { gql } from '@apollo/client';
+
+import { useLoadUserContextQuery } from '@core/graphql';
+import { Loading } from '@geist-ui/react';
+
+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);
+};
+
+const LoadUserContextQuery = gql`
+ query loadUserContext {
+ user {
+ id
+
+ firstName
+ lastName
+
+ displayName
+
+ email
+ photo
+
+ permissions
+ }
+ }
+`;
+
+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
+ });
+
+ console.log('User data and permissions loaded!');
+ }
+ }, [data]);
+
+ // Render
+ return (
+
+ {context.loaded ? (
+
+ {children}
+
+ ) : (
+
+ )}
+
+ );
+};
\ No newline at end of file
diff --git a/packages/admin/src/core/context/index.ts b/packages/admin/src/core/context/index.ts
new file mode 100644
index 000000000..38751f180
--- /dev/null
+++ b/packages/admin/src/core/context/index.ts
@@ -0,0 +1 @@
+export { UserContextProvider, useUserContext } from './UserContext';
\ No newline at end of file
diff --git a/packages/admin/src/core/graphql/index.ts b/packages/admin/src/core/graphql/index.ts
new file mode 100644
index 000000000..88eeaabb9
--- /dev/null
+++ b/packages/admin/src/core/graphql/index.ts
@@ -0,0 +1,2009 @@
+import * as Apollo from '@apollo/client';
+import { gql } from '@apollo/client';
+
+export type Maybe = T | null;
+export type Exact = { [K in keyof T]: T[K] };
+export type MakeOptional = Omit & { [SubKey in K]?: Maybe };
+export type MakeMaybe = Omit & { [SubKey in K]: Maybe };
+/** All built-in and custom scalars, mapped to their actual values */
+export type Scalars = {
+ ID: string;
+ String: string;
+ Boolean: boolean;
+ Int: number;
+ Float: number;
+ /** A field whose value conforms to the standard URL format as specified in RFC3986: https://www.ietf.org/rfc/rfc3986.txt. */
+ URL: any;
+ /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */
+ DateTime: any;
+ /** The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */
+ JSON: any;
+ /** A field whose value is a generic Universally Unique Identifier: https://en.wikipedia.org/wiki/Universally_unique_identifier. */
+ UUID: any;
+ Void: any;
+};
+
+
+export type User = {
+ __typename?: 'User';
+ /** The system Id of the user */
+ id: Scalars['ID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ /** The first name of the user */
+ firstName: Scalars['String'];
+ /** The last name of the user */
+ lastName: Scalars['String'];
+ /** The display name of the user */
+ displayName: Scalars['String'];
+ photo: Scalars['String'];
+ /** The email of the user */
+ email: Scalars['String'];
+ /** List of all the users permissions */
+ permissions: Array;
+ /** List of events, that occurred and are related to this user */
+ events: Array;
+ proposals: Array;
+ subscriptions: Array;
+ notifications: Array;
+ notificationTokens: Array;
+ discussionSubscriptions: Array;
+};
+
+
+export type UserEventsArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+ orderBy?: Maybe;
+};
+
+
+export type UserProposalsArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+ where?: Maybe;
+};
+
+
+export type UserNotificationsArgs = {
+ orderBy?: Maybe;
+ cursor?: Maybe;
+ take?: Maybe;
+ skip?: Maybe;
+};
+
+
+export type UserDiscussionSubscriptionsArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+ orderBy?: Maybe;
+};
+
+export type UserNotificationToken = BaseEntity & {
+ __typename?: 'UserNotificationToken';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ state: UserNotificationTokenState;
+ token: Scalars['String'];
+ description: Scalars['String'];
+ lastUsed: Scalars['DateTime'];
+ lastVerified: Scalars['DateTime'];
+};
+
+export type UserWhereUniqueInput = {
+ userId: Scalars['ID'];
+};
+
+export type UserWhereInput = {
+ firstName?: Maybe;
+ lastName?: Maybe;
+ email?: Maybe;
+};
+
+export type CreateUserInput = {
+ firstName: Scalars['String'];
+ lastName: Scalars['String'];
+ email: Scalars['String'];
+ photo: Scalars['String'];
+};
+
+export type CreateUserNotificationTokenInput = {
+ token: Scalars['String'];
+ description: Scalars['String'];
+};
+
+export enum UserNotificationTokenState {
+ Active = 'Active',
+ Expired = 'Expired',
+ Voided = 'Voided'
+}
+
+export type Role = BaseEntity & {
+ __typename?: 'Role';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ name: Scalars['String'];
+ displayName: Scalars['String'];
+ description: Scalars['String'];
+ permissions: Array;
+};
+
+export type Card = {
+ __typename?: 'Card';
+ /** The main identifier of the item */
+ id: Scalars['ID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+};
+
+export type CreateCardInput = {
+ /** The ID of the key used for the encryption of the sensitive data */
+ keyId: Scalars['String'];
+ /** The sensitive part of the card as encrypted card */
+ encryptedData: Scalars['String'];
+ expYear: Scalars['Int'];
+ expMonth: Scalars['Int'];
+ billingDetails: BillingDetailsInput;
+};
+
+export type Vote = {
+ __typename?: 'Vote';
+ /** The main identifier of the item */
+ id: Scalars['ID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ outcome: VoteOutcome;
+ voterId: Scalars['ID'];
+ voter: CommonMember;
+};
+
+export enum VoteOutcome {
+ Approve = 'Approve',
+ Condemn = 'Condemn'
+}
+
+export type CreateVoteInput = {
+ outcome: VoteOutcome;
+ /** The ID of the root of the proposal whether it is funding one or join */
+ proposalId: Scalars['ID'];
+};
+
+export type Event = {
+ __typename?: 'Event';
+ /** The main identifier of the item */
+ id: Scalars['ID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ /** The type of the event in one of the predefined event types */
+ type: EventType;
+ payload?: Maybe;
+ /** The ID of the common, for whom the event was created */
+ commonId?: Maybe;
+ /** The ID of the event creator */
+ userId?: Maybe;
+ /** The event creator */
+ user?: Maybe;
+};
+
+export enum EventType {
+ CommonCreated = 'CommonCreated',
+ CommonDelisted = 'CommonDelisted',
+ CommonWhitelisted = 'CommonWhitelisted',
+ CommonMemberCreated = 'CommonMemberCreated',
+ CommonMemberRoleAdded = 'CommonMemberRoleAdded',
+ CommonMemberRoleRemoved = 'CommonMemberRoleRemoved',
+ JoinRequestCreated = 'JoinRequestCreated',
+ JoinRequestAccepted = 'JoinRequestAccepted',
+ JoinRequestRejected = 'JoinRequestRejected',
+ FundingRequestCreated = 'FundingRequestCreated',
+ FundingRequestAccepted = 'FundingRequestAccepted',
+ FundingRequestRejected = 'FundingRequestRejected',
+ CardCreated = 'CardCreated',
+ CardCvvVerificationPassed = 'CardCvvVerificationPassed',
+ CardCvvVerificationFailed = 'CardCvvVerificationFailed',
+ PaymentCreated = 'PaymentCreated',
+ PaymentSucceeded = 'PaymentSucceeded',
+ PaymentFailed = 'PaymentFailed',
+ ProposalMajorityReached = 'ProposalMajorityReached',
+ ProposalExpired = 'ProposalExpired',
+ VoteCreated = 'VoteCreated',
+ UserCreated = 'UserCreated',
+ DiscussionCreated = 'DiscussionCreated',
+ DiscussionMessageCreated = 'DiscussionMessageCreated',
+ DiscussionSubscriptionCreated = 'DiscussionSubscriptionCreated',
+ DiscussionSubscriptionTypeChanged = 'DiscussionSubscriptionTypeChanged',
+ NotificationTemplateCreated = 'NotificationTemplateCreated',
+ NotificationTemplateUpdated = 'NotificationTemplateUpdated',
+ UserNotificationTokenVoided = 'UserNotificationTokenVoided',
+ UserNotificationTokenExpired = 'UserNotificationTokenExpired',
+ UserNotificationTokenCreated = 'UserNotificationTokenCreated',
+ UserNotificationTokenRefreshed = 'UserNotificationTokenRefreshed',
+ ReportCreated = 'ReportCreated',
+ ReportRespected = 'ReportRespected',
+ ReportDismissed = 'ReportDismissed',
+ RoleCreated = 'RoleCreated',
+ RoleUpdated = 'RoleUpdated',
+ RolePermissionAdded = 'RolePermissionAdded',
+ RolePermissionRemoved = 'RolePermissionRemoved',
+ RoleDeleted = 'RoleDeleted',
+ UserAddedToRole = 'UserAddedToRole',
+ UserRemovedFromRole = 'UserRemovedFromRole'
+}
+
+export type EventOrderByInput = {
+ createdAt?: Maybe;
+ updatedAt?: Maybe;
+ type?: Maybe;
+};
+
+export type Common = {
+ __typename?: 'Common';
+ /** The main identifier of the item */
+ id: Scalars['ID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ /** The name of the common as provided */
+ name: Scalars['String'];
+ /** The whitelisting state of a common */
+ whitelisted: Scalars['Boolean'];
+ /** The current available funds of the common. In cents */
+ balance: Scalars['Int'];
+ /** The total amount of money that the common has raised. In cents */
+ raised: Scalars['Int'];
+ image: Scalars['String'];
+ description?: Maybe;
+ action?: Maybe;
+ byline?: Maybe;
+ fundingType: FundingType;
+ /** The minimum amount that the join request should provide. In cents */
+ fundingMinimumAmount: Scalars['Int'];
+ /** List of events, that occurred in a common */
+ events: Array;
+ reports: Array;
+ proposals: Array;
+ discussions: Array;
+ members: Array>;
+ activeProposals: Scalars['Int'];
+ activeFundingProposals: Scalars['Int'];
+ activeJoinProposals: Scalars['Int'];
+};
+
+
+export type CommonEventsArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+ orderBy?: Maybe;
+};
+
+
+export type CommonReportsArgs = {
+ where?: Maybe;
+};
+
+
+export type CommonProposalsArgs = {
+ paginate?: Maybe;
+ where?: Maybe;
+};
+
+
+export type CommonDiscussionsArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+};
+
+
+export type CommonMembersArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+ orderBy?: Maybe;
+};
+
+/** The funding type of the common */
+export enum FundingType {
+ OneTime = 'OneTime',
+ Monthly = 'Monthly'
+}
+
+export type CreateCommonInput = {
+ name: Scalars['String'];
+ fundingMinimumAmount: Scalars['Int'];
+ fundingType: FundingType;
+ image: Scalars['String'];
+ description?: Maybe;
+ action?: Maybe;
+ byline?: Maybe;
+};
+
+export type CommonWhereUniqueInput = {
+ id: Scalars['ID'];
+};
+
+export type Report = BaseEntity & {
+ __typename?: 'Report';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ /** The current status of the report */
+ status: ReportStatus;
+ /** The type of violation that this report is for */
+ for: ReportFor;
+ /** The note that the report has left for the content */
+ note: Scalars['String'];
+ /** The date on which the report was last reviewed if reviewed */
+ reviewedOn?: Maybe;
+ reporterId: Scalars['ID'];
+ reporter: User;
+ messageId: Scalars['UUID'];
+ message: DiscussionMessage;
+};
+
+export enum ReportFor {
+ Nudity = 'Nudity',
+ Violance = 'Violance',
+ Harassment = 'Harassment',
+ FalseNews = 'FalseNews',
+ Spam = 'Spam',
+ Hate = 'Hate',
+ Other = 'Other'
+}
+
+export enum ReportAction {
+ Respected = 'Respected',
+ Dismissed = 'Dismissed'
+}
+
+export enum ReportStatus {
+ Active = 'Active',
+ Clossed = 'Clossed'
+}
+
+export enum ReportAuditor {
+ CommonModerator = 'CommonModerator',
+ SystemAdmin = 'SystemAdmin'
+}
+
+export type ReportWhereInput = {
+ status?: Maybe;
+ for?: Maybe;
+};
+
+export type ReportStatusFilterInput = {
+ in?: Maybe>>;
+ not?: Maybe>>;
+};
+
+export type ActOnReportInput = {
+ reportId: Scalars['UUID'];
+ action: ReportAction;
+};
+
+export type ReportDiscussionMessageInput = {
+ messageId: Scalars['UUID'];
+ note: Scalars['String'];
+ for: ReportFor;
+};
+
+export type Proposal = {
+ __typename?: 'Proposal';
+ /** The main identifier of the item */
+ id: Scalars['ID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ type: ProposalType;
+ state: ProposalState;
+ links?: Maybe;
+ files?: Maybe;
+ images?: Maybe;
+ votesFor: Scalars['Int'];
+ votesAgainst: Scalars['Int'];
+ expiresAt: Scalars['DateTime'];
+ title?: Maybe;
+ description?: Maybe;
+ /** The IP from which the proposal was created */
+ ipAddress?: Maybe;
+ discussions: Array;
+ /** The ID of the user who created the proposal */
+ userId: Scalars['ID'];
+ /** The ID of the membership of the user who created the proposal */
+ commonMemberId: Scalars['UUID'];
+ user: User;
+ member: CommonMember;
+ fundingId?: Maybe;
+ funding?: Maybe;
+ commonId: Scalars['UUID'];
+ common: Common;
+ votes: Array;
+ joinId?: Maybe;
+ join?: Maybe;
+};
+
+
+export type ProposalDiscussionsArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+};
+
+export type JoinProposal = BaseEntity & {
+ __typename?: 'JoinProposal';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ /** The amount that this join proposal will contribute to the common. In cents */
+ funding: Scalars['Int'];
+ fundingType: FundingType;
+ paymentState: PaymentState;
+};
+
+export type FundingProposal = BaseEntity & {
+ __typename?: 'FundingProposal';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ /** The amount that the proposal has requested in cents */
+ amount: Scalars['Int'];
+ fundingState: FundingState;
+};
+
+export type ProposalWhereInput = {
+ type?: Maybe;
+ state?: Maybe;
+ commonId?: Maybe;
+ commonMemberId?: Maybe;
+ userId?: Maybe;
+};
+
+export type CreateJoinProposalInput = {
+ title: Scalars['String'];
+ description: Scalars['String'];
+ fundingAmount: Scalars['Int'];
+ cardId: Scalars['String'];
+ commonId: Scalars['String'];
+ links?: Maybe>;
+};
+
+export type CreateFundingProposalInput = {
+ commonId: Scalars['ID'];
+ amount: Scalars['Int'];
+ title: Scalars['String'];
+ description: Scalars['String'];
+ links?: Maybe>;
+ files?: Maybe>;
+ images?: Maybe>;
+};
+
+export type ProposalLinkInput = {
+ title: Scalars['String'];
+ url: Scalars['String'];
+};
+
+export type ProposalFileInput = {
+ value: Scalars['String'];
+};
+
+export type ProposalImageInput = {
+ value: Scalars['String'];
+};
+
+export enum ProposalType {
+ FundingRequest = 'FundingRequest',
+ JoinRequest = 'JoinRequest'
+}
+
+export enum ProposalState {
+ Countdown = 'Countdown',
+ Finalizing = 'Finalizing',
+ Rejected = 'Rejected',
+ Accepted = 'Accepted'
+}
+
+export enum FundingState {
+ NotEligible = 'NotEligible',
+ Eligible = 'Eligible',
+ AwaitingApproval = 'AwaitingApproval',
+ Pending = 'Pending',
+ Completed = 'Completed',
+ Confirmed = 'Confirmed'
+}
+
+export enum PaymentState {
+ NotAttempted = 'NotAttempted',
+ Pending = 'Pending',
+ Successful = 'Successful',
+ Unsuccessful = 'Unsuccessful'
+}
+
+export type ProposalWhereUniqueInput = {
+ id: Scalars['UUID'];
+};
+
+export enum StatisticType {
+ AllTime = 'AllTime',
+ Hourly = 'Hourly',
+ Daily = 'Daily',
+ Weekly = 'Weekly'
+}
+
+export type Statistic = BaseEntity & {
+ __typename?: 'Statistic';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ users: Scalars['Int'];
+ commons: Scalars['Int'];
+ fundingProposals: Scalars['Int'];
+ joinProposals: Scalars['Int'];
+};
+
+export type StatisticsWhereInput = {
+ type?: Maybe;
+};
+
+export type Discussion = BaseEntity & {
+ __typename?: 'Discussion';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ /** What this discussion is about */
+ topic: Scalars['String'];
+ /** Short description of the topic */
+ description: Scalars['String'];
+ /** The date at which the last message on the discussion was added */
+ latestMessage: Scalars['DateTime'];
+ type: DiscussionType;
+ messages: Array;
+};
+
+
+export type DiscussionMessagesArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+ orderBy?: Maybe;
+};
+
+export type DiscussionMessage = BaseEntity & {
+ __typename?: 'DiscussionMessage';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ message: Scalars['String'];
+ type: DiscussionMessageType;
+ flag: DiscussionMessageFlag;
+ reports: Array;
+};
+
+export type DiscussionSubscription = BaseEntity & {
+ __typename?: 'DiscussionSubscription';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ type: DiscussionSubscriptionType;
+ userId: Scalars['String'];
+ discussionId: Scalars['UUID'];
+ discussion: Discussion;
+};
+
+export enum DiscussionType {
+ ProposalDiscussion = 'ProposalDiscussion',
+ CommonDiscussion = 'CommonDiscussion'
+}
+
+export enum DiscussionMessageType {
+ Message = 'Message'
+}
+
+export enum DiscussionMessageFlag {
+ Clear = 'Clear',
+ Reported = 'Reported',
+ Hidden = 'Hidden'
+}
+
+export enum DiscussionSubscriptionType {
+ AllNotifications = 'AllNotifications',
+ OnlyMentions = 'OnlyMentions',
+ NoNotification = 'NoNotification'
+}
+
+export type DiscussionMessagesOrderByInput = {
+ createdAt?: Maybe;
+ updatedAt?: Maybe;
+};
+
+export type DiscussionSubscriptionOrderByInput = {
+ createdAt?: Maybe;
+ updatedAt?: Maybe;
+};
+
+export type CreateDiscussionInput = {
+ /** The topic of the discussion to be created */
+ topic: Scalars['String'];
+ /** Short description about the topic */
+ description: Scalars['String'];
+ /** The ID of the common, for which we are creating the discussion */
+ commonId: Scalars['ID'];
+ /** The ID of the proposal, if this is proposal discussion */
+ proposalId?: Maybe;
+};
+
+export type CreateDiscussionMessageInput = {
+ /** The ID of the discussion, for which we are creating the message */
+ discussionId: Scalars['ID'];
+ /** The message itself */
+ message: Scalars['String'];
+};
+
+export type CommonMember = BaseEntity & {
+ __typename?: 'CommonMember';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ userId: Scalars['ID'];
+ commonId: Scalars['ID'];
+ roles: Array;
+ user?: Maybe;
+ common?: Maybe;
+ proposals: Array;
+};
+
+
+export type CommonMemberProposalsArgs = {
+ take?: Maybe;
+ skip?: Maybe;
+ where?: Maybe;
+};
+
+export type CommonMemberOrderByInput = {
+ createdAt: SortOrder;
+};
+
+export enum CommonMemberRole {
+ Founder = 'Founder',
+ Moderator = 'Moderator'
+}
+
+export enum NotificationType {
+ JoinRequestAccepted = 'JoinRequestAccepted',
+ JoinRequestRejected = 'JoinRequestRejected',
+ FundingRequestAccepted = 'FundingRequestAccepted',
+ FundingRequestRejected = 'FundingRequestRejected',
+ General = 'General'
+}
+
+export enum NotificationSeenStatus {
+ NotSeen = 'NotSeen',
+ Seen = 'Seen',
+ Done = 'Done'
+}
+
+export enum NotificationLanguage {
+ En = 'EN',
+ Ru = 'RU',
+ Bg = 'BG',
+ He = 'HE',
+ Jp = 'JP',
+ Ko = 'KO'
+}
+
+export enum NotificationTemplateType {
+ PushNotification = 'PushNotification',
+ EmailNotification = 'EmailNotification'
+}
+
+export type Notification = BaseEntity & {
+ __typename?: 'Notification';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ /** Whether the notification should be shown in the user notification feed */
+ show: Scalars['Boolean'];
+ type: NotificationType;
+ seenStatus: NotificationSeenStatus;
+ /** The ID of the linked user */
+ userId: Scalars['UUID'];
+ /** The linked user. Expensive operation */
+ user: User;
+ /** The ID of the linked common. May be null */
+ commonId?: Maybe;
+ /** The linked common. Expensive operation that may return null */
+ common?: Maybe;
+ /** The ID of the linked proposal. May be null */
+ proposalId?: Maybe;
+ /** The linked proposal. Expensive operation that may return null */
+ proposal?: Maybe;
+ /** The ID of the linked discussion. May be null */
+ discussionId?: Maybe;
+ /** The linked discussion. Expensive operation that may return null */
+ discussion?: Maybe;
+};
+
+export type NotificationTemplate = BaseEntity & {
+ __typename?: 'NotificationTemplate';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ forType: NotificationType;
+ templateType: NotificationTemplateType;
+ language: NotificationLanguage;
+ subject: Scalars['String'];
+ content: Scalars['String'];
+ from?: Maybe;
+ fromName?: Maybe;
+ bcc?: Maybe;
+ bccName?: Maybe;
+};
+
+export type NotificationEventSettings = BaseEntity & {
+ __typename?: 'NotificationEventSettings';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ active: Scalars['Boolean'];
+ sendToEveryone: Scalars['Boolean'];
+ sendToCommon: Scalars['Boolean'];
+ sendToUser: Scalars['Boolean'];
+ description: Scalars['String'];
+ sendNotificationType: NotificationType;
+ onEvent: EventType;
+};
+
+export type NotificationWhereInput = {
+ seenStatus?: Maybe;
+ type?: Maybe;
+ userId?: Maybe;
+ commonId?: Maybe;
+ proposalId?: Maybe;
+ discussionId?: Maybe;
+};
+
+export type NotificationWhereUniqueInput = {
+ id?: Maybe;
+};
+
+export type NotificationTemplateWhereInput = {
+ language?: Maybe;
+ forType?: Maybe;
+ type?: Maybe;
+};
+
+export type NotificationOrderByInput = {
+ createdAt?: Maybe;
+ updatedAt?: Maybe;
+ status?: Maybe;
+};
+
+export type CommonSubscription = BaseEntity & {
+ __typename?: 'CommonSubscription';
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+ paymentStatus: SubscriptionPaymentStatus;
+ status: SubscriptionStatus;
+ dueDate: Scalars['DateTime'];
+ chargedAt: Scalars['DateTime'];
+ voided: Scalars['Boolean'];
+ amount: Scalars['Int'];
+ common: Common;
+};
+
+export enum SubscriptionPaymentStatus {
+ AwaitingInitialPayment = 'AwaitingInitialPayment',
+ Pending = 'Pending',
+ Successful = 'Successful',
+ Unsuccessful = 'Unsuccessful'
+}
+
+export enum SubscriptionStatus {
+ Pending = 'Pending',
+ Active = 'Active',
+ PaymentFailed = 'PaymentFailed',
+ CanceledByUser = 'CanceledByUser',
+ CanceledByPaymentFailure = 'CanceledByPaymentFailure'
+}
+
+
+export enum SortOrder {
+ Asc = 'asc',
+ Desc = 'desc'
+}
+
+export type Link = {
+ __typename?: 'Link';
+ /** The display title of the link */
+ title: Scalars['String'];
+ /** The actual link part of the link */
+ url: Scalars['String'];
+};
+
+export type BaseEntity = {
+ /** The main identifier of the item */
+ id: Scalars['UUID'];
+ /** The date, at which the item was created */
+ createdAt: Scalars['DateTime'];
+ /** The date, at which the item was last modified */
+ updatedAt: Scalars['DateTime'];
+};
+
+export type PaginateInput = {
+ take: Scalars['Int'];
+ skip?: Maybe;
+};
+
+export type LinkInput = {
+ /** The display title of the link */
+ title: Scalars['String'];
+ /** The actual link part of the link */
+ url: Scalars['String'];
+};
+
+export type StringFilter = {
+ contains?: Maybe;
+ endsWith?: Maybe;
+ equals?: Maybe;
+ gt?: Maybe;
+ gte?: Maybe;
+ lt?: Maybe;
+ lte?: Maybe;
+ startsWith?: Maybe;
+ in?: Maybe>;
+ notIn?: Maybe>;
+};
+
+export type BillingDetailsInput = {
+ name: Scalars['String'];
+ city: Scalars['String'];
+ country: Scalars['String'];
+ line1: Scalars['String'];
+ postalCode: Scalars['String'];
+ line2?: Maybe;
+ district?: Maybe;
+};
+
+export type CreateRoleInput = {
+ name: Scalars['String'];
+ displayName: Scalars['String'];
+ description: Scalars['String'];
+ permissions: Array;
+};
+
+export type CreateNotificationEventSettingsInput = {
+ sendToEveryone: Scalars['Boolean'];
+ sendToCommon: Scalars['Boolean'];
+ sendToUser: Scalars['Boolean'];
+ description: Scalars['String'];
+ sendNotificationType: NotificationType;
+ onEvent: EventType;
+};
+
+export type Query = {
+ __typename?: 'Query';
+ /** Provide ID to fetch specific user or do not pass anything to get the currently authenticated user */
+ user?: Maybe;
+ users?: Maybe>>;
+ generateUserAuthToken: Scalars['String'];
+ roles?: Maybe>>;
+ events?: Maybe>>;
+ common?: Maybe;
+ commons?: Maybe>>;
+ proposal?: Maybe;
+ proposals?: Maybe>>;
+ getStatistics?: Maybe>>;
+ discussion?: Maybe;
+ notificationEventSettings?: Maybe>>;
+ notificationTemplates?: Maybe>>;
+ /** List of all notifications, readable only by the admin */
+ notifications?: Maybe>>;
+};
+
+
+export type QueryUserArgs = {
+ where?: Maybe;
+};
+
+
+export type QueryUsersArgs = {
+ where?: Maybe;
+ paginate?: Maybe;
+};
+
+
+export type QueryGenerateUserAuthTokenArgs = {
+ authId: Scalars['String'];
+};
+
+
+export type QueryRolesArgs = {
+ paginate?: Maybe;
+};
+
+
+export type QueryEventsArgs = {
+ paginate?: Maybe;
+};
+
+
+export type QueryCommonArgs = {
+ where: CommonWhereUniqueInput;
+};
+
+
+export type QueryCommonsArgs = {
+ paginate?: Maybe;
+};
+
+
+export type QueryProposalArgs = {
+ where: ProposalWhereUniqueInput;
+};
+
+
+export type QueryProposalsArgs = {
+ where?: Maybe;
+ paginate?: Maybe;
+};
+
+
+export type QueryGetStatisticsArgs = {
+ where?: Maybe;
+};
+
+
+export type QueryDiscussionArgs = {
+ id: Scalars['ID'];
+};
+
+
+export type QueryNotificationEventSettingsArgs = {
+ paginate: PaginateInput;
+};
+
+
+export type QueryNotificationTemplatesArgs = {
+ where?: Maybe;
+ paginate?: Maybe;
+};
+
+
+export type QueryNotificationsArgs = {
+ paginate: PaginateInput;
+};
+
+export type Mutation = {
+ __typename?: 'Mutation';
+ /** Creates new user in the system */
+ createUser: User;
+ createUserNotificationToken: UserNotificationToken;
+ voidUserNotificationToken: UserNotificationToken;
+ createRole?: Maybe;
+ assignRole?: Maybe;
+ unassignRole?: Maybe;
+ createCard: Card;
+ createVote: Vote;
+ createCommon: Common;
+ delistCommon?: Maybe;
+ whitelistCommon?: Maybe;
+ actOnReport?: Maybe;
+ reportDiscussionMessage: Report;
+ finalizeProposal: Scalars['Boolean'];
+ /** Create new proposal of type JOIN. */
+ createJoinProposal: Proposal;
+ createFundingProposal: Proposal;
+ createDiscussion: Discussion;
+ createDiscussionMessage: DiscussionMessage;
+ changeDiscussionSubscriptionType?: Maybe;
+ createNotificationEventSettings?: Maybe;
+};
+
+
+export type MutationCreateUserArgs = {
+ input: CreateUserInput;
+};
+
+
+export type MutationCreateUserNotificationTokenArgs = {
+ input: CreateUserNotificationTokenInput;
+};
+
+
+export type MutationVoidUserNotificationTokenArgs = {
+ tokenId: Scalars['ID'];
+};
+
+
+export type MutationCreateRoleArgs = {
+ input: CreateRoleInput;
+};
+
+
+export type MutationAssignRoleArgs = {
+ userId: Scalars['ID'];
+ roleId: Scalars['ID'];
+};
+
+
+export type MutationUnassignRoleArgs = {
+ userId: Scalars['ID'];
+ roleId: Scalars['ID'];
+};
+
+
+export type MutationCreateCardArgs = {
+ input: CreateCardInput;
+};
+
+
+export type MutationCreateVoteArgs = {
+ input: CreateVoteInput;
+};
+
+
+export type MutationCreateCommonArgs = {
+ input: CreateCommonInput;
+};
+
+
+export type MutationDelistCommonArgs = {
+ commonId: Scalars['String'];
+};
+
+
+export type MutationWhitelistCommonArgs = {
+ commonId: Scalars['String'];
+};
+
+
+export type MutationActOnReportArgs = {
+ input: ActOnReportInput;
+};
+
+
+export type MutationReportDiscussionMessageArgs = {
+ input: ReportDiscussionMessageInput;
+};
+
+
+export type MutationFinalizeProposalArgs = {
+ proposalId: Scalars['ID'];
+};
+
+
+export type MutationCreateJoinProposalArgs = {
+ input: CreateJoinProposalInput;
+};
+
+
+export type MutationCreateFundingProposalArgs = {
+ input: CreateFundingProposalInput;
+};
+
+
+export type MutationCreateDiscussionArgs = {
+ input: CreateDiscussionInput;
+};
+
+
+export type MutationCreateDiscussionMessageArgs = {
+ input: CreateDiscussionMessageInput;
+};
+
+
+export type MutationChangeDiscussionSubscriptionTypeArgs = {
+ id: Scalars['ID'];
+ type: DiscussionSubscriptionType;
+};
+
+
+export type MutationCreateNotificationEventSettingsArgs = {
+ input: CreateNotificationEventSettingsInput;
+};
+
+export type Subscription = {
+ __typename?: 'Subscription';
+ onProposalChange?: Maybe;
+ discussionMessageCreated?: Maybe;
+ notificationCreated?: Maybe;
+};
+
+
+export type SubscriptionOnProposalChangeArgs = {
+ proposalId: Scalars['ID'];
+};
+
+
+export type SubscriptionDiscussionMessageCreatedArgs = {
+ discussionId: Scalars['ID'];
+};
+
+export type LoadUserContextQueryVariables = Exact<{ [key: string]: never; }>;
+
+
+export type LoadUserContextQuery = (
+ { __typename?: 'Query' }
+ & {
+ user?: Maybe<(
+ { __typename?: 'User' }
+ & Pick
+ )>
+}
+ );
+
+export type GetCommonDetailsQueryVariables = Exact<{
+ commonId: Scalars['ID'];
+ paginate: PaginateInput;
+}>;
+
+
+export type GetCommonDetailsQuery = (
+ { __typename?: 'Query' }
+ & {
+ common?: Maybe<(
+ { __typename?: 'Common' }
+ & Pick
+ & {
+ members: Array
+ & {
+ user?: Maybe<(
+ { __typename?: 'User' }
+ & Pick
+ )>
+ }
+ )>>, proposals: Array<(
+ { __typename?: 'Proposal' }
+ & Pick
+ & {
+ funding?: Maybe<(
+ { __typename?: 'FundingProposal' }
+ & Pick
+ )>, join?: Maybe<(
+ { __typename?: 'JoinProposal' }
+ & Pick
+ )>
+ }
+ )>
+ }
+ )>
+}
+ );
+
+export type GetAllUsersNotificationsQueryVariables = Exact<{
+ paginate: PaginateInput;
+}>;
+
+
+export type GetAllUsersNotificationsQuery = (
+ { __typename?: 'Query' }
+ & {
+ notifications?: Maybe
+ & {
+ user: (
+ { __typename?: 'User' }
+ & Pick
+ )
+ }
+ )>>>
+}
+ );
+
+export type GetProposalDetailsQueryVariables = Exact<{
+ where: ProposalWhereUniqueInput;
+}>;
+
+
+export type GetProposalDetailsQuery = (
+ { __typename?: 'Query' }
+ & {
+ proposal?: Maybe<(
+ { __typename?: 'Proposal' }
+ & Pick
+ & {
+ join?: Maybe<(
+ { __typename?: 'JoinProposal' }
+ & Pick
+ )>, funding?: Maybe<(
+ { __typename?: 'FundingProposal' }
+ & Pick
+ )>, user: (
+ { __typename?: 'User' }
+ & Pick
+ ), common: (
+ { __typename?: 'Common' }
+ & {
+ members: Array
+ )>>
+ }
+ ), votes: Array<(
+ { __typename?: 'Vote' }
+ & Pick
+ & {
+ voter: (
+ { __typename?: 'CommonMember' }
+ & {
+ user?: Maybe<(
+ { __typename?: 'User' }
+ & Pick
+ )>
+ }
+ )
+ }
+ )>
+ }
+ )>
+}
+ );
+
+export type GetUserDetailsQueryQueryVariables = Exact<{
+ where: UserWhereUniqueInput;
+}>;
+
+
+export type GetUserDetailsQueryQuery = (
+ { __typename?: 'Query' }
+ & {
+ user?: Maybe<(
+ { __typename?: 'User' }
+ & Pick
+ & {
+ proposals: Array<(
+ { __typename?: 'Proposal' }
+ & Pick
+ & {
+ join?: Maybe<(
+ { __typename?: 'JoinProposal' }
+ & Pick
+ )>
+ }
+ )>, subscriptions: Array<(
+ { __typename?: 'CommonSubscription' }
+ & Pick
+ & {
+ common: (
+ { __typename?: 'Common' }
+ & Pick
+ )
+ }
+ )>
+ }
+ )>
+}
+ );
+
+export type WhitelistCommonMutationVariables = Exact<{
+ commonId: Scalars['String'];
+}>;
+
+
+export type WhitelistCommonMutation = (
+ { __typename?: 'Mutation' }
+ & Pick
+ );
+
+export type DelistCommonMutationVariables = Exact<{
+ commonId: Scalars['String'];
+}>;
+
+
+export type DelistCommonMutation = (
+ { __typename?: 'Mutation' }
+ & Pick
+ );
+
+export type GetLatestEventsQueryVariables = Exact<{
+ take?: Maybe;
+ skip?: Maybe;
+}>;
+
+
+export type GetLatestEventsQuery = (
+ { __typename?: 'Query' }
+ & {
+ events?: Maybe
+ & {
+ user?: Maybe<(
+ { __typename?: 'User' }
+ & Pick
+ )>
+ }
+ )>>>
+}
+ );
+
+export type GetCommonsHomescreenDataQueryVariables = Exact<{
+ take?: Maybe;
+ skip?: Maybe;
+}>;
+
+
+export type GetCommonsHomescreenDataQuery = (
+ { __typename?: 'Query' }
+ & {
+ commons?: Maybe
+ & {
+ members: Array
+ )>>
+ }
+ )>>>
+}
+ );
+
+export type GetAllTimeStatistiscQueryVariables = Exact<{ [key: string]: never; }>;
+
+
+export type GetAllTimeStatistiscQuery = (
+ { __typename?: 'Query' }
+ & {
+ getStatistics?: Maybe
+ )>>>
+}
+ );
+
+export type GetProposalsHomescreenQueryVariables = Exact<{
+ fundingPaginate: PaginateInput;
+ joinPaginate: PaginateInput;
+}>;
+
+
+export type GetProposalsHomescreenQuery = (
+ { __typename?: 'Query' }
+ & {
+ funding?: Maybe
+ & {
+ funding?: Maybe<(
+ { __typename?: 'FundingProposal' }
+ & Pick
+ )>
+ }
+ )>>>, join?: Maybe
+ & {
+ join?: Maybe<(
+ { __typename?: 'JoinProposal' }
+ & Pick
+ )>
+ }
+ )>>>
+}
+ );
+
+export type GetUsersHomepageDataQueryVariables = Exact<{
+ paginate: PaginateInput;
+ where?: Maybe;
+}>;
+
+
+export type GetUsersHomepageDataQuery = (
+ { __typename?: 'Query' }
+ & {
+ users?: Maybe
+ )>>>
+}
+ );
+
+
+export const LoadUserContextDocument = gql`
+ query loadUserContext {
+ user {
+ id
+ firstName
+ lastName
+ displayName
+ email
+ photo
+ permissions
+ }
+ }
+`;
+
+/**
+ * __useLoadUserContextQuery__
+ *
+ * To run a query within a React component, call `useLoadUserContextQuery` and pass it any options that fit your needs.
+ * When your component renders, `useLoadUserContextQuery` returns an object from Apollo Client that contains loading, error, and data properties
+ * you can use to render your UI.
+ *
+ * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
+ *
+ * @example
+ * const { data, loading, error } = useLoadUserContextQuery({
+ * variables: {
+ * },
+ * });
+ */
+export function useLoadUserContextQuery(baseOptions?: Apollo.QueryHookOptions) {
+ return Apollo.useQuery(LoadUserContextDocument, baseOptions);
+}
+export function useLoadUserContextLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) {
+ return Apollo.useLazyQuery(LoadUserContextDocument, baseOptions);
+}
+export type LoadUserContextQueryHookResult = ReturnType;
+export type LoadUserContextLazyQueryHookResult = ReturnType;
+export type LoadUserContextQueryResult = Apollo.QueryResult;
+export const GetCommonDetailsDocument = gql`
+ query getCommonDetails($commonId: ID!, $paginate: PaginateInput!) {
+ common(where: {id: $commonId}) {
+ name
+ createdAt
+ updatedAt
+ balance
+ raised
+ fundingType
+ activeJoinProposals
+ activeFundingProposals
+ byline
+ action
+ description
+ image
+ whitelisted
+ members {
+ createdAt
+ userId
+ roles
+ user {
+ firstName
+ lastName
+ }
+ }
+ proposals(paginate: $paginate) {
+ id
+ type
+ title
+ description
+ funding {
+ amount
+ }
+ join {
+ fundingType
+ funding
+ }
+ }
+ }
+ }
+`;
+
+/**
+ * __useGetCommonDetailsQuery__
+ *
+ * To run a query within a React component, call `useGetCommonDetailsQuery` and pass it any options that fit your needs.
+ * When your component renders, `useGetCommonDetailsQuery` returns an object from Apollo Client that contains loading, error, and data properties
+ * you can use to render your UI.
+ *
+ * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
+ *
+ * @example
+ * const { data, loading, error } = useGetCommonDetailsQuery({
+ * variables: {
+ * commonId: // value for 'commonId'
+ * paginate: // value for 'paginate'
+ * },
+ * });
+ */
+export function useGetCommonDetailsQuery(baseOptions: Apollo.QueryHookOptions