refactor(sync): export designation-matching helpers for reuse

This commit is contained in:
lorentz 2026-07-18 10:10:10 +00:00
parent fb3fe67164
commit d8aaea33e6

View file

@ -5,7 +5,7 @@ import { isRelevantDueDate } from './task-due-date'
const DAY_MS = 24 * 60 * 60 * 1000
/** Designation IDs (primary + secondary) of a client, with nulls dropped. */
function designationIdsOf(entity: {
export function designationIdsOf(entity: {
designationId: string | null
designation2Id: string | null
}): string[] {
@ -16,7 +16,7 @@ function designationIdsOf(entity: {
* Prisma `OR` clause matching templates that apply to a client: templates with
* no designation, plus templates scoped to one of the client's designations.
*/
function designationFilter(ids: string[]) {
export function designationFilter(ids: string[]) {
return [
{ designationId: null },
...(ids.length > 0 ? [{ designationId: { in: ids } }] : []),