11import {
2- IAppAccessors ,
3- IConfigurationExtend ,
4- IConfigurationModify ,
5- IEnvironmentRead ,
6- IHttp ,
7- ILogger ,
8- IModify ,
9- IPersistence ,
10- IRead ,
2+ IAppAccessors ,
3+ IConfigurationExtend ,
4+ IConfigurationModify ,
5+ IEnvironmentRead ,
6+ IHttp ,
7+ ILogger ,
8+ IModify ,
9+ IPersistence ,
10+ IRead ,
1111} from '@rocket.chat/apps-engine/definition/accessors' ;
1212import { App } from '@rocket.chat/apps-engine/definition/App' ;
1313import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata' ;
@@ -23,35 +23,46 @@ import { TimeOffCache } from './TimeOffCache';
2323import { UserService } from './services/UserService' ;
2424
2525export class TimeOffApp extends App implements IPostMessageSent {
26- constructor ( info : IAppInfo , logger : ILogger , accessors : IAppAccessors ) {
27- super ( info , logger , accessors ) ;
28- }
26+ constructor ( info : IAppInfo , logger : ILogger , accessors : IAppAccessors ) {
27+ super ( info , logger , accessors ) ;
28+ }
2929
30- public async extendConfiguration ( configuration : IConfigurationExtend , environmentRead : IEnvironmentRead ) : Promise < void > {
31- configuration . slashCommands . provideSlashCommand ( new TimeOffCommand ( this ) ) ;
32- }
30+ public async extendConfiguration (
31+ configuration : IConfigurationExtend ,
32+ _environmentRead : IEnvironmentRead ,
33+ ) : Promise < void > {
34+ configuration . slashCommands . provideSlashCommand ( new TimeOffCommand ( this ) ) ;
35+ }
3336
34- public async onEnable ( environmentRead : IEnvironmentRead , configurationModify : IConfigurationModify ) : Promise < boolean > {
35- TimeOffCache . getInstance ( ) . invalidateCache ( ) ;
36- return Promise . resolve ( true ) ;
37- }
37+ public async onEnable (
38+ _environmentRead : IEnvironmentRead ,
39+ _configurationModify : IConfigurationModify ,
40+ ) : Promise < boolean > {
41+ TimeOffCache . getInstance ( ) . invalidateCache ( ) ;
42+ return Promise . resolve ( true ) ;
43+ }
3844
39- public async checkPostMessageSent ?( message : IMessage , read : IRead , http : IHttp ) : Promise < boolean > {
40- // We only want to notify the user if the message was sent in a direct message
41- return Promise . resolve ( message . room . type === RoomType . DIRECT_MESSAGE ) ;
42- }
45+ public async checkPostMessageSent ?( message : IMessage , _read : IRead , _http : IHttp ) : Promise < boolean > {
46+ // We only want to notify the user if the message was sent in a direct message
47+ return Promise . resolve ( message . room . type === RoomType . DIRECT_MESSAGE ) ;
48+ }
4349
44- public async executePostMessageSent ( message : IMessage , read : IRead , http : IHttp , persistence : IPersistence , modify : IModify ) : Promise < void > {
45- const userRepository = new UserRepository ( read ) ;
46- const userService = new UserService ( userRepository ) ;
50+ public async executePostMessageSent (
51+ message : IMessage ,
52+ read : IRead ,
53+ _http : IHttp ,
54+ persistence : IPersistence ,
55+ _modify : IModify ,
56+ ) : Promise < void > {
57+ const userRepository = new UserRepository ( read ) ;
58+ const userService = new UserService ( userRepository ) ;
4759
48- const timeOffRepository = new TimeOffRepository ( this , read , persistence ) ;
49- const timeOffService = new TimeOffService ( timeOffRepository ) ;
60+ const timeOffRepository = new TimeOffRepository ( this , read , persistence ) ;
61+ const timeOffService = new TimeOffService ( timeOffRepository ) ;
5062
51- const notifier = new AppNotifier ( this , read ) ;
52-
53- const handler = new PostMessageSentHandler ( this , userService , timeOffService , notifier ) ;
54- await handler . handle ( message ) ;
55- }
63+ const notifier = new AppNotifier ( this , read ) ;
5664
65+ const handler = new PostMessageSentHandler ( this , userService , timeOffService , notifier ) ;
66+ await handler . handle ( message ) ;
67+ }
5768}
0 commit comments