mirror of
https://github.com/quepasaevents/qpa-client.git
synced 2023-12-14 05:33:02 +01:00
Fix TS Issues
This commit is contained in:
parent
96ebc77452
commit
ced32e8ad9
228
@types/graphql.d.ts
vendored
228
@types/graphql.d.ts
vendored
|
@ -1,228 +0,0 @@
|
||||||
// tslint:disable
|
|
||||||
// graphql typescript definitions
|
|
||||||
|
|
||||||
declare namespace GQL {
|
|
||||||
interface IGraphQLResponseRoot {
|
|
||||||
data?: IQuery | IMutation;
|
|
||||||
errors?: Array<IGraphQLResponseError>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IGraphQLResponseError {
|
|
||||||
/** Required for all errors */
|
|
||||||
message: string;
|
|
||||||
locations?: Array<IGraphQLResponseErrorLocation>;
|
|
||||||
/** 7.2.2 says 'GraphQL servers may provide additional entries to error' */
|
|
||||||
[propName: string]: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IGraphQLResponseErrorLocation {
|
|
||||||
line: number;
|
|
||||||
column: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IQuery {
|
|
||||||
__typename: 'Query';
|
|
||||||
me: IUser | null;
|
|
||||||
events: Array<ICalendarEvent | null> | null;
|
|
||||||
occurrences: Array<IEventOccurrence | null> | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventsOnQueryArguments {
|
|
||||||
filter: IEventsQueryFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IOccurrencesOnQueryArguments {
|
|
||||||
filter: IOccurrencesQueryFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IUser {
|
|
||||||
__typename: 'User';
|
|
||||||
name: string;
|
|
||||||
username: string;
|
|
||||||
email: string;
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventsQueryFilter {
|
|
||||||
owner?: string | null;
|
|
||||||
limit?: number | null;
|
|
||||||
from?: any | null;
|
|
||||||
to?: any | null;
|
|
||||||
categories?: Array<any | null> | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ICalendarEvent {
|
|
||||||
__typename: 'CalendarEvent';
|
|
||||||
id: string;
|
|
||||||
owner: IUser;
|
|
||||||
info: Array<IEventInformation | null>;
|
|
||||||
time: IEventTime;
|
|
||||||
status: any;
|
|
||||||
contact: Array<IEventContactPerson>;
|
|
||||||
location: ILocation;
|
|
||||||
occurrences: Array<IEventOccurrence | null> | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventInformation {
|
|
||||||
__typename: 'EventInformation';
|
|
||||||
language: string;
|
|
||||||
title: string;
|
|
||||||
description: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventTime {
|
|
||||||
__typename: 'EventTime';
|
|
||||||
timeZone: any | null;
|
|
||||||
start: any | null;
|
|
||||||
end: any | null;
|
|
||||||
recurrence: string | null;
|
|
||||||
exceptions: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventContactPerson {
|
|
||||||
__typename: 'EventContactPerson';
|
|
||||||
name: string;
|
|
||||||
languages: Array<any> | null;
|
|
||||||
contact: IContact | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IContact {
|
|
||||||
__typename: 'Contact';
|
|
||||||
email: string | null;
|
|
||||||
phone: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ILocation {
|
|
||||||
__typename: 'Location';
|
|
||||||
address: string | null;
|
|
||||||
name: string | null;
|
|
||||||
coordinate: IGeoCoordinate | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IGeoCoordinate {
|
|
||||||
__typename: 'GeoCoordinate';
|
|
||||||
lat: number | null;
|
|
||||||
lng: number | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventOccurrence {
|
|
||||||
__typename: 'EventOccurrence';
|
|
||||||
id: string;
|
|
||||||
event: ICalendarEvent;
|
|
||||||
start: string;
|
|
||||||
utcStart: string;
|
|
||||||
end: string;
|
|
||||||
utcEnd: string;
|
|
||||||
timeZone: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IOccurrencesQueryFilter {
|
|
||||||
from?: any | null;
|
|
||||||
to?: any | null;
|
|
||||||
timeZone?: any | null;
|
|
||||||
categories?: Array<any | null> | null;
|
|
||||||
limit?: number | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IMutation {
|
|
||||||
__typename: 'Mutation';
|
|
||||||
signup: Array<IError | null> | null;
|
|
||||||
signin: IUserSession;
|
|
||||||
requestInvite: boolean;
|
|
||||||
createEvent: ICalendarEvent | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ISignupOnMutationArguments {
|
|
||||||
input?: ISignupInput | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ISigninOnMutationArguments {
|
|
||||||
input?: ISigninInput | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IRequestInviteOnMutationArguments {
|
|
||||||
input?: IRequestInviteInput | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ICreateEventOnMutationArguments {
|
|
||||||
input: ICreateEventInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ISignupInput {
|
|
||||||
email: string;
|
|
||||||
username: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IError {
|
|
||||||
__typename: 'Error';
|
|
||||||
path: string;
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ISigninInput {
|
|
||||||
hash: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IUserSession {
|
|
||||||
__typename: 'UserSession';
|
|
||||||
hash: string;
|
|
||||||
user: IUser;
|
|
||||||
ctime: any;
|
|
||||||
isValid: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IRequestInviteInput {
|
|
||||||
email: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ICreateEventInput {
|
|
||||||
time?: IEventTimeInput | null;
|
|
||||||
info?: Array<IEventInformationInput | null> | null;
|
|
||||||
location?: IEventLocationInput | null;
|
|
||||||
meta?: IEventMetaInput | null;
|
|
||||||
status: string;
|
|
||||||
contact: Array<IEventContactPersonInput>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventTimeInput {
|
|
||||||
timeZone: any;
|
|
||||||
start: any;
|
|
||||||
end: any;
|
|
||||||
recurrence?: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventInformationInput {
|
|
||||||
language: string;
|
|
||||||
title: string;
|
|
||||||
description?: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventLocationInput {
|
|
||||||
address?: string | null;
|
|
||||||
name?: string | null;
|
|
||||||
coordinate?: IGeoCoordinateInput | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IGeoCoordinateInput {
|
|
||||||
lat?: number | null;
|
|
||||||
lng?: number | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventMetaInput {
|
|
||||||
tags?: Array<string | null> | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventContactPersonInput {
|
|
||||||
name: string;
|
|
||||||
languages?: Array<any> | null;
|
|
||||||
contact?: IEventContactInput | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IEventContactInput {
|
|
||||||
email?: string | null;
|
|
||||||
phone?: string | null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// tslint:enable
|
|
30
@types/index.d.ts
vendored
30
@types/index.d.ts
vendored
|
@ -24,10 +24,15 @@ declare namespace GQL {
|
||||||
interface IQuery {
|
interface IQuery {
|
||||||
__typename: 'Query';
|
__typename: 'Query';
|
||||||
me: IUser | null;
|
me: IUser | null;
|
||||||
|
event: ICalendarEvent | null;
|
||||||
events: Array<ICalendarEvent | null> | null;
|
events: Array<ICalendarEvent | null> | null;
|
||||||
occurrences: Array<IEventOccurrence | null> | null;
|
occurrences: Array<IEventOccurrence | null> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IEventOnQueryArguments {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface IEventsOnQueryArguments {
|
interface IEventsOnQueryArguments {
|
||||||
filter: IEventsQueryFilter;
|
filter: IEventsQueryFilter;
|
||||||
}
|
}
|
||||||
|
@ -44,14 +49,6 @@ declare namespace GQL {
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IEventsQueryFilter {
|
|
||||||
owner?: string | null;
|
|
||||||
limit?: number | null;
|
|
||||||
from?: any | null;
|
|
||||||
to?: any | null;
|
|
||||||
categories?: Array<any | null> | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ICalendarEvent {
|
interface ICalendarEvent {
|
||||||
__typename: 'CalendarEvent';
|
__typename: 'CalendarEvent';
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -117,6 +114,14 @@ declare namespace GQL {
|
||||||
timeZone: string;
|
timeZone: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IEventsQueryFilter {
|
||||||
|
owner?: string | null;
|
||||||
|
limit?: number | null;
|
||||||
|
from?: any | null;
|
||||||
|
to?: any | null;
|
||||||
|
categories?: Array<any | null> | null;
|
||||||
|
}
|
||||||
|
|
||||||
interface IOccurrencesQueryFilter {
|
interface IOccurrencesQueryFilter {
|
||||||
from?: any | null;
|
from?: any | null;
|
||||||
to?: any | null;
|
to?: any | null;
|
||||||
|
@ -178,9 +183,9 @@ declare namespace GQL {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ICreateEventInput {
|
interface ICreateEventInput {
|
||||||
time?: IEventTimeInput | null;
|
time: IEventTimeInput;
|
||||||
info?: Array<IEventInformationInput | null> | null;
|
info: Array<IEventInformationInput | null>;
|
||||||
location?: IEventLocationInput | null;
|
location: IEventLocationInput;
|
||||||
meta?: IEventMetaInput | null;
|
meta?: IEventMetaInput | null;
|
||||||
status: string;
|
status: string;
|
||||||
contact: Array<IEventContactPersonInput>;
|
contact: Array<IEventContactPersonInput>;
|
||||||
|
@ -227,3 +232,6 @@ declare namespace GQL {
|
||||||
}
|
}
|
||||||
|
|
||||||
// tslint:enable
|
// tslint:enable
|
||||||
|
|
||||||
|
|
||||||
|
// tslint:enable
|
||||||
|
|
|
@ -9,10 +9,9 @@ import CreateEvent from "../Event/CreateEvent";
|
||||||
|
|
||||||
|
|
||||||
const httpLink = new HttpLink({
|
const httpLink = new HttpLink({
|
||||||
uri: 'http://localhost:4000',
|
uri: '/graphql',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const graphqlClient = new ApolloClient({
|
const graphqlClient = new ApolloClient({
|
||||||
connectToDevTools: true,
|
connectToDevTools: true,
|
||||||
link: httpLink,
|
link: httpLink,
|
||||||
|
|
|
@ -119,6 +119,7 @@ const EventForm = (props: Props) => (
|
||||||
({field}) => <input {...field} placeholder="Email to contact"/>
|
({field}) => <input {...field} placeholder="Email to contact"/>
|
||||||
}
|
}
|
||||||
</Field>
|
</Field>
|
||||||
|
<button type="submit">Create</button>
|
||||||
</Form>
|
</Form>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,14 @@ const config: webpack.Configuration = {
|
||||||
devServer: {
|
devServer: {
|
||||||
historyApiFallback: true,
|
historyApiFallback: true,
|
||||||
hot: true,
|
hot: true,
|
||||||
|
proxy: {
|
||||||
|
'/graphql': {
|
||||||
|
redirect: false,
|
||||||
|
changeOrigin: true,
|
||||||
|
target: `http://localhost:4000`,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
@ -28,7 +36,7 @@ const config: webpack.Configuration = {
|
||||||
}
|
}
|
||||||
} ]
|
} ]
|
||||||
},
|
},
|
||||||
devtool: '#@source-map',
|
devtool: '@source-map',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, './dist'),
|
path: path.resolve(__dirname, './dist'),
|
||||||
filename: 'bundle.js'
|
filename: 'bundle.js'
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import SessionManager, { SessionAlreadyValidatedError } from "./SessionManager"
|
import SessionManager, { SessionAlreadyValidatedError } from "./SessionManager"
|
||||||
import { User } from "./User.entity"
|
import { User } from "./User.entity"
|
||||||
import { PostOffice } from "../post_office"
|
import { PostOffice } from "../post_office"
|
||||||
|
import {GQL} from "../../../@types"
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
sendEmail: PostOffice
|
sendEmail: PostOffice
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
EventOccurrence
|
EventOccurrence
|
||||||
} from "../Calendar/Event.entity"
|
} from "../Calendar/Event.entity"
|
||||||
import { Context, ResolverMap } from "../@types/graphql-utils"
|
import { Context, ResolverMap } from "../@types/graphql-utils"
|
||||||
|
import {GQL} from "../../../@types"
|
||||||
const resolvers: ResolverMap = {
|
const resolvers: ResolverMap = {
|
||||||
Query: {
|
Query: {
|
||||||
event: (_, req: GQL.IEventOnQueryArguments, context, info) => {
|
event: (_, req: GQL.IEventOnQueryArguments, context, info) => {
|
||||||
|
|
|
@ -59,6 +59,7 @@ export const createServer = async (dependencies: Dependencies) => {
|
||||||
const ctx: Context = {
|
const ctx: Context = {
|
||||||
req: a.req
|
req: a.req
|
||||||
}
|
}
|
||||||
|
console.log('cookies: ', a.req.cookies.toString())
|
||||||
if (a.req && a.req.headers.authentication) {
|
if (a.req && a.req.headers.authentication) {
|
||||||
const session = await Session.findOne({hash: a.req.headers.authentication as string})
|
const session = await Session.findOne({hash: a.req.headers.authentication as string})
|
||||||
if (session) {
|
if (session) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"../@types/graphql.d.ts", "../node_modules/@types/node/ts3.2/index.d.ts"
|
"../@types/index.d.ts", "../node_modules/@types/node/ts3.2/index.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"**/*.spec.ts", "node_modules", "__tests__"
|
"**/*.spec.ts", "node_modules", "__tests__"
|
||||||
|
|
Loading…
Reference in a new issue