MCPcopy
hub / github.com/RedPlanetHQ/core / findOrCreateDailyPage

Function findOrCreateDailyPage

apps/webapp/app/services/page.server.ts:32–55  ·  view source on GitHub ↗
(
  workspaceId: string,
  userId: string,
  date: Date,
)

Source from the content-addressed store, hash-verified

30 * The date is normalized to midnight UTC so uniqueness works correctly.
31 */
32export 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
57export async function findOrCreateTaskPage(
58 workspaceId: string,

Callers 4

loaderFunction · 0.90
loaderFunction · 0.90
api.v1.page.tsxFile · 0.90
getTaskToolsFunction · 0.90

Calls 1

upsertMethod · 0.65

Tested by

no test coverage detected