Commit 34857bfa authored by aleclofabbro's avatar aleclofabbro
Browse files

removed follows

parent 4aab0b87
......@@ -12,17 +12,8 @@ type Knows implements Glyph {
_obj: [KnowsObject!]!
}
# Follows
union FollowsSubject = User
union FollowsObject = User
type Follows implements Glyph {
_id: ID!
_subj: [FollowsSubject!]!
_obj: [FollowsObject!]!
}
# User
union UserRelation = Knows | Follows
union UserRelation = Knows
type User implements Glyph {
_id: ID!
......@@ -42,5 +33,4 @@ input CreateUserInput {
type Mutation {
createUser(user: CreateUserInput!): User
createKnows(from: ID!, to: ID!): Knows
createFollows(from: ID!, to: ID!): Follows
}
......@@ -39,11 +39,6 @@
"name": "Knows",
"ofType": null
},
{
"kind": "OBJECT",
"name": "Follows",
"ofType": null
},
{
"kind": "OBJECT",
"name": "User",
......@@ -174,119 +169,6 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "UNION",
"name": "FollowsSubject",
"description": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": [
{
"kind": "OBJECT",
"name": "User",
"ofType": null
}
]
},
{
"kind": "UNION",
"name": "FollowsObject",
"description": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": [
{
"kind": "OBJECT",
"name": "User",
"ofType": null
}
]
},
{
"kind": "OBJECT",
"name": "Follows",
"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": "_subj",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "UNION",
"name": "FollowsSubject",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "_obj",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "UNION",
"name": "FollowsObject",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
{
"kind": "INTERFACE",
"name": "Glyph",
"ofType": null
}
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "UNION",
"name": "UserRelation",
......@@ -300,11 +182,6 @@
"kind": "OBJECT",
"name": "Knows",
"ofType": null
},
{
"kind": "OBJECT",
"name": "Follows",
"ofType": null
}
]
},
......@@ -523,47 +400,6 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "createFollows",
"description": null,
"args": [
{
"name": "from",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "to",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "Follows",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
......
import { ObjectID } from 'mongodb'
import { toMongoRelation } from '../../../gql-graph/mongo/mappers'
import { graphCollection } from '../../../mongo/collection'
import { Follows, MutationResolvers } from '../../types'
export const createFollows: MutationResolvers['createFollows'] = async (_parent, args) => {
const newFollows = toMongoRelation<Follows>(
{
__typename: 'Follows',
},
new ObjectID(args.to),
new ObjectID(args.from)
)
const c = await graphCollection<Follows>()
await c.insertOne(newFollows)
return null //{ ...newFollows, _id: newFollows._id.toHexString(), _obj: [], _subj: [] }
}
import { MutationResolvers } from '../../types'
import { createUser } from './createUser'
import { createFollows } from './createFollows'
import { createKnows } from './createKnows'
import { createUser } from './createUser'
export const Mutation: MutationResolvers = {
createUser,
createFollows,
createKnows,
}
......@@ -10,9 +10,4 @@ export const Types = {
_subj: defaultGraphFieldResolver(),
_obj: defaultGraphFieldResolver(),
},
Follows: {
_id: defaultGraphFieldResolver(),
_subj: defaultGraphFieldResolver(),
_obj: defaultGraphFieldResolver(),
},
}
import { ShallowRelation } from '../../gql-graph/types'
import * as Types from '../types'
export const Follows = (tag: string): ShallowRelation<Types.Follows> => ({
__typename: 'Follows',
_id: `_id[${tag}]`,
})
import { Follows } from './Follows'
import { Knows } from './Knows'
import { User } from './User'
......@@ -6,5 +5,4 @@ export type ShallowTypeMocks = typeof ShallowTypeMocks
export const ShallowTypeMocks = {
User,
Knows,
Follows,
}
......@@ -28,18 +28,7 @@ export type Knows = Glyph & {
_obj: Array<KnowsObject>;
};
export type FollowsSubject = User;
export type FollowsObject = User;
export type Follows = Glyph & {
__typename: 'Follows';
_id: Scalars['ID'];
_subj: Array<FollowsSubject>;
_obj: Array<FollowsObject>;
};
export type UserRelation = Knows | Follows;
export type UserRelation = Knows;
export type User = Glyph & {
__typename: 'User';
......@@ -61,7 +50,6 @@ export type Mutation = {
__typename: 'Mutation';
createUser: Maybe<User>;
createKnows: Maybe<Knows>;
createFollows: Maybe<Follows>;
};
......@@ -76,12 +64,6 @@ export type MutationCreateKnowsArgs = {
};
export type MutationCreateFollowsArgs = {
from: Scalars['ID'];
to: Scalars['ID'];
};
export type ResolverTypeWrapper<T> = Promise<T> | T;
......@@ -159,15 +141,12 @@ export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs
/** Mapping between all available schema types and the resolvers types */
export type ResolversTypes = {
Glyph: ResolversTypes['Knows'] | ResolversTypes['Follows'] | ResolversTypes['User'];
Glyph: ResolversTypes['Knows'] | ResolversTypes['User'];
ID: ResolverTypeWrapper<Scalars['ID']>;
KnowsSubject: ResolversTypes['User'];
KnowsObject: ResolversTypes['User'];
Knows: ResolverTypeWrapper<Omit<Knows, '_subj' | '_obj'> & { _subj: Array<ResolversTypes['KnowsSubject']>, _obj: Array<ResolversTypes['KnowsObject']> }>;
FollowsSubject: ResolversTypes['User'];
FollowsObject: ResolversTypes['User'];
Follows: ResolverTypeWrapper<Omit<Follows, '_subj' | '_obj'> & { _subj: Array<ResolversTypes['FollowsSubject']>, _obj: Array<ResolversTypes['FollowsObject']> }>;
UserRelation: ResolversTypes['Knows'] | ResolversTypes['Follows'];
UserRelation: ResolversTypes['Knows'];
User: ResolverTypeWrapper<Omit<User, '_rel'> & { _rel: Array<ResolversTypes['UserRelation']> }>;
String: ResolverTypeWrapper<Scalars['String']>;
Query: ResolverTypeWrapper<RootValue>;
......@@ -178,15 +157,12 @@ export type ResolversTypes = {
/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = {
Glyph: ResolversParentTypes['Knows'] | ResolversParentTypes['Follows'] | ResolversParentTypes['User'];
Glyph: ResolversParentTypes['Knows'] | ResolversParentTypes['User'];
ID: Scalars['ID'];
KnowsSubject: ResolversParentTypes['User'];
KnowsObject: ResolversParentTypes['User'];
Knows: Omit<Knows, '_subj' | '_obj'> & { _subj: Array<ResolversParentTypes['KnowsSubject']>, _obj: Array<ResolversParentTypes['KnowsObject']> };
FollowsSubject: ResolversParentTypes['User'];
FollowsObject: ResolversParentTypes['User'];
Follows: Omit<Follows, '_subj' | '_obj'> & { _subj: Array<ResolversParentTypes['FollowsSubject']>, _obj: Array<ResolversParentTypes['FollowsObject']> };
UserRelation: ResolversParentTypes['Knows'] | ResolversParentTypes['Follows'];
UserRelation: ResolversParentTypes['Knows'];
User: Omit<User, '_rel'> & { _rel: Array<ResolversParentTypes['UserRelation']> };
String: Scalars['String'];
Query: RootValue;
......@@ -196,7 +172,7 @@ export type ResolversParentTypes = {
};
export type GlyphResolvers<ContextType = Context, ParentType extends ResolversParentTypes['Glyph'] = ResolversParentTypes['Glyph']> = {
__resolveType: TypeResolveFn<'Knows' | 'Follows' | 'User', ParentType, ContextType>;
__resolveType: TypeResolveFn<'Knows' | 'User', ParentType, ContextType>;
_id: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
};
......@@ -215,23 +191,8 @@ export type KnowsResolvers<ContextType = Context, ParentType extends ResolversPa
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export type FollowsSubjectResolvers<ContextType = Context, ParentType extends ResolversParentTypes['FollowsSubject'] = ResolversParentTypes['FollowsSubject']> = {
__resolveType: TypeResolveFn<'User', ParentType, ContextType>;
};
export type FollowsObjectResolvers<ContextType = Context, ParentType extends ResolversParentTypes['FollowsObject'] = ResolversParentTypes['FollowsObject']> = {
__resolveType: TypeResolveFn<'User', ParentType, ContextType>;
};
export type FollowsResolvers<ContextType = Context, ParentType extends ResolversParentTypes['Follows'] = ResolversParentTypes['Follows']> = {
_id: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
_subj: Resolver<Array<ResolversTypes['FollowsSubject']>, ParentType, ContextType>;
_obj: Resolver<Array<ResolversTypes['FollowsObject']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export type UserRelationResolvers<ContextType = Context, ParentType extends ResolversParentTypes['UserRelation'] = ResolversParentTypes['UserRelation']> = {
__resolveType: TypeResolveFn<'Knows' | 'Follows', ParentType, ContextType>;
__resolveType: TypeResolveFn<'Knows', ParentType, ContextType>;
};
export type UserResolvers<ContextType = Context, ParentType extends ResolversParentTypes['User'] = ResolversParentTypes['User']> = {
......@@ -248,7 +209,6 @@ export type QueryResolvers<ContextType = Context, ParentType extends ResolversPa
export type MutationResolvers<ContextType = Context, ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']> = {
createUser: Resolver<Maybe<ResolversTypes['User']>, ParentType, ContextType, RequireFields<MutationCreateUserArgs, 'user'>>;
createKnows: Resolver<Maybe<ResolversTypes['Knows']>, ParentType, ContextType, RequireFields<MutationCreateKnowsArgs, 'from' | 'to'>>;
createFollows: Resolver<Maybe<ResolversTypes['Follows']>, ParentType, ContextType, RequireFields<MutationCreateFollowsArgs, 'from' | 'to'>>;
};
export type Resolvers<ContextType = Context> = {
......@@ -256,9 +216,6 @@ export type Resolvers<ContextType = Context> = {
KnowsSubject: KnowsSubjectResolvers<ContextType>;
KnowsObject: KnowsObjectResolvers<ContextType>;
Knows: KnowsResolvers<ContextType>;
FollowsSubject: FollowsSubjectResolvers<ContextType>;
FollowsObject: FollowsObjectResolvers<ContextType>;
Follows: FollowsResolvers<ContextType>;
UserRelation: UserRelationResolvers<ContextType>;
User: UserResolvers<ContextType>;
Query: QueryResolvers<ContextType>;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment