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
|
## 📊 API Reference (Endpoints)
|
||||||
|
|
||||||
### Endpoints
|
|
||||||
|
|
||||||
|
### 📈 Dashboard & Analytics (Admin)
|
||||||
| Método | Endpoint | Descrição |
|
| Método | Endpoint | Descrição |
|
||||||
|--------|----------|-----------|
|
|--------|----------|-----------|
|
||||||
| `GET` | `/admin/stats` | Dashboard stats |
|
| `GET` | `/admin/stats` | Estatísticas gerais (Empresas, Receita, Assinaturas) |
|
||||||
| `GET` | `/admin/revenue` | Revenue by month |
|
| `GET` | `/admin/revenue` | Receita mensal detalhada |
|
||||||
| `GET` | `/admin/subscriptions-by-plan` | Subscriptions breakdown |
|
| `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
|
### 🔑 Credentials & Integrations
|
||||||
{
|
| Método | Endpoint | Descrição |
|
||||||
"totalCompanies": 150,
|
|--------|----------|-----------|
|
||||||
"activeSubscriptions": 120,
|
| `POST` | `/admin/credentials/stripe` | Salvar Chave API Stripe (Criptografado) |
|
||||||
"monthlyRevenue": 25000,
|
| `GET` | `/system/credentials` | Listar serviços com credenciais configuradas |
|
||||||
"newCompaniesThisMonth": 15
|
| `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
|
### Pré-requisitos
|
||||||
|
- **Node.js 20+**
|
||||||
- Node.js 20+
|
- **pnpm 9+**
|
||||||
- pnpm 9+
|
- **Podman** (para containerizar)
|
||||||
|
|
||||||
### Executar
|
|
||||||
|
|
||||||
|
### Executar (Nativo)
|
||||||
```bash
|
```bash
|
||||||
# Instalar dependências
|
# Instalar dependências
|
||||||
pnpm install
|
pnpm install
|
||||||
|
|
||||||
# Desenvolvimento
|
# Desenvolvimento (Hot Reload)
|
||||||
pnpm start:dev
|
pnpm start:dev
|
||||||
|
|
||||||
# Produção
|
# Produção
|
||||||
|
|
@ -262,38 +278,17 @@ pnpm build
|
||||||
pnpm start:prod
|
pnpm start:prod
|
||||||
```
|
```
|
||||||
|
|
||||||
### Testes
|
### Executar com Podman (Container)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Unit tests
|
# Build da imagem
|
||||||
pnpm test
|
podman build -t gohorse-backoffice .
|
||||||
|
|
||||||
# E2E tests
|
# Rodar container
|
||||||
pnpm test:e2e
|
# --net host recomendado para acessar DB local em desenvolvimento
|
||||||
|
podman run --name backoffice -p 3001:3001 --env-file .env gohorse-backoffice
|
||||||
# Coverage
|
|
||||||
pnpm test:cov
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
> **Nota:** Não utilizamos `docker-compose`. Para orquestração em produção, utilizamos **Quadlet**.
|
||||||
|
|
||||||
## 📡 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
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue