Ignore:
Timestamp:
01/29/26 03:53:57 (5 months ago)
Author:
Tome <gjorgievtome@…>
Branches:
main
Children:
c586cbd, f727252
Parents:
be22289
Message:

Add stored functions and triggers

File:
1 edited

Legend:

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

    rbe22289 rb348db4  
    104104}
    105105
    106 export async function getDetailsForNewComponent(componentType: string) {
     106export async function getDetailsNewComponent(componentType: string) {
    107107    const config = typeConfigMap[componentType as ComponentType];
    108108
     
    10671067            );
    10681068
    1069         const totalPrice = buildComponents.reduce((sum, c) =>
    1070             sum + (Number(c.price) * c.quantity), 0
    1071         );
    1072 
    1073         await tx
    1074             .update(buildsTable)
    1075             .set({
    1076                 totalPrice: totalPrice.toFixed(2)
    1077             })
    1078             .where(
    1079                 eq(buildsTable.id, buildId)
    1080             );
     1069        // const totalPrice = buildComponents.reduce((sum, c) =>
     1070        //     sum + (Number(c.price) * c.quantity), 0
     1071        // );
     1072
     1073        // await tx
     1074        //     .update(buildsTable)
     1075        //     .set({
     1076        //         totalPrice: totalPrice.toFixed(2)
     1077        //     })
     1078        //     .where(
     1079        //         eq(buildsTable.id, buildId)
     1080        //     );
    10811081
    10821082        return buildId;
     
    11511151            );
    11521152
    1153         const totalPrice = buildComponents.reduce((sum, c) =>
    1154             sum + (Number(c.price) * c.quantity), 0
    1155         );
    1156 
    1157         await tx
    1158             .update(buildsTable)
    1159             .set({
    1160                 totalPrice: totalPrice.toFixed(2)
    1161             })
    1162             .where(
    1163                 eq(buildsTable.id, buildId)
    1164             );
     1153        // const totalPrice = buildComponents.reduce((sum, c) =>
     1154        //     sum + (Number(c.price) * c.quantity), 0
     1155        // );
     1156
     1157        // await tx
     1158        //     .update(buildsTable)
     1159        //     .set({
     1160        //         totalPrice: totalPrice.toFixed(2)
     1161        //     })
     1162        //     .where(
     1163        //         eq(buildsTable.id, buildId)
     1164        //     );
    11651165
    11661166        return componentId;
Note: See TracChangeset for help on using the changeset viewer.