chore: Use integer for IDs of resources
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
a58411ee99
commit
3f2f1212c9
@@ -1,4 +1,4 @@
|
||||
import { GraphQLNonNull, GraphQLString } from 'graphql';
|
||||
import { GraphQLNonNull, GraphQLInt } from 'graphql';
|
||||
import Connection from '../../models/connection';
|
||||
import authLinkType from '../types/auth-link';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
@@ -6,6 +6,7 @@ import RequestWithCurrentUser from '../../types/express/request-with-current-use
|
||||
type Params = {
|
||||
id: number,
|
||||
}
|
||||
|
||||
const createAuthDataResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
const connection = await Connection.query().findOne({
|
||||
user_id: req.currentUser.id,
|
||||
@@ -34,7 +35,7 @@ const createAuthDataResolver = async (params: Params, req: RequestWithCurrentUse
|
||||
const createAuthData = {
|
||||
type: authLinkType,
|
||||
args: {
|
||||
id: { type: GraphQLNonNull(GraphQLString) },
|
||||
id: { type: GraphQLNonNull(GraphQLInt) },
|
||||
},
|
||||
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => createAuthDataResolver(params, req)
|
||||
};
|
||||
|
@@ -32,7 +32,7 @@ const createStepResolver = async (params: Params, req: RequestWithCurrentUser) =
|
||||
const createStep = {
|
||||
type: stepType,
|
||||
args: {
|
||||
flowId: { type: GraphQLNonNull(GraphQLString) },
|
||||
flowId: { type: GraphQLNonNull(GraphQLInt) },
|
||||
key: { type: GraphQLNonNull(GraphQLString) },
|
||||
appKey: { type: GraphQLNonNull(GraphQLString) },
|
||||
type: {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { GraphQLString, GraphQLNonNull, GraphQLBoolean } from 'graphql';
|
||||
import { GraphQLInt, GraphQLNonNull, GraphQLBoolean } from 'graphql';
|
||||
import Connection from '../../models/connection';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
|
||||
type Params = {
|
||||
id: string,
|
||||
id: number,
|
||||
data: object
|
||||
}
|
||||
const deleteConnectionResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
@@ -18,7 +18,7 @@ const deleteConnectionResolver = async (params: Params, req: RequestWithCurrentU
|
||||
const deleteConnection = {
|
||||
type: GraphQLBoolean,
|
||||
args: {
|
||||
id: { type: GraphQLNonNull(GraphQLString) }
|
||||
id: { type: GraphQLNonNull(GraphQLInt) }
|
||||
},
|
||||
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => deleteConnectionResolver(params, req)
|
||||
};
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { GraphQLString, GraphQLNonNull } from 'graphql';
|
||||
import { GraphQLInt, GraphQLNonNull } from 'graphql';
|
||||
import App from '../../models/app';
|
||||
import Connection from '../../models/connection';
|
||||
import Step from '../../models/step';
|
||||
@@ -6,7 +6,7 @@ import stepType from '../types/step';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
|
||||
type Params = {
|
||||
id: string,
|
||||
id: number,
|
||||
data: object
|
||||
}
|
||||
const executeStepResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
@@ -28,7 +28,7 @@ const executeStepResolver = async (params: Params, req: RequestWithCurrentUser)
|
||||
const executeStep = {
|
||||
type: stepType,
|
||||
args: {
|
||||
id: { type: GraphQLNonNull(GraphQLString) }
|
||||
id: { type: GraphQLNonNull(GraphQLInt) }
|
||||
},
|
||||
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => executeStepResolver(params, req)
|
||||
};
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { GraphQLString, GraphQLNonNull } from 'graphql';
|
||||
import { GraphQLInt, GraphQLNonNull } from 'graphql';
|
||||
import Connection from '../../models/connection';
|
||||
import connectionType from '../types/connection';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
|
||||
type Params = {
|
||||
id: string
|
||||
id: number
|
||||
}
|
||||
|
||||
const resetConnectionResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
@@ -23,7 +23,7 @@ const resetConnectionResolver = async (params: Params, req: RequestWithCurrentUs
|
||||
const resetConnection = {
|
||||
type: connectionType,
|
||||
args: {
|
||||
id: { type: GraphQLNonNull(GraphQLString) },
|
||||
id: { type: GraphQLNonNull(GraphQLInt) },
|
||||
},
|
||||
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => resetConnectionResolver(params, req)
|
||||
};
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { GraphQLString, GraphQLNonNull } from 'graphql';
|
||||
import { GraphQLInt, GraphQLNonNull } from 'graphql';
|
||||
import { GraphQLJSONObject } from 'graphql-type-json';
|
||||
import Connection from '../../models/connection';
|
||||
import connectionType from '../types/connection';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
|
||||
type Params = {
|
||||
id: string,
|
||||
id: number,
|
||||
data: object
|
||||
}
|
||||
const updateConnectionResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
@@ -27,7 +27,7 @@ const updateConnectionResolver = async (params: Params, req: RequestWithCurrentU
|
||||
const updateConnection = {
|
||||
type: connectionType,
|
||||
args: {
|
||||
id: { type: GraphQLNonNull(GraphQLString) },
|
||||
id: { type: GraphQLNonNull(GraphQLInt) },
|
||||
data: { type: GraphQLNonNull(GraphQLJSONObject) }
|
||||
},
|
||||
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => updateConnectionResolver(params, req)
|
||||
|
@@ -4,7 +4,7 @@ import flowType from '../types/flow';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
|
||||
type Params = {
|
||||
id: string,
|
||||
id: number,
|
||||
name: string
|
||||
}
|
||||
const updateFlowResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { GraphQLString, GraphQLNonNull } from 'graphql';
|
||||
import { GraphQLInt, GraphQLNonNull } from 'graphql';
|
||||
import Connection from '../../models/connection';
|
||||
import connectionType from '../types/connection';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
|
||||
type Params = {
|
||||
id: string
|
||||
id: number
|
||||
}
|
||||
const verifyConnectionResolver = async (params: Params, req: RequestWithCurrentUser) => {
|
||||
let connection = await Connection.query().findOne({
|
||||
@@ -31,7 +31,7 @@ const verifyConnectionResolver = async (params: Params, req: RequestWithCurrentU
|
||||
const verifyConnection = {
|
||||
type: connectionType,
|
||||
args: {
|
||||
id: { type: GraphQLNonNull(GraphQLString) }
|
||||
id: { type: GraphQLNonNull(GraphQLInt) }
|
||||
},
|
||||
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => verifyConnectionResolver(params, req)
|
||||
};
|
||||
|
Reference in New Issue
Block a user