diff --git a/server/src/routes/admin-meta.ts b/server/src/routes/admin-meta.ts index 2eff91d..1011154 100644 --- a/server/src/routes/admin-meta.ts +++ b/server/src/routes/admin-meta.ts @@ -306,7 +306,6 @@ export async function adminMetaRoutes(app: FastifyInstance) { dryRun: body.dryRun, publish: body.publish, url: body.url, - defaultCad: true, }); if (!started) { diff --git a/server/src/services/artstation-import.ts b/server/src/services/artstation-import.ts index 802594e..4c11d07 100644 --- a/server/src/services/artstation-import.ts +++ b/server/src/services/artstation-import.ts @@ -44,8 +44,6 @@ export interface ImportOptions { dryRun?: boolean; /** Publish new imports instead of leaving as draft */ publish?: boolean; - /** Assign CAD when no category matched */ - defaultCad?: boolean; onLog?: (line: string) => void; } @@ -238,9 +236,25 @@ async function importProject( const tags = detail.tags || []; let categoryIds = await resolveCategoryIds([...mediums, ...cats]); - if (categoryIds.length === 0 && opts.defaultCad !== false) { - const cad = await prisma.category.findUnique({ where: { slug: "cad" } }); - if (cad) categoryIds = [cad.id]; + // Infer from software / description when ArtStation has no useful medium tags + if (categoryIds.length === 0) { + const hay = `${software.join(" ")} ${detail.title} ${detail.description || ""}`.toLowerCase(); + let slug: string | null = null; + if ( + hay.includes("nomad sculpt") || + hay.includes("zbrush") || + (detail.title.toLowerCase().includes("mogwai") && hay.includes("sculpt")) + ) { + slug = "3d-sculpting"; + } else if (hay.includes("blender") || hay.includes("maya") || hay.includes("3d model")) { + slug = "3d-modeling"; + } else if (hay.includes("solidworks") || hay.includes("fusion 360") || /\bcad\b/.test(hay)) { + slug = "cad"; + } + if (slug) { + const cat = await prisma.category.findUnique({ where: { slug } }); + if (cat) categoryIds = [cat.id]; + } } log(