feat: migrate setup visibility from boolean to three-tier system

Replace isPublic boolean with visibility enum (private/link/public) across
the full stack. Add shares table to schema for future share link support.
Update all services, routes, schemas, hooks, components, and tests.

Plan: 32-01 (Setup Sharing System - Schema Migration)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 17:55:46 +02:00
parent 727abf1528
commit edc9793c2d
20 changed files with 1556 additions and 81 deletions

View File

@@ -111,8 +111,8 @@ describe("Profile Routes", () => {
it("includes only public setups", async () => {
// Create public and private setups
await db.insert(schema.setups).values([
{ name: "Public Setup", userId, isPublic: true },
{ name: "Private Setup", userId, isPublic: false },
{ name: "Public Setup", userId, visibility: "public" },
{ name: "Private Setup", userId, visibility: "private" },
]);
const res = await app.request(`/api/users/${userId}/profile`);
@@ -181,7 +181,7 @@ describe("Public Setup Routes", () => {
it("returns 200 for public setup without auth", async () => {
const [setup] = await db
.insert(schema.setups)
.values({ name: "My Public Setup", userId, isPublic: true })
.values({ name: "My Public Setup", userId, visibility: "public" })
.returning();
const res = await app.request(`/api/setups/${setup.id}/public`);
@@ -189,14 +189,14 @@ describe("Public Setup Routes", () => {
const body = await res.json();
expect(body.name).toBe("My Public Setup");
expect(body.isPublic).toBe(true);
expect(body.visibility).toBe("public");
expect(body.items).toBeDefined();
});
it("returns 200 for public setup with items", async () => {
const [setup] = await db
.insert(schema.setups)
.values({ name: "Loaded Setup", userId, isPublic: true })
.values({ name: "Loaded Setup", userId, visibility: "public" })
.returning();
const [cat] = await db
@@ -231,7 +231,7 @@ describe("Public Setup Routes", () => {
it("returns 404 for private setup", async () => {
const [setup] = await db
.insert(schema.setups)
.values({ name: "Private Setup", userId, isPublic: false })
.values({ name: "Private Setup", userId, visibility: "private" })
.returning();
const res = await app.request(`/api/setups/${setup.id}/public`);