Merge branch 'rafi/taskmanager'
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-07-12 14:53:27 +03:30
@@ -5,18 +5,16 @@ import { TMProject } from "../entities/project.entity";
@Injectable()
export class ProjectRepository extends Repository<TMProject> {
constructor(
@InjectRepository(TMProject) projectRepository: Repository<TMProject>,
) {
constructor(@InjectRepository(TMProject) projectRepository: Repository<TMProject>) {
super(projectRepository.target, projectRepository.manager, projectRepository.queryRunner);
}
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('workspace.id = :wsId', {wsId})
.andWhere('user.id = :userId', {userId})
return this.createQueryBuilder("project")
.innerJoin("project.workspace", "workspace")
.innerJoin("project.users", "user")
.where("workspace.id = :wsId", { wsId })
.andWhere("user.id = :userId", { userId })
.skip(skip ?? 0)
.take(take ?? 10)
.getManyAndCount();
@@ -28,21 +26,12 @@ export class ProjectRepository extends Repository<TMProject> {
.leftJoinAndSelect("taskPhase.tasks", "task")
.leftJoinAndSelect("task.remarks", "remark")
.loadRelationCountAndMap(
"task.attachmentCount",
"task.attachments",
)
.loadRelationCountAndMap("task.attachmentCount", "task.attachments")
.loadRelationCountAndMap(
"task.checkListItemCount",
"task.checkListItems",
)
.loadRelationCountAndMap("task.checkListItemCount", "task.checkListItems")
.loadRelationCountAndMap(
"task.completedCheckListItemCount",
"task.checkListItems",
"completedCheckListItems",
(qb) => qb.where("completedCheckListItems.isDone = :isDone", { isDone: true }),
.loadRelationCountAndMap("task.completedCheckListItemCount", "task.checkListItems", "completedCheckListItems", (qb) =>
qb.where("completedCheckListItems.isDone = :isDone", { isDone: true }),
)
.where("project.id = :projectId", { projectId })
@@ -52,6 +41,7 @@ export class ProjectRepository extends Repository<TMProject> {
"project.name",
"taskPhase.id",
"taskPhase.name",
"taskPhase.order",
"task.id",
"task.title",
"task.startDate",
@@ -60,6 +50,8 @@ export class ProjectRepository extends Repository<TMProject> {
"remark.color",
])
.orderBy("taskPhase.order", "ASC")
.getOne();
}
}