# Tenant Admins Mapping

This table links tenants to the admin user responsible for managing them. Apply the migration below before enabling the feature.

## Database Schema

### `tenant_admins`
- `id` INT AUTO_INCREMENT PRIMARY KEY
- `tenant_id` INT tenant this row belongs to
- `admin_user_id` INT user with admin rights
- `isDeleted` TINYINT default 0
- `updatedAt` TIMESTAMP auto updated

## API Endpoints

### TenantAdminsController
Standard CRUD routes require a **Super Admin** or the current mapping's admin:
- `GET /api/tenant_admins`
- `GET /api/tenant_admins/{id}`
- `POST /api/tenant_admins`
- `PUT /api/tenant_admins/{id}`
- `DELETE /api/tenant_admins/{id}`

### TenantsController
- `POST /api/tenants/reassign/{id}` – move the tenant to a different admin user. Payload `{ "admin_user_id": n }`.

## Migration Notes

Add the table to both `TAFDB.sql` and `TAFDB.pgsql` and run your usual migration process.
