diff --git a/apps/api/src/app.ts b/apps/api/src/app.ts index 8be8194..d4e346e 100644 --- a/apps/api/src/app.ts +++ b/apps/api/src/app.ts @@ -406,17 +406,27 @@ export function createApp({ // A whole shop: when the hub last listed its products on IMVU (null: not yet), and how many IMVU listed. shopListedAt: r.grant.shopListedAt?.toISOString() ?? null, shopListed: r.grant.shopListed, + shopListedSignedIn: r.grant.shopListedSignedIn, status: r.grant.status as "pending" | "active" | "declined" | "suspended" | "withdrawn", statusReason: r.grant.statusReason, createdAt: r.grant.createdAt.toISOString(), decidedAt: r.grant.decidedAt?.toISOString() ?? null, }); + /** A product as an importer's IMVU account sees it. */ + const seenProduct = t.Object({ + id: t.Integer({ minimum: 1 }), + name: t.String({ maxLength: 200 }), + rating: t.Union([t.Literal("general"), t.Literal("adult")]), + creatorId: t.Integer({ minimum: 1 }), + creatorName: t.String({ maxLength: 64 }), + purchasable: t.Boolean(), + }); const jobView = (j: typeof schema.importJob.$inferSelect) => ({ id: j.id, grant: j.grantId, imvuProduct: j.imvuProduct, - kind: j.kind as "import" | "recheck", + kind: j.kind as "import" | "recheck" | "list", status: j.status as "queued" | "claimed" | "done" | "failed", imvuRevision: j.imvuRevision, reason: j.reason, @@ -1943,6 +1953,45 @@ export function createApp({ }, { body: t.Object({ imvuRevision: t.Integer({ minimum: 1 }) }) }, ) + .post( + "/importer/jobs/:id/listing", + async ({ request, params, body }) => { + const c = await imports.importerFor(request.headers.get("authorization")); + if (!c) throw new Problem(401, "forbidden", "Not an importer of an approved catalog with imports on."); + return productCall(() => imports.reportListing(c, params.id, body.products)); + }, + { body: t.Object({ products: t.Array(seenProduct, { maxItems: 10000 }) }) }, + ) + .post( + "/importer/jobs/:id/info", + async ({ request, params, body }) => { + const c = await imports.importerFor(request.headers.get("authorization")); + if (!c) throw new Problem(401, "forbidden", "Not an importer of an approved catalog with imports on."); + return productCall(() => + imvuSafe(() => + imports.reportInfo(c, params.id, { + id: 0, + found: body.found, + name: body.name ?? "", + rating: body.rating ?? "general", + creatorId: body.creatorId ?? 0, + creatorName: body.creatorName ?? "", + purchasable: body.purchasable ?? true, + }), + ), + ); + }, + { + body: t.Object({ + found: t.Boolean(), + name: t.Optional(t.String({ maxLength: 200 })), + rating: t.Optional(t.Union([t.Literal("general"), t.Literal("adult")])), + creatorId: t.Optional(t.Integer({ minimum: 1 })), + creatorName: t.Optional(t.String({ maxLength: 64 })), + purchasable: t.Optional(t.Boolean()), + }), + }, + ) .post( "/importer/jobs/:id", async ({ request, params, body }) => { @@ -1986,6 +2035,8 @@ export function createApp({ const c = await imports.importerFor(request.headers.get("authorization")); if (!c) throw new Problem(401, "forbidden", "Not an importer of an approved catalog with imports on."); const a = await productCall(() => importers.report(c, params.id, body)); + // An account signed in with Access Pass: list the catalog's whole shops with it (Access Pass products too). + if (body.state === "ok" && body.accessPass) await imports.queueListings(c.id); return { account: importerAccountView(a) }; }, { diff --git a/apps/api/src/imports.ts b/apps/api/src/imports.ts index d70a439..1a9fc83 100644 --- a/apps/api/src/imports.ts +++ b/apps/api/src/imports.ts @@ -7,8 +7,22 @@ import { ImvuUnavailable, NoSuchImvuUser, type ImvuClient, type ImvuUser } from import type { Signer } from "./keys"; import { BlockedUpload, checkFiles, newProductID, ProductError, type Catalog } from "./products"; -const { catalog, catalogChange, fileBlock, hosting, imvuLink, imvuProductInfo, importGrant, importJob, importRequest, library, product, productRevision, user } = - schema; +const { + catalog, + catalogChange, + fileBlock, + hosting, + imvuLink, + imvuProductInfo, + importerAccount, + importGrant, + importJob, + importRequest, + library, + product, + productRevision, + user, +} = schema; export type Grant = typeof importGrant.$inferSelect; export type Job = typeof importJob.$inferSelect; @@ -59,6 +73,23 @@ const imvuNameOf = sql`coalesce(${imvuLink.username}, (select u.d export const unclaimedUsername = (imvuId: number) => `imvu_${imvuId}`; /** Whether a grant covers an IMVU product (by its IMVU creator): active, the creator's, and in its scope. */ +/** A product as an importer's IMVU account sees it (docs/imports.md, "Access Pass products"). */ +export type SeenProduct = { id: number; name: string; rating: string; creatorId: number; creatorName: string; purchasable: boolean }; + +/** Checks what an importer says it saw: null if it isn't a product. */ +function checkSeen(p: SeenProduct): SeenProduct | null { + if (!Number.isSafeInteger(p.id) || p.id <= 0 || !Number.isSafeInteger(p.creatorId) || p.creatorId <= 0) return null; + if (p.rating !== "general" && p.rating !== "adult") return null; + return { + id: p.id, + name: String(p.name ?? "").trim().slice(0, 200), + rating: p.rating, + creatorId: p.creatorId, + creatorName: String(p.creatorName ?? "").trim().slice(0, 64), + purchasable: p.purchasable !== false, + }; +} + export function covers(g: Grant, imvuProduct: number, creatorId: number): boolean { if (g.status !== "active" || creatorId !== g.imvuId) return false; return g.scope === "shop" ? !g.exclude.includes(imvuProduct) : g.products.includes(imvuProduct); @@ -545,17 +576,24 @@ export class Imports { listed = []; // the account is gone from IMVU: nothing to list (rechecks withdraw what was imported) } const now = new Date(); - for (let i = 0; i < listed.length; i += 500) { - const rows = listed.slice(i, i + 500).map((p) => ({ - id: p.id, - found: true, - name: p.name, - creatorId: p.creatorId, - creatorName: p.creatorName, - rating: p.adult ? "adult" : "general", - purchasable: p.purchasable, - checkedAt: now, - })); + await this.keepSeen( + listed.map((p) => ({ id: p.id, name: p.name, rating: p.adult ? "adult" : "general", creatorId: p.creatorId, creatorName: p.creatorName, purchasable: p.purchasable })), + now, + ); + const [updated] = await this.db + .update(importGrant) + .set({ shopListedAt: now, shopListed: listed.length, shopListedSignedIn: false }) + .where(eq(importGrant.id, g.id)) + .returning(); + const queued = updated?.status === "active" && updated.scope === "shop" ? await this.queueCovered(updated) : 0; + if (updated) await this.queueListing(updated); + return { listed: listed.length, queued }; + } + + /** Keeps products' info as seen (by the hub's listing, or an importer's account), in batches. */ + private async keepSeen(seen: SeenProduct[], now: Date) { + for (let i = 0; i < seen.length; i += 500) { + const rows = seen.slice(i, i + 500).map((p) => ({ ...p, found: true, checkedAt: now })); await this.db .insert(imvuProductInfo) .values(rows) @@ -572,13 +610,97 @@ export class Imports { }, }); } + } + + /** + * Queues a signed-in listing of a whole-shop grant's shop for its catalog's importer, if one of the importer's IMVU + * accounts signed in with Access Pass: IMVU lists Access Pass products only to them. + */ + async queueListing(g: Grant): Promise { + if (g.status !== "active" || g.scope !== "shop") return false; + const [ap] = await this.db + .select({ id: importerAccount.id }) + .from(importerAccount) + .where(and(eq(importerAccount.catalogId, g.catalogId), eq(importerAccount.state, "ok"), eq(importerAccount.accessPass, true))) + .limit(1); + if (!ap) return false; + const [j] = await this.db + .insert(importJob) + .values({ id: newProductID(), catalogId: g.catalogId, grantId: g.id, imvuProduct: g.imvuId, kind: "list" }) + .onConflictDoNothing() + .returning(); + return j !== undefined; + } + + /** + * The importer lists a whole shop signed in (a "list" job): the products it saw are kept (only the grant's IMVU + * account's: an importer can't vouch for another creator's), and those not imported yet are queued. + */ + async reportListing(c: Catalog, jobId: string, products: SeenProduct[]): Promise<{ listed: number; queued: number }> { + const job = await this.claimedJob(c, jobId); + if (job.kind !== "list") throw new ProductError(409, "not_list", "That job isn't a shop listing."); + const g = await this.grant(job.grantId); + const seen = new Map(); + for (const p of products) { + const ok = checkSeen(p); + if (ok && ok.creatorId === g.imvuId) seen.set(ok.id, ok); + } + const now = new Date(); + await this.keepSeen([...seen.values()], now); + await this.db.update(importJob).set({ status: "done", reason: "", claimedAt: null }).where(eq(importJob.id, job.id)); const [updated] = await this.db .update(importGrant) - .set({ shopListedAt: now, shopListed: listed.length }) - .where(eq(importGrant.id, g.id)) + .set({ shopListedAt: now, shopListed: seen.size, shopListedSignedIn: true }) + .where(and(eq(importGrant.id, g.id), eq(importGrant.status, "active"), eq(importGrant.scope, "shop"))) .returning(); - const queued = updated?.status === "active" && updated.scope === "shop" ? await this.queueCovered(updated) : 0; - return { listed: listed.length, queued }; + const queued = updated ? await this.queueCovered(updated) : 0; + return { listed: seen.size, queued }; + } + + /** + * The importer says what its IMVU account sees of a claimed job's product, which IMVU hides from the hub (Access + * Pass products): kept, so the job can go on. What IMVU shows the hub publicly wins. + */ + async reportInfo(c: Catalog, jobId: string, seen: SeenProduct & { found: boolean }): Promise<{ rating: string | null; covered: boolean }> { + const job = await this.claimedJob(c, jobId); + if (job.kind === "list") throw new ProductError(409, "not_product", "That job is a shop listing."); + const g = await this.grant(job.grantId); + const answer = this.imvu ? await this.imvu.lookup(job.imvuProduct) : "hidden"; + let info: ImvuInfo | undefined; + if (typeof answer !== "string") info = await this.info(job.imvuProduct, true); + else if (!seen.found) { + // Gone, as the importer's account sees it too: rechecks withdraw it. + const now = new Date(); + await this.db + .insert(imvuProductInfo) + .values({ id: job.imvuProduct, found: false, checkedAt: now }) + .onConflictDoUpdate({ target: imvuProductInfo.id, set: { found: false, checkedAt: now } }); + } else { + const ok = checkSeen({ ...seen, id: job.imvuProduct }); + if (!ok) throw new ProductError(400, "invalid", "That isn't a product's info."); + await this.keepSeen([ok], new Date()); + [info] = await this.db.select().from(imvuProductInfo).where(eq(imvuProductInfo.id, job.imvuProduct)); + } + return { rating: info?.rating ?? null, covered: !!info && covers(g, job.imvuProduct, info.creatorId) }; + } + + /** Queues signed-in listings of a catalog's whole-shop grants (once its importer has an Access Pass account). */ + async queueListings(catalogId: string): Promise { + const grants = await this.db + .select() + .from(importGrant) + .where(and(eq(importGrant.catalogId, catalogId), eq(importGrant.status, "active"), eq(importGrant.scope, "shop"))); + let n = 0; + for (const g of grants) if (await this.queueListing(g)) n++; + return n; + } + + /** A job of this catalog's that its importer has claimed. */ + private async claimedJob(c: Catalog, jobId: string): Promise { + const [job] = await this.db.select().from(importJob).where(and(eq(importJob.id, jobId), eq(importJob.catalogId, c.id))); + if (!job) throw new ProductError(404, "not_found", "No such job."); + if (job.status !== "claimed") throw new ProductError(409, "not_claimed", "That job isn't claimed."); + return job; } /** Lists the whole-shop grants not listed in a day, never-listed ones first. */ @@ -829,13 +951,17 @@ export class Imports { .from(imvuProductInfo) .where(and(inArray(imvuProductInfo.id, jobs.map((j) => j.imvuProduct)), eq(imvuProductInfo.found, true))) : []; - return jobs.map((j) => ({ - id: j.id, - kind: j.kind, - imvuProduct: j.imvuProduct, - lastRevision: last.find((l) => l.imvuProduct === j.imvuProduct)?.imvuRevision ?? 0, - rating: infos.find((i) => i.id === j.imvuProduct)?.rating ?? null, - })); + return jobs.map((j) => + j.kind === "list" + ? { id: j.id, kind: j.kind, imvuProduct: 0, imvuCreator: j.imvuProduct, lastRevision: 0, rating: null } + : { + id: j.id, + kind: j.kind, + imvuProduct: j.imvuProduct, + lastRevision: last.find((l) => l.imvuProduct === j.imvuProduct)?.imvuRevision ?? 0, + rating: infos.find((i) => i.id === j.imvuProduct)?.rating ?? null, + }, + ); } /** A claimed job of this catalog's, whose grant still covers its product. */ @@ -843,6 +969,7 @@ export class Imports { const [job] = await this.db.select().from(importJob).where(and(eq(importJob.id, jobId), eq(importJob.catalogId, c.id))); if (!job) throw new ProductError(404, "not_found", "No such job."); if (job.status !== "claimed") throw new ProductError(409, "not_claimed", "That job isn't claimed."); + if (job.kind === "list") throw new ProductError(409, "not_product", "That job is a shop listing."); const g = await this.grant(job.grantId); const info = await this.info(job.imvuProduct); if (!info || !covers(g, job.imvuProduct, info.creatorId)) throw new ProductError(409, "not_covered", "The grant no longer covers this product."); diff --git a/apps/api/test/imports.test.ts b/apps/api/test/imports.test.ts index fea7a69..e9ca2c8 100644 --- a/apps/api/test/imports.test.ts +++ b/apps/api/test/imports.test.ts @@ -500,3 +500,87 @@ test("whole shops listed on IMVU, and what's available", async () => { await call(owner, "POST", `/api/v1/imports/grants/${g2.json.grant.id}/accept`); expect((await call(owner, "POST", `/api/v1/imports/grants/${g2.json.grant.id}/list`)).json.error).toBe("not_shop"); }); + +test("Access Pass products, through the importer's signed-in account", async () => { + const owner = await person("apstall"); + const keeper = await person("apkeeper", 903); + const chooser = await person("apchooser", 904); + const reg = await call(owner, "POST", "/api/v1/catalogs", { name: "AP Shelf", url: "https://ap.example.test", contact: "t@example.test", visibility: "public", membership: "open" }); + const catalogID = reg.json.catalog.id as string; + const catalogAuth = { Authorization: `Catalog ${catalogID}:${reg.json.key}` }; + expect((await call(rootAdmin, "POST", `/api/v1/console/catalogs/${catalogID}/approve`)).status).toBe(200); + const on = await call(owner, "POST", `/api/v1/catalogs/${catalogID}/importer`, { enabled: true }); + const importer = { Authorization: `Importer ${catalogID}:${on.json.key}` }; + const version = (await call(undefined, "GET", "/api/v1/imports/catalogs")).json.consent.version; + imvuProducts.set(9501, { ...imvuProduct("AP Keeper Coat", 903), creator_name: "apkeeperAv" }); + shops.set("apkeeperav", [9501]); // what IMVU lists signed out: the general-rated one + for (const id of [9502, 9503, 9504, 9505]) hiddenProducts.add(id); // Access Pass (or gone): 401 to the hub + + // Without an Access Pass account, the hub lists the shop itself; no signed-in listing. + const made = await call(keeper, "POST", "/api/v1/imports/grants", { catalog: catalogID, imvuId: 903, scope: "shop", consentVersion: version }); + const grantID = made.json.grant.id as string; + await call(owner, "POST", `/api/v1/imports/grants/${grantID}/accept`); + await imports.listingsDone(); + let claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 10 }, importer)).json.jobs; + expect(claimed).toEqual([{ id: expect.any(String), kind: "import", imvuProduct: 9501, lastRevision: 0, rating: "general" }]); + await call(undefined, "POST", `/api/v1/importer/jobs/${claimed[0].id}`, { status: "failed", reason: "later" }, importer); + + // The importer signs in with an account that has Access Pass: the catalog's whole shops are listed with it. + const [acct] = await db + .insert(schema.importerAccount) + .values({ id: "apacct0001", catalogId: catalogID, imvuId: 777, username: "ImporterAP", position: 0, state: "received" }) + .returning(); + const signedIn = await call(undefined, "POST", `/api/v1/importer/accounts/${acct!.id}`, { state: "ok", accessPass: true }, importer); + expect(signedIn.json.account).toMatchObject({ state: "ok", accessPass: true }); + claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 10 }, importer)).json.jobs; + expect(claimed).toEqual([{ id: expect.any(String), kind: "list", imvuProduct: 0, imvuCreator: 903, lastRevision: 0, rating: null }]); + const list = claimed[0].id as string; + expect((await call(undefined, "POST", `/api/v1/importer/jobs/${list}/token`, { imvuRevision: 1 }, importer)).json.error).toBe("not_product"); + const seen = (id: number, name: string, rating: string, creatorId = 903) => ({ id, name, rating, creatorId, creatorName: "apkeeperAv", purchasable: true }); + const listed = await call( + undefined, + "POST", + `/api/v1/importer/jobs/${list}/listing`, + { products: [seen(9501, "AP Keeper Coat", "general"), seen(9502, "AP Keeper Robe", "adult"), seen(9503, "Someone Else's", "adult", 999)] }, + importer, + ); + expect(listed.json).toEqual({ listed: 2, queued: 1 }); // another creator's product isn't taken from it + expect(await imports.info(9502)).toMatchObject({ found: true, name: "AP Keeper Robe", rating: "adult", creatorId: 903 }); + expect(await imports.info(9503)).toBeUndefined(); + const grant = (await call(owner, "GET", `/api/v1/catalogs/${catalogID}/importer`)).json.grants[0]; + expect(grant).toMatchObject({ shopListed: 2, shopListedSignedIn: true }); + expect((await call(undefined, "POST", `/api/v1/importer/jobs/${list}/listing`, { products: [] }, importer)).json.error).toBe("not_claimed"); + + // The Access Pass product imports as adult; the hub's daily recheck keeps it though IMVU hides it from the hub. + claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 10 }, importer)).json.jobs; + const robe = claimed.find((j: any) => j.imvuProduct === 9502); + expect(robe).toMatchObject({ kind: "import", rating: "adult" }); + const tok = await call(undefined, "POST", `/api/v1/importer/jobs/${robe.id}/token`, { imvuRevision: 2 }, importer); + const r = await call(undefined, "POST", "/api/v1/catalog/revisions", { importToken: tok.json.token, files: [file("index.xml", 9502)], rating: "adult", parent: 0, name: "x" }, catalogAuth); + expect(r.status).toBe(201); + await db.update(schema.importJob).set({ updatedAt: new Date(Date.now() - 2 * 86_400_000) }).where(eq(schema.importJob.imvuProduct, 9502)); + const rechecked = await imports.recheck(); + expect(rechecked.withdrawn).not.toContain(r.json.product); + + // Products chosen by ID that IMVU hides from the hub: the importer says what its account sees, then imports. + const g2 = await call(chooser, "POST", "/api/v1/imports/grants", { catalog: catalogID, imvuId: 904, scope: "products", products: [9504, 9505], consentVersion: version }); + await call(owner, "POST", `/api/v1/imports/grants/${g2.json.grant.id}/accept`); + claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 10 }, importer)).json.jobs; + const hidden = claimed.filter((j: any) => j.imvuProduct === 9504 || j.imvuProduct === 9505); + expect(hidden.map((j: any) => j.rating)).toEqual([null, null]); + const j4 = hidden.find((j: any) => j.imvuProduct === 9504); + const j5 = hidden.find((j: any) => j.imvuProduct === 9505); + expect((await call(undefined, "POST", `/api/v1/importer/jobs/${j4.id}/token`, { imvuRevision: 1 }, importer)).json.error).toBe("not_covered"); + const info = await call(undefined, "POST", `/api/v1/importer/jobs/${j4.id}/info`, { found: true, name: "Chosen Veil", rating: "adult", creatorId: 904, creatorName: "chooserAv", purchasable: true }, importer); + expect(info.json).toEqual({ rating: "adult", covered: true }); + expect((await call(undefined, "POST", `/api/v1/importer/jobs/${j4.id}/token`, { imvuRevision: 1 }, importer)).status).toBe(200); + // Another creator's, as the account sees it: not covered. + const other = await call(undefined, "POST", `/api/v1/importer/jobs/${j5.id}/info`, { found: true, name: "Not Theirs", rating: "general", creatorId: 999, creatorName: "x", purchasable: true }, importer); + expect(other.json).toEqual({ rating: "general", covered: false }); + // What IMVU shows the hub publicly wins over the importer's word. + hiddenProducts.delete(9505); + imvuProducts.set(9505, { ...imvuProduct("Public Now", 904), creator_name: "chooserAv" }); + const pub = await call(undefined, "POST", `/api/v1/importer/jobs/${j5.id}/info`, { found: false }, importer); + expect(pub.json).toEqual({ rating: "general", covered: true }); + expect(await imports.info(9505)).toMatchObject({ name: "Public Now", creatorId: 904 }); +}); diff --git a/apps/web/app/console/catalogs/[id]/imports/importer-account-form.tsx b/apps/web/app/console/catalogs/[id]/imports/importer-account-form.tsx index abaa5a3..77f50f4 100644 --- a/apps/web/app/console/catalogs/[id]/imports/importer-account-form.tsx +++ b/apps/web/app/console/catalogs/[id]/imports/importer-account-form.tsx @@ -157,7 +157,7 @@ export function ImporterAccountForm({

{found.username}

IMVU ID {found.imvuId}

- {found.accessPass ? Access Pass : No Access Pass} + {found.accessPass ? Access Pass : Access Pass not shown} {found.ageVerified ? Age verified : Not age verified}
@@ -165,8 +165,8 @@ export function ImporterAccountForm({ )} {found && !found.accessPass && (

- Without Access Pass, the importer can't see AP products, so it can't import them with this - account. + IMVU shows Access Pass publicly only if the member chooses to; the importer checks when it signs in. + Without Access Pass, it can't import Access Pass products with this account.

)}

diff --git a/apps/web/app/console/catalogs/[id]/imports/page.tsx b/apps/web/app/console/catalogs/[id]/imports/page.tsx index 378fefe..cb37fd4 100644 --- a/apps/web/app/console/catalogs/[id]/imports/page.tsx +++ b/apps/web/app/console/catalogs/[id]/imports/page.tsx @@ -45,6 +45,7 @@ const accountState = { needs_password: { tone: "danger", label: "needs its password" }, } as const; const imvuPage = (id: number) => `https://www.imvu.com/shop/product.php?products_id=${id}`; +const imvuShop = (creator: number) => `https://www.imvu.com/shop/web_search.php?manufacturers_id=${creator}`; export default async function CatalogImports({ params, @@ -178,7 +179,11 @@ export default async function CatalogImports({ {a.username} (IMVU {a.imvuId}) {st.label} - {a.accessPass ? Access Pass : No Access Pass} + {a.accessPass ? ( + Access Pass + ) : ( + {a.state === "ok" ? "No Access Pass" : "Access Pass not checked"} + )} {a.stateMessage && {a.stateMessage}} {can.run && ( @@ -372,17 +377,28 @@ export default async function CatalogImports({ {data.jobs.map((j) => ( - - {j.name || j.imvuProduct} - + {j.kind === "list" ? ( + + IMVU shop {j.imvuProduct} + + ) : ( + + {j.name || j.imvuProduct} + + )} - {j.kind} + {j.kind === "list" ? "listing, signed in" : j.kind} {j.imvuRevision ? ` · revision ${j.imvuRevision}` : ""} diff --git a/apps/web/components/shop-listing.tsx b/apps/web/components/shop-listing.tsx index 11f03b0..b658a9f 100644 --- a/apps/web/components/shop-listing.tsx +++ b/apps/web/components/shop-listing.tsx @@ -4,16 +4,22 @@ import { DateTime } from "@/components/time"; export function ShopListing({ grant: g, }: { - grant: { scope: string; status: string; shopListedAt: string | null; shopListed: number }; + grant: { + scope: string; + status: string; + shopListedAt: string | null; + shopListed: number; + shopListedSignedIn: boolean; + }; }) { if (g.scope !== "shop" || g.status !== "active") return null; if (!g.shopListedAt) return <> Not checked on IMVU yet.; return ( <> {" "} - On IMVU: {g.shopListed} general-rated product{g.shopListed === 1 ? "" : "s"} (checked{" "} - - ). + On IMVU: {g.shopListed} {g.shopListedSignedIn ? "" : "general-rated "}product{g.shopListed === 1 ? "" : "s"}{" "} + (checked + {g.shopListedSignedIn ? " by the importer, with Access Pass" : ""}). ); } diff --git a/docs/imports.md b/docs/imports.md index 6d9c5f2..e45d4ab 100644 --- a/docs/imports.md +++ b/docs/imports.md @@ -105,7 +105,7 @@ import_request(person, imvu_creator, imvu_product (0: the whole shop), created_a ## Import jobs ``` -import_job(id, catalog, grant, imvu_product, kind ("import" | "recheck"), status ("queued" | "claimed" | "done" | "failed"), +import_job(id, catalog, grant, imvu_product, kind ("import" | "recheck" | "list"), status ("queued" | "claimed" | "done" | "failed"), imvu_revision, reason, attempts, claimed_at, next_at, created_at, updated_at) ``` @@ -188,9 +188,35 @@ passwords never reach the hub readable, and are kept only by the importer. (`catalog.importer_hello`). - Built (2026-11-07): all of the above on the hub and the console, except the importer's report of AP products' info (with the importer). -- What the importer sees with an account (creator, name, rating of AP products) it reports to the hub with the job - (`POST /api/v1/importer/jobs/:id {product: {creatorId, name, rating}}`), trusted from that catalog's importer - only, for products IMVU hides from the hub. +- What the importer sees with an account it reports to the hub ("Access Pass products" below), trusted from that + catalog's importer only, for products IMVU hides from the hub. +- IMVU shows an account's Access Pass publicly only if its member chooses to (verified 2026-11-08: an AP account's + public profile said `is_ap: false`, its own signed-in view `true`). So the console's lookup shows "Access Pass not + shown", and the importer reports the real answer when it signs in (`accessPass` with state `ok`). + +### Access Pass products + +Signed out, IMVU hides Access Pass products: the product API answers 401 (as for deleted products and made-up IDs) +and shop listings leave them out (2026-11-08: NellLuna's shop lists 639 products signed out, 763 signed in with +Access Pass; `product_rating=AP` lists the 124 others). The CDN serves their files to anyone. So the hub learns +about them from the importer's account: + +- **Signed-in shop listings**: when a whole-shop grant's shop is listed (accepted, daily, "List the shop again"), and + the catalog's importer has an account that signed in with Access Pass (state `ok`, `accessPass`), the hub also + queues a `list` job (one open per shop and catalog; also queued for every whole shop when such an account first + reports in). The importer lists the shop signed in and reports every product it saw (`POST + /api/v1/importer/jobs/:id/listing`); the hub keeps those of the grant's IMVU account (an importer can't vouch for + another creator's products), records the count (`shopListedSignedIn`: "with Access Pass"), and queues those not + imported yet. The job is then done. +- **Single products** (a grant's chosen products, or a request the hub couldn't place): a claimed job whose + `rating` is null is one IMVU hides from the hub. The importer looks it up signed in and reports what it saw (`POST + /api/v1/importer/jobs/:id/info`); the hub keeps it (unless IMVU now shows the product publicly: that wins), and + answers `{rating, covered}`. Not covered (another creator's): the importer fails the job with that reason. + `found: false` (gone for the account too) is kept, so the daily recheck withdraws an imported product. +- **Rechecks** keep what was last seen for a product IMVU hides (401), so imported Access Pass products aren't + withdrawn for being hidden. Not built: noticing that a hidden product was deleted, except when a job's lookup says + so. +- Built (2026-11-08) on the hub; the importer's side is t5de-importer's. ## Hub routes @@ -204,6 +230,8 @@ passwords never reach the hub readable, and are kept only by the importer. | `DELETE /api/v1/imports/grants/:id` | (its creator, or `import:withdraw` at the catalog) `{reason?}` → `{grant, withdrawn}` | | `POST /api/v1/imports/grants/:id/list` | (its creator, or `import:run` at the catalog) → `{grant, listed, queued}`: an active whole-shop grant's shop listed on IMVU now. 409 `not_shop`; 429 after 3 an hour. | | `GET /api/v1/imports/available?products=&creators=` | (anyone) up to 100 IMVU product IDs and 100 IMVU account IDs, comma-separated → `{products: [{imvuProduct, status, product, requested?}], shops: [{imvuCreator, shop, products}]}`. `status`: `imported` (`product` is the hub product), `adult` (imported, but the person can't see adult products), `queued`, `covered` (a grant covers it: asking queues it) or `none` (asking counts it). `requested` (signed in): they asked for it. `shop`: an active whole-shop grant; `products`: how many of the shop's are on T5DE. From what the hub knows only (it asks IMVU nothing), for the proxy's "Get on T5DE". | +| `POST /api/v1/importer/jobs/:id/listing` | (the catalog's importer) a claimed `list` job: `{products: [{id, name, rating, creatorId, creatorName, purchasable}]}` (up to 10,000) → `{listed, queued}`: the grant's IMVU account's products are kept and queued; the job is done ("Access Pass products") | +| `POST /api/v1/importer/jobs/:id/info` | (the catalog's importer) a claimed import or recheck job: `{found, name?, rating?, creatorId?, creatorName?, purchasable?}`, as its IMVU account sees the product → `{rating, covered}` | | `POST /api/v1/imports/requests` | `{imvuProduct}` or `{imvuCreator}` → `{status: "added" \| "queued" \| "suggested" \| "counted", product?}` (`added`: imported already, now in their library). At most 50 a day. | | `GET /api/v1/imports/requests?imvuCreator=` | `{requests: [{imvuProduct (0: the whole shop), name, requests}]}` for a linked account of theirs (moderators: any); without `imvuCreator`, moderators get `{creators}`: the most asked-for IMVU creators | | `GET /api/v1/catalogs/:id/importer` | (`import:accept` or `import:pause`) `{importer, grants, jobs, counts, permissions}`; `?status=` filters jobs | diff --git a/docs/products.md b/docs/products.md index 138e76a..a2f915b 100644 --- a/docs/products.md +++ b/docs/products.md @@ -82,8 +82,10 @@ catalog's). Only approved catalogs with imports on and not paused. | | | | --- | --- | -| `POST /api/v1/importer/jobs/claim` | `{limit}` (1-20) → `{jobs: [{id, kind, imvuProduct, lastRevision, rating}]}`; `rating` is IMVU's (`general`, `adult`, or null when the hub couldn't see it), for the importer to write into `index.xml` as `ProductRating` (GA, AP); claimed jobs not reported within 30 minutes go back to the queue | -| `POST /api/v1/importer/jobs/:id/token` | `{imvuRevision}` → `{token, url}`: a `t5de-import` token and the catalog's upload URL | +| `POST /api/v1/importer/jobs/claim` | `{limit}` (1-20) → `{jobs: [{id, kind, imvuProduct, lastRevision, rating}]}`; `kind` is `import`, `recheck` or `list`; `rating` is IMVU's (`general`, `adult`, or null when IMVU hides the product from the hub: the importer reports what its account sees first, `/info` below), for the importer to write into `index.xml` as `ProductRating` (GA, AP). A `list` job (a whole shop, signed in) has `imvuCreator` (the shop's IMVU account) and `imvuProduct` 0. Claimed jobs not reported within 30 minutes go back to the queue | +| `POST /api/v1/importer/jobs/:id/token` | `{imvuRevision}` → `{token, url}`: a `t5de-import` token and the catalog's upload URL (not for `list` jobs: 409 `not_product`) | +| `POST /api/v1/importer/jobs/:id/listing` | a `list` job's products, as the importer's IMVU account lists the shop: `{products: [{id, name, rating, creatorId, creatorName, purchasable}]}` → `{listed, queued}` (imports.md, "Access Pass products") | +| `POST /api/v1/importer/jobs/:id/info` | an import or recheck job's product, as the importer's IMVU account sees it: `{found, name?, rating?, creatorId?, creatorName?, purchasable?}` → `{rating, covered}` | | `POST /api/v1/importer/jobs/:id` | `{status: "done" \| "failed" \| "unchanged", imvuRevision?, reason?}` | | `POST /api/v1/importer/hello` | `{version, publicKey}` (base64 SPKI, RSA 3072 to 4096 bits) → the config, as below. Sent at start. A new key means passwords sealed for the old one can't be read: the catalog's accounts then need their passwords again (imports.md "IMVU accounts"). | | `GET /api/v1/importer/config` | `{paused, settings: {rate, concurrency}, fingerprint, accounts: [{id, imvuId, username, sealed}]}`, accounts in the order to try them. `sealed` (or null): `{imvuId, password}` as JSON, RSA-OAEP (SHA-256) for the importer's key, base64; check `imvuId`. Polled every minute; accounts no longer listed are forgotten. | diff --git a/packages/db/drizzle/0020_importer_signed_in.sql b/packages/db/drizzle/0020_importer_signed_in.sql new file mode 100644 index 0000000..629b77b --- /dev/null +++ b/packages/db/drizzle/0020_importer_signed_in.sql @@ -0,0 +1,4 @@ +DROP INDEX "import_job_open";--> statement-breakpoint +ALTER TABLE "import_grant" ADD COLUMN "shop_listed_signed_in" boolean DEFAULT false NOT NULL;--> statement-breakpoint +CREATE UNIQUE INDEX "import_job_list_open" ON "import_job" USING btree ("catalog_id","imvu_product") WHERE "import_job"."status" in ('queued', 'claimed') and "import_job"."kind" = 'list';--> statement-breakpoint +CREATE UNIQUE INDEX "import_job_open" ON "import_job" USING btree ("catalog_id","imvu_product") WHERE "import_job"."status" in ('queued', 'claimed') and "import_job"."kind" <> 'list'; \ No newline at end of file diff --git a/packages/db/drizzle/meta/0020_snapshot.json b/packages/db/drizzle/meta/0020_snapshot.json new file mode 100644 index 0000000..0a25bd6 --- /dev/null +++ b/packages/db/drizzle/meta/0020_snapshot.json @@ -0,0 +1,4485 @@ +{ + "id": "4a56b2c3-b2e0-465c-a40d-087706e99882", + "prevId": "1dee2886-5a68-48e9-83ac-6f78fcef4be7", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "account_user": { + "name": "account_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.age_check": { + "name": "age_check", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "imvu_id": { + "name": "imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "method": { + "name": "method", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "over_eighteen": { + "name": "over_eighteen", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "provider_ref": { + "name": "provider_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "checked_at": { + "name": "checked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "age_check_user": { + "name": "age_check_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "age_check_imvu": { + "name": "age_check_imvu", + "columns": [ + { + "expression": "imvu_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "age_check_provider_ref": { + "name": "age_check_provider_ref", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "provider_ref", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "age_check_user_id_user_id_fk": { + "name": "age_check_user_id_user_id_fk", + "tableFrom": "age_check", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_token": { + "name": "api_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "grants": { + "name": "grants", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "api_token_hash": { + "name": "api_token_hash", + "columns": [ + { + "expression": "hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "api_token_user": { + "name": "api_token_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_token_user_id_user_id_fk": { + "name": "api_token_user_id_user_id_fk", + "tableFrom": "api_token", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.audit": { + "name": "audit", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "at": { + "name": "at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target": { + "name": "target", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "detail": { + "name": "detail", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + } + }, + "indexes": { + "audit_at": { + "name": "audit_at", + "columns": [ + { + "expression": "at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_tags": { + "name": "audit_tags", + "columns": [ + { + "expression": "tags", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "audit_actor_id_user_id_fk": { + "name": "audit_actor_id_user_id_fk", + "tableFrom": "audit", + "tableTo": "user", + "columnsFrom": [ + "actor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.case_note": { + "name": "case_note", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "case_id": { + "name": "case_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "by_id": { + "name": "by_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "internal": { + "name": "internal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "case_note_case": { + "name": "case_note_case", + "columns": [ + { + "expression": "case_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "case_note_case_id_moderation_case_id_fk": { + "name": "case_note_case_id_moderation_case_id_fk", + "tableFrom": "case_note", + "tableTo": "moderation_case", + "columnsFrom": [ + "case_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "case_note_by_id_user_id_fk": { + "name": "case_note_by_id_user_id_fk", + "tableFrom": "case_note", + "tableTo": "user", + "columnsFrom": [ + "by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.catalog": { + "name": "catalog", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "contact": { + "name": "contact", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "membership": { + "name": "membership", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "status_reason": { + "name": "status_reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "max_rating": { + "name": "max_rating", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'adult'" + }, + "uploads": { + "name": "uploads", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'anyone'" + }, + "mirrors": { + "name": "mirrors", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'approve'" + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "importer": { + "name": "importer", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'off'" + }, + "importer_key_hash": { + "name": "importer_key_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importer_public_key": { + "name": "importer_public_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importer_fingerprint": { + "name": "importer_fingerprint", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "importer_version": { + "name": "importer_version", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "importer_seen_at": { + "name": "importer_seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "importer_settings": { + "name": "importer_settings", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"rate\":2,\"concurrency\":2}'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "catalog_url": { + "name": "catalog_url", + "columns": [ + { + "expression": "url", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "catalog_owner_id_user_id_fk": { + "name": "catalog_owner_id_user_id_fk", + "tableFrom": "catalog", + "tableTo": "user", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.catalog_change": { + "name": "catalog_change", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "catalog_id": { + "name": "catalog_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "catalog_change_catalog": { + "name": "catalog_change_catalog", + "columns": [ + { + "expression": "catalog_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "catalog_change_catalog_id_catalog_id_fk": { + "name": "catalog_change_catalog_id_catalog_id_fk", + "tableFrom": "catalog_change", + "tableTo": "catalog", + "columnsFrom": [ + "catalog_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.catalog_invite": { + "name": "catalog_invite", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "catalog_id": { + "name": "catalog_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_uses": { + "name": "max_uses", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uses": { + "name": "uses", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "catalog_invite_catalog": { + "name": "catalog_invite_catalog", + "columns": [ + { + "expression": "catalog_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "catalog_invite_catalog_id_catalog_id_fk": { + "name": "catalog_invite_catalog_id_catalog_id_fk", + "tableFrom": "catalog_invite", + "tableTo": "catalog", + "columnsFrom": [ + "catalog_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "catalog_invite_created_by_user_id_fk": { + "name": "catalog_invite_created_by_user_id_fk", + "tableFrom": "catalog_invite", + "tableTo": "user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.catalog_member": { + "name": "catalog_member", + "schema": "", + "columns": { + "catalog_id": { + "name": "catalog_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invite": { + "name": "invite", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "decided_by": { + "name": "decided_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "catalog_member_user": { + "name": "catalog_member_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "catalog_member_catalog_id_catalog_id_fk": { + "name": "catalog_member_catalog_id_catalog_id_fk", + "tableFrom": "catalog_member", + "tableTo": "catalog", + "columnsFrom": [ + "catalog_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "catalog_member_user_id_user_id_fk": { + "name": "catalog_member_user_id_user_id_fk", + "tableFrom": "catalog_member", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "catalog_member_decided_by_user_id_fk": { + "name": "catalog_member_decided_by_user_id_fk", + "tableFrom": "catalog_member", + "tableTo": "user", + "columnsFrom": [ + "decided_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "catalog_member_catalog_id_user_id_pk": { + "name": "catalog_member_catalog_id_user_id_pk", + "columns": [ + "catalog_id", + "user_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.device_code": { + "name": "device_code", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "device_code": { + "name": "device_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_code": { + "name": "user_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_polled_at": { + "name": "last_polled_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "polling_interval": { + "name": "polling_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "device_code_user_id_user_id_fk": { + "name": "device_code_user_id_user_id_fk", + "tableFrom": "device_code", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.file_block": { + "name": "file_block", + "schema": "", + "columns": { + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "by_id": { + "name": "by_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "file_block_by_id_user_id_fk": { + "name": "file_block_by_id_user_id_fk", + "tableFrom": "file_block", + "tableTo": "user", + "columnsFrom": [ + "by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hosted_room": { + "name": "hosted_room", + "schema": "", + "columns": { + "n": { + "name": "n", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "owner_imvu_id": { + "name": "owner_imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "room_pid": { + "name": "room_pid", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "rating": { + "name": "rating", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'general'" + }, + "max_users": { + "name": "max_users", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 10 + }, + "scene": { + "name": "scene", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "scene_hash": { + "name": "scene_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "closed": { + "name": "closed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "privacy": { + "name": "privacy", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "moderators": { + "name": "moderators", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "image_hash": { + "name": "image_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "hosted_room_owner": { + "name": "hosted_room_owner", + "columns": [ + { + "expression": "owner_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "hosted_room_created": { + "name": "hosted_room_created", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "hosted_room_owner_id_user_id_fk": { + "name": "hosted_room_owner_id_user_id_fk", + "tableFrom": "hosted_room", + "tableTo": "user", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hosted_room_ban": { + "name": "hosted_room_ban", + "schema": "", + "columns": { + "n": { + "name": "n", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "imvu_id": { + "name": "imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "by_imvu_id": { + "name": "by_imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "until": { + "name": "until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "hosted_room_ban_n_hosted_room_n_fk": { + "name": "hosted_room_ban_n_hosted_room_n_fk", + "tableFrom": "hosted_room_ban", + "tableTo": "hosted_room", + "columnsFrom": [ + "n" + ], + "columnsTo": [ + "n" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "hosted_room_ban_n_imvu_id_pk": { + "name": "hosted_room_ban_n_imvu_id_pk", + "columns": [ + "n", + "imvu_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hosted_room_favorite": { + "name": "hosted_room_favorite", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "n": { + "name": "n", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "hosted_room_favorite_user_id_user_id_fk": { + "name": "hosted_room_favorite_user_id_user_id_fk", + "tableFrom": "hosted_room_favorite", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "hosted_room_favorite_n_hosted_room_n_fk": { + "name": "hosted_room_favorite_n_hosted_room_n_fk", + "tableFrom": "hosted_room_favorite", + "tableTo": "hosted_room", + "columnsFrom": [ + "n" + ], + "columnsTo": [ + "n" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "hosted_room_favorite_user_id_n_pk": { + "name": "hosted_room_favorite_user_id_n_pk", + "columns": [ + "user_id", + "n" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hosted_room_image": { + "name": "hosted_room_image", + "schema": "", + "columns": { + "n": { + "name": "n", + "type": "integer", + "primaryKey": true, + "notNull": true + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "bytea", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "hosted_room_image_n_hosted_room_n_fk": { + "name": "hosted_room_image_n_hosted_room_n_fk", + "tableFrom": "hosted_room_image", + "tableTo": "hosted_room", + "columnsFrom": [ + "n" + ], + "columnsTo": [ + "n" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hosted_room_rating": { + "name": "hosted_room_rating", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "n": { + "name": "n", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "score": { + "name": "score", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "hosted_room_rating_room": { + "name": "hosted_room_rating_room", + "columns": [ + { + "expression": "n", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "hosted_room_rating_user_id_user_id_fk": { + "name": "hosted_room_rating_user_id_user_id_fk", + "tableFrom": "hosted_room_rating", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "hosted_room_rating_n_hosted_room_n_fk": { + "name": "hosted_room_rating_n_hosted_room_n_fk", + "tableFrom": "hosted_room_rating", + "tableTo": "hosted_room", + "columnsFrom": [ + "n" + ], + "columnsTo": [ + "n" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "hosted_room_rating_user_id_n_pk": { + "name": "hosted_room_rating_user_id_n_pk", + "columns": [ + "user_id", + "n" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hosted_room_visit": { + "name": "hosted_room_visit", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "n": { + "name": "n", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "imvu_id": { + "name": "imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "at": { + "name": "at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "hosted_room_visit_at": { + "name": "hosted_room_visit_at", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "hosted_room_visit_user_id_user_id_fk": { + "name": "hosted_room_visit_user_id_user_id_fk", + "tableFrom": "hosted_room_visit", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "hosted_room_visit_n_hosted_room_n_fk": { + "name": "hosted_room_visit_n_hosted_room_n_fk", + "tableFrom": "hosted_room_visit", + "tableTo": "hosted_room", + "columnsFrom": [ + "n" + ], + "columnsTo": [ + "n" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "hosted_room_visit_user_id_n_pk": { + "name": "hosted_room_visit_user_id_n_pk", + "columns": [ + "user_id", + "n" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hosting": { + "name": "hosting", + "schema": "", + "columns": { + "catalog_id": { + "name": "catalog_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "product_id": { + "name": "product_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "hosting_product": { + "name": "hosting_product", + "columns": [ + { + "expression": "product_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "hosting_catalog_id_catalog_id_fk": { + "name": "hosting_catalog_id_catalog_id_fk", + "tableFrom": "hosting", + "tableTo": "catalog", + "columnsFrom": [ + "catalog_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "hosting_catalog_id_product_id_number_pk": { + "name": "hosting_catalog_id_product_id_number_pk", + "columns": [ + "catalog_id", + "product_id", + "number" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hub_setting": { + "name": "hub_setting", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.import_grant": { + "name": "import_grant", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "catalog_id": { + "name": "catalog_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "creator_id": { + "name": "creator_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "imvu_id": { + "name": "imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "products": { + "name": "products", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "exclude": { + "name": "exclude", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "listed": { + "name": "listed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "consent_version": { + "name": "consent_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "consented_at": { + "name": "consented_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "consent_kind": { + "name": "consent_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'verified'" + }, + "evidence": { + "name": "evidence", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "recorded_by": { + "name": "recorded_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "proof_code": { + "name": "proof_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "proof_checked_at": { + "name": "proof_checked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "shop_listed_at": { + "name": "shop_listed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "shop_listed": { + "name": "shop_listed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "shop_listed_signed_in": { + "name": "shop_listed_signed_in", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "status_reason": { + "name": "status_reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "decided_at": { + "name": "decided_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "decided_by": { + "name": "decided_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "import_grant_catalog": { + "name": "import_grant_catalog", + "columns": [ + { + "expression": "catalog_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "import_grant_imvu": { + "name": "import_grant_imvu", + "columns": [ + { + "expression": "imvu_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "import_grant_catalog_id_catalog_id_fk": { + "name": "import_grant_catalog_id_catalog_id_fk", + "tableFrom": "import_grant", + "tableTo": "catalog", + "columnsFrom": [ + "catalog_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "import_grant_creator_id_user_id_fk": { + "name": "import_grant_creator_id_user_id_fk", + "tableFrom": "import_grant", + "tableTo": "user", + "columnsFrom": [ + "creator_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "import_grant_recorded_by_user_id_fk": { + "name": "import_grant_recorded_by_user_id_fk", + "tableFrom": "import_grant", + "tableTo": "user", + "columnsFrom": [ + "recorded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "import_grant_decided_by_user_id_fk": { + "name": "import_grant_decided_by_user_id_fk", + "tableFrom": "import_grant", + "tableTo": "user", + "columnsFrom": [ + "decided_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.import_job": { + "name": "import_job", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "catalog_id": { + "name": "catalog_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "grant_id": { + "name": "grant_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "imvu_product": { + "name": "imvu_product", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'queued'" + }, + "imvu_revision": { + "name": "imvu_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "claimed_at": { + "name": "claimed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "next_at": { + "name": "next_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "import_job_queue": { + "name": "import_job_queue", + "columns": [ + { + "expression": "catalog_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "next_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "import_job_open": { + "name": "import_job_open", + "columns": [ + { + "expression": "catalog_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "imvu_product", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"import_job\".\"status\" in ('queued', 'claimed') and \"import_job\".\"kind\" <> 'list'", + "concurrently": false, + "method": "btree", + "with": {} + }, + "import_job_list_open": { + "name": "import_job_list_open", + "columns": [ + { + "expression": "catalog_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "imvu_product", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"import_job\".\"status\" in ('queued', 'claimed') and \"import_job\".\"kind\" = 'list'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "import_job_catalog_id_catalog_id_fk": { + "name": "import_job_catalog_id_catalog_id_fk", + "tableFrom": "import_job", + "tableTo": "catalog", + "columnsFrom": [ + "catalog_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "import_job_grant_id_import_grant_id_fk": { + "name": "import_job_grant_id_import_grant_id_fk", + "tableFrom": "import_job", + "tableTo": "import_grant", + "columnsFrom": [ + "grant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.import_request": { + "name": "import_request", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "imvu_creator": { + "name": "imvu_creator", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "imvu_product": { + "name": "imvu_product", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "fulfilled_at": { + "name": "fulfilled_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "import_request_creator": { + "name": "import_request_creator", + "columns": [ + { + "expression": "imvu_creator", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "import_request_product": { + "name": "import_request_product", + "columns": [ + { + "expression": "imvu_product", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "import_request_user_id_user_id_fk": { + "name": "import_request_user_id_user_id_fk", + "tableFrom": "import_request", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "import_request_user_id_imvu_creator_imvu_product_pk": { + "name": "import_request_user_id_imvu_creator_imvu_product_pk", + "columns": [ + "user_id", + "imvu_creator", + "imvu_product" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.importer_account": { + "name": "importer_account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "catalog_id": { + "name": "catalog_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "imvu_id": { + "name": "imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "sealed": { + "name": "sealed", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sealed_for": { + "name": "sealed_for", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sealed_at": { + "name": "sealed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'waiting'" + }, + "state_message": { + "name": "state_message", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "state_at": { + "name": "state_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "access_pass": { + "name": "access_pass", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "age_verified": { + "name": "age_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "added_by": { + "name": "added_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "importer_account_imvu": { + "name": "importer_account_imvu", + "columns": [ + { + "expression": "catalog_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "imvu_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "importer_account_catalog_id_catalog_id_fk": { + "name": "importer_account_catalog_id_catalog_id_fk", + "tableFrom": "importer_account", + "tableTo": "catalog", + "columnsFrom": [ + "catalog_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "importer_account_added_by_user_id_fk": { + "name": "importer_account_added_by_user_id_fk", + "tableFrom": "importer_account", + "tableTo": "user", + "columnsFrom": [ + "added_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.imvu_link": { + "name": "imvu_link", + "schema": "", + "columns": { + "imvu_id": { + "name": "imvu_id", + "type": "bigint", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pairwise_id": { + "name": "pairwise_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "linked_at": { + "name": "linked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "show_badge": { + "name": "show_badge", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "show_presence": { + "name": "show_presence", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "list_rooms": { + "name": "list_rooms", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "imvu_link_user": { + "name": "imvu_link_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "imvu_link_user_id_user_id_fk": { + "name": "imvu_link_user_id_user_id_fk", + "tableFrom": "imvu_link", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "imvu_link_pairwise_id_unique": { + "name": "imvu_link_pairwise_id_unique", + "nullsNotDistinct": false, + "columns": [ + "pairwise_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.imvu_product_info": { + "name": "imvu_product_info", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true + }, + "found": { + "name": "found", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "creator_id": { + "name": "creator_id", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "creator_name": { + "name": "creator_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "rating": { + "name": "rating", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'general'" + }, + "purchasable": { + "name": "purchasable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "checked_at": { + "name": "checked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.jwks": { + "name": "jwks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "private_key": { + "name": "private_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "alg": { + "name": "alg", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "crv": { + "name": "crv", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.library": { + "name": "library", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "product_id": { + "name": "product_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "stay_on": { + "name": "stay_on", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "added_at": { + "name": "added_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "library_user_id_user_id_fk": { + "name": "library_user_id_user_id_fk", + "tableFrom": "library", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "library_product_id_product_id_fk": { + "name": "library_product_id_product_id_fk", + "tableFrom": "library", + "tableTo": "product", + "columnsFrom": [ + "product_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "library_user_id_product_id_pk": { + "name": "library_user_id_product_id_pk", + "columns": [ + "user_id", + "product_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.link_challenge": { + "name": "link_challenge", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "imvu_id": { + "name": "imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "link_challenge_user_id_user_id_fk": { + "name": "link_challenge_user_id_user_id_fk", + "tableFrom": "link_challenge", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "link_challenge_user_id_imvu_id_pk": { + "name": "link_challenge_user_id_imvu_id_pk", + "columns": [ + "user_id", + "imvu_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.moderation_case": { + "name": "moderation_case", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "opened_by": { + "name": "opened_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "assignee": { + "name": "assignee", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "resolution": { + "name": "resolution", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "decided_by": { + "name": "decided_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "decided_at": { + "name": "decided_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "moderation_case_status": { + "name": "moderation_case_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "moderation_case_opened_by": { + "name": "moderation_case_opened_by", + "columns": [ + { + "expression": "opened_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "moderation_case_tags": { + "name": "moderation_case_tags", + "columns": [ + { + "expression": "tags", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "moderation_case_opened_by_user_id_fk": { + "name": "moderation_case_opened_by_user_id_fk", + "tableFrom": "moderation_case", + "tableTo": "user", + "columnsFrom": [ + "opened_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "moderation_case_assignee_user_id_fk": { + "name": "moderation_case_assignee_user_id_fk", + "tableFrom": "moderation_case", + "tableTo": "user", + "columnsFrom": [ + "assignee" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "moderation_case_decided_by_user_id_fk": { + "name": "moderation_case_decided_by_user_id_fk", + "tableFrom": "moderation_case", + "tableTo": "user", + "columnsFrom": [ + "decided_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notification": { + "name": "notification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "read_at": { + "name": "read_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "notification_user": { + "name": "notification_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "notification_user_id_user_id_fk": { + "name": "notification_user_id_user_id_fk", + "tableFrom": "notification", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.product": { + "name": "product", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "creator_id": { + "name": "creator_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "rating": { + "name": "rating", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "latest": { + "name": "latest", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'published'" + }, + "published_at": { + "name": "published_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "listed": { + "name": "listed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "category": { + "name": "category", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "removed_at": { + "name": "removed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "removed_reason": { + "name": "removed_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "imvu_product": { + "name": "imvu_product", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "product_imvu_product": { + "name": "product_imvu_product", + "columns": [ + { + "expression": "imvu_product", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "product_creator": { + "name": "product_creator", + "columns": [ + { + "expression": "creator_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "product_created": { + "name": "product_created", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "product_tags": { + "name": "product_tags", + "columns": [ + { + "expression": "tags", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "product_creator_id_user_id_fk": { + "name": "product_creator_id_user_id_fk", + "tableFrom": "product", + "tableTo": "user", + "columnsFrom": [ + "creator_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.product_info_change": { + "name": "product_info_change", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "product_id": { + "name": "product_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "by_id": { + "name": "by_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "changes": { + "name": "changes", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "revert_of": { + "name": "revert_of", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "product_info_change_product": { + "name": "product_info_change_product", + "columns": [ + { + "expression": "product_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "product_info_change_product_id_product_id_fk": { + "name": "product_info_change_product_id_product_id_fk", + "tableFrom": "product_info_change", + "tableTo": "product", + "columnsFrom": [ + "product_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "product_info_change_by_id_user_id_fk": { + "name": "product_info_change_by_id_user_id_fk", + "tableFrom": "product_info_change", + "tableTo": "user", + "columnsFrom": [ + "by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.product_revision": { + "name": "product_revision", + "schema": "", + "columns": { + "product_id": { + "name": "product_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "files": { + "name": "files", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "rating": { + "name": "rating", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent": { + "name": "parent", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "parent_info": { + "name": "parent_info", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retracted": { + "name": "retracted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "imvu_revision": { + "name": "imvu_revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "product_revision_files": { + "name": "product_revision_files", + "columns": [ + { + "expression": "files", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "gin", + "with": {} + } + }, + "foreignKeys": { + "product_revision_product_id_product_id_fk": { + "name": "product_revision_product_id_product_id_fk", + "tableFrom": "product_revision", + "tableTo": "product", + "columnsFrom": [ + "product_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "product_revision_uploaded_by_user_id_fk": { + "name": "product_revision_uploaded_by_user_id_fk", + "tableFrom": "product_revision", + "tableTo": "user", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "product_revision_product_id_number_pk": { + "name": "product_revision_product_id_number_pk", + "columns": [ + "product_id", + "number" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_assignment": { + "name": "role_assignment", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_type": { + "name": "scope_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_id": { + "name": "scope_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "granted_by": { + "name": "granted_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "role_assignment_scope": { + "name": "role_assignment_scope", + "columns": [ + { + "expression": "scope_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "role_assignment_user_id_user_id_fk": { + "name": "role_assignment_user_id_user_id_fk", + "tableFrom": "role_assignment", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "role_assignment_granted_by_user_id_fk": { + "name": "role_assignment_granted_by_user_id_fk", + "tableFrom": "role_assignment", + "tableTo": "user", + "columnsFrom": [ + "granted_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "role_assignment_user_id_role_scope_type_scope_id_pk": { + "name": "role_assignment_user_id_role_scope_type_scope_id_pk", + "columns": [ + "user_id", + "role", + "scope_type", + "scope_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.room": { + "name": "room", + "schema": "", + "columns": { + "instance_id": { + "name": "instance_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "owner_imvu_id": { + "name": "owner_imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "privacy": { + "name": "privacy", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content_rating": { + "name": "content_rating", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "access_pass": { + "name": "access_pass", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "occupancy": { + "name": "occupancy", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "capacity": { + "name": "capacity", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "expired": { + "name": "expired", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "checked_at": { + "name": "checked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "seen_at": { + "name": "seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "room_owner": { + "name": "room_owner", + "columns": [ + { + "expression": "owner_imvu_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.room_decoration": { + "name": "room_decoration", + "schema": "", + "columns": { + "instance_id": { + "name": "instance_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "owner_imvu_id": { + "name": "owner_imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "contents": { + "name": "contents", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "room_decoration_owner": { + "name": "room_decoration_owner", + "columns": [ + { + "expression": "owner_imvu_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "session_user": { + "name": "session_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.signing_key": { + "name": "signing_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "public_key": { + "name": "public_key", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "private_key": { + "name": "private_key", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.two_factor": { + "name": "two_factor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "backup_codes": { + "name": "backup_codes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verified": { + "name": "verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "failed_verification_count": { + "name": "failed_verification_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "locked_until": { + "name": "locked_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "two_factor_user": { + "name": "two_factor_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "two_factor_secret": { + "name": "two_factor_secret", + "columns": [ + { + "expression": "secret", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "two_factor_user_id_user_id_fk": { + "name": "two_factor_user_id_user_id_fk", + "tableFrom": "two_factor", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_username": { + "name": "display_username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'user'" + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "link_cap": { + "name": "link_cap", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 10 + }, + "approved": { + "name": "approved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "two_factor_enabled": { + "name": "two_factor_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "unclaimed_imvu_id": { + "name": "unclaimed_imvu_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_username_lower": { + "name": "user_username_lower", + "columns": [ + { + "expression": "lower(\"username\")", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + }, + "user_username_unique": { + "name": "user_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + }, + "user_unclaimed_imvu_id_unique": { + "name": "user_unclaimed_imvu_id_unique", + "nullsNotDistinct": false, + "columns": [ + "unclaimed_imvu_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "verification_identifier": { + "name": "verification_identifier", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 2c50e36..cf9c665 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -141,6 +141,13 @@ "when": 1794092472616, "tag": "0019_shop_listing", "breakpoints": true + }, + { + "idx": 20, + "version": "7", + "when": 1794150630963, + "tag": "0020_importer_signed_in", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index de7db93..33720b6 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -757,6 +757,7 @@ export const importGrant = pgTable( // IMVU lists no Access Pass products to the signed out). shopListedAt: timestamp("shop_listed_at", { withTimezone: true }), shopListed: integer("shop_listed").notNull().default(0), + shopListedSignedIn: boolean("shop_listed_signed_in").notNull().default(false), // by the importer, signed in: AP products too // "pending" (the catalog's team hasn't accepted), "active", "declined", "suspended", "withdrawn". status: text("status").notNull().default("pending"), statusReason: text("status_reason").notNull().default(""), @@ -799,7 +800,7 @@ export const importJob = pgTable( .notNull() .references(() => importGrant.id, { onDelete: "cascade" }), imvuProduct: bigint("imvu_product", { mode: "number" }).notNull(), - kind: text("kind").notNull(), // "import", "recheck" + kind: text("kind").notNull(), // "import", "recheck", "list" (a whole shop, signed in: imvuProduct is the creator's IMVU ID) status: text("status").notNull().default("queued"), // "queued", "claimed", "done", "failed" imvuRevision: integer("imvu_revision"), // done: the revision imported (or found unchanged) reason: text("reason").notNull().default(""), // why it failed (last attempt) @@ -811,10 +812,13 @@ export const importJob = pgTable( }, (t) => [ index("import_job_queue").on(t.catalogId, t.status, t.nextAt), - // One open job per product and catalog. + // One open job per product and catalog, and one open listing per shop and catalog. uniqueIndex("import_job_open") .on(t.catalogId, t.imvuProduct) - .where(sql`${t.status} in ('queued', 'claimed')`), + .where(sql`${t.status} in ('queued', 'claimed') and ${t.kind} <> 'list'`), + uniqueIndex("import_job_list_open") + .on(t.catalogId, t.imvuProduct) + .where(sql`${t.status} in ('queued', 'claimed') and ${t.kind} = 'list'`), ], );