Skip to content

Commit 6dcab80

Browse files
committed
chore: added wire gauge to properties
1 parent 17200d1 commit 6dcab80

18 files changed

Lines changed: 388 additions & 270 deletions

File tree

cmd/web/handlers:equipment.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,15 @@ func (app *application) postEquipmentItemProperties(w http.ResponseWriter, r *ht
351351
}
352352

353353
if err := app.services.equipment.UpdateProperties(ctx, equipment.UpdateEquipmentProperties{
354-
ID: itemID,
355-
WeightG: form.WeightGInt64(),
356-
WidthMM: form.WidthMMInt64(),
357-
HeightMM: form.HeightMMInt64(),
358-
DepthMM: form.DepthMMInt64(),
359-
VoltageV: form.VoltageVInt64(),
360-
PowerMW: form.PowerMW(),
361-
CurrentMA: form.CurrentMA(),
354+
ID: itemID,
355+
WeightG: form.WeightGInt64(),
356+
WidthMM: form.WidthMMInt64(),
357+
HeightMM: form.HeightMMInt64(),
358+
DepthMM: form.DepthMMInt64(),
359+
VoltageV: form.VoltageVInt64(),
360+
PowerMW: form.PowerMW(),
361+
CurrentMA: form.CurrentMA(),
362+
WireGaugeMM2X100: form.WireGaugeMM2X100Int64(),
362363
}); err != nil {
363364
return &httperr.Error{Error: err, Message: "Failed to update inventory item.", Code: http.StatusInternalServerError}
364365
}

cmd/web/handlers:equipment:export.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func (app *application) getEquipmentExport(w http.ResponseWriter, r *http.Reques
5757
exportOptInt(item.VoltageV),
5858
exportOptInt(item.CurrentMA),
5959
exportOptInt(item.PowerMW),
60+
exportOptInt(item.WireGaugeMM2X100),
6061
strconv.FormatInt(item.TotalStock, 10),
6162
})
6263
}

cmd/web/handlers:equipment:import.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ func (app *application) postEquipmentImportConfirm(w http.ResponseWriter, r *htt
125125
return nil
126126
}
127127

128-
const importTemplateCSV = "Name,Type,Usage,Category,Manufacturer,Location,Rental Price,Resale Price,Notes,Weight (g),Width (mm),Height (mm),Depth (mm),Voltage (V),Current (mA),Power (mW),Quantity\n" +
129-
"Shure SM58,Bulk,Rental,Audio,Shure,Main Warehouse,15.00,99.00,Cardioid dynamic vocal microphone,298,47,47,162,,,,7\n" +
130-
"Sony SRS-XB43,Serialized,Rental,Audio,Sony,Main Warehouse,25.00,180.00,Portable Bluetooth speaker with extra bass,900,220,220,95,5,2400,12000,4\n"
128+
const importTemplateCSV = "Name,Type,Usage,Category,Manufacturer,Location,Rental Price,Resale Price,Notes,Weight (g),Width (mm),Height (mm),Depth (mm),Voltage (V),Current (mA),Power (mW),Wire Gauge (mm² ×100),Quantity\n" +
129+
"Shure SM58,Bulk,Rental,Audio,Shure,Main Warehouse,15.00,99.00,Cardioid dynamic vocal microphone,298,47,47,162,,,,,7\n" +
130+
"Sony SRS-XB43,Serialized,Rental,Audio,Sony,Main Warehouse,25.00,180.00,Portable Bluetooth speaker with extra bass,900,220,220,95,5,2400,12000,,4\n"
131131

132132
// getEquipmentImportTemplate serves a ready-to-fill CSV template for download.
133133
func (app *application) getEquipmentImportTemplate(w http.ResponseWriter, _ *http.Request) *httperr.Error {
@@ -201,7 +201,8 @@ func readImportRows(cr *csv.Reader) ([]imports.RawRow, string) {
201201
VoltageV: strings.TrimSpace(record[13]),
202202
CurrentMa: strings.TrimSpace(record[14]),
203203
PowerMw: strings.TrimSpace(record[15]),
204-
Quantity: strings.TrimSpace(record[16]),
204+
WireGaugeMM2X100: strings.TrimSpace(record[16]),
205+
Quantity: strings.TrimSpace(record[17]),
205206
})
206207
}
207208
if len(rows) == 0 {

internal/database/migrations/sqlite/20260521110354_equipment.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ CREATE TABLE equipment (
2323
voltage_v INTEGER,
2424
current_ma INTEGER,
2525
power_mw INTEGER,
26+
wire_gauge_mm2_x100 INTEGER,
2627
updated_at INTEGER NOT NULL DEFAULT (unixepoch()),
2728
created_at INTEGER NOT NULL DEFAULT (unixepoch())
2829
) STRICT;

internal/database/migrations/sqlite/20260606133519_equipment_imports.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ CREATE TABLE equipment_imports (
2929
voltage_v TEXT NOT NULL DEFAULT '',
3030
current_ma TEXT NOT NULL DEFAULT '',
3131
power_mw TEXT NOT NULL DEFAULT '',
32+
wire_gauge_mm2_x100 TEXT NOT NULL DEFAULT '',
3233
quantity TEXT NOT NULL DEFAULT '1',
3334
purchase_price TEXT NOT NULL DEFAULT '',
3435
purchased_at TEXT NOT NULL DEFAULT '',

internal/database/queries/gen/equipment/equipment.sql.go

Lines changed: 99 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)