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

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

@ -1,15 +1,34 @@
# Copilot Instructions # 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) ## 🔄 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 ```bash
# Repositório principal (Gitea) # Remote configurado
git remote -v git remote -v
# gitea https://git.cnxifly.com/marco/webmoney.git # origin https://git.cnxifly.com/marco/webmoney.git
# URL Web # URL Web
https://git.cnxifly.com/marco/webmoney https://git.cnxifly.com/marco/webmoney
@ -19,97 +38,108 @@ Usuário: marco
Senha: M@ster9354 Senha: M@ster9354
``` ```
### Comandos Git ### 📋 Workflow de Desenvolvimento
```bash ```bash
# Push para Gitea (SEMPRE usar este) # 1. Fazer alterações no código
git push gitea main
# Pull do Gitea # 2. Para Frontend (React) - OBRIGATÓRIO build:
git pull gitea main cd /root/webmoney/frontend && npm run build
# Commit padrão # 3. Para Backend (PHP) - Apenas se necessário:
git add -A && git commit -m "descrição" && git push gitea main 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 ### ❌ Proibições Git
- NUNCA usar `git push origin` (GitHub foi descontinuado) - NUNCA usar GitHub (repositório descontinuado)
- NUNCA criar repositórios no GitHub para este projeto - NUNCA fazer push sem testar antes
--- ---
## 🚨 REGRA CRÍTICA DE DEPLOY ## 🏗️ Estrutura do Projeto
**NUNCA envie arquivos manualmente com scp/rsync para o servidor.** ```
/root/webmoney/ ← Workspace (VS Code)
### Deploy Obrigatório ↓ symlink
/var/www/webmoney/ ← Servido pelo Nginx
Sempre que precisar enviar código para produção, USE OS SCRIPTS: ├── backend/ # Laravel API
│ ├── app/
```bash │ ├── config/
# Para mudanças no BACKEND (PHP/Laravel) │ ├── database/
cd /workspaces/webmoney/backend && ./deploy.sh │ ├── routes/api.php
│ ├── storage/logs/
# Para mudanças no FRONTEND (React/JS) │ └── .env # Configuração produção
cd /workspaces/webmoney/frontend && ./deploy.sh └── frontend/
├── src/ # Código React
└── dist/ # Build (servido pelo Nginx)
``` ```
### Por que usar os scripts? ---
Os scripts de deploy: ## 🔧 Serviços do Servidor
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
2. **Frontend (deploy.sh)**: | Serviço | Versão | Status |
- Faz build do React (npm run build) |---------|--------|--------|
- Envia para /var/www/webmoney/frontend/**dist** (não /frontend!) | Nginx | latest | ✅ Ativo |
- Verifica se deploy funcionou | 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/...` ```bash
`rsync arquivo root@213.165.93.60:/var/www/webmoney/...` # Reiniciar PHP-FPM (após mudanças em config)
❌ Copiar arquivos individuais manualmente systemctl restart php8.4-fpm
### Workflow # Ver logs Laravel
tail -f /root/webmoney/backend/storage/logs/laravel.log
1. Editar código # Ver logs Nginx
2. `cd backend && ./deploy.sh` ou `cd frontend && ./deploy.sh` tail -f /var/log/nginx/webmoney_subdomain_error.log
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
```
### 📝 Quando atualizar README.md # Limpar cache Laravel
cd /root/webmoney/backend && php artisan optimize:clear
- Nova funcionalidade importante # Build frontend
- Mudança de requisitos (versão PHP, Node, etc.) cd /root/webmoney/frontend && npm run build
- Novos endpoints de API
- Alteração de variáveis de ambiente # Tinker (debug PHP)
- Novos comandos artisan cd /root/webmoney/backend && php artisan tinker
- Mudança na estrutura do projeto
# 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 ## 🚫 Regras de UI/UX
**NUNCA use alert(), confirm() ou prompt() do navegador.** **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 ```jsx
// ❌ PROIBIDO // ❌ PROIBIDO
alert('Erro!'); alert('Erro!');
@ -124,44 +154,17 @@ toast.error('Erro!');
toast.success('Sucesso!'); toast.success('Sucesso!');
``` ```
## Estrutura do Servidor ---
``` ## <20><> Padrão Visual de Modais
/var/www/webmoney/
├── backend/ # Laravel (Nginx → PHP-FPM)
└── frontend/
└── dist/ # React build (Nginx root)
```
## Credenciais **TODOS os modais de formulário devem seguir este padrão:**
- **Servidor**: root@213.165.93.60 (senha: Master9354) ### Cores do Sistema
- **Banco**: webmoney / M@ster9354 - **Background modal**: `#1e293b`
- **Usuário WebMoney**: marco@cnxifly.com / M@ster9354 - **Background campos/cards**: `#0f172a`
- **Texto principal**: `text-white`
## 🔑 Acesso SSH - SEMPRE usar sshpass - **Texto secundário**: `text-slate-400`
**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:**
### Estrutura Base ### Estrutura Base
```jsx ```jsx
@ -171,26 +174,16 @@ sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "mysq
{/* Header sem borda */} {/* Header sem borda */}
<div className="modal-header border-0 pb-0"> <div className="modal-header border-0 pb-0">
<div> <h5 className="modal-title text-white">
<h5 className="modal-title text-white mb-1"> <i className="bi bi-icon me-2 text-primary"></i>
<i className="bi bi-icon me-2 text-primary"></i> Título
Título </h5>
</h5>
<p className="text-slate-400 mb-0 small">Subtítulo</p>
</div>
<button className="btn-close btn-close-white" onClick={onClose}></button> <button className="btn-close btn-close-white" onClick={onClose}></button>
</div> </div>
{/* Body com scroll */} {/* Body com scroll */}
<div className="modal-body pt-3" style={{ maxHeight: '65vh', overflowY: 'auto' }}> <div className="modal-body pt-3" style={{ maxHeight: '65vh', overflowY: 'auto' }}>
{/* Preview Card - SEMPRE no topo */} {/* Conteúdo */}
<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 */}
</div> </div>
{/* Footer sem borda */} {/* Footer sem borda */}
@ -203,71 +196,32 @@ sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 "mysq
</div> </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 ## 📝 Quando Atualizar Documentação
```jsx
<label className="form-label text-white fw-medium mb-2">
<i className="bi bi-type me-2 text-primary"></i>
Nome *
</label>
```
### Badge Opcional ### VERSION
```jsx - Após cada funcionalidade completa
<span className="badge bg-secondary ms-2" style={{ fontSize: '0.65rem' }}> - Formato: X.Y.Z (Major.Minor.Patch)
{t('common.optional')}
</span>
```
### Seleção Visual com Cards ### CHANGELOG.md
Para seleções (categorias, ícones), usar cards clicáveis: - Toda mudança significativa
```jsx - Formato: data, tipo, descrição
<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>
```
### Seção de Keywords/Tags ### README.md
```jsx - Nova funcionalidade importante
<div className="p-3 rounded" style={{ background: '#0f172a' }}> - Mudança de requisitos
<div className="input-group mb-2"> - Novos endpoints de API
<input className="form-control bg-dark text-white border-0" /> - Novos comandos
<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>
```
### 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