feat: Add draft column to connections

This commit is contained in:
Faruk AYDIN
2022-07-27 13:54:10 +03:00
parent 095948e737
commit 70d59c6c64
4 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import { Knex } from 'knex';
export async function up(knex: Knex): Promise<void> {
return knex.schema.table('connections', (table) => {
table.boolean('draft').defaultTo(true);
});
}
export async function down(knex: Knex): Promise<void> {
return knex.schema.table('connections', (table) => {
table.dropColumn('draft');
});
}

View File

@@ -32,6 +32,7 @@ const verifyConnection = async (
...verifiedCredentials,
},
verified: true,
draft: false,
});
return connection;

View File

@@ -13,6 +13,7 @@ const getApp = async (_parent: unknown, params: Params, context: Context) => {
.$relatedQuery('connections')
.where({
key: params.key,
draft: false,
})
.orderBy('created_at', 'desc');

View File

@@ -14,6 +14,7 @@ class Connection extends Base {
formattedData?: IJSONObject;
userId!: string;
verified = false;
draft: boolean;
count?: number;
static tableName = 'connections';
@@ -29,6 +30,7 @@ class Connection extends Base {
formattedData: { type: 'object' },
userId: { type: 'string', format: 'uuid' },
verified: { type: 'boolean' },
draft: { type: 'boolean' },
},
};