first commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
|
||||
import { CommandResult, ack } from './command-result';
|
||||
import { ChangeIssueStatusCommand } from './change-issue-status.command';
|
||||
import { WriteAccess } from './write-access';
|
||||
|
||||
@CommandHandler(ChangeIssueStatusCommand)
|
||||
export class ChangeIssueStatusCommandHandler
|
||||
implements ICommandHandler<ChangeIssueStatusCommand>
|
||||
{
|
||||
constructor(private readonly access: WriteAccess) {}
|
||||
|
||||
async execute(command: ChangeIssueStatusCommand): Promise<CommandResult> {
|
||||
const { issue } = await this.access.issueForContributor(
|
||||
command.issueId,
|
||||
command.actorId,
|
||||
);
|
||||
issue.changeStatus(command.actorId, command.status, command.reason);
|
||||
await issue.commitAndWait();
|
||||
return ack(issue);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user