Skip to content

Commit

Permalink
feat(next/api): get associated tickets by master key
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjdd committed Aug 9, 2023
1 parent 9995731 commit 528733c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions next/api/src/model/Ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export class Ticket extends Model {
operator: User,
options?: UpdateOptions & { cascade?: boolean }
): Promise<Ticket> {
const associateTickets = await this.getAssociatedTickets(options);
const associateTickets = await this.getAssociatedTickets();

const result = await Promise.all(
(options?.cascade ? [...associateTickets, this] : [this]).map((ticket) => {
Expand All @@ -386,13 +386,13 @@ export class Ticket extends Model {
return Status.isClosed(this.status);
}

async getAssociatedTickets(options?: AuthOptions) {
async getAssociatedTickets() {
if (!this.parentId) {
return [];
}
return Ticket.queryBuilder()
.where('parent', '==', Ticket.ptr(this.parentId))
.where('objectId', '!=', this.id)
.find(options);
.find({ useMasterKey: true });
}
}

0 comments on commit 528733c

Please sign in to comment.