feat(ai): AiWorker — notebook_match 매치 시 자동 moveNote

- NotebookRepository.findByName(name) 추가 — COLLATE NOCASE case-insensitive 조회
- AiWorkerOptions.notebookRepo 옵션 추가 (optional Pick<NotebookRepository, ...>)
- processJob: generate 전 notebookRepo.list() → notebooks 배열 GenerateInput 에 주입
- processJob: updateAiResult 후 res.notebookMatch valid 이름이면 findByName + moveNote 호출
- main/index.ts: AiWorker 생성 시 notebookRepo 전달
- NotebookRepository.test.ts: findByName 3개 테스트 추가
- AiWorker.test.ts: notebook 매칭 describe 4개 테스트 추가 (총 45 테스트 통과)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
th-kim0823
2026-05-15 10:36:59 +09:00
parent 359d94e7e6
commit 7aef46dc1a
5 changed files with 144 additions and 2 deletions

View File

@@ -97,4 +97,19 @@ describe('NotebookRepository', () => {
expect(r.ok).toBe(false);
if (!r.ok) expect(r.reason).toBe('not_found');
});
it('findByName: 이름으로 조회', () => {
const nb = repo.create({ name: '회사' });
const found = repo.findByName('회사');
expect(found?.id).toBe(nb.id);
});
it('findByName: case-insensitive', () => {
repo.create({ name: 'Work' });
expect(repo.findByName('work')?.name).toBe('Work');
});
it('findByName: 없으면 null', () => {
expect(repo.findByName('없음')).toBeNull();
});
});