Commit c01663f3 authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis
Browse files

change protocol reset type

parent e312d271
......@@ -35,11 +35,23 @@ console.log(auditRecordDB({},new FileEngine('/tmp/auditRecords')))
}
```
```
//you can change the protocol reset sequence type
import auditRecordDB,{FileEngine} from 'AuditRecordDB';
const main = () =>{
console.log(auditRecordDB({},new FileEngine(undefined, 'daily')))
}
```
# AuditEngine
By default, the file storage engine `FileEngine` is used.
Please keep in mind to change the storage path to app needs.
`FileEngine` is a simple file storage engine, that stores the audit records in a file, also it is possible to use other storage engines.
Your app can also use `PostgreSqlEngine` provided from `@digigov-oss/auditrecord-postgresql-engine` module.
If you do not provide protocol numbers, the module will generate them for you. You can pass at the engine the type of protocol number reset you want to use from one of the following:
"daily", "monthly", "yearly". By default, innumerable protocol numbers are generated.
Look at `FileEngine.ts` here and `PostgreSqlEngine.ts` of the above module for examples to extend the store to another 'real' database.
......@@ -16,8 +16,8 @@ export class FileEngine implements AuditEngine {
#path: string
#pnseqtype:SEQTYPES
constructor(path: string, pnseqtype?: SEQTYPES) {
this.#path = path;
constructor(path?: string, pnseqtype?: SEQTYPES) {
this.#path = path?path:"/tmp";
this.#pnseqtype = pnseqtype || "innumerable";
}
......
......@@ -22,7 +22,7 @@ const test4 = async () => {
}
const test5 = async () => {
const ar = await generateAuditRecord(undefined, new FileEngine('/tmp', 'yearly'));
const ar = await generateAuditRecord(undefined, new FileEngine(undefined, 'yearly'));
console.log(ar);
}
......
......@@ -22,7 +22,7 @@ const test4 = async () => {
}
const test5 = async () => {
const ar = await generateAuditRecord(undefined, new FileEngine('/tmp', 'yearly'));
const ar = await generateAuditRecord(undefined, new FileEngine(undefined, 'yearly'));
console.log(ar);
}
......
......@@ -22,7 +22,7 @@ const test4 = async () => {
}
const test5 = async () => {
const ar = await generateAuditRecord(undefined, new FileEngine('/tmp', 'yearly'));
const ar = await generateAuditRecord(undefined, new FileEngine(undefined, 'yearly'));
console.log(ar);
}
......
Markdown is supported
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