| 383 | } |
| 384 | |
| 385 | function getTableSchema(table: Table): Record<string, string> { |
| 386 | const schemas: Record<Table, Record<string, string>> = { |
| 387 | customers: { |
| 388 | id: 'number', |
| 389 | name: 'string', |
| 390 | email: 'string', |
| 391 | city: 'string', |
| 392 | joined: 'string (date)', |
| 393 | }, |
| 394 | products: { |
| 395 | id: 'number', |
| 396 | name: 'string', |
| 397 | category: 'string', |
| 398 | price: 'number', |
| 399 | stock: 'number', |
| 400 | }, |
| 401 | purchases: { |
| 402 | id: 'number', |
| 403 | customer_id: 'number', |
| 404 | product_id: 'number', |
| 405 | quantity: 'number', |
| 406 | total: 'number', |
| 407 | purchased_at: 'string (date)', |
| 408 | }, |
| 409 | } |
| 410 | return schemas[table] |
| 411 | } |
| 412 | |
| 413 | function evaluateCondition( |
| 414 | row: Record<string, unknown>, |