From 9a43fa05ade031c91d515d1254e05fd33cc7a482 Mon Sep 17 00:00:00 2001 From: physcik Date: Mon, 27 Apr 2026 16:52:45 +0500 Subject: Auth middleware + origin check --- backend/src/Database/RangedWeaponsAccessLayer.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'backend/src/Database/RangedWeaponsAccessLayer.zig') diff --git a/backend/src/Database/RangedWeaponsAccessLayer.zig b/backend/src/Database/RangedWeaponsAccessLayer.zig index 6857581..6170a60 100644 --- a/backend/src/Database/RangedWeaponsAccessLayer.zig +++ b/backend/src/Database/RangedWeaponsAccessLayer.zig @@ -46,8 +46,9 @@ pub fn Update(displayName: []const u8, updatedModel: *model.RangedWeaponType) !v \\ number_of_shots = $9, \\ rate_of_fire = $10, \\ reliability = $11, + \\ origin = $12, \\ updated_at = CURRENT_TIMESTAMP - \\ WHERE id = $12 + \\ WHERE id = $13 ; _ = try conn.pool.exec(query, .{ @@ -62,6 +63,7 @@ pub fn Update(displayName: []const u8, updatedModel: *model.RangedWeaponType) !v updatedModel.NumberOfShots, updatedModel.RateOfFire, updatedModel.Reliability, + updatedModel.Origin, displayName, }); } @@ -70,9 +72,9 @@ pub fn Create(NewWeapon: *model.RangedWeaponType) !void { if (try Exists(NewWeapon.Id)) return conn.ResultErrors.AlreadyExists; const query = \\ INSERT INTO RangedWeapons - \\ (id, name, weapon_type, accuracy, concealability, availability, damage, ammunition, number_of_shots, rate_of_fire, reliability) + \\ (id, name, weapon_type, accuracy, concealability, availability, damage, ammunition, number_of_shots, rate_of_fire, reliability, origin) \\ VALUES - \\ ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) + \\ ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) ; _ = try conn.pool.exec(query, .{ @@ -87,6 +89,7 @@ pub fn Create(NewWeapon: *model.RangedWeaponType) !void { NewWeapon.NumberOfShots, NewWeapon.RateOfFire, NewWeapon.Reliability, + NewWeapon.Origin, }); } -- cgit v1.3