refactor: migração para desenvolvimento direto no servidor

- Removido README.md padrão do Laravel (backend)
- Removidos scripts de deploy (não mais necessários)
- Atualizado copilot-instructions.md para novo fluxo
- Adicionada documentação de auditoria do servidor
- Sincronizado código de produção com repositório

Novo workflow:
- Trabalhamos diretamente em /root/webmoney (symlink para /var/www/webmoney)
- Mudanças PHP são instantâneas
- Mudanças React requerem 'npm run build'
- Commit após validação funcional
This commit is contained in:
marco 2025-12-19 11:45:32 +01:00
parent accba4ec41
commit 54cccdd095
343 changed files with 333 additions and 1718 deletions

0
.github/.DIRETRIZES_DESENVOLVIMENTO_v5 vendored Normal file → Executable file
View File

306
.github/copilot-instructions.md vendored Normal file → Executable file
View File

@ -1,15 +1,34 @@
# Copilot Instructions
## 🖥️ AMBIENTE DE DESENVOLVIMENTO - SERVIDOR DE PRODUÇÃO
**IMPORTANTE:** Estamos trabalhando diretamente no servidor de produção.
- **Hostname:** mail.cnxifly.com
- **IP:** 213.165.93.60
- **Sistema:** Ubuntu 24.04.3 LTS
- **Workspace:** `/root/webmoney` (symlink: `/var/www/webmoney`)
### ⚠️ Consequências
Como trabalhamos diretamente em produção:
- Mudanças em arquivos PHP **afetam imediatamente** o site
- Mudanças no Frontend **requerem build** (`npm run build`)
- **NÃO** é necessário usar SSH, sshpass ou scripts de deploy
- **Testar sempre** antes de fazer commit
---
## 🔄 REPOSITÓRIO GIT - GITEA (Self-Hosted)
**IMPORTANTE:** O repositório principal é o Gitea no nosso servidor, NÃO o GitHub.
O repositório está em nosso Gitea, NÃO no GitHub.
### Configuração do Repositório
### Configuração
```bash
# Repositório principal (Gitea)
# Remote configurado
git remote -v
# gitea https://git.cnxifly.com/marco/webmoney.git
# origin https://git.cnxifly.com/marco/webmoney.git
# URL Web
https://git.cnxifly.com/marco/webmoney
@ -19,97 +38,108 @@ Usuário: marco
Senha: M@ster9354
```
### Comandos Git
### 📋 Workflow de Desenvolvimento
```bash
# Push para Gitea (SEMPRE usar este)
git push gitea main
# 1. Fazer alterações no código
# Pull do Gitea
git pull gitea main
# 2. Para Frontend (React) - OBRIGATÓRIO build:
cd /root/webmoney/frontend && npm run build
# Commit padrão
git add -A && git commit -m "descrição" && git push gitea main
# 3. Para Backend (PHP) - Apenas se necessário:
cd /root/webmoney/backend && php artisan config:clear && php artisan cache:clear
# 4. Testar em https://webmoney.cnxifly.com
# 5. Se OK, commit e push:
cd /root/webmoney
git add -A && git commit -m "descrição" && git push origin main
# 6. Atualizar VERSION e CHANGELOG.md se necessário
```
### ❌ Proibições Git
- NUNCA usar `git push origin` (GitHub foi descontinuado)
- NUNCA criar repositórios no GitHub para este projeto
- NUNCA usar GitHub (repositório descontinuado)
- NUNCA fazer push sem testar antes
---
## 🚨 REGRA CRÍTICA DE DEPLOY
## 🏗️ Estrutura do Projeto
**NUNCA envie arquivos manualmente com scp/rsync para o servidor.**
### Deploy Obrigatório
Sempre que precisar enviar código para produção, USE OS SCRIPTS:
```bash
# Para mudanças no BACKEND (PHP/Laravel)
cd /workspaces/webmoney/backend && ./deploy.sh
# Para mudanças no FRONTEND (React/JS)
cd /workspaces/webmoney/frontend && ./deploy.sh
```
/root/webmoney/ ← Workspace (VS Code)
↓ symlink
/var/www/webmoney/ ← Servido pelo Nginx
├── backend/ # Laravel API
│ ├── app/
│ ├── config/
│ ├── database/
│ ├── routes/api.php
│ ├── storage/logs/
│ └── .env # Configuração produção
└── frontend/
├── src/ # Código React
└── dist/ # Build (servido pelo Nginx)
```
### Por que usar os scripts?
---
Os scripts de deploy:
1. **Backend (deploy.sh)**:
- Sincroniza arquivos com rsync
- Instala dependências com composer
- Executa migrações
- Limpa e regenera cache
- Reinicia PHP-FPM
- Ajusta permissões
## 🔧 Serviços do Servidor
2. **Frontend (deploy.sh)**:
- Faz build do React (npm run build)
- Envia para /var/www/webmoney/frontend/**dist** (não /frontend!)
- Verifica se deploy funcionou
| Serviço | Versão | Status |
|---------|--------|--------|
| Nginx | latest | ✅ Ativo |
| PHP-FPM | 8.4.15 | ✅ Ativo |
| MariaDB | 11.4.9 | ✅ Ativo |
| Redis | 7.0.15 | ✅ Ativo |
| Node.js | 22.21.0 | ✅ Disponível |
| Postfix | - | ✅ Ativo |
| Dovecot | - | ✅ Ativo |
| Gitea | - | ✅ Ativo |
### Proibições
### Comandos Úteis
`scp arquivo root@213.165.93.60:/var/www/webmoney/...`
`rsync arquivo root@213.165.93.60:/var/www/webmoney/...`
❌ Copiar arquivos individuais manualmente
```bash
# Reiniciar PHP-FPM (após mudanças em config)
systemctl restart php8.4-fpm
### Workflow
# Ver logs Laravel
tail -f /root/webmoney/backend/storage/logs/laravel.log
1. Editar código
2. `cd backend && ./deploy.sh` ou `cd frontend && ./deploy.sh`
3. Testar em https://webmoney.cnxifly.com
4. Se OK:
- `VERSION++` (incrementar versão)
- Atualizar `CHANGELOG.md` (documentar mudanças)
- Atualizar `README.md` (sempre que necessário - novas features, requisitos, comandos, etc.)
5. Commit e push para Gitea:
```bash
git add -A && git commit -m "descrição" && git push gitea main
```
# Ver logs Nginx
tail -f /var/log/nginx/webmoney_subdomain_error.log
### 📝 Quando atualizar README.md
# Limpar cache Laravel
cd /root/webmoney/backend && php artisan optimize:clear
- Nova funcionalidade importante
- Mudança de requisitos (versão PHP, Node, etc.)
- Novos endpoints de API
- Alteração de variáveis de ambiente
- Novos comandos artisan
- Mudança na estrutura do projeto
# Build frontend
cd /root/webmoney/frontend && npm run build
# Tinker (debug PHP)
cd /root/webmoney/backend && php artisan tinker
# MySQL
mysql -u webmoney -p'M@ster9354' webmoney -e "QUERY"
```
---
## 🔐 Credenciais
| Serviço | Usuário | Senha |
|---------|---------|-------|
| Servidor (root) | root | Master9354 |
| MySQL | webmoney | M@ster9354 |
| WebMoney App | marco@cnxifly.com | M@ster9354 |
| Gitea | marco | M@ster9354 |
---
## 🚫 Regras de UI/UX
**NUNCA use alert(), confirm() ou prompt() do navegador.**
Sempre usar componentes modais ou toast:
- Para erros: `toast.error('mensagem')`
- Para sucesso: `toast.success('mensagem')`
- Para confirmação: Usar `<ConfirmModal />` component
- Para formulários: Criar modal customizado
```jsx
// ❌ PROIBIDO
alert('Erro!');
@ -124,44 +154,17 @@ toast.error('Erro!');
toast.success('Sucesso!');
```
## Estrutura do Servidor
---
```
/var/www/webmoney/
├── backend/ # Laravel (Nginx → PHP-FPM)
└── frontend/
└── dist/ # React build (Nginx root)
```
## <20><> Padrão Visual de Modais
## Credenciais
**TODOS os modais de formulário devem seguir este padrão:**
- **Servidor**: root@213.165.93.60 (senha: Master9354)
- **Banco**: webmoney / M@ster9354
- **Usuário WebMoney**: marco@cnxifly.com / M@ster9354
## 🔑 Acesso SSH - SEMPRE usar sshpass
**OBRIGATÓRIO:** Sempre usar `sshpass` para comandos SSH/SCP/RSYNC.
```bash
# SSH para executar comandos
sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "comando"
# Ver logs do Laravel
sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "tail -50 /var/www/webmoney/backend/storage/logs/laravel.log"
# Executar tinker
sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "cd /var/www/webmoney/backend && php artisan tinker --execute='codigo'"
# MySQL
sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "mysql -u webmoney -p'M@ster9354' webmoney -e 'QUERY'"
```
❌ NUNCA usar `ssh root@213.165.93.60` sem sshpass (vai travar esperando senha)
## 🎨 Padrão Visual de Modais
**TODOS os modais de formulário devem seguir este padrão elegante:**
### Cores do Sistema
- **Background modal**: `#1e293b`
- **Background campos/cards**: `#0f172a`
- **Texto principal**: `text-white`
- **Texto secundário**: `text-slate-400`
### Estrutura Base
```jsx
@ -171,26 +174,16 @@ sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "mysq
{/* Header sem borda */}
<div className="modal-header border-0 pb-0">
<div>
<h5 className="modal-title text-white mb-1">
<h5 className="modal-title text-white">
<i className="bi bi-icon me-2 text-primary"></i>
Título
</h5>
<p className="text-slate-400 mb-0 small">Subtítulo</p>
</div>
<button className="btn-close btn-close-white" onClick={onClose}></button>
</div>
{/* Body com scroll */}
<div className="modal-body pt-3" style={{ maxHeight: '65vh', overflowY: 'auto' }}>
{/* Preview Card - SEMPRE no topo */}
<div className="mb-4 p-3 rounded-3" style={{ background: '#0f172a' }}>
{/* Preview visual do item sendo criado/editado */}
</div>
{/* Campos em cards com background #0f172a */}
{/* Labels com ícones coloridos */}
{/* Badges "Opcional" quando necessário */}
{/* Conteúdo */}
</div>
{/* Footer sem borda */}
@ -203,71 +196,32 @@ sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "mysq
</div>
```
### Cores do Sistema
- **Background modal**: `#1e293b`
- **Background campos/cards**: `#0f172a`
- **Texto principal**: `text-white`
- **Texto secundário**: `text-slate-400`
- **Texto desabilitado**: `text-slate-500`
---
### Labels com Ícones
```jsx
<label className="form-label text-white fw-medium mb-2">
<i className="bi bi-type me-2 text-primary"></i>
Nome *
</label>
```
## 📝 Quando Atualizar Documentação
### Badge Opcional
```jsx
<span className="badge bg-secondary ms-2" style={{ fontSize: '0.65rem' }}>
{t('common.optional')}
</span>
```
### VERSION
- Após cada funcionalidade completa
- Formato: X.Y.Z (Major.Minor.Patch)
### Seleção Visual com Cards
Para seleções (categorias, ícones), usar cards clicáveis:
```jsx
<div
onClick={() => handleSelect(item)}
className="p-2 rounded text-center"
style={{
background: isSelected ? 'rgba(59, 130, 246, 0.15)' : '#0f172a',
cursor: 'pointer',
border: isSelected ? '2px solid #3b82f6' : '2px solid transparent'
}}
>
<i className={`bi ${icon} d-block mb-1`} style={{ color }}></i>
<small className="text-white">{label}</small>
</div>
```
### CHANGELOG.md
- Toda mudança significativa
- Formato: data, tipo, descrição
### Seção de Keywords/Tags
```jsx
<div className="p-3 rounded" style={{ background: '#0f172a' }}>
<div className="input-group mb-2">
<input className="form-control bg-dark text-white border-0" />
<button className="btn btn-primary px-3">
<i className="bi bi-plus-lg"></i>
</button>
</div>
<div className="d-flex flex-wrap gap-2">
{/* Tags com cor do item */}
</div>
</div>
```
### README.md
- Nova funcionalidade importante
- Mudança de requisitos
- Novos endpoints de API
- Novos comandos
### Switch de Status
```jsx
<div className="form-check form-switch">
<input type="checkbox" className="form-check-input" role="switch" />
<label className="form-check-label text-white">
<i className={`bi ${isActive ? 'bi-check-circle text-success' : 'bi-x-circle text-secondary'} me-2`}></i>
{isActive ? 'Activo' : 'Inactivo'}
</label>
</div>
```
---
## Documentação
## 🌐 URLs do Projeto
Consulte `.DIRETRIZES_DESENVOLVIMENTO_v5` para regras completas.
| Serviço | URL |
|---------|-----|
| WebMoney App | https://webmoney.cnxifly.com |
| WebMoney API | https://webmoney.cnxifly.com/api |
| Gitea | https://git.cnxifly.com |
| phpMyAdmin | https://pma.cnxifly.com |
| Webmail | https://mail.cnxifly.com |

0
.gitignore vendored Normal file → Executable file
View File

0
ANALISE_CONTRATO_PRICE.md Normal file → Executable file
View File

0
ANALISE_CONTRATO_PRICE.txt Normal file → Executable file
View File

0
ANALISE_PRECIFICACAO.md Normal file → Executable file
View File

0
APRENDIZADOS_TECNICOS.md Normal file → Executable file
View File

0
CHANGELOG.md Normal file → Executable file
View File

0
CONFIGURACION_LOCAL.md Normal file → Executable file
View File

0
CREDENCIAIS_SERVIDOR.md Normal file → Executable file
View File

0
DKIM_DNS_RECORD.txt Normal file → Executable file
View File

0
ESPECIFICACIONES_WEBMONEY.md Normal file → Executable file
View File

0
ESTRUTURA_PROJETO.md Normal file → Executable file
View File

0
IMPLEMENTACAO_ORCAMENTOS_SUBCATEGORIA.md Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
ROTEIRO_INSTALACAO_SERVIDOR.md Normal file → Executable file
View File

0
VERSION Normal file → Executable file
View File

0
Wanna.xlsx Normal file → Executable file
View File

0
backend/.editorconfig Normal file → Executable file
View File

0
backend/.env.example Normal file → Executable file
View File

0
backend/.gitattributes vendored Normal file → Executable file
View File

0
backend/.gitignore vendored Normal file → Executable file
View File

View File

@ -1,59 +0,0 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You can also check out [Laravel Learn](https://laravel.com/learn), where you will be guided through building a modern Laravel application.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Redberry](https://redberry.international/laravel-development)**
- **[Active Logic](https://activelogic.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

View File

0
backend/app/Console/Commands/PopulateDemoData.php Normal file → Executable file
View File

0
backend/app/Console/Commands/SendDuePaymentsAlert.php Normal file → Executable file
View File

0
backend/app/Console/Commands/SetupPayPalPlans.php Normal file → Executable file
View File

0
backend/app/Http/Controllers/Api/AccountController.php Normal file → Executable file
View File

View File

0
backend/app/Http/Controllers/Api/AuthController.php Normal file → Executable file
View File

0
backend/app/Http/Controllers/Api/BudgetController.php Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

View File

0
backend/app/Http/Controllers/Api/ImportController.php Normal file → Executable file
View File

View File

0
backend/app/Http/Controllers/Api/PlanController.php Normal file → Executable file
View File

View File

View File

View File

0
backend/app/Http/Controllers/Api/ReportController.php Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

View File

0
backend/app/Http/Controllers/Controller.php Normal file → Executable file
View File

0
backend/app/Http/Middleware/AdminOnly.php Normal file → Executable file
View File

0
backend/app/Http/Middleware/CheckPlanLimits.php Normal file → Executable file
View File

0
backend/app/Http/Middleware/DemoProtection.php Normal file → Executable file
View File

0
backend/app/Http/Middleware/SecurityHeaders.php Normal file → Executable file
View File

0
backend/app/Mail/AccountActivationMail.php Normal file → Executable file
View File

0
backend/app/Mail/DuePaymentsAlert.php Normal file → Executable file
View File

0
backend/app/Mail/SubscriptionCancelledMail.php Normal file → Executable file
View File

0
backend/app/Mail/WelcomeEmail.php Normal file → Executable file
View File

0
backend/app/Mail/WelcomeNewUser.php Normal file → Executable file
View File

0
backend/app/Models/Account.php Normal file → Executable file
View File

0
backend/app/Models/AssetAccount.php Normal file → Executable file
View File

0
backend/app/Models/Budget.php Normal file → Executable file
View File

0
backend/app/Models/BusinessSetting.php Normal file → Executable file
View File

0
backend/app/Models/Category.php Normal file → Executable file
View File

0
backend/app/Models/CategoryKeyword.php Normal file → Executable file
View File

0
backend/app/Models/CostCenter.php Normal file → Executable file
View File

0
backend/app/Models/CostCenterKeyword.php Normal file → Executable file
View File

0
backend/app/Models/EmailVerificationToken.php Normal file → Executable file
View File

0
backend/app/Models/FinancialGoal.php Normal file → Executable file
View File

0
backend/app/Models/GoalContribution.php Normal file → Executable file
View File

0
backend/app/Models/ImportLog.php Normal file → Executable file
View File

0
backend/app/Models/ImportMapping.php Normal file → Executable file
View File

0
backend/app/Models/Invoice.php Normal file → Executable file
View File

0
backend/app/Models/LiabilityAccount.php Normal file → Executable file
View File

0
backend/app/Models/LiabilityInstallment.php Normal file → Executable file
View File

0
backend/app/Models/Plan.php Normal file → Executable file
View File

0
backend/app/Models/ProductSheet.php Normal file → Executable file
View File

0
backend/app/Models/ProductSheetItem.php Normal file → Executable file
View File

0
backend/app/Models/ProductVariant.php Normal file → Executable file
View File

0
backend/app/Models/PromotionalCampaign.php Normal file → Executable file
View File

0
backend/app/Models/RecurringInstance.php Normal file → Executable file
View File

0
backend/app/Models/RecurringTemplate.php Normal file → Executable file
View File

0
backend/app/Models/ServiceSheet.php Normal file → Executable file
View File

0
backend/app/Models/ServiceSheetItem.php Normal file → Executable file
View File

0
backend/app/Models/SiteSetting.php Normal file → Executable file
View File

0
backend/app/Models/Subscription.php Normal file → Executable file
View File

0
backend/app/Models/Transaction.php Normal file → Executable file
View File

0
backend/app/Models/User.php Normal file → Executable file
View File

0
backend/app/Models/UserPreference.php Normal file → Executable file
View File

0
backend/app/Policies/RecurringTemplatePolicy.php Normal file → Executable file
View File

0
backend/app/Providers/AppServiceProvider.php Normal file → Executable file
View File

0
backend/app/Services/Import/CsvParser.php Normal file → Executable file
View File

0
backend/app/Services/Import/ExcelParser.php Normal file → Executable file
View File

0
backend/app/Services/Import/FileParserInterface.php Normal file → Executable file
View File

0
backend/app/Services/Import/ImportService.php Normal file → Executable file
View File

0
backend/app/Services/Import/OfxParser.php Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More