Ignore:
Timestamp:
12/25/25 03:39:56 (7 months ago)
Author:
Tome <gjorgievtome@…>
Branches:
main
Children:
898cf68
Parents:
83fb5e2
Message:

implement forge features

File:
1 edited

Legend:

Unmodified
Added
Removed
  • database/drizzle/config/componentFieldConfig.ts

    r83fb5e2 re7f1bfa  
     1import {
     2    cablesTable, caseMoboFormFactorsTable, casePsFormFactorsTable,
     3    caseStorageFormFactorsTable, coolerCPUSocketsTable, coolersTable,
     4    CPUTable,
     5    GPUTable, memoryCardsTable,
     6    memoryTable, motherboardsTable,
     7    networkAdaptersTable,
     8    networkCardsTable, opticalDrivesTable, pcCasesTable, powerSupplyTable,
     9    soundCardsTable, storageTable
     10} from "../schema";
     11
     12export type ComponentConfig<SelectType = any, InsertType = any> = {
     13    table: any;
     14    multiTables?: {
     15        storageFormFactors?: typeof caseStorageFormFactorsTable;
     16        psFormFactors?: typeof casePsFormFactorsTable;
     17        moboFormFactors?: typeof caseMoboFormFactorsTable;
     18        cpuSockets?: typeof coolerCPUSocketsTable;
     19    }
     20};
     21
    122export type ComponentType =
    223    | 'cpu'
     
    1435    | 'network_adapter'
    1536    | 'network_card';
     37
     38export const typeConfigMap: Record<ComponentType, ComponentConfig> = {
     39    cpu: { table: CPUTable },
     40    gpu: { table: GPUTable },
     41    memory: { table: memoryTable },
     42    storage: { table: storageTable },
     43    power_supply: { table: powerSupplyTable },
     44    motherboard: { table: motherboardsTable },
     45    case: {
     46        table: pcCasesTable,
     47        multiTables: {
     48            storageFormFactors: caseStorageFormFactorsTable,
     49            psFormFactors: casePsFormFactorsTable,
     50            moboFormFactors: caseMoboFormFactorsTable,
     51        },
     52    },
     53    cooler: {
     54        table: coolersTable,
     55        multiTables: {
     56            cpuSockets: coolerCPUSocketsTable,
     57        },
     58    },
     59    memory_card: { table: memoryCardsTable },
     60    optical_drive: { table: opticalDrivesTable },
     61    sound_card: { table: soundCardsTable },
     62    cables: { table: cablesTable },
     63    network_adapter: { table: networkAdaptersTable },
     64    network_card: { table: networkCardsTable },
     65};
    1666
    1767export const requiredFields: Record<ComponentType, string[]> = {
Note: See TracChangeset for help on using the changeset viewer.