Skip to content

Commit

Permalink
fix: optimised display of delete, archive, unarchive button (#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoganandaness authored Oct 29, 2024
2 parents 4236884 + 7d079d8 commit 845ec87
Show file tree
Hide file tree
Showing 12 changed files with 1,918 additions and 350 deletions.
4 changes: 4 additions & 0 deletions apps/backend/src/datasources/postgres/CallDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export default class PostgresCallDataSource implements CallDataSource {
query.whereIn('fap_review_template_id', filter.fapReviewTemplateIds);
}

if (filter?.esiTemplateIds) {
query.whereIn('esi_template_id', filter.esiTemplateIds);
}

// if filter is explicitly set to true or false
if (filter?.isActive === true) {
query.where('is_active', true);
Expand Down
3 changes: 3 additions & 0 deletions apps/backend/src/resolvers/queries/CallsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export class CallsFilter {
@Field(() => [Int], { nullable: true })
public pdfTemplateIds?: number[];

@Field(() => [Int], { nullable: true })
public esiTemplateIds?: number[];

@Field(() => [Int], { nullable: true })
public fapReviewTemplateIds?: number[];

Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/resolvers/types/FapReviewTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class TemplateResolver {
@Ctx() context: ResolverContext
): Promise<number> {
return context.queries.call
.getAll(context.user, { templateIds: [template.templateId] })
.getAll(context.user, { fapReviewTemplateIds: [template.templateId] })
.then((result) => result?.length || 0);
}
}
10 changes: 10 additions & 0 deletions apps/backend/src/resolvers/types/Template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ export class TemplateResolver {
.then((result) => result?.length || 0);
}

@FieldResolver(() => Int, { nullable: true })
async proposalESICallCount(
@Root() template: Template,
@Ctx() context: ResolverContext
): Promise<number> {
return context.queries.call
.getAll(context.user, { esiTemplateIds: [template.templateId] })
.then((result) => result?.length || 0);
}

@FieldResolver(() => TemplateGroup)
async group(@Root() template: Template): Promise<TemplateGroup> {
const templateDataSource = container.resolve(TemplateDataSource);
Expand Down
Loading

0 comments on commit 845ec87

Please sign in to comment.