Compare commits

..
1 Commits
Author SHA1 Message Date
Ian Roddis 2a0b8fcab2 Fixing errors and danger zone 2026-08-05 14:19:25 -03:00
4 changed files with 12 additions and 14 deletions

No files matched your search

-3
View File
@@ -16,12 +16,9 @@ from app.models.fit import Fit, FitNote
from app.models.imported_part import ImportedPart
from app.models.iso_thread import IsoThread
from app.models.manufacturer import Manufacturer
from app.models.part_colour import PartColour
from app.models.part_type import PartType
from app.models.scope_info import ScopeInfo
from app.models.scope_model import ScopeModel
from app.models.static_connection import StaticConnection
from app.models.sub_part_type import SubPartType
from app.models.unc_thread import UncThread
# Children before the RESTRICT-protected reference tables they point to.
+6 -6
View File
@@ -8,15 +8,15 @@
<div class="card" style="border: 1px solid var(--color-danger, #c00)">
<h2>Purge database</h2>
<p>
Permanently deletes every part, taxonomy entry, attachment point, fit,
and imported part in the database — manufacturers, part colours, part
types, sub part types, scope models, ISO/UNC threads, clamp/static
connections, attachment point names, augmented parts, scope info,
attachment points, fits, fit notes, and imported parts.
Permanently deletes every part, attachment point, fit, and imported
part in the database — manufacturers, scope models, ISO/UNC threads,
clamp/static connections, attachment point names, augmented parts,
scope info, attachment points, fits, fit notes, and imported parts.
</p>
<p>
<strong>Not</strong> deleted: users, roles &amp; permissions, refresh
tokens, the audit log, and the OData connection configuration.
tokens, the audit log, the OData connection configuration, and part
taxonomy (part colours, part types, sub part types).
</p>
<p class="muted">This cannot be undone. Take a database backup first if you might need this data again.</p>
<button class="btn btn-danger"
+5 -4
View File
@@ -132,20 +132,17 @@ async def test_purge_wipes_domain_data_but_keeps_users_and_odata_config(
FitNote,
ImportedPart,
ScopeModel,
SubPartType,
PartType,
AttachmentPointName,
IsoThread,
UncThread,
ClampConnection,
StaticConnection,
PartColour,
Manufacturer,
):
rows = (await db.execute(Model.__table__.select())).all()
assert rows == [], f"{Model.__name__} should be empty after purge"
# Kept: users, RBAC, and the OData connection config.
# Kept: users, RBAC, the OData connection config, and part taxonomy.
from app.crud import user as user_crud
assert await user_crud.get_by_email(db, "root@example.com") is not None
@@ -153,5 +150,9 @@ async def test_purge_wipes_domain_data_but_keeps_users_and_odata_config(
assert config is not None
assert config.odata_url == "https://example.test/odata"
for Model in (PartColour, PartType, SubPartType):
rows = (await db.execute(Model.__table__.select())).all()
assert rows != [], f"{Model.__name__} should survive the purge"
entries = await audit_crud.list_recent(db)
assert any("Purged all domain data" in e.description for e in entries)
+1 -1
View File
@@ -275,7 +275,7 @@ async def test_scopes_page_renders_objective_attachment_point_thread(
assert resp.status_code == 200
body = resp.text
# The attachment point's thread spec wins over ScopeInfo.objective_thread_pitch.
assert "M44×0.5" in body
assert "M44.0×0.5" in body
assert "M52x0.75" not in body