Commit 7d4e8c68 authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis
Browse files

allow generic engine

parent 65c585d0
import db from './lib/db.js';
import { AuditRecord,FS_ERROR } from './interfaces/index.js';
import {FileEngine} from './engines/index.js';
import { AuditRecord,AuditEngine,FS_ERROR } from './interfaces/index.js';
import {FileEngine,PostgreSqlEngine} from './engines/index.js';
/**
* @description Use this on your app to generate and log the audit record
......@@ -12,8 +12,9 @@ import {FileEngine} from './engines/index.js';
* @env env.HOSTIP - useful to pass the IP address of the end user automatically on docker enviroments
* @returns AuditRecord | null - The audit record generated or the one provided
*/
export const generateAuditRecord = (auditInit?: AuditRecord | undefined, dbEngine=new FileEngine("/tmp")): AuditRecord | null => {
const _db = new db(dbEngine);
export const generateAuditRecord = (auditInit?: AuditRecord | undefined, dbEngine?:AuditEngine) => {
const dbe:AuditEngine = dbEngine || new FileEngine("/tmp");
const _db = new db(dbe);
const auditUnit = auditInit?.auditUnit || "gov.gr";
const auditTransactionId = auditInit?.auditTransactionId || "" + _db.seq();
const auditProtocol = auditInit?.auditProtocol || _db.pn();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment