chore: Remove displayName field from credentials

This commit is contained in:
Faruk AYDIN
2021-10-14 16:56:51 +02:00
committed by Ali BARIN
parent 5be9ff8383
commit 1fbc58e7e1
5 changed files with 14 additions and 23 deletions

View File

@@ -18,18 +18,6 @@
"docUrl": "https://automatisch.io/docs/twitter#oauth-redirect-url",
"clickToCopy": true
},
{
"key": "displayName",
"label": "Name",
"type": "string",
"required": true,
"readOnly": false,
"value": null,
"placeholder": null,
"description": "It's the value you can remember later on while changing connection settings.",
"docUrl": "https://automatisch.io/docs/twitter#display-name",
"clickToCopy": false
},
{
"key": "consumerKey",
"label": "Consumer Key",
@@ -61,10 +49,6 @@
"type": "mutation",
"name": "createCredential",
"fields": [
{
"name": "displayName",
"value": "{fields.displayName}"
},
{
"name": "key",
"value": "{key}"

View File

@@ -0,0 +1,13 @@
import { Knex } from "knex";
export async function up(knex: Knex): Promise<void> {
return knex.schema.table('credentials', (table) => {
table.dropColumn('display_name');
});
}
export async function down(knex: Knex): Promise<void> {
return knex.schema.table('credentials', (table) => {
table.string('display_name');
});
}

View File

@@ -6,12 +6,10 @@ import RequestWithCurrentUser from '../../types/express/request-with-current-use
type Params = {
key: string,
displayName: string,
data: object
}
const createCredentialResolver = async (params: Params, req: RequestWithCurrentUser) => {
const credential = await Credential.query().insert({
displayName: params.displayName,
key: params.key,
data: params.data,
userId: req.currentUser.id
@@ -24,7 +22,6 @@ const createCredential = {
type: credentialType,
args: {
key: { type: GraphQLNonNull(GraphQLString) },
displayName: { type: GraphQLNonNull(GraphQLString) },
data: { type: GraphQLNonNull(twitterCredentialInputType) }
},
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => createCredentialResolver(params, req)

View File

@@ -6,7 +6,6 @@ const credentialType = new GraphQLObjectType({
fields: {
id: { type: GraphQLString },
key: { type: GraphQLString },
displayName: { type: GraphQLString },
data: { type: twitterCredentialType },
}
})

View File

@@ -3,7 +3,6 @@ import User from './user'
class Credential extends Base {
id!: number
displayName!: string
key!: string
data!: string
userId!: number
@@ -12,11 +11,10 @@ class Credential extends Base {
static jsonSchema = {
type: 'object',
required: ['displayName', 'key', 'data', 'userId'],
required: ['key', 'data', 'userId'],
properties: {
id: { type: 'integer' },
displayName: { type: 'string', minLength: 1, maxLength: 255 },
key: { type: 'string', minLength: 1, maxLength: 255 },
data: { type: 'object' },
userId: { type: 'integer' },