update nozzle stuff
This commit is contained in:
@@ -156,6 +156,17 @@ router.get('/', async (req, res, next) => {
|
||||
maxGpm: parseFloat(item.max_gpm) || null,
|
||||
maxPsi: parseFloat(item.max_psi) || null,
|
||||
powerSource: item.power_source,
|
||||
// Nozzle fields
|
||||
orificeSize: item.orifice_size,
|
||||
sprayAngle: item.spray_angle,
|
||||
flowRateGpm: parseFloat(item.flow_rate_gpm) || null,
|
||||
dropletSize: item.droplet_size,
|
||||
sprayPattern: item.spray_pattern,
|
||||
pressureRangePsi: item.pressure_range_psi,
|
||||
threadSize: item.thread_size,
|
||||
material: item.material,
|
||||
colorCode: item.color_code,
|
||||
quantityOwned: item.quantity_owned,
|
||||
// General fields
|
||||
purchaseDate: item.purchase_date,
|
||||
purchasePrice: parseFloat(item.purchase_price) || null,
|
||||
@@ -232,6 +243,17 @@ router.get('/:id', validateParams(idParamSchema), async (req, res, next) => {
|
||||
maxGpm: parseFloat(item.max_gpm) || null,
|
||||
maxPsi: parseFloat(item.max_psi) || null,
|
||||
powerSource: item.power_source,
|
||||
// Nozzle fields
|
||||
orificeSize: item.orifice_size,
|
||||
sprayAngle: item.spray_angle,
|
||||
flowRateGpm: parseFloat(item.flow_rate_gpm) || null,
|
||||
dropletSize: item.droplet_size,
|
||||
sprayPattern: item.spray_pattern,
|
||||
pressureRangePsi: item.pressure_range_psi,
|
||||
threadSize: item.thread_size,
|
||||
material: item.material,
|
||||
colorCode: item.color_code,
|
||||
quantityOwned: item.quantity_owned,
|
||||
// General fields
|
||||
purchaseDate: item.purchase_date,
|
||||
purchasePrice: parseFloat(item.purchase_price) || null,
|
||||
@@ -282,6 +304,17 @@ router.post('/', async (req, res, next) => {
|
||||
maxGpm,
|
||||
maxPsi,
|
||||
powerSource,
|
||||
// Nozzle specific fields
|
||||
orificeSize,
|
||||
sprayAngle,
|
||||
flowRateGpm,
|
||||
dropletSize,
|
||||
sprayPattern,
|
||||
pressureRangePsi,
|
||||
threadSize,
|
||||
material,
|
||||
colorCode,
|
||||
quantityOwned,
|
||||
// General fields
|
||||
purchaseDate,
|
||||
purchasePrice,
|
||||
@@ -331,8 +364,9 @@ router.post('/', async (req, res, next) => {
|
||||
mower_style, cutting_width_inches, engine_hp, fuel_type,
|
||||
tool_type, working_width_inches,
|
||||
pump_type, max_gpm, max_psi, power_source,
|
||||
orifice_size, spray_angle, flow_rate_gpm, droplet_size, spray_pattern, pressure_range_psi, thread_size, material, color_code, quantity_owned,
|
||||
purchase_date, purchase_price, notes)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38)
|
||||
RETURNING *`,
|
||||
[
|
||||
req.user.id, equipmentTypeId, finalCategoryId, customName, manufacturer, model,
|
||||
@@ -341,6 +375,7 @@ router.post('/', async (req, res, next) => {
|
||||
mowerStyle, cuttingWidthInches, engineHp, fuelType,
|
||||
toolType, workingWidthInches,
|
||||
pumpType, maxGpm, maxPsi, powerSource,
|
||||
orificeSize, sprayAngle, flowRateGpm, dropletSize, sprayPattern, pressureRangePsi, threadSize, material, colorCode, quantityOwned,
|
||||
purchaseDate, purchasePrice, notes
|
||||
]
|
||||
);
|
||||
@@ -422,6 +457,16 @@ router.put('/:id', validateParams(idParamSchema), async (req, res, next) => {
|
||||
maxGpm,
|
||||
maxPsi,
|
||||
powerSource,
|
||||
orificeSize,
|
||||
sprayAngle,
|
||||
flowRateGpm,
|
||||
dropletSize,
|
||||
sprayPattern,
|
||||
pressureRangePsi,
|
||||
threadSize,
|
||||
material,
|
||||
colorCode,
|
||||
quantityOwned,
|
||||
purchaseDate,
|
||||
purchasePrice,
|
||||
notes,
|
||||
@@ -446,9 +491,10 @@ router.put('/:id', validateParams(idParamSchema), async (req, res, next) => {
|
||||
mower_style = $15, cutting_width_inches = $16, engine_hp = $17, fuel_type = $18,
|
||||
tool_type = $19, working_width_inches = $20,
|
||||
pump_type = $21, max_gpm = $22, max_psi = $23, power_source = $24,
|
||||
purchase_date = $25, purchase_price = $26, notes = $27, is_active = $28,
|
||||
orifice_size = $25, spray_angle = $26, flow_rate_gpm = $27, droplet_size = $28, spray_pattern = $29, pressure_range_psi = $30, thread_size = $31, material = $32, color_code = $33, quantity_owned = $34,
|
||||
purchase_date = $35, purchase_price = $36, notes = $37, is_active = $38,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = $29
|
||||
WHERE id = $39
|
||||
RETURNING *`,
|
||||
[
|
||||
equipmentTypeId, categoryId, customName, manufacturer, model,
|
||||
@@ -457,6 +503,7 @@ router.put('/:id', validateParams(idParamSchema), async (req, res, next) => {
|
||||
mowerStyle, cuttingWidthInches, engineHp, fuelType,
|
||||
toolType, workingWidthInches,
|
||||
pumpType, maxGpm, maxPsi, powerSource,
|
||||
orificeSize, sprayAngle, flowRateGpm, dropletSize, sprayPattern, pressureRangePsi, threadSize, material, colorCode, quantityOwned,
|
||||
purchaseDate, purchasePrice, notes, isActive !== undefined ? isActive : true,
|
||||
equipmentId
|
||||
]
|
||||
@@ -494,6 +541,16 @@ router.put('/:id', validateParams(idParamSchema), async (req, res, next) => {
|
||||
maxGpm: parseFloat(equipment.max_gpm) || null,
|
||||
maxPsi: parseFloat(equipment.max_psi) || null,
|
||||
powerSource: equipment.power_source,
|
||||
orificeSize: equipment.orifice_size,
|
||||
sprayAngle: equipment.spray_angle,
|
||||
flowRateGpm: parseFloat(equipment.flow_rate_gpm) || null,
|
||||
dropletSize: equipment.droplet_size,
|
||||
sprayPattern: equipment.spray_pattern,
|
||||
pressureRangePsi: equipment.pressure_range_psi,
|
||||
threadSize: equipment.thread_size,
|
||||
material: equipment.material,
|
||||
colorCode: equipment.color_code,
|
||||
quantityOwned: equipment.quantity_owned,
|
||||
purchaseDate: equipment.purchase_date,
|
||||
purchasePrice: parseFloat(equipment.purchase_price) || null,
|
||||
notes: equipment.notes,
|
||||
|
||||
19
database/migrations/add_nozzle_fields_to_user_equipment.sql
Normal file
19
database/migrations/add_nozzle_fields_to_user_equipment.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Add nozzle-specific fields to user_equipment table
|
||||
-- This migration adds columns to capture nozzle specifications when equipment category is 'Nozzle'
|
||||
|
||||
ALTER TABLE user_equipment
|
||||
ADD COLUMN IF NOT EXISTS orifice_size VARCHAR(20),
|
||||
ADD COLUMN IF NOT EXISTS spray_angle INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS flow_rate_gpm DECIMAL(6, 3),
|
||||
ADD COLUMN IF NOT EXISTS droplet_size VARCHAR(50) CHECK (droplet_size IN ('fine', 'medium', 'coarse', 'very_coarse', 'extremely_coarse')),
|
||||
ADD COLUMN IF NOT EXISTS spray_pattern VARCHAR(50) CHECK (spray_pattern IN ('flat_fan', 'hollow_cone', 'full_cone', 'flooding')),
|
||||
ADD COLUMN IF NOT EXISTS pressure_range_psi VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS thread_size VARCHAR(20),
|
||||
ADD COLUMN IF NOT EXISTS material VARCHAR(50) CHECK (material IN ('polymer', 'stainless_steel', 'brass', 'ceramic')),
|
||||
ADD COLUMN IF NOT EXISTS color_code VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS quantity_owned INTEGER DEFAULT 1;
|
||||
|
||||
-- Create index for better performance when filtering nozzles
|
||||
CREATE INDEX IF NOT EXISTS idx_user_equipment_nozzle_specs ON user_equipment(orifice_size, droplet_size, spray_angle) WHERE orifice_size IS NOT NULL;
|
||||
|
||||
SELECT 'Nozzle fields added to user_equipment table successfully!' as migration_status;
|
||||
Reference in New Issue
Block a user