Skip to content

Commit

Permalink
update (note parents): modifications based on reviews, use test.each …
Browse files Browse the repository at this point in the history
…in tests instead of individual test cases
  • Loading branch information
dependentmadani committed Sep 18, 2024
1 parent 1809ca1 commit ca7a9a2
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 295 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: '3.2'

services:
api:
build:
Expand Down
2 changes: 1 addition & 1 deletion src/domain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function init(repositories: Repositories, appConfig: AppConfig): DomainSe
/**
* @todo use shared methods for uncoupling repositories unrelated to note service
*/
const noteService = new NoteService(repositories.noteRepository, repositories.noteRelationsRepository, repositories.noteVisitsRepository, repositories.editorToolsRepository, repositories.noteHistoryRepository, repositories.teamRepository);
const noteService = new NoteService(repositories.noteRepository, repositories.noteRelationsRepository, repositories.noteVisitsRepository, repositories.editorToolsRepository, repositories.noteHistoryRepository);
const noteVisitsService = new NoteVisitsService(repositories.noteVisitsRepository);
const authService = new AuthService(
appConfig.auth.accessSecret,
Expand Down
12 changes: 2 additions & 10 deletions src/domain/service/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type User from '@domain/entities/user.js';
import type { NoteList } from '@domain/entities/noteList.js';
import type NoteHistoryRepository from '@repository/noteHistory.repository.js';
import type { NoteHistoryMeta, NoteHistoryRecord, NoteHistoryPublic } from '@domain/entities/noteHistory.js';
import type TeamRepository from '@repository/team.repository.js';
import type { NotePublic } from '@domain/entities/notePublic.js';

/**
Expand Down Expand Up @@ -41,11 +40,6 @@ export default class NoteService {
*/
public noteHistoryRepository: NoteHistoryRepository;

/**
* Team repository
*/
public teamRepository: TeamRepository;

/**
* Number of the notes to be displayed on one page
* it is used to calculate offset and limit for getting notes that the user has recently opened
Expand All @@ -64,15 +58,13 @@ export default class NoteService {
* @param noteVisitsRepository - note visits repository
* @param editorToolsRepository - editor tools repositoryn
* @param noteHistoryRepository - note history repository
* @param teamRepository - team note repository
*/
constructor(noteRepository: NoteRepository, noteRelationsRepository: NoteRelationsRepository, noteVisitsRepository: NoteVisitsRepository, editorToolsRepository: EditorToolsRepository, noteHistoryRepository: NoteHistoryRepository, teamRepository: TeamRepository) {
constructor(noteRepository: NoteRepository, noteRelationsRepository: NoteRelationsRepository, noteVisitsRepository: NoteVisitsRepository, editorToolsRepository: EditorToolsRepository, noteHistoryRepository: NoteHistoryRepository) {
this.noteRepository = noteRepository;
this.noteRelationsRepository = noteRelationsRepository;
this.noteVisitsRepository = noteVisitsRepository;
this.editorToolsRepository = editorToolsRepository;
this.noteHistoryRepository = noteHistoryRepository;
this.teamRepository = teamRepository;
}

/**
Expand Down Expand Up @@ -459,6 +451,6 @@ export default class NoteService {
* @returns - array of notes that are parent structure of the note
*/
public async getNoteParentStructure(noteId: NoteInternalId, userId: number): Promise<NotePublic[]> {
return await this.noteRepository.getAllNotesParents(noteId, userId);
return await this.noteRepository.getNoteParents(noteId, userId);
}
}
Loading

0 comments on commit ca7a9a2

Please sign in to comment.