chore: Return connectionType for testConnection query
This commit is contained in:
@@ -40,7 +40,11 @@ export default class Twitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isStillVerified() {
|
async isStillVerified() {
|
||||||
const userData = await this.client.currentUser();
|
try {
|
||||||
return userData.id ? true : false
|
await this.client.currentUser();
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { GraphQLString, GraphQLNonNull, GraphQLBoolean } from 'graphql';
|
import { GraphQLString, GraphQLNonNull, GraphQLBoolean } from 'graphql';
|
||||||
import Connection from '../../models/connection';
|
import Connection from '../../models/connection';
|
||||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||||
|
import connectionType from '../types/connection'
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
id: string,
|
id: string,
|
||||||
@@ -17,11 +18,15 @@ const testConnectionResolver = async (params: Params, req: RequestWithCurrentUse
|
|||||||
const appInstance = new appClass(connection.data)
|
const appInstance = new appClass(connection.data)
|
||||||
const isStillVerified = await appInstance.isStillVerified();
|
const isStillVerified = await appInstance.isStillVerified();
|
||||||
|
|
||||||
return isStillVerified;
|
connection = await connection.$query().patchAndFetch({
|
||||||
|
verified: isStillVerified
|
||||||
|
})
|
||||||
|
|
||||||
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const testConnection = {
|
const testConnection = {
|
||||||
type: GraphQLBoolean,
|
type: connectionType,
|
||||||
args: {
|
args: {
|
||||||
id: { type: GraphQLNonNull(GraphQLString) }
|
id: { type: GraphQLNonNull(GraphQLString) }
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user