chore: Use integer for IDs of resources

This commit is contained in:
Faruk AYDIN
2021-12-26 13:41:46 +03:00
committed by Ömer Faruk Aydın
parent a58411ee99
commit 3f2f1212c9
29 changed files with 172 additions and 103 deletions

View File

@@ -75,7 +75,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
},
@@ -97,7 +98,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
},
{
"name": "data",
@@ -118,7 +120,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -131,7 +134,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -142,7 +146,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -167,7 +172,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -189,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -210,7 +217,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -75,7 +75,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
},
@@ -97,7 +98,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
},
{
"name": "data",
@@ -118,7 +120,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -131,7 +134,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -142,7 +146,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -167,7 +172,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -189,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -210,7 +217,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -75,7 +75,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
},
@@ -97,7 +98,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
},
{
"name": "data",
@@ -118,7 +120,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -131,7 +134,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -142,7 +146,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -167,7 +172,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -189,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -210,7 +217,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -75,7 +75,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
},
@@ -97,7 +98,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
},
{
"name": "data",
@@ -118,7 +120,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -131,7 +134,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -142,7 +146,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -167,7 +172,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -189,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -210,7 +217,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -127,7 +127,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -140,7 +141,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -151,7 +153,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -192,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -127,7 +127,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -140,7 +141,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -151,7 +153,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -192,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -63,7 +63,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -76,7 +77,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -87,7 +89,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -112,7 +115,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -75,7 +75,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
},
@@ -97,7 +98,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
},
{
"name": "data",
@@ -118,7 +120,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -131,7 +134,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -142,7 +146,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -167,7 +172,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -189,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -210,7 +217,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -75,7 +75,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
},
@@ -97,7 +98,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
},
{
"name": "data",
@@ -118,7 +120,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -131,7 +134,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -142,7 +146,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -167,7 +172,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -189,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -210,7 +217,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -75,7 +75,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
},
@@ -97,7 +98,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
},
{
"name": "data",
@@ -118,7 +120,8 @@
"arguments": [
{
"name": "id",
"value": "{createConnection.id}"
"value": "{createConnection.id}",
"type": "integer"
}
]
}
@@ -131,7 +134,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -142,7 +146,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -167,7 +172,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
},
@@ -189,7 +195,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
},
{
"name": "data",
@@ -210,7 +217,8 @@
"arguments": [
{
"name": "id",
"value": "{connection.id}"
"value": "{connection.id}",
"type": "integer"
}
]
}

View File

@@ -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)
};

View File

@@ -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: {

View File

@@ -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)
};

View File

@@ -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)
};

View File

@@ -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)
};

View File

@@ -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)

View File

@@ -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) => {

View File

@@ -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)
};

View File

@@ -1,4 +1,4 @@
import { GraphQLObjectType, GraphQLString, GraphQLBoolean } from 'graphql';
import { GraphQLObjectType, GraphQLString, GraphQLBoolean, GraphQLInt } from 'graphql';
import connectionDataType from './connection-data';
const connectionType = new GraphQLObjectType({
@@ -7,7 +7,7 @@ const connectionType = new GraphQLObjectType({
const appType = require('./app').default;
return {
id: { type: GraphQLString },
id: { type: GraphQLInt },
key: { type: GraphQLString },
data: { type: connectionDataType },
verified: { type: GraphQLBoolean },

View File

@@ -1,10 +1,10 @@
import { GraphQLList, GraphQLObjectType, GraphQLString } from 'graphql';
import { GraphQLList, GraphQLObjectType, GraphQLString, GraphQLInt } from 'graphql';
import StepType from './step';
const flowType = new GraphQLObjectType({
name: 'Flow',
fields: {
id: { type: GraphQLString },
id: { type: GraphQLInt },
name: { type: GraphQLString },
steps: {
type: GraphQLList(StepType),

View File

@@ -4,7 +4,7 @@ import ConnectionType from './connection';
const stepType = new GraphQLObjectType({
name: 'Step',
fields: {
id: { type: GraphQLString },
id: { type: GraphQLInt },
key: { type: GraphQLNonNull(GraphQLString) },
appKey: { type: GraphQLNonNull(GraphQLString) },
type: {

View File

@@ -1,9 +1,9 @@
import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLInt } from 'graphql';
import { GraphQLObjectType, GraphQLString, GraphQLInt } from 'graphql';
const userType = new GraphQLObjectType({
name: 'User',
fields: {
id: { type: GraphQLString },
id: { type: GraphQLInt },
email: { type: GraphQLString },
createdAt: { type: GraphQLString },
updatedAt: { type: GraphQLString }

View File

@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const CREATE_AUTH_DATA = gql`
mutation createAuthData($id: String!) {
mutation createAuthData($id: Int!) {
createAuthData(id: $id) {
url
}

View File

@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const DELETE_CONNECTION = gql`
mutation DeleteConnection($id: String!) {
mutation DeleteConnection($id: Int!) {
deleteConnection(id: $id)
}
`;

View File

@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const RESET_CONNECTION = gql`
mutation ResetConnection($id: String!) {
mutation ResetConnection($id: Int!) {
resetConnection(id: $id) {
id
}

View File

@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const UPDATE_CONNECTION = gql`
mutation UpdateConnection($id: String!, $data: JSONObject!) {
mutation UpdateConnection($id: Int!, $data: JSONObject!) {
updateConnection(id: $id, data: $data) {
id
key

View File

@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const VERIFY_CONNECTION = gql`
mutation VerifyConnection($id: String!) {
mutation VerifyConnection($id: Int!) {
verifyConnection(id: $id) {
id
verified

View File

@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const GET_FLOW = gql`
query GetFlow($id: String!) {
query GetFlow($id: Int!) {
getFlow(id: $id) {
id
name

View File

@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const TEST_CONNECTION = gql`
query TestConnection($id: String!) {
query TestConnection($id: Int!) {
testConnection(id: $id) {
id
verified