feat: Convert factories files to JS

This commit is contained in:
Faruk AYDIN
2024-01-04 21:10:42 +01:00
parent 75f5db23df
commit b0f53268f6
10 changed files with 16 additions and 38 deletions

View File

@@ -0,0 +1,12 @@
import { createUser } from './user';
export const createFlow = async (params = {}) => {
params.userId = params?.userId || (await createUser()).id;
params.name = params?.name || 'Name your flow!';
params.createdAt = params?.createdAt || new Date().toISOString();
params.updatedAt = params?.updatedAt || new Date().toISOString();
const [flow] = await global.knex.table('flows').insert(params).returning('*');
return flow;
};