feat: introduce singleton webhook URL

This commit is contained in:
Ali BARIN
2023-06-07 22:29:40 +00:00
parent 92638c2e97
commit de7a35dfe9
19 changed files with 285 additions and 78 deletions

View File

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

View File

@@ -0,0 +1,16 @@
import { Knex } from 'knex';
export async function up(knex: Knex): Promise<void> {
return await knex('steps')
.where('type', 'trigger')
.whereIn('app_key', ['gitlab', 'typeform', 'twilio', 'flowers-software', 'webhook'])
.update({
webhook_path: knex.raw('? || ??', ['/webhooks/flows/', knex.ref('flow_id')]),
});
}
export async function down(knex: Knex): Promise<void> {
return await knex('steps').update({
webhook_path: null
});
}