pkgs/db/src/utils/ticket.ts (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
import type { APIEmbed, APIMessageTopLevelComponent } from "discord-api-types/v10";
import { and, desc, eq, inArray, or } from "drizzle-orm";
import { randomUUID } from "node:crypto";
import db, {
type Ticket,
actors,
ticketAttachments,
ticketComments,
ticketMessages,
ticketParticipants,
tickets,
} from "..";
export const ticketWithRelations = {
guild: true,
opener: {
with: {
user: true,
},
},
subjectActor: {
with: {
user: true,
},
},
claimedByActor: {
with: {
user: true,
},
},
closedByActor: {
with: {
user: true,
},
},
participants: {
with: {
actor: {
with: {
user: true,
},
},
},
},
messages: {
orderBy: {
createdAt: "asc",
},
with: {
actor: {
with: {
user: true,
},
},
attachments: true,
},
},
attachments: {
with: {
actor: {
with: {
user: true,
},
},
},
},
comments: {
with: {
actor: {
with: {
user: true,
},
},
},
},
} as const;
export async function getTicketById(id: string) {
return await db.query.tickets.findFirst({
with: ticketWithRelations,
where: {
id: id,
},
});
}
export type TicketWithRelations = NonNullable<Awaited<ReturnType<typeof getTicketById>>>;
export async function getTicket(ticketId: string): Promise<TicketWithRelations | undefined>;
export async function getTicket(
guildId: number,
ticketId: number,
): Promise<TicketWithRelations | undefined>;
export async function getTicket(
idOrGuildId: string | number,
ticketId?: number,
): Promise<TicketWithRelations | undefined> {
return typeof idOrGuildId === "string"
? getTicketById(idOrGuildId)
: getTicketByGuild(idOrGuildId, ticketId);
}
export async function getTicketByGuild(
guildId: number,
localId?: number,
): Promise<TicketWithRelations | undefined> {
if (localId === undefined) return undefined;
return await db.query.tickets.findFirst({
where: {
guildId: guildId,
localId: localId,
},
with: ticketWithRelations,
});
}
export async function getTicketByUser(
userId: number,
ticketNumber: number,
): Promise<TicketWithRelations | undefined> {
return await db.query.tickets.findFirst({
where: {
openedBy: userId,
localId: ticketNumber,
},
with: ticketWithRelations,
});
}
export async function getTicketByChannelId(
channelId: string,
): Promise<TicketWithRelations | undefined> {
return await db.query.tickets.findFirst({
where: {
channelId: channelId,
},
with: ticketWithRelations,
});
}
export async function getOpenTickets(): Promise<TicketWithRelations[]> {
return await db.query.tickets.findMany({
where: {
status: "open",
},
with: ticketWithRelations,
});
}
export async function editTicket(
ticketId: string,
data: Partial<Ticket>,
): Promise<TicketWithRelations | undefined> {
const [result] = await db.update(tickets).set(data).where(eq(tickets.id, ticketId)).returning();
if (!result) return undefined;
return await getTicketById(ticketId);
}
export async function getTicketsByUser(userId: number): Promise<TicketWithRelations[]> {
return await db.query.tickets.findMany({
where: {
openedBy: userId,
},
with: ticketWithRelations,
});
}
export async function getTicketsByUserGDPR(userId: number) {
const userActors = await db
.select({ id: actors.id })
.from(actors)
.where(eq(actors.userId, userId));
const actorIds = userActors.map((a) => a.id);
if (actorIds.length === 0) {
return [];
}
const openedTickets = await db
.select({ id: tickets.id })
.from(tickets)
.where(inArray(tickets.openedBy, actorIds));
const subjectTickets = await db
.select({ id: tickets.id })
.from(tickets)
.where(inArray(tickets.subject, actorIds));
const participantTickets = await db
.select({ ticketId: ticketParticipants.ticketId })
.from(ticketParticipants)
.where(inArray(ticketParticipants.actorId, actorIds));
const allTargetTicketIds = Array.from(
new Set([
...openedTickets.map((t) => t.id),
...subjectTickets.map((t) => t.id),
...participantTickets.map((t) => t.ticketId),
]),
);
if (allTargetTicketIds.length === 0) {
return [];
}
const userTickets = await db.query.tickets.findMany({
where: {
id: {
in: allTargetTicketIds,
},
},
with: ticketWithRelations,
});
const sanitizeActor = (actor: TicketWithRelations["opener"]) => {
if (!actor) return null;
const isSelf = actor.userId === userId;
return {
id: actor.id,
guildId: actor.guildId,
userId: actor.userId,
displayName: actor.displayName,
username: actor.username,
avatar: actor.avatar,
moderator: actor.moderator,
createdAt: actor.createdAt,
discordId: isSelf ? actor.discordId : undefined,
user: actor.user
? {
id: actor.user.id,
displayName: actor.user.displayName,
username: actor.user.username,
avatar: actor.user.avatar,
discordId: isSelf ? actor.user.discordId : undefined,
acceptedPrivacyPolicy: isSelf ? actor.user.acceptedPrivacyPolicy : undefined,
acceptedTermsOfService: isSelf ? actor.user.acceptedTermsOfService : undefined,
createdAt: isSelf ? actor.user.createdAt : undefined,
updatedAt: isSelf ? actor.user.updatedAt : undefined,
}
: null,
};
};
const sanitizeGuild = (guild: TicketWithRelations["guild"]) => {
if (!guild) return null;
return {
id: guild.id,
name: guild.name,
icon: guild.icon,
};
};
return userTickets.map((ticket) => {
const isModeratorOnTicket =
ticket.participants.some((p) => actorIds.includes(p.actorId) && p.role === "moderator") ||
ticket.participants.some((p) => actorIds.includes(p.actorId) && p.actor?.moderator === true);
const baseTicket = {
id: ticket.id,
guildId: ticket.guildId,
localId: ticket.localId,
status: ticket.status,
openedAt: ticket.openedAt,
closedAt: ticket.closedAt,
closeReason: ticket.closeReason,
openReason: ticket.openReason,
claimedAt: ticket.claimedAt,
guild: sanitizeGuild(ticket.guild),
opener: sanitizeActor(ticket.opener),
subjectActor: sanitizeActor(ticket.subjectActor),
claimedByActor: sanitizeActor(ticket.claimedByActor),
closedByActor: sanitizeActor(ticket.closedByActor),
};
if (isModeratorOnTicket) {
return {
...baseTicket,
privateReason: ticket.privateReason,
participants: ticket.participants.map((p) => ({
id: p.id,
role: p.role,
actorId: p.actorId,
createdAt: p.createdAt,
reason: p.reason,
actor: sanitizeActor(p.actor),
})),
messages: ticket.messages.map((msg) => ({
id: msg.id,
messageId: msg.messageId,
actorId: msg.actorId,
actorRole: msg.actorRole,
content: msg.content,
embeds: msg.embeds,
components: msg.components,
createdAt: msg.createdAt,
editedAt: msg.editedAt,
isPrivate: msg.isPrivate,
deletedAt: msg.deletedAt,
actor: sanitizeActor(msg.actor),
})),
attachments: ticket.attachments.map((att) => ({
id: att.id,
messageId: att.messageId,
fileName: att.fileName,
fileType: att.fileType,
fileSize: att.fileSize,
actorId: att.actorId,
actor: sanitizeActor(att.actor),
})),
comments: ticket.comments.map((c) => ({
id: c.id,
content: c.content,
createdAt: c.createdAt,
updatedAt: c.updatedAt,
actor: sanitizeActor(c.actor),
})),
};
}
const sanitizedMessages = ticket.messages
.filter((msg) => !msg.isPrivate && !msg.deletedAt)
.map((msg) => ({
id: msg.id,
messageId: msg.messageId,
actorId: msg.actorId,
actorRole: msg.actorRole,
content: msg.content,
embeds: msg.embeds,
components: msg.components,
createdAt: msg.createdAt,
editedAt: msg.editedAt,
actor: sanitizeActor(msg.actor),
}));
return {
...baseTicket,
privateReason: null,
comments: [],
participants: ticket.participants.map((p) => ({
id: p.id,
role: p.role,
actorId: p.actorId,
createdAt: p.createdAt,
reason: actorIds.includes(p.actorId) ? p.reason : null,
actor: sanitizeActor(p.actor),
})),
messages: sanitizedMessages,
attachments: ticket.attachments
.filter((att) => {
if (!att.messageId) return true;
return sanitizedMessages.some((msg) => msg.id === att.messageId);
})
.map((att) => ({
id: att.id,
messageId: att.messageId,
fileName: att.fileName,
fileType: att.fileType,
fileSize: att.fileSize,
actorId: att.actorId,
actor: sanitizeActor(att.actor),
})),
};
});
}
// standard ops
export async function createTicket(data: {
guildId: number;
openedBy: number;
subject: number;
status: string;
channelId?: string | null;
openReason?: string | null;
}): Promise<TicketWithRelations> {
const id = randomUUID();
return await db.transaction(async (tx) => {
const [lastTicket] = await tx
.select({ localId: tickets.localId })
.from(tickets)
.where(eq(tickets.guildId, data.guildId))
.orderBy(desc(tickets.localId))
.limit(1);
const nextLocalId = lastTicket ? lastTicket.localId + 1 : 1;
const [newTicket] = await tx
.insert(tickets)
.values({
id: id,
guildId: data.guildId,
localId: nextLocalId,
status: data.status,
channelId: data.channelId,
openedBy: data.openedBy,
subject: data.subject,
openReason: data.openReason,
openedAt: new Date(),
})
.returning();
if (!newTicket) throw new Error("Failed to create ticket");
await tx.insert(ticketParticipants).values({
ticketId: newTicket.id,
actorId: data.openedBy,
role: data.openedBy === data.subject ? "subject" : "participant",
createdAt: new Date(),
});
const populatedTicket = await tx.query.tickets.findFirst({
where: {
id: newTicket.id,
},
with: ticketWithRelations,
});
if (!populatedTicket) throw new Error("Failed to retrieve created ticket");
return populatedTicket as TicketWithRelations;
});
}
export async function closeTicket(data: {
ticketId: string;
closedBy: number;
reason?: string | null;
status?: string;
}): Promise<TicketWithRelations | undefined> {
const [closedTicket] = await db
.update(tickets)
.set({
status: data.status ?? "closed",
closedAt: new Date(),
closedBy: data.closedBy,
closeReason: data.reason,
})
.where(eq(tickets.id, data.ticketId))
.returning();
if (!closedTicket) return undefined;
return await getTicketById(data.ticketId);
}
export async function claimTicket(
ticketId: string,
actorId: number,
): Promise<TicketWithRelations | undefined> {
const [ticket] = await db
.update(tickets)
.set({
claimedBy: actorId,
claimedAt: new Date(),
})
.where(eq(tickets.id, ticketId))
.returning();
if (!ticket) return undefined;
return await getTicketById(ticketId);
}
export async function unclaimTicket(ticketId: string): Promise<TicketWithRelations | undefined> {
const [ticket] = await db
.update(tickets)
.set({
claimedBy: null,
claimedAt: null,
lastClaimantActivityAt: null,
})
.where(eq(tickets.id, ticketId))
.returning();
if (!ticket) return undefined;
return await getTicketById(ticketId);
}
// messages
export async function createTicketMessageWithAttachments(data: {
id: string;
ticketId: string;
actorId: number;
messageId?: string | null;
content: string;
actorRole: "participant" | "moderator" | "subject" | "bot";
isPrivate?: boolean;
embeds?: APIEmbed[];
components?: APIMessageTopLevelComponent[];
attachments?: {
id: string;
fileName: string;
key: string;
fileType: string;
fileSize: number;
}[];
}) {
return await db.transaction(async (tx) => {
const [message] = await tx
.insert(ticketMessages)
.values({
id: data.id,
messageId: data.messageId,
ticketId: data.ticketId,
actorId: data.actorId,
isPrivate: data.isPrivate,
content: data.content,
actorRole: data.actorRole,
embeds: data.embeds,
components: data.components,
createdAt: new Date(),
})
.returning();
if (data.attachments && data.attachments.length > 0) {
await tx.insert(ticketAttachments).values(
data.attachments.map((att) => ({
id: att.id,
messageId: message?.id,
ticketId: data.ticketId,
actorId: data.actorId,
key: att.key,
fileName: att.fileName,
fileType: att.fileType,
fileSize: att.fileSize,
})),
);
}
const ticketUpdate: Partial<Ticket> = {
lastMessageAt: new Date(),
};
if (data.actorRole === "moderator") ticketUpdate.hasModeratorMessage = true;
else if (data.actorRole === "subject") ticketUpdate.hasAuthorMessage = true;
await tx.update(tickets).set(ticketUpdate).where(eq(tickets.id, data.ticketId));
return message;
});
}
export async function getTicketTranscript(ticketId: string) {
return await db.query.tickets.findFirst({
where: { id: ticketId },
with: {
opener: true,
subjectActor: true,
claimedByActor: true,
participants: {
with: {
actor: true,
},
},
messages: {
orderBy: (messages, { asc }) => [asc(messages.createdAt)],
with: {
actor: true,
attachments: true,
},
},
},
});
}
export const ticketMessageWithRelations = {
actor: {
with: {
user: true,
},
},
attachments: true,
} as const;
export async function getTicketMessage(id: string) {
return await db.query.ticketMessages.findFirst({
where: {
id: id,
},
with: ticketMessageWithRelations,
});
}
export type TicketMessageWithRelations = NonNullable<Awaited<ReturnType<typeof getTicketMessage>>>;
export async function getTicketMessageByMessageId(
messageId: string,
): Promise<TicketMessageWithRelations | undefined> {
return await db.query.ticketMessages.findFirst({
where: {
messageId: messageId,
},
with: ticketMessageWithRelations,
});
}
export async function getTicketMessages(
ticketId: string,
options?: { includeDeleted?: boolean },
): Promise<TicketMessageWithRelations[]> {
return await db.query.ticketMessages.findMany({
where: options?.includeDeleted
? { ticketId: ticketId }
: {
ticketId: ticketId,
deletedAt: { isNull: true },
},
orderBy: {
createdAt: "asc",
},
with: ticketMessageWithRelations,
});
}
export async function editTicketMessage(
id: string,
data: { content?: string; embeds?: Embed[]; components?: TopLevelComponent[] },
): Promise<TicketMessageWithRelations | undefined> {
const [updated] = await db
.update(ticketMessages)
.set({
editedAt: new Date(),
...data,
})
.where(eq(ticketMessages.id, id))
.returning();
if (!updated) return undefined;
return await getTicketMessage(id);
}
export async function deleteTicketMessage(
id: string,
): Promise<TicketMessageWithRelations | undefined> {
const [deleted] = await db
.update(ticketMessages)
.set({
deletedAt: new Date(),
})
.where(eq(ticketMessages.id, id))
.returning();
if (!deleted) return undefined;
return await getTicketMessage(id);
}
export async function restoreTicketMessage(
id: string,
): Promise<TicketMessageWithRelations | undefined> {
const [restored] = await db
.update(ticketMessages)
.set({
deletedAt: null,
})
.where(eq(ticketMessages.id, id))
.returning();
if (!restored) return undefined;
return await getTicketMessage(id);
}
export async function setTicketMessagePrivacy(
id: string,
isPrivate: boolean,
): Promise<TicketMessageWithRelations | undefined> {
const [updated] = await db
.update(ticketMessages)
.set({
isPrivate,
})
.where(eq(ticketMessages.id, id))
.returning();
if (!updated) return undefined;
return await getTicketMessage(id);
}
export async function setTicketMessageExternalId(
id: string,
messageId: string,
): Promise<TicketMessageWithRelations | undefined> {
const [updated] = await db
.update(ticketMessages)
.set({
messageId,
})
.where(eq(ticketMessages.id, id))
.returning();
if (!updated) return undefined;
return await getTicketMessage(id);
}
// participants
export async function addTicketParticipant(data: {
ticketId: string;
actorId: number;
role: "participant" | "moderator" | "subject";
reason?: string | null;
}) {
const participant = await db.insert(ticketParticipants).values({
ticketId: data.ticketId,
actorId: data.actorId,
role: data.role,
reason: data.reason,
createdAt: new Date(),
});
return participant;
}
export async function addTicketParticipants(
data: {
ticketId: string;
actorId: number;
role: "participant" | "moderator" | "subject";
reason?: string | null;
}[],
) {
const participants = data.map((item) => ({
ticketId: item.ticketId,
actorId: item.actorId,
role: item.role,
reason: item.reason,
createdAt: new Date(),
}));
const result = await db.insert(ticketParticipants).values(participants).returning();
return result;
}
export async function removeTicketParticipant(ticketId: string, actorId: number) {
const [removed] = await db
.delete(ticketParticipants)
.where(and(eq(ticketParticipants.ticketId, ticketId), eq(ticketParticipants.actorId, actorId)))
.returning();
return removed;
}
export async function getTicketParticipants(ticketId: string) {
return await db.query.ticketParticipants.findMany({
where: {
ticketId: ticketId,
},
with: {
actor: true,
},
});
}
// comments
export async function getTicketComments(ticketId: string) {
return await db.query.ticketComments.findMany({
where: {
ticketId: ticketId,
},
with: {
actor: {
with: {
user: true,
},
},
},
});
}
export async function addTicketComment(data: {
ticketId: string;
actorId: number;
content: string;
}) {
const [comment] = await db
.insert(ticketComments)
.values({
id: randomUUID(),
ticketId: data.ticketId,
actorId: data.actorId,
content: data.content,
createdAt: new Date(),
updatedAt: new Date(),
})
.returning();
return comment;
}
export async function removeTicketComment(commentId: string) {
const [removed] = await db
.delete(ticketComments)
.where(eq(ticketComments.id, commentId))
.returning();
return removed;
}
export async function editTicketComment(commentId: string, content: string) {
const [updated] = await db
.update(ticketComments)
.set({
content: content,
updatedAt: new Date(),
})
.where(eq(ticketComments.id, commentId))
.returning();
return updated;
}
// attachments
export async function getTicketAttachments(ticketId: string) {
return await db.query.ticketAttachments.findMany({
where: {
ticketId: ticketId,
},
with: {
actor: {
with: {
user: true,
},
},
},
});
}
// gdpr deletion
export async function purgeTicketData(ticketId: string, guildActorId: number) {
await db.transaction(async (tx) => {
await tx
.update(tickets)
.set({
openedBy: guildActorId,
subject: guildActorId,
claimedBy: null,
closedBy: null,
openReason: null,
closeReason: null,
privateReason: null,
hasModeratorMessage: false,
hasAuthorMessage: false,
lastMessageAt: null,
})
.where(eq(tickets.id, ticketId));
await tx.delete(ticketParticipants).where(eq(ticketParticipants.ticketId, ticketId));
await tx.delete(ticketComments).where(eq(ticketComments.ticketId, ticketId));
await tx.delete(ticketAttachments).where(eq(ticketAttachments.ticketId, ticketId));
await tx.delete(ticketMessages).where(eq(ticketMessages.ticketId, ticketId));
});
}
export async function purgeUserTicketData(actorId: number, guildActorId: number) {
await db.transaction(async (tx) => {
const userTickets = await tx
.select({ id: tickets.id })
.from(tickets)
.where(or(eq(tickets.openedBy, actorId), eq(tickets.subject, actorId)));
const ticketIds = userTickets.map((t) => t.id);
if (ticketIds.length > 0) {
await tx
.update(tickets)
.set({
openedBy: guildActorId,
subject: guildActorId,
claimedBy: null,
closedBy: null,
openReason: null,
closeReason: null,
privateReason: null,
hasModeratorMessage: false,
hasAuthorMessage: false,
lastMessageAt: null,
})
.where(inArray(tickets.id, ticketIds));
await tx.delete(ticketParticipants).where(inArray(ticketParticipants.ticketId, ticketIds));
await tx.delete(ticketComments).where(inArray(ticketComments.ticketId, ticketIds));
await tx.delete(ticketAttachments).where(inArray(ticketAttachments.ticketId, ticketIds));
await tx.delete(ticketMessages).where(inArray(ticketMessages.ticketId, ticketIds));
}
await tx.delete(ticketParticipants).where(eq(ticketParticipants.actorId, actorId));
await tx.delete(ticketComments).where(eq(ticketComments.actorId, actorId));
await tx.delete(ticketAttachments).where(eq(ticketAttachments.actorId, actorId));
await tx.delete(ticketMessages).where(eq(ticketMessages.actorId, actorId));
await tx.update(tickets).set({ claimedBy: null }).where(eq(tickets.claimedBy, actorId));
await tx.update(tickets).set({ closedBy: null }).where(eq(tickets.closedBy, actorId));
});
}
|