Ignore:
Timestamp:
01/28/26 12:12:43 (5 months ago)
Author:
Tome <gjorgievtome@…>
Branches:
main
Children:
a744c90
Parents:
ad211d1
Message:

Fix missing attribute in buildComponents relation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • database/drizzle/queries/builds.ts

    rad211d1 re03e6fb  
    200200            .select({
    201201                componentId: buildComponentsTable.componentId,
    202                 component: componentsTable
     202                component: componentsTable,
     203                quantity: buildComponentsTable.numComponents
    203204            })
    204205            .from(buildComponentsTable)
     
    292293        return {
    293294            ...buildDetails,
    294             components: components.map(c => c.component),
     295            components: components.map(c => ({
     296                    ...c.component,
     297                    quantity: c.quantity
     298            })),
    295299            reviews: reviews.map(r => ({
    296300                username: r.username,
     
    419423
    420424        const existing = await tx
    421             .select({ componentId: buildComponentsTable.componentId })
     425            .select({
     426                componentId: buildComponentsTable.componentId,
     427                numComponents: buildComponentsTable.numComponents
     428            })
    422429            .from(buildComponentsTable)
    423430            .where(eq(buildComponentsTable.buildId, buildId));
     
    428435                    buildId: newBuild.id,
    429436                    componentId: r.componentId,
     437                    numComponents: r.numComponents
    430438                })),
    431439            );
     
    545553        const components = await tx
    546554            .select({
    547                 componentId: buildComponentsTable.componentId
     555                componentId: buildComponentsTable.componentId,
     556                quantity: buildComponentsTable.numComponents
    548557            })
    549558            .from(buildComponentsTable)
     
    554563        return {
    555564            build,
    556             componentIds: components.map(c => c.componentId)
     565            components: components.map(c => ({
     566                id: c.componentId,
     567                quantity: c.quantity
     568            }))
    557569        };
    558570    });
Note: See TracChangeset for help on using the changeset viewer.