refactor: made the findOne project by id to return users of each project as well
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user