diff --git a/app-nest/src/bolt/types/bolt-action-types.ts b/app-nest/src/bolt/types/bolt-action-types.ts new file mode 100644 index 0000000..ff1d2f9 --- /dev/null +++ b/app-nest/src/bolt/types/bolt-action-types.ts @@ -0,0 +1,9 @@ +import { + AllMiddlewareArgs, + SlackAction, + SlackActionMiddlewareArgs, +} from "@slack/bolt"; +import { StringIndexed } from "@slack/bolt/dist/types/helpers"; + +export type BoltActionArgs = SlackActionMiddlewareArgs & + AllMiddlewareArgs; diff --git a/app-nest/src/bolt/types/bolt-event-types.ts b/app-nest/src/bolt/types/bolt-event-types.ts new file mode 100644 index 0000000..9d73a77 --- /dev/null +++ b/app-nest/src/bolt/types/bolt-event-types.ts @@ -0,0 +1,17 @@ +import { + AllMiddlewareArgs, + AppHomeOpenedEvent, + SlackEventMiddlewareArgs, + UserProfileChangedEvent, +} from "@slack/bolt"; +import { StringIndexed } from "@slack/bolt/dist/types/helpers"; + +export type AppHomeOpenedArgs = SlackEventMiddlewareArgs< + AppHomeOpenedEvent["type"] +> & + AllMiddlewareArgs; + +export type UserProfileChangedArgs = SlackEventMiddlewareArgs< + UserProfileChangedEvent["type"] +> & + AllMiddlewareArgs; diff --git a/app-nest/src/dev-tools/dev-tools.controller.ts b/app-nest/src/dev-tools/dev-tools.controller.ts index 17096c4..5d8ecb5 100644 --- a/app-nest/src/dev-tools/dev-tools.controller.ts +++ b/app-nest/src/dev-tools/dev-tools.controller.ts @@ -1,6 +1,7 @@ import { Controller } from "@nestjs/common"; import BoltAction from "../bolt/decorators/bolt-action.decorator"; import BoltActions from "../bolt/enums/bolt-actions.enum"; +import { BoltActionArgs } from "../bolt/types/bolt-action-types"; import { UserSyncService } from "../sync/user-sync.service"; @Controller() @@ -8,7 +9,7 @@ export class DevToolsController { constructor(private userSyncService: UserSyncService) {} @BoltAction(BoltActions.SYNC_USERS) - async syncUsers({ ack }) { + async syncUsers({ ack }: BoltActionArgs) { await ack(); await this.userSyncService.syncUsers(); } diff --git a/app-nest/src/gui/tabs/home-tab.controller.ts b/app-nest/src/gui/tabs/home-tab.controller.ts index 5f0ad8a..f1a781b 100644 --- a/app-nest/src/gui/tabs/home-tab.controller.ts +++ b/app-nest/src/gui/tabs/home-tab.controller.ts @@ -1,6 +1,7 @@ import { Controller } from "@nestjs/common"; import BoltEvent from "../../bolt/decorators/bolt-event.decorator"; import BoltEvents from "../../bolt/enums/bolt-events.enum"; +import { AppHomeOpenedArgs } from "../../bolt/types/bolt-event-types"; import { UserService } from "../../entities/user/user.service"; import devTools from "../dev/dev-tools"; @@ -9,7 +10,7 @@ export class HomeTabController { constructor(private userService: UserService) {} @BoltEvent(BoltEvents.APP_HOME_OPENED) - async getView({ event, client, logger }) { + async getView({ event, client, logger }: AppHomeOpenedArgs) { const users = await this.userService.findAll(); const { slackId } = users[0]; diff --git a/app-nest/src/sync/sync.controller.ts b/app-nest/src/sync/sync.controller.ts index c3f41da..8121dd0 100644 --- a/app-nest/src/sync/sync.controller.ts +++ b/app-nest/src/sync/sync.controller.ts @@ -1,6 +1,7 @@ import { Controller } from "@nestjs/common"; import BoltEvent from "../bolt/decorators/bolt-event.decorator"; import BoltEvents from "../bolt/enums/bolt-events.enum"; +import { UserProfileChangedArgs } from "../bolt/types/bolt-event-types"; import { UserSyncService } from "./user-sync.service"; @Controller() @@ -8,7 +9,7 @@ export class SyncController { constructor(private userSyncService: UserSyncService) {} @BoltEvent(BoltEvents.USER_PROFILE_CHANGED) - async userProfileChanged({ event }) { + async userProfileChanged({ event }: UserProfileChangedArgs) { await this.userSyncService.syncUsers(event.user); } }