Milestone v1.0: FamilySync MVP #1

Merged
luckberg merged 376 commits from gsd/v1.0-milestone into main 2026-06-10 17:39:19 -04:00
Showing only changes of commit 5499f83782 - Show all commits
+7 -1
View File
@@ -256,11 +256,17 @@ eventsRouter.post('/create', zValidator('json', eventFieldsSchema), async (c) =>
}
targetCalendarUrl = calRow.url
} else {
// Default to first personal calendar (D-01)
// Default to the member's first personal calendar (D-01).
// WR-02: add a deterministic ORDER BY + LIMIT. Without them, a member with
// multiple personal calendars gets an arbitrary, query-to-query-unstable "first"
// row. Ordering by id (insertion order) gives a stable default; limit(1) avoids
// fetching the whole set just to take [0].
const [calRow] = await db
.select({ url: calendars.url })
.from(calendars)
.where(eq(calendars.userId, currentUserId))
.orderBy(calendars.id)
.limit(1)
if (!calRow) {
return c.json({ error: 'No writable calendar found for user' }, 422)