Reconcile website_* schema to the live AtomCMS DB (amx_test)

Introspected the live DB and fixed real drift between the hand-modeled
schema and the actual columns:
- Added missing @map("snake_case") on camelCase fields that silently
  failed at query time: website_teams (rank_name/hidden_rank/...),
  website_paypal_transactions/user_guestbooks/help_center_tickets(+replies)/
  used_shop_vouchers/maintenance_tasks (user_id), website_rare_values
  (currency_type).
- website_permissions was modeled as key/value/comment but is actually
  permission/min_rank/description — fixed the model + the admin page/action.
- website_shop_articles.icon -> icon_url (+ added category_id, is_giftable);
  updated the shop page + admin shop CRUD.
- website_shop_categories: dropped non-existent slug/timestamps, added the
  real description/order columns; updated the shop page.
- website_shop_article_features.features(Json) -> content(Text).

Verified against amx_test: all website_* query errors gone; home renders
the real hotel_name ("Habbo"), rankings shows real users, /staff + /shop
200. tsc 0, vitest 49/49, next build 0. Remaining missing tables
(radio_*/game_*/staff_activities/alert_logs/article_comments+reactions)
don't exist in this DB and degrade gracefully via try/catch.
This commit is contained in:
Simo committed 2026-06-28 16:35:27 +02:00
1 parent 4eccd146ba
commit b97a88c561
6 files changed
+92 -93

No files matched your search

+2 -2
View File
@@ -37,7 +37,7 @@ export async function createShopArticle(formData: FormData): Promise<void> {
data: {
name,
info: String(formData.get("info") ?? "").trim().slice(0, 255),
icon: String(formData.get("icon") ?? "").trim().slice(0, 255),
iconUrl: String(formData.get("icon") ?? "").trim().slice(0, 255),
color: String(formData.get("color") ?? "").trim().slice(0, 255),
costs: reqUInt(formData, "costs"),
giveRank: optUInt(formData, "giveRank"),
@@ -86,7 +86,7 @@ export async function updateShopArticle(formData: FormData): Promise<void> {
data: {
name,
info: String(formData.get("info") ?? "").trim().slice(0, 255),
icon: String(formData.get("icon") ?? "").trim().slice(0, 255),
iconUrl: String(formData.get("icon") ?? "").trim().slice(0, 255),
color: String(formData.get("color") ?? "").trim().slice(0, 255),
costs: reqUInt(formData, "costs"),
giveRank: optUInt(formData, "giveRank"),