Owner settings: add a real delete for Mitarbeiter (barbers)
Test backoffice (smb-crm) / test (push) Successful in 1m40s
Test backoffice (smb-crm) / test (push) Successful in 1m40s
Rename + active-toggle already existed (this session, earlier commit) -- this adds a genuine, permanent delete alongside them, guarded by a confirm() prompt that points to the "Aktiv" checkbox as the reversible alternative for someone just temporarily off. Existing bookings against a deleted resource are left as-is (no FK in this schema, matching its existing convention) -- the owner agenda already falls back to the raw resource_id for a booking whose resource no longer resolves, same as it does today for a deactivated one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import threading
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from datetime import datetime, time, timedelta, timezone
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -32,6 +32,30 @@ def test_get_resource_is_tenant_scoped():
|
||||
assert bdb.get_resource(CLIENT_B, r["resource_id"]) is None
|
||||
|
||||
|
||||
def test_delete_resource_removes_it_and_its_hours():
|
||||
r = bdb.create_resource(CLIENT_A, _loc(CLIENT_A), "Chair 1")
|
||||
bdb.set_resource_hours(CLIENT_A, r["resource_id"], 0, time(9, 0), time(17, 0))
|
||||
assert bdb.delete_resource(CLIENT_A, r["resource_id"]) == r["resource_id"]
|
||||
assert bdb.get_resource(CLIENT_A, r["resource_id"]) is None
|
||||
assert bdb.get_resource_hours(CLIENT_A, r["resource_id"]) == {}
|
||||
|
||||
|
||||
def test_delete_resource_is_tenant_scoped():
|
||||
r = bdb.create_resource(CLIENT_B, _loc(CLIENT_B), "Chair 1")
|
||||
assert bdb.delete_resource(CLIENT_A, r["resource_id"]) is None
|
||||
assert bdb.get_resource(CLIENT_B, r["resource_id"]) is not None
|
||||
|
||||
|
||||
def test_delete_resource_leaves_existing_bookings_in_place():
|
||||
r = bdb.create_resource(CLIENT_A, _loc(CLIENT_A), "Chair 1")
|
||||
b = bdb.create_booking(CLIENT_A, r["resource_id"], "Alice", "a@x.com",
|
||||
"Haircut", _dt(10), _dt(11))
|
||||
bdb.delete_resource(CLIENT_A, r["resource_id"])
|
||||
still_there = bdb.get_booking(CLIENT_A, b["booking_id"])
|
||||
assert still_there is not None
|
||||
assert still_there["resource_id"] == r["resource_id"]
|
||||
|
||||
|
||||
def test_create_and_get_service():
|
||||
s = bdb.create_service(CLIENT_A, "Haircut", 30, price=25)
|
||||
assert s["duration_minutes"] == 30
|
||||
|
||||
Reference in New Issue
Block a user