feat: operator docs, Gitea push guide, and creatives API scaffold

Unblock ops with marketing@ provisioning steps and start multi-tenant creatives against Supabase RLS.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-09-21 12:12:57 +02:00
parent 2df3fe6983
commit 6e3d561f4b
5 changed files with 203 additions and 2 deletions

55
docs/OPERATOR.md Normal file
View File

@@ -0,0 +1,55 @@
# Operador marketing@4ventures.es
La contraseña del portal legado **no** vale en Supabase Auth (`invalid_credentials`).
## Alta / reset en Studio
1. Abre https://supabase.4ventures.es (Studio) con cuenta admin de infra.
2. **Authentication → Users → Add user**
- Email: `marketing@4ventures.es`
- Password: genera una fuerte (guárdala en el gestor de la agencia)
- Auto Confirm: sí
3. En el usuario → **User Metadata** / **App Metadata** (JSON), por ejemplo:
```json
{
"role": "admin",
"company": "4Ventures",
"slug": "4ventures-hub"
}
```
App metadata (preferible para rol):
```json
{
"role": "admin",
"tenant_id": "<uuid-del-tenant-hub-si-existe>"
}
```
4. Si usáis `provision_client`, también podéis:
```sql
select public.provision_client(
'4Ventures',
'4ventures-hub',
'marketing@4ventures.es',
'CONTRASEÑA_FUERTE_AQUI',
'admin'
);
```
5. Login en https://app.4ventures.es/login con ese email/password.
## Rotación de API keys (obligatorio)
Settings → API → Regenerate `anon` y `service_role`.
Actualizar en Dokploy env del contenedor `app` (y n8n si las usa).
Nunca volver a pegar keys en PDFs ni `.env.example`.
## Verificación
- Rol `admin` → ve `/dashboard/agencia`
- Rol `client` → redirigido fuera de agencia
- Chat/simulate solo con sesión

32
docs/PUSH.md Normal file
View File

@@ -0,0 +1,32 @@
# Push a Gitea (bloqueado sin token)
HTTPS a `git.4ventures.es` exige autenticación. SSH :22 hace timeout (solo HTTPS público).
## Crear token (1 vez)
1. Entra en https://git.4ventures.es (usuario con acceso a `Marketing/4ventures-client-portal`).
2. Settings → Applications → Generate New Token
- Nombre: `cursor-push`
- Scopes: `write:repository`
3. Copia el token (solo se muestra una vez).
## Push de la rama de seguridad
```bash
cd /Users/4ventures/4ventures-client-portal
git checkout harden/auth-tenant-security
# Opción A — URL con usuario (el SO pedirá contraseña = el token)
git push -u origin harden/auth-tenant-security
# Opción B — token en URL (no dejarlo en historial de shell si puedes evitarlo)
# git push -u https://USER:TOKEN@git.4ventures.es/Marketing/4ventures-client-portal.git HEAD
```
Usuario Gitea típico: el de Marcos / marketing (el que pueda escribir en Marketing).
## Después del push
1. Dokploy → servicio `app` → Redeploy / pull `harden/auth-tenant-security` o merge a `main`.
2. `curl -sf https://app.4ventures.es/api/health`
3. Login con operador aprovisionado (ver `docs/OPERATOR.md`).