docs: update BACKOFFICE.md with detailed API routes and Podman instructions
This commit is contained in:
parent
6700d367f0
commit
672d2364cb
1 changed files with 46 additions and 51 deletions
|
|
@ -161,26 +161,43 @@ O módulo `EmailModule` atua como **consumer** do LavinMQ:
|
|||
|
||||
---
|
||||
|
||||
## 📊 Admin Dashboard
|
||||
|
||||
### Endpoints
|
||||
## 📊 API Reference (Endpoints)
|
||||
|
||||
### 📈 Dashboard & Analytics (Admin)
|
||||
| Método | Endpoint | Descrição |
|
||||
|--------|----------|-----------|
|
||||
| `GET` | `/admin/stats` | Dashboard stats |
|
||||
| `GET` | `/admin/revenue` | Revenue by month |
|
||||
| `GET` | `/admin/subscriptions-by-plan` | Subscriptions breakdown |
|
||||
| `GET` | `/admin/stats` | Estatísticas gerais (Empresas, Receita, Assinaturas) |
|
||||
| `GET` | `/admin/revenue` | Receita mensal detalhada |
|
||||
| `GET` | `/admin/subscriptions-by-plan` | Distribuição de assinaturas por plano |
|
||||
|
||||
### Stats Response
|
||||
### 📦 Plans Management (SaaS)
|
||||
| Método | Endpoint | Descrição |
|
||||
|--------|----------|-----------|
|
||||
| `GET` | `/plans` | Listar todos os planos |
|
||||
| `GET` | `/plans/{id}` | Detalhes de um plano |
|
||||
| `POST` | `/plans` | Criar novo plano |
|
||||
| `PATCH` | `/plans/{id}` | Atualizar plano |
|
||||
| `DELETE` | `/plans/{id}` | Remover plano |
|
||||
|
||||
```json
|
||||
{
|
||||
"totalCompanies": 150,
|
||||
"activeSubscriptions": 120,
|
||||
"monthlyRevenue": 25000,
|
||||
"newCompaniesThisMonth": 15
|
||||
}
|
||||
```
|
||||
### 🔑 Credentials & Integrations
|
||||
| Método | Endpoint | Descrição |
|
||||
|--------|----------|-----------|
|
||||
| `POST` | `/admin/credentials/stripe` | Salvar Chave API Stripe (Criptografado) |
|
||||
| `GET` | `/system/credentials` | Listar serviços com credenciais configuradas |
|
||||
| `POST` | `/system/credentials` | Salvar credencial genérica (Service Payload) |
|
||||
| `DELETE` | `/system/credentials/{serviceName}` | Remover credencial de serviço |
|
||||
|
||||
### 📲 Push Notifications (FCM)
|
||||
| Método | Endpoint | Descrição |
|
||||
|--------|----------|-----------|
|
||||
| `POST` | `/fcm-tokens` | Registrar token de dispositivo (iOS/Android/Web) |
|
||||
|
||||
### 💳 Stripe & Billing
|
||||
| Método | Endpoint | Descrição |
|
||||
|--------|----------|-----------|
|
||||
| `POST` | `/stripe/checkout` | Criar Checkout Session |
|
||||
| `POST` | `/stripe/portal` | Gerar Link do Billing Portal |
|
||||
| `POST` | `/stripe/webhook` | Webhook Event Handler |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -241,20 +258,19 @@ JWT_SECRET=your-secret-key
|
|||
|
||||
---
|
||||
|
||||
## 🚀 Desenvolvimento
|
||||
## 🚀 Desenvolvimento Local
|
||||
|
||||
### Requisitos
|
||||
|
||||
- Node.js 20+
|
||||
- pnpm 9+
|
||||
|
||||
### Executar
|
||||
### Pré-requisitos
|
||||
- **Node.js 20+**
|
||||
- **pnpm 9+**
|
||||
- **Podman** (para containerizar)
|
||||
|
||||
### Executar (Nativo)
|
||||
```bash
|
||||
# Instalar dependências
|
||||
pnpm install
|
||||
|
||||
# Desenvolvimento
|
||||
# Desenvolvimento (Hot Reload)
|
||||
pnpm start:dev
|
||||
|
||||
# Produção
|
||||
|
|
@ -262,38 +278,17 @@ pnpm build
|
|||
pnpm start:prod
|
||||
```
|
||||
|
||||
### Testes
|
||||
|
||||
### Executar com Podman (Container)
|
||||
```bash
|
||||
# Unit tests
|
||||
pnpm test
|
||||
# Build da imagem
|
||||
podman build -t gohorse-backoffice .
|
||||
|
||||
# E2E tests
|
||||
pnpm test:e2e
|
||||
|
||||
# Coverage
|
||||
pnpm test:cov
|
||||
# Rodar container
|
||||
# --net host recomendado para acessar DB local em desenvolvimento
|
||||
podman run --name backoffice -p 3001:3001 --env-file .env gohorse-backoffice
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📡 API Documentation
|
||||
|
||||
Swagger UI disponível em:
|
||||
|
||||
**Development:** `http://localhost:3001/api/docs`
|
||||
|
||||
---
|
||||
|
||||
## 🐳 Docker
|
||||
|
||||
```bash
|
||||
# Build
|
||||
docker build -t gohorse-backoffice .
|
||||
|
||||
# Run
|
||||
docker run -p 3001:3001 --env-file .env gohorse-backoffice
|
||||
```
|
||||
> **Nota:** Não utilizamos `docker-compose`. Para orquestração em produção, utilizamos **Quadlet**.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue