Find as a controller

This commit is contained in:
Shin'ya Ueoka 2019-05-11 13:55:25 +09:00
parent ad1f3c07fb
commit fcd15f4f09
9 changed files with 78 additions and 75 deletions

View file

@ -0,0 +1,24 @@
import * as messages from '../../shared/messages';
import FindUseCase from '../usecases/FindUseCase';
export default class FindController {
private findUseCase: FindUseCase;
constructor({
findUseCase = new FindUseCase(),
} = {}) {
this.findUseCase = findUseCase;
}
async start(m: messages.ConsoleEnterFindMessage): Promise<void> {
await this.findUseCase.startFind(m.text);
}
async next(_: messages.FindNextMessage): Promise<void> {
await this.findUseCase.findNext();
}
async prev(_: messages.FindPrevMessage): Promise<void> {
await this.findUseCase.findPrev();
}
}