Create empty command (#2963)

* create empty command

* update description

* rebase

---------

Co-authored-by: corentin <corentin@twenty.com>
This commit is contained in:
bosiraphael
2023-12-12 18:22:19 +01:00
committed by GitHub
parent f126bd95d6
commit 6594055317
3 changed files with 40 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { Module } from '@nestjs/common';
import { DatabaseCommandModule } from 'src/database/commands/database-command.module';
import { FetchWorkspaceMessagesCommand } from 'src/workspace/messaging/commands/fetch-workspace-messages.command';
import { AppModule } from './app.module';
@ -13,6 +14,7 @@ import { WorkspaceMigrationRunnerCommandsModule } from './workspace/workspace-mi
WorkspaceMigrationRunnerCommandsModule,
WorkspaceSyncMetadataCommandsModule,
DatabaseCommandModule,
FetchWorkspaceMessagesCommand,
],
})
export class CommandModule {}

View File

@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { FetchWorkspaceMessagesCommand } from 'src/workspace/messaging/commands/fetch-workspace-messages.command';
@Module({
imports: [],
providers: [FetchWorkspaceMessagesCommand],
})
export class FetchWorkspaceMessagesCommandsModule {}

View File

@ -0,0 +1,29 @@
import { Command, CommandRunner, Option } from 'nest-commander';
interface FetchWorkspaceMessagesOptions {
workspaceId: string;
}
@Command({
name: 'workspace:fetch-messages',
description: 'Fetch messages of all workspaceMembers in a workspace.',
})
export class FetchWorkspaceMessagesCommand extends CommandRunner {
async run(
_passedParam: string[],
options: FetchWorkspaceMessagesOptions,
): Promise<void> {
console.log('fetching messages for workspace', options.workspaceId);
return;
}
@Option({
flags: '-w, --workspace-id [workspace_id]',
description: 'workspace id',
required: true,
})
parseWorkspaceId(value: string): string {
return value;
}
}