Skip to content

Commit

Permalink
Сhanging type at service level
Browse files Browse the repository at this point in the history
  • Loading branch information
HyTekCoop committed Oct 21, 2023
1 parent 704f18d commit c8b69ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/domain/service/noteList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export default class NoteListService {
* @returns { Promise<NoteList> } note
*/
public async getNoteListByCreatorId(id: number): Promise<NoteList> {
return await this.repository.getNoteListByCreatorId(id);
return {
items: await this.repository.getNoteListByCreatorId(id),
};
}
}
2 changes: 1 addition & 1 deletion src/repository/note.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class NoteRepository {
* @param id - note creator id
* @returns { Promise<NoteList> } note
*/
public async getNoteListByCreatorId(id: number): Promise<NoteList> {
public async getNoteListByCreatorId(id: number): Promise<Note[]> {
return await this.storage.getNoteListByCreatorId(id);
}
}
6 changes: 2 additions & 4 deletions src/repository/storage/postgres/orm/sequelize/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,14 @@ export default class NoteSequelizeStorage {
* @param creatorId - note creator id
* @returns { Promise<NoteList> } note
*/
public async getNoteListByCreatorId(creatorId: number): Promise<NoteList> {
public async getNoteListByCreatorId(creatorId: number): Promise<Note[]> {
const noteList = await this.model.findAll({
where: {
creatorId,
},
});

return {
items: noteList,
};
return noteList;
}
/**
* Gets note by id
Expand Down

0 comments on commit c8b69ef

Please sign in to comment.