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,13 @@
import { createRole } from './role';
import { faker } from '@faker-js/faker';
export const createUser = async (params = {}) => {
params.roleId = params?.roleId || (await createRole()).id;
params.fullName = params?.fullName || faker.person.fullName();
params.email = params?.email || faker.internet.email();
params.password = params?.password || faker.internet.password();
const [user] = await global.knex.table('users').insert(params).returning('*');
return user;
};