( workspaceId: string, userId: string, date: Date, )
| 30 | * The date is normalized to midnight UTC so uniqueness works correctly. |
| 31 | */ |
| 32 | export async function findOrCreateDailyPage( |
| 33 | workspaceId: string, |
| 34 | userId: string, |
| 35 | date: Date, |
| 36 | ): Promise<Page> { |
| 37 | const normalized = new Date(date); |
| 38 | normalized.setUTCHours(0, 0, 0, 0); |
| 39 | |
| 40 | return prisma.page.upsert({ |
| 41 | where: { |
| 42 | workspaceId_userId_date: { |
| 43 | workspaceId, |
| 44 | userId, |
| 45 | date: normalized, |
| 46 | }, |
| 47 | }, |
| 48 | create: { |
| 49 | workspaceId, |
| 50 | userId, |
| 51 | date: normalized, |
| 52 | }, |
| 53 | update: {}, |
| 54 | }); |
| 55 | } |
| 56 | |
| 57 | export async function findOrCreateTaskPage( |
| 58 | workspaceId: string, |
no test coverage detected