- Migration 034: extend users table with phone, position, active columns; add new roles (receptionist, accountant, security) - Backend users.ts: accept phone/position on create, accept phone/position/active/role on update; managers can now assign all non-admin roles - types/index.ts + api.ts: add phone, position, active to User type and users create/update payload types - UsersPage: fix mapRole to handle all 5 roles, fix toStaffUser to use real phone/position/active from API, fix handleSave to pass all fields - SettingsPage: load SMTP settings from hotelSettings API on mount, save SMTP on handleSave when section === 'notify' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
10 lines
492 B
SQL
10 lines
492 B
SQL
-- Extend role constraint to support more roles
|
|
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_role_check;
|
|
ALTER TABLE users ADD CONSTRAINT users_role_check
|
|
CHECK (role IN ('manager', 'housekeeper', 'super_admin', 'receptionist', 'accountant', 'security'));
|
|
|
|
-- Add new columns
|
|
ALTER TABLE users ADD COLUMN IF NOT EXISTS phone VARCHAR(50);
|
|
ALTER TABLE users ADD COLUMN IF NOT EXISTS position VARCHAR(100);
|
|
ALTER TABLE users ADD COLUMN IF NOT EXISTS active BOOLEAN NOT NULL DEFAULT true;
|