chore: Refactor v2 folder and class structure + Adding Company App (dummy)

This commit is contained in:
Josepablo C
2024-08-07 00:59:50 -06:00
parent f8d41db04d
commit 288fdc10a7
24 changed files with 614 additions and 190 deletions

View File

@@ -0,0 +1,34 @@
'use strict';
const Repository = require('../Repository');
const Interfaces = require('../Interfaces');
class Company {
constructor(){
this.Events = {
/** Event_Id : callback */
"Example" : this.event_handler_example
};
}
init(){
/// Setup application events
const Events = this.Events;
/// Setup application events
for ( const [event, callback] of Object.entries( Events ) ) {
const event_id = Interfaces.ModuleName + event
Interfaces.registerEvent( event_id , callback );
}
}
trigger_example_event( data ){
Interfaces.publishEvent( "Example", data );
}
event_handler_example( data ){
console.log( "CompanyDomain event" );
console.log( data );
}
};
module.exports = new Company();