feat(imports): job claims carry IMVU's rating
Pull request / title (pull_request) Successful in 2s
CI / test (pull_request) Successful in 1m31s
CI / image (apps/api/Dockerfile, t5de-hub-api) (pull_request) Skipped
CI / image (apps/web/Dockerfile, t5de-hub-web) (pull_request) Skipped

The importer writes it into index.xml as ProductRating, so the files agree with the revision's rating.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-11-08 05:52:43 -08:00
1 parent 26cc8aec84
commit 56f9e29573
4 files changed
+14 -4

No files matched your search

+9
View File
@@ -821,11 +821,20 @@ export class Imports {
.where(inArray(product.imvuProduct, jobs.map((j) => j.imvuProduct)))
.groupBy(product.imvuProduct)
: [];
// IMVU's rating, as the hub knows it: the importer writes it into index.xml (IMVU's files have no ProductRating),
// so the files agree with the revision's rating (the higher of the two).
const infos = jobs.length
? await this.db
.select({ id: imvuProductInfo.id, rating: imvuProductInfo.rating })
.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,
}));
}
+1 -1
View File
@@ -166,7 +166,7 @@ test("grants, requests, the importer's jobs, and withdrawal", async () => {
// The importer claims the job, gets a token for the revision it found, and uploads; the catalog registers it.
const claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 5 }, importer)).json.jobs;
expect(claimed).toEqual([{ id: expect.any(String), kind: "import", imvuProduct: 9001, lastRevision: 0 }]);
expect(claimed).toEqual([{ id: expect.any(String), kind: "import", imvuProduct: 9001, lastRevision: 0, rating: "general" }]);
const tok = await call(undefined, "POST", `/api/v1/importer/jobs/${claimed[0].id}/token`, { imvuRevision: 3 }, importer);
expect(tok.json.url).toBe("https://imports.example.test/api/v1/uploads");
const files = [file("index.xml", 11), file("dress.xmf", 12)];