refactor: Use objectionjs instead of knex for factories

This commit is contained in:
Faruk AYDIN
2024-02-13 01:49:40 +01:00
parent 697f72ecf4
commit 95f89ba03e
9 changed files with 19 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
import appConfig from '../../src/config/app';
import { AES } from 'crypto-js';
import Connection from '../../src/models/connection';
export const createConnection = async (params = {}) => {
params.key = params?.key || 'deepl';
@@ -16,10 +17,7 @@ export const createConnection = async (params = {}) => {
appConfig.encryptionKey
).toString();
const [connection] = await global.knex
.table('connections')
.insert(params)
.returning('*');
const connection = await Connection.query().insert(params).returning('*');
return connection;
};