diff options
| author | physcik <mynameisgennadiy@vk.com> | 2026-04-27 16:52:45 +0500 |
|---|---|---|
| committer | physcik <mynameisgennadiy@vk.com> | 2026-04-27 16:52:45 +0500 |
| commit | 9a43fa05ade031c91d515d1254e05fd33cc7a482 (patch) | |
| tree | c585ee7725c5e88518e18ff98b93b944caa4520e /backend/src/Database/RangedWeaponsAccessLayer.zig | |
| parent | b5ce961b3ef30758f77e2487dc9b6ed2dd39de73 (diff) | |
Auth middleware + origin check
Diffstat (limited to 'backend/src/Database/RangedWeaponsAccessLayer.zig')
| -rw-r--r-- | backend/src/Database/RangedWeaponsAccessLayer.zig | 9 |
1 files changed, 6 insertions, 3 deletions
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, }); } |
