Skip to content

Commit

Permalink
fix: refact some isuues
Browse files Browse the repository at this point in the history
  • Loading branch information
GloireMutaliko21 committed May 6, 2024
1 parent 20892c1 commit 1ed2176
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/core/src/tasks/daily-plan/daily-plan.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export class DailyPlanService extends TenantAwareCrudService<DailyPlan> {
): Promise<IPagination<IDailyPlan>> {
try {
const { where } = options;
const { organizationId, tenantId } = where;
const { organizationId } = where;
const tenantId = RequestContext.currentTenantId();

// Create the initial query
const query = this.typeOrmRepository.createQueryBuilder(this.tableName);
Expand All @@ -116,6 +117,10 @@ export class DailyPlanService extends TenantAwareCrudService<DailyPlan> {

// Apply optional find options if provided
query.setFindOptions({
...(isNotEmpty(options) &&
isNotEmpty(options.where) && {
where: options.where
}),
...(isNotEmpty(options) &&
isNotEmpty(options.relations) && {
relations: options.relations
Expand Down Expand Up @@ -292,7 +297,8 @@ export class DailyPlanService extends TenantAwareCrudService<DailyPlan> {
async getPlansByTaskId(options: PaginationParams, taskId: ITask['id']): Promise<IPagination<IDailyPlan>> {
try {
const { where } = options;
const { organizationId, tenantId } = where;
const { organizationId } = where;
const tenantId = RequestContext.currentTenantId();

// Initial query
const query = this.typeOrmRepository.createQueryBuilder(this.tableName);
Expand Down

0 comments on commit 1ed2176

Please sign in to comment.