| 1 | import { |
| 2 | and, |
| 3 | asc, |
| 4 | desc, |
| 5 | eq, |
| 6 | getTableColumns, |
| 7 | gte, |
| 8 | inArray, |
| 9 | isNull, |
| 10 | lte, |
| 11 | sum, |
| 12 | } from 'drizzle-orm' |
| 13 | import type { ReadonlyHeaders |
| 14 | import { getCachedActiveOrgMember } |
| 15 | import type { projectsService |
| 16 | import { db } |
| 17 | import { |
| 18 | customFields, |
| 19 | memberRates, |
| 20 | members, |
| 21 | projectBudgets, |
| 22 | requirements, |
| 23 | timeEntries, |
| 24 | timesheetReportEntries, |
| 25 | timesheetReportRecipients, |
| 26 | timesheetReports, |
| 27 | users, |
| 28 | } from '@/server/db/schema' |
| 29 | |
| 30 | interface ListFilters { |
| 31 | billable?: boolean |
| 32 | dateFrom?: string |
| 33 | dateTo?: string |
| 34 | memberId?: string |
| 35 | requirementId?: string |
| 36 | status?: string |
| 37 | } |
| 38 | |
| 39 | const listByProject = async |
| 40 | projectId: string, |
| 41 | headers: ReadonlyHeaders |
| 42 | filters?: ListFilters |
| 43 | ) => { |
| 44 | const activeMember = |
| 45 | const isAdmin = |
| 46 | activeMember?.role === |
| 47 | |
| 48 | const conditions = |
| 49 | |
| 50 | if (!isAdmin && |
| 51 | conditions.push(eq |
| 52 | } |
| 53 | |
| 54 | if (filters?.memberId |
| 55 | conditions.push(eq |
| 56 | } |
| 57 | if (filters?.status |
| 58 | conditions.push( |
| 59 | eq( |
| 60 | timeEntries.status, |
| 61 | filters.status as |
| 62 | ) |
| 63 | ) |
| 64 | } |
| 65 | if (filters?.requirementId |
| 66 | conditions.push(eq |
| 67 | } |
| 68 | if (filters?.billable |
| 69 | conditions.push(eq |
| 70 | } |
| 71 | if (filters?.dateFrom |
| 72 | conditions.push(gte |
| 73 | } |
| 74 | if (filters?.dateTo |
| 75 | conditions.push(lte |
| 76 | } |
| 77 | |
| 78 | const entries = |
| 79 | .select({ |
| 80 | id: timeEntries.id |
| 81 | projectId: timeEntries.projectId |
| 82 | requirementId: timeEntries.requirementId |
| 83 | memberId: timeEntries.memberId |
| 84 | description: timeEntries.description |
| 85 | date: timeEntries.date |
| 86 | durationMinutes: timeEntries.durationMinutes |
| 87 | billable: timeEntries.billable |
| 88 | status: timeEntries.status |
| 89 | rejectReason: timeEntries.rejectReason |
| 90 | invoiceId: timeEntries.invoiceId |
| 91 | customValues: timeEntries.customValues |
| 92 | createdAt: timeEntries.createdAt |
| 93 | updatedAt: timeEntries.updatedAt |
| 94 | memberName: users.name |
| 95 | memberEmail: users.email |
| 96 | requirementTitle: requirements.title |
| 97 | requirementSlug: requirements.slug |
| 98 | }) |
| 99 | .from(timeEntries) |
| 100 | .innerJoin(members, |
| 101 | .innerJoin(users, |
| 102 | .leftJoin(requirements, |
| 103 | .where(and(... |
| 104 | .orderBy(desc(timeEntries |
| 105 | |
| 106 | return entries as |
| 107 | (typeof entries |
| 108 | 'requirementTitle' | |
| 109 | > & { |
| 110 | } |
| 111 | |
| 112 | const getById = async |
| 113 | const [entry] |
| 114 | .select({ |
| 115 | id: timeEntries.id |
| 116 | projectId: timeEntries.projectId |
| 117 | requirementId: timeEntries.requirementId |
| 118 | memberId: timeEntries.memberId |
| 119 | description: timeEntries.description |
| 120 | date: timeEntries.date |
| 121 | durationMinutes: timeEntries.durationMinutes |
| 122 | billable: timeEntries.billable |
| 123 | status: timeEntries.status |
| 124 | invoiceId: timeEntries.invoiceId |
| 125 | createdAt: timeEntries.createdAt |
| 126 | updatedAt: timeEntries.updatedAt |
| 127 | memberName: users.name |
| 128 | memberEmail: users.email |
| 129 | requirementTitle: requirements.title |
| 130 | }) |
| 131 | .from(timeEntries) |
| 132 | .innerJoin(members, |
| 133 | .innerJoin(users, |
| 134 | .leftJoin(requirements, |
| 135 | .where( |
| 136 | and(eq(timeEntries |
| 137 | ) |
| 138 | |
| 139 | return entry ?? |
| 140 | } |
| 141 | |
| 142 | const getWeeklyTimesheet = async |
| 143 | projectId: string, |
| 144 | memberId: string, |
| 145 | weekStart: string |
| 146 | ) => { |
| 147 | const startDate = |
| 148 | const end = |
| 149 | end.setUTCDate(end |
| 150 | const endDate = |
| 151 | |
| 152 | const entries = |
| 153 | .select({ |
| 154 | id: timeEntries.id |
| 155 | requirementId: timeEntries.requirementId |
| 156 | description: timeEntries.description |
| 157 | date: timeEntries.date |
| 158 | durationMinutes: timeEntries.durationMinutes |
| 159 | billable: timeEntries.billable |
| 160 | status: timeEntries.status |
| 161 | requirementTitle: requirements.title |
| 162 | }) |
| 163 | .from(timeEntries) |
| 164 | .leftJoin(requirements, |
| 165 | .where( |
| 166 | and( |
| 167 | eq(timeEntries.projectId |
| 168 | eq(timeEntries.memberId |
| 169 | gte(timeEntries.date |
| 170 | lte(timeEntries.date |
| 171 | ) |
| 172 | ) |
| 173 | .orderBy(asc(timeEntries |
| 174 | |
| 175 | return entries |
| 176 | } |
| 177 | |
| 178 | const getProjectBudgetStatus = async |
| 179 | const [budget] |
| 180 | .select() |
| 181 | .from(projectBudgets) |
| 182 | .where(eq(projectBudgets |
| 183 | |
| 184 | if (!budget) |
| 185 | return null |
| 186 | } |
| 187 | |
| 188 | const [result] |
| 189 | .select({ |
| 190 | totalMinutes: sum(timeEntries |
| 191 | }) |
| 192 | .from(timeEntries) |
| 193 | .where( |
| 194 | and( |
| 195 | eq(timeEntries.projectId |
| 196 | eq(timeEntries.status |
| 197 | ) |
| 198 | ) |
| 199 | |
| 200 | const totalApprovedMinutes = |
| 201 | const percentageUsed = |
| 202 | (totalApprovedMinutes / budget |
| 203 | ) |
| 204 | |
| 205 | return { |
| 206 | budget, |
| 207 | totalApprovedMinutes, |
| 208 | percentageUsed, |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | const getMemberRate = async |
| 213 | memberId: string, |
| 214 | projectId: string, |
| 215 | date: string |
| 216 | ) => { |
| 217 | const [projectRate] |
| 218 | .select() |
| 219 | .from(memberRates) |
| 220 | .where( |
| 221 | and( |
| 222 | eq(memberRates.memberId |
| 223 | eq(memberRates.projectId |
| 224 | lte(memberRates.effectiveFrom |
| 225 | ) |
| 226 | ) |
| 227 | .orderBy(desc(memberRates |
| 228 | .limit(1) |
| 229 | |
| 230 | if (projectRate) { |
| 231 | return projectRate |
| 232 | } |
| 233 | |
| 234 | const [orgRate] |
| 235 | .select() |
| 236 | .from(memberRates) |
| 237 | .where( |
| 238 | and( |
| 239 | eq(memberRates.memberId |
| 240 | isNull(memberRates.projectId |
| 241 | lte(memberRates.effectiveFrom |
| 242 | ) |
| 243 | ) |
| 244 | .orderBy(desc(memberRates |
| 245 | .limit(1) |
| 246 | |
| 247 | return orgRate ?? |
| 248 | } |
| 249 | |
| 250 | const getBillableSummary = async |
| 251 | const entries = |
| 252 | .select({ |
| 253 | id: timeEntries.id |
| 254 | memberId: timeEntries.memberId |
| 255 | requirementId: timeEntries.requirementId |
| 256 | description: timeEntries.description |
| 257 | date: timeEntries.date |
| 258 | durationMinutes: timeEntries.durationMinutes |
| 259 | invoiceId: timeEntries.invoiceId |
| 260 | memberName: users.name |
| 261 | requirementTitle: requirements.title |
| 262 | }) |
| 263 | .from(timeEntries) |
| 264 | .innerJoin(members, |
| 265 | .innerJoin(users, |
| 266 | .leftJoin(requirements, |
| 267 | .where( |
| 268 | and( |
| 269 | eq(timeEntries.projectId |
| 270 | eq(timeEntries.status |
| 271 | eq(timeEntries.billable |
| 272 | isNull(timeEntries.invoiceId |
| 273 | ) |
| 274 | ) |
| 275 | .orderBy(asc(users |
| 276 | |
| 277 | return entries |
| 278 | } |
| 279 | |
| 280 | const getMemberRates = async |
| 281 | const { |
| 282 | payCurrency, |
| 283 | payFrequency, |
| 284 | payRate, |
| 285 | billingCurrency, |
| 286 | billingFrequency, |
| 287 | billingRate, |
| 288 | } = getTableColumns(memberRates |
| 289 | const rates = |
| 290 | .select({ |
| 291 | id: memberRates.id |
| 292 | memberId: memberRates.memberId |
| 293 | projectId: memberRates.projectId |
| 294 | payCurrency, |
| 295 | payFrequency, |
| 296 | payRate, |
| 297 | billingCurrency, |
| 298 | billingFrequency, |
| 299 | billingRate, |
| 300 | effectiveFrom: memberRates.effectiveFrom |
| 301 | createdAt: memberRates.createdAt |
| 302 | memberName: users.name |
| 303 | memberEmail: users.email |
| 304 | }) |
| 305 | .from(memberRates) |
| 306 | .innerJoin(members, |
| 307 | .innerJoin(users, |
| 308 | .where(eq(members |
| 309 | .orderBy(desc(memberRates |
| 310 | |
| 311 | return rates |
| 312 | } |
| 313 | |
| 314 | const getProjectBudget = async |
| 315 | const [budget] |
| 316 | .select() |
| 317 | .from(projectBudgets) |
| 318 | .where(eq(projectBudgets |
| 319 | |
| 320 | return budget ?? |
| 321 | } |
| 322 | |
| 323 | const listReportsByProject = async |
| 324 | const reports = |
| 325 | .select({ |
| 326 | id: timesheetReports.id |
| 327 | projectId: timesheetReports.projectId |
| 328 | title: timesheetReports.title |
| 329 | status: timesheetReports.status |
| 330 | totalMinutes: timesheetReports.totalMinutes |
| 331 | totalAmount: timesheetReports.totalAmount |
| 332 | currency: timesheetReports.currency |
| 333 | disputeReason: timesheetReports.disputeReason |
| 334 | sentAt: timesheetReports.sentAt |
| 335 | respondedAt: timesheetReports.respondedAt |
| 336 | createdAt: timesheetReports.createdAt |
| 337 | updatedAt: timesheetReports.updatedAt |
| 338 | sentByMemberId: timesheetReports.sentByMemberId |
| 339 | }) |
| 340 | .from(timesheetReports) |
| 341 | .where(eq(timesheetReports |
| 342 | .orderBy(desc(timesheetReports |
| 343 | return reports |
| 344 | } |
| 345 | |
| 346 | const listReportsForClient = async |
| 347 | clientMemberId: string, |
| 348 | projectId: string |
| 349 | ) => { |
| 350 | const reports = |
| 351 | .select({ |
| 352 | id: timesheetReports.id |
| 353 | projectId: timesheetReports.projectId |
| 354 | title: timesheetReports.title |
| 355 | status: timesheetReports.status |
| 356 | totalMinutes: timesheetReports.totalMinutes |
| 357 | totalAmount: timesheetReports.totalAmount |
| 358 | currency: timesheetReports.currency |
| 359 | disputeReason: timesheetReports.disputeReason |
| 360 | sentAt: timesheetReports.sentAt |
| 361 | respondedAt: timesheetReports.respondedAt |
| 362 | createdAt: timesheetReports.createdAt |
| 363 | updatedAt: timesheetReports.updatedAt |
| 364 | sentByMemberId: timesheetReports.sentByMemberId |
| 365 | }) |
| 366 | .from(timesheetReportRecipients) |
| 367 | .innerJoin( |
| 368 | timesheetReports, |
| 369 | eq(timesheetReportRecipients.reportId |
| 370 | ) |
| 371 | .where( |
| 372 | and( |
| 373 | eq(timesheetReportRecipients.clientMemberId |
| 374 | eq(timesheetReports.projectId |
| 375 | ) |
| 376 | ) |
| 377 | .orderBy(desc(timesheetReports |
| 378 | |
| 379 | return reports |
| 380 | } |
| 381 | |
| 382 | const getReportEntriesBatch = async |
| 383 | interface Row |
| 384 | billable: boolean |
| 385 | createdAt: Date |
| 386 | customValues: Record |
| 387 | date: string |
| 388 | description: string |
| 389 | durationMinutes: number |
| 390 | id: string |
| 391 | invoiceId: string |
| 392 | memberId: string |
| 393 | memberName: string |
| 394 | reportId: string |
| 395 | requirementTitle: string |
| 396 | timeEntryId: string |
| 397 | updatedAt: Date |
| 398 | } |
| 399 | |
| 400 | if (reportIds.length |
| 401 | return {} as Record |
| 402 | } |
| 403 | |
| 404 | const rows = |
| 405 | .select({ |
| 406 | reportId: timesheetReportEntries.reportId |
| 407 | id: timeEntries.id |
| 408 | memberId: timeEntries.memberId |
| 409 | description: timeEntries.description |
| 410 | date: timeEntries.date |
| 411 | durationMinutes: timeEntries.durationMinutes |
| 412 | billable: timeEntries.billable |
| 413 | memberName: users.name |
| 414 | requirementTitle: requirements.title |
| 415 | timeEntryId: timeEntries.id |
| 416 | createdAt: timesheetReportEntries.createdAt |
| 417 | updatedAt: timesheetReportEntries.updatedAt |
| 418 | invoiceId: timeEntries.invoiceId |
| 419 | customValues: timeEntries.customValues |
| 420 | }) |
| 421 | .from(timesheetReportEntries) |
| 422 | .innerJoin( |
| 423 | timeEntries, |
| 424 | eq(timesheetReportEntries.timeEntryId |
| 425 | ) |
| 426 | .innerJoin(members, |
| 427 | .innerJoin(users, |
| 428 | .leftJoin(requirements, |
| 429 | .where(inArray(timesheetReportEntries |
| 430 | .orderBy(asc(timeEntries |
| 431 | |
| 432 | const grouped = |
| 433 | for (const row |
| 434 | const list = |
| 435 | if (list) { |
| 436 | list.push(row |
| 437 | } else { |
| 438 | grouped.set(row |
| 439 | } |
| 440 | } |
| 441 | return Object.fromEntries |
| 442 | } |
| 443 | |
| 444 | const getReportById = async |
| 445 | const [report] |
| 446 | .select() |
| 447 | .from(timesheetReports) |
| 448 | .where( |
| 449 | and( |
| 450 | eq(timesheetReports.id |
| 451 | eq(timesheetReports.projectId |
| 452 | ) |
| 453 | ) |
| 454 | if (!report) |
| 455 | return null |
| 456 | } |
| 457 | |
| 458 | const entryLinks = |
| 459 | .select({ timeEntryId: |
| 460 | .from(timesheetReportEntries) |
| 461 | .where(eq(timesheetReportEntries |
| 462 | |
| 463 | const entryIds = |
| 464 | if (entryIds.length |
| 465 | return { report, |
| 466 | } |
| 467 | |
| 468 | const entries = |
| 469 | .select({ |
| 470 | id: timeEntries.id |
| 471 | description: timeEntries.description |
| 472 | date: timeEntries.date |
| 473 | durationMinutes: timeEntries.durationMinutes |
| 474 | billable: timeEntries.billable |
| 475 | memberName: users.name |
| 476 | requirementTitle: requirements.title |
| 477 | }) |
| 478 | .from(timeEntries) |
| 479 | .innerJoin(members, |
| 480 | .innerJoin(users, |
| 481 | .leftJoin(requirements, |
| 482 | .where(inArray(timeEntries |
| 483 | .orderBy(asc(timeEntries |
| 484 | |
| 485 | return { report, |
| 486 | } |
| 487 | const getBillableEntriesForReport = async |
| 488 | reportId: string, |
| 489 | memberId?: string |
| 490 | ) => { |
| 491 | const conditions = |
| 492 | if (memberId) { |
| 493 | conditions.push(eq |
| 494 | } |
| 495 | |
| 496 | const entries = |
| 497 | .select({ |
| 498 | id: timeEntries.id |
| 499 | memberId: timeEntries.memberId |
| 500 | requirementId: timeEntries.requirementId |
| 501 | description: timeEntries.description |
| 502 | date: timeEntries.date |
| 503 | durationMinutes: timeEntries.durationMinutes |
| 504 | invoiceId: timeEntries.invoiceId |
| 505 | memberName: users.name |
| 506 | requirementTitle: requirements.title |
| 507 | }) |
| 508 | .from(timesheetReportEntries) |
| 509 | .innerJoin( |
| 510 | timeEntries, |
| 511 | eq(timesheetReportEntries.timeEntryId |
| 512 | ) |
| 513 | .innerJoin(members, |
| 514 | .innerJoin(users, |
| 515 | .leftJoin(requirements, |
| 516 | .where(and(... |
| 517 | .orderBy(asc(users |
| 518 | |
| 519 | return entries |
| 520 | } |
| 521 | |
| 522 | const getReportRecipientsBatch = async |
| 523 | if (reportIds.length |
| 524 | return {} as Record |
| 525 | string, |
| 526 | { |
| 527 | id: string |
| 528 | clientMemberId: string |
| 529 | clientName: string |
| 530 | clientEmail: string |
| 531 | status: 'pending |
| 532 | disputeReason: string |
| 533 | respondedAt: Date |
| 534 | }[] |
| 535 | > |
| 536 | } |
| 537 | |
| 538 | const rows = |
| 539 | .select({ |
| 540 | reportId: timesheetReportRecipients.reportId |
| 541 | id: timesheetReportRecipients.id |
| 542 | clientMemberId: timesheetReportRecipients.clientMemberId |
| 543 | clientName: users.name |
| 544 | clientEmail: users.email |
| 545 | status: timesheetReportRecipients.status |
| 546 | disputeReason: timesheetReportRecipients.disputeReason |
| 547 | respondedAt: timesheetReportRecipients.respondedAt |
| 548 | }) |
| 549 | .from(timesheetReportRecipients) |
| 550 | .innerJoin( |
| 551 | members, |
| 552 | eq(timesheetReportRecipients.clientMemberId |
| 553 | ) |
| 554 | .innerJoin(users, |
| 555 | .where(inArray(timesheetReportRecipients |
| 556 | |
| 557 | const grouped = |
| 558 | for (const row |
| 559 | if (!grouped.has |
| 560 | grouped.set(row |
| 561 | } |
| 562 | grouped.get(row |
| 563 | } |
| 564 | return Object.fromEntries |
| 565 | } |
| 566 | |
| 567 | const listByProjectIdsSince = async |
| 568 | projectIds: string[] |
| 569 | since: Date |
| 570 | memberId?: string |
| 571 | ) => { |
| 572 | if (projectIds.length |
| 573 | return [] |
| 574 | } |
| 575 | |
| 576 | return await db |
| 577 | .select({ |
| 578 | projectId: timeEntries.projectId |
| 579 | durationMinutes: timeEntries.durationMinutes |
| 580 | }) |
| 581 | .from(timeEntries) |
| 582 | .where( |
| 583 | and( |
| 584 | inArray(timeEntries.projectId |
| 585 | gte(timeEntries.date |
| 586 | memberId ? eq( |
| 587 | ) |
| 588 | ) |
| 589 | } |
| 590 | |
| 591 | const getEntryForEdit = async |
| 592 | const [entry] |
| 593 | .select({ |
| 594 | id: timeEntries.id |
| 595 | projectId: timeEntries.projectId |
| 596 | requirementId: timeEntries.requirementId |
| 597 | memberId: timeEntries.memberId |
| 598 | description: timeEntries.description |
| 599 | date: timeEntries.date |
| 600 | durationMinutes: timeEntries.durationMinutes |
| 601 | billable: timeEntries.billable |
| 602 | status: timeEntries.status |
| 603 | rejectReason: timeEntries.rejectReason |
| 604 | invoiceId: timeEntries.invoiceId |
| 605 | customValues: timeEntries.customValues |
| 606 | createdAt: timeEntries.createdAt |
| 607 | updatedAt: timeEntries.updatedAt |
| 608 | requirementSlug: requirements.slug |
| 609 | requirementTitle: requirements.title |
| 610 | memberEmail: users.email |
| 611 | memberName: users.name |
| 612 | }) |
| 613 | .from(timeEntries) |
| 614 | .leftJoin(requirements, |
| 615 | .leftJoin(members, |
| 616 | .leftJoin(users, |
| 617 | .where( |
| 618 | and(eq(timeEntries |
| 619 | ) |
| 620 | .limit(1) |
| 621 | |
| 622 | return entry ?? |
| 623 | } |
| 624 | |
| 625 | const getProjectCustomFields = async |
| 626 | projectId: string, |
| 627 | role: 'owner |
| 628 | ) => { |
| 629 | const conditions = |
| 630 | if (role === |
| 631 | conditions.push(eq |
| 632 | } |
| 633 | return await db |
| 634 | .select() |
| 635 | .from(customFields) |
| 636 | .where(and(... |
| 637 | .orderBy(asc(customFields |
| 638 | } |
| 639 | |
| 640 | /** |
| 641 | * Ensures a member has a usable rate before their entries are approved. |
| 642 | * Returns if a member rate already exists. Otherwise seeds a project-level |
| 643 | * rate from the org/project default rates. The pay rate is the required |
| 644 | * value: a null or 0 default pay rate is treated as "not configured" and |
| 645 | * throws. When the default billing rate is unset (null/0), the pay rate's |
| 646 | * value is used for billing too. |
| 647 | */ |
| 648 | const ensureMemberRate = async |
| 649 | memberId: string, |
| 650 | projectId: string, |
| 651 | asOf: string, |
| 652 | settings: Awaited |
| 653 | ): Promise<void |
| 654 | const existing = |
| 655 | if (existing) { |
| 656 | return |
| 657 | } |
| 658 | // Pay rate is required; treat 0 (and null) as "not configured". |
| 659 | if (!settings.payRate |
| 660 | throw new Error( |
| 661 | 'No member rate or default pay rate is configured. Please set a member rate or a default pay rate before approving.' |
| 662 | ) |
| 663 | } |
| 664 | // Fall back to the pay rate for billing when no billing rate is configured. |
| 665 | const billingConfigured = |
| 666 | // The existence check above guards the common case. Concurrent approvals |
| 667 | // could still both insert a same-day rate; readers tolerate duplicates by |
| 668 | // taking the latest effectiveFrom, so a plain insert is fine. |
| 669 | await db.insert |
| 670 | memberId, |
| 671 | projectId, |
| 672 | billingRate: billingConfigured ? |
| 673 | billingCurrency: billingConfigured |
| 674 | ? settings.billingCurrency |
| 675 | : settings.payCurrency, |
| 676 | billingFrequency: billingConfigured |
| 677 | ? settings.billingFrequency |
| 678 | : settings.payFrequency, |
| 679 | payRate: settings.payRate |
| 680 | payCurrency: settings.payCurrency |
| 681 | payFrequency: settings.payFrequency |
| 682 | effectiveFrom: asOf, |
| 683 | }) |
| 684 | } |
| 685 | |
| 686 | export const timesheetService = |
| 687 | getEntryForEdit, |
| 688 | ensureMemberRate, |
| 689 | getProjectCustomFields, |
| 690 | listByProject, |
| 691 | listByProjectIdsSince, |
| 692 | getById, |
| 693 | getWeeklyTimesheet, |
| 694 | getProjectBudgetStatus, |
| 695 | getMemberRate, |
| 696 | getBillableSummary, |
| 697 | getBillableEntriesForReport, |
| 698 | getMemberRates, |
| 699 | getProjectBudget, |
| 700 | listReportsByProject, |
| 701 | listReportsForClient, |
| 702 | getReportById, |
| 703 | getReportEntriesBatch, |
| 704 | getReportRecipientsBatch, |
| 705 | } |