refactor: made the findOne project by id to return users of each project as well

This commit is contained in:
2026-07-11 11:36:17 +03:30
parent 9ded147354
commit d93e4be6ef
@@ -21,7 +21,19 @@ export class ProjectService {
) {}
async findOneOrFail(id: string): Promise<TMProject> {
const project = await this.projectRepository.findOne({ where: { id } });
const project = await this.projectRepository.findOne({
where: { id },
relations: {
users: true,
},
select: {
users: {
id: true,
firstName: true,
lastName: true
}
}
});
if (!project) throw new NotFoundException(ProjectMessage.PROJECT_NOT_FOUND);
return project;
}