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:
@@ -40,7 +40,7 @@ async function insertPublicSetup(
|
||||
) {
|
||||
const [row] = await db
|
||||
.insert(setups)
|
||||
.values({ name, userId, isPublic: true })
|
||||
.values({ name, userId, visibility: "public" })
|
||||
.returning();
|
||||
return row;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ describe("Discovery Routes", () => {
|
||||
// Insert a private setup
|
||||
await db
|
||||
.insert(setups)
|
||||
.values({ name: "Private Setup", userId, isPublic: false });
|
||||
.values({ name: "Private Setup", userId, visibility: "private" });
|
||||
|
||||
const res = await app.request("/api/discovery/setups");
|
||||
expect(res.status).toBe(200);
|
||||
|
||||
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user