(projectId: string)
| 87 | // Create a new Promise that resolves to filtered chats |
| 88 | project.chats = Promise.resolve( |
| 89 | chats.filter((chat) => !chat.isDeleted), |
| 90 | ); |
| 91 | } |
| 92 | }), |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | return projects.length > 0 ? projects : []; |
| 97 | } |
| 98 | |
| 99 | async getProjectById(projectId: string): Promise<Project> { |
| 100 | const project = await this.projectsRepository.findOne({ |
| 101 | where: { id: projectId, isDeleted: false }, |
| 102 | relations: ['chats', 'user'], |
| 103 | }); |
| 104 | |
| 105 | if (!project) { |
| 106 | throw new NotFoundException(`Project with ID ${projectId} not found.`); |
| 107 | } |
| 108 | |
| 109 | if (project.chats) { |
| 110 | const chats = await project.chats; |
| 111 | this.logger.log('Project chats:', chats); |
| 112 | project.chats = Promise.resolve(chats.filter((chat) => !chat.isDeleted)); |
| 113 | } |
no outgoing calls
no test coverage detected