parent
89c28d67fd
commit
a1e5e97200
5 changed files with 62 additions and 7 deletions
@ -0,0 +1,15 @@ |
||||
import FindInteractor from '../usecases/find'; |
||||
|
||||
export default class FindController { |
||||
constructor() { |
||||
this.findInteractor = new FindInteractor(); |
||||
} |
||||
|
||||
getKeyword() { |
||||
return this.findInteractor.getKeyword(); |
||||
} |
||||
|
||||
setKeyword(keyword) { |
||||
return this.findInteractor.setKeyword(keyword); |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
import MemoryStorage from '../infrastructures/memory-storage'; |
||||
|
||||
const FIND_KEYWORD_KEY = 'find-keyword'; |
||||
|
||||
export default class FindRepository { |
||||
constructor() { |
||||
this.cache = new MemoryStorage(); |
||||
} |
||||
|
||||
getKeyword() { |
||||
return Promise.resolve(this.cache.get(FIND_KEYWORD_KEY)); |
||||
} |
||||
|
||||
setKeyword(keyword) { |
||||
return this.cache.set(FIND_KEYWORD_KEY, keyword); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,15 @@ |
||||
import FindRepository from '../repositories/find'; |
||||
|
||||
export default class FindInteractor { |
||||
constructor() { |
||||
this.findRepository = new FindRepository(); |
||||
} |
||||
|
||||
getKeyword() { |
||||
return this.findRepository.getKeyword(); |
||||
} |
||||
|
||||
setKeyword(keyword) { |
||||
return this.findRepository.setKeyword(keyword); |
||||
} |
||||
} |
Reference in new issue