refactor: changed the getUserProjects to get projects in a specific workspace
This commit is contained in:
@@ -11,12 +11,14 @@ export class ProjectRepository extends Repository<TMProject> {
|
||||
super(projectRepository.target, projectRepository.manager, projectRepository.queryRunner);
|
||||
}
|
||||
|
||||
async findUserProjects(userId: string, skip?: number, take?: number): Promise<[TMProject[], number]> {
|
||||
async findUserProjects(userId: string, wsId: string, skip?: number, take?: number): Promise<[TMProject[], number]> {
|
||||
return this.createQueryBuilder('project')
|
||||
.innerJoin('project.workspace', 'workspace')
|
||||
.innerJoin('project.users', 'user')
|
||||
.where('user.id = :userId', {userId})
|
||||
.where('workspace.id = :wsId', {wsId})
|
||||
.andWhere('user.id = :userId', {userId})
|
||||
.skip(skip ?? 0)
|
||||
.take(take ?? 0)
|
||||
.take(take ?? 10)
|
||||
.getManyAndCount();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user