feat: add endpoint for workflow sharing (#4172) (no changelog)

* feat: add endpoint for workflow sharing

Co-authored-by: Ben Hesseldieck <b.hesseldieck@gmail.com>
This commit is contained in:
Omar Ajoue
2022-10-11 14:55:05 +02:00
committed by GitHub
parent 3390b509aa
commit 07d21d2c5d
25 changed files with 483 additions and 65 deletions

View File

@@ -96,7 +96,12 @@ export async function init() {
try {
const schema = config.getEnv('database.postgresdb.schema');
await exec(`psql -d ${testDbName} -c "CREATE SCHEMA IF NOT EXISTS ${schema}";`);
const exportPasswordCli = pgOptions.password
? `export PGPASSWORD=${pgOptions.password} && `
: '';
await exec(
`${exportPasswordCli} psql -h ${pgOptions.host} -U ${pgOptions.username} -d ${testDbName} -c "CREATE SCHEMA IF NOT EXISTS ${schema}";`,
);
} catch (error) {
if (error instanceof Error && error.message.includes('command not found')) {
console.error(
@@ -647,6 +652,18 @@ export async function createWorkflowWithTrigger(
return workflow;
}
// ----------------------------------
// workflow sharing
// ----------------------------------
export async function getWorkflowSharing(workflow: WorkflowEntity) {
return Db.collections.SharedWorkflow.find({
where: {
workflow,
},
});
}
// ----------------------------------
// connection options
// ----------------------------------