diff --git a/client/src/core/repository/repository.interface.ts b/client/src/core/repository/repository.interface.ts index c830ba1..c268537 100644 --- a/client/src/core/repository/repository.interface.ts +++ b/client/src/core/repository/repository.interface.ts @@ -6,5 +6,6 @@ export interface ITodoListDataBase { getAll: () => Promise; add: (todo: InputTodo) => Promise; edit: (id: string, todo: InputTodo) => Promise; + editMany: (inputArr: Array<{ id: string; todo: InputTodo }>) => Promise; remove: (id: string) => Promise; } diff --git a/client/src/core/repository/repository.memoryDB.ts b/client/src/core/repository/repository.memoryDB.ts index b21254d..6c640ca 100644 --- a/client/src/core/repository/repository.memoryDB.ts +++ b/client/src/core/repository/repository.memoryDB.ts @@ -36,6 +36,13 @@ export class MemoryDB implements ITodoListDataBase { return [...this.todoList.values()].map((el) => el.toPlain()); } + async editMany(inputArr: Array<{ id: string; todo: InputTodo }>): Promise { + for (const el of inputArr) { + await this.edit(el.id, el.todo); + } + return [...this.todoList.values()].map((el) => el.toPlain()); + } + async remove(id: string): Promise { if (!this.todoList.has(id)) throw new Error('ERROR: 삭제하려는 ID의 Todo가 없습니다.'); this.todoList.delete(id);