🐛 Bound hours per week on settings

The field accepted any number from 0.01 up, so a typo or a bad client
could store more hours than a week has and break every expected value
derived from it. The initial migration limits hours_per_week to 168; no
database was ever deployed with the previous version of the migration.
This commit is contained in:
2026-12-01 16:54:32 +01:00
parent b41f83342c
commit 590758dfb6
4 changed files with 65 additions and 1 deletions
+5
View File
@@ -382,6 +382,11 @@ func TestPushRejectsInvalidChanges(t *testing.T) {
data: `"effective_from":"2026-01-01","hours_per_week":40,"workdays_mask":0,"timezone":"UTC"`,
status: "invalid", errMsg: "workdays_mask must be between 1 and 127",
},
{
name: "more hours than a week has", collection: "settings_history",
data: `"effective_from":"2026-01-01","hours_per_week":200,"workdays_mask":31,"timezone":"UTC"`,
status: "invalid", errMsg: "hours_per_week: Must be less or equal than 168",
},
{
name: "zero adjustment", collection: "balance_adjustments",
data: `"delta_ms":0,"note":"","effective_at":1`,