feat: connect UsersPage and SettingsPage SMTP to API + extend user roles/fields
- 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>
This commit is contained in:
@@ -264,10 +264,10 @@ export const api = {
|
||||
list: (slug: string) =>
|
||||
req<User[]>('GET', `/api/hotels/${slug}/users`),
|
||||
|
||||
create: (slug: string, data: { email: string; password: string; name: string; role: string }) =>
|
||||
create: (slug: string, data: { email: string; password: string; name: string; role: string; phone?: string; position?: string }) =>
|
||||
req<User>('POST', `/api/hotels/${slug}/users`, data),
|
||||
|
||||
update: (slug: string, id: string, data: Partial<{ name: string; email: string; password: string }>) =>
|
||||
update: (slug: string, id: string, data: Partial<{ name: string; email: string; password: string; role: string; phone: string; position: string; active: boolean }>) =>
|
||||
req<User>('PATCH', `/api/hotels/${slug}/users/${id}`, data),
|
||||
|
||||
delete: (slug: string, id: string) =>
|
||||
|
||||
Reference in New Issue
Block a user