feat: add collaborative shopping lists with items and invitations
Some checks failed
CI / Verify (push) Has been cancelled

API: lists, items and invitations modules (list, create, get, update,
set-primary, items create/list, invitation create/accept/list-pending),
BetterAuth session helper, list membership, mailer and Prisma schema plus
migrations.

Web: lists overview, list detail (items) and list management (settings)
views, item and invitation forms/hooks, sign-up and invitation accept pages.

Shared: shopping list DTOs.

Tooling: ignore the generated TanStack Router cache (apps/web/.tanstack).
This commit is contained in:
Jose Selesan
2026-10-16 10:12:11 -03:00
parent 964a3c7217
commit 6aa86a3b68
81 changed files with 3476 additions and 269 deletions

View File

@@ -0,0 +1,15 @@
import { Hono } from 'hono'
import { requireSession } from '@/lib/auth-session'
import { prisma } from '@/lib/prisma'
import { resultJson } from '@/lib/result-json'
import type { AppEnv } from '@/types'
import { ListShoppingLists } from './use-case'
/** GET /lists — every list the signed-in user belongs to. */
export const listListsRoute = new Hono<AppEnv>().get('/', requireSession, async (c) => {
const result = await new ListShoppingLists(prisma).execute({ userId: c.get('user').id })
return resultJson(c, result)
})

View File

@@ -0,0 +1,28 @@
import { Ok, type ProblemDetails, type Result, type ShoppingListSummary } from '@superlist/shared'
import type { Database } from '@/lib/prisma'
/** Lists every shopping list the user belongs to (owned or shared). */
export class ListShoppingLists {
constructor(private readonly db: Database) {}
async execute(input: { userId: string }): Promise<Result<ShoppingListSummary[], ProblemDetails>> {
const memberships = await this.db.shoppingListMember.findMany({
where: { userId: input.userId },
include: { list: { include: { _count: { select: { members: true } } } } },
orderBy: [{ isPrimary: 'desc' }, { list: { createdAt: 'desc' } }],
})
const lists = memberships.map((membership) => ({
id: membership.list.id,
name: membership.list.name,
role: membership.role,
isPrimary: membership.isPrimary,
memberCount: membership.list._count.members,
createdAt: membership.list.createdAt.toISOString(),
updatedAt: membership.list.updatedAt.toISOString(),
}))
return Ok(lists)
}
}