chore: Refactor v2 folder and class structure + Adding Company App (dummy)
This commit is contained in:
34
v2/server/src/Apps/Company/Domain/index.js
Normal file
34
v2/server/src/Apps/Company/Domain/index.js
Normal 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();
|
||||
Reference in New Issue
Block a user