[FEAT] Update the database for the scores. And follow the new file format

This commit is contained in:
NADAL Jean-Baptiste
2026-02-17 13:25:29 +01:00
parent 5066e1d54f
commit 5c93000873
4 changed files with 1323 additions and 0 deletions

134
AGENTS.md Normal file
View File

@@ -0,0 +1,134 @@
# AGENTS.md - Development Guidelines
This file contains essential information for AI agents working on this codebase.
## Project Overview
PHP website for "Harmonie de Montpellier-Jacou" (music band) with a Vue.js 2 frontend for score management.
- **Backend**: PHP with MySQL (legacy codebase)
- **Frontend**: Vue.js 2 + Bootstrap Vue (in `frontend/score/`)
- **API**: RESTful PHP API in `api/` directory
## Build Commands
### Frontend (Vue.js)
```bash
cd frontend/score
npm install
npm run serve # Development server
npm run build # Production build
npm run lint # ESLint check
```
### PHP
No build step required. Deploy to PHP-enabled web server.
## Testing
**No test framework configured.**
To add tests:
- **PHP**: Consider PHPUnit
- **Vue**: Add Jest or Vitest via Vue CLI
Run single test (when configured):
```bash
# Example for Jest (not yet configured)
npm test -- --testNamePattern="test name"
```
## Code Style Guidelines
### PHP
- Use `<?php` opening tags (avoid short `<?` tags for consistency)
- Classes: PascalCase (e.g., `Score`, `Database`)
- Methods: camelCase (e.g., `readScore`, `getEntryName`)
- Variables: snake_case or camelCase (be consistent within files)
- Indent: 3 spaces (legacy style) - maintain consistency with surrounding code
- Place opening braces on same line as class/function declaration
- Use `include_once` for required files
- **Note**: Uses legacy MySQL functions (consider upgrading to PDO/MySQLi)
### JavaScript/Vue
- ESLint configuration in `package.json`:
- Extends: `plugin:vue/essential`, `eslint:recommended`
- Parser: `babel-eslint`
- Use ES6+ features (async/await, arrow functions)
- Components: PascalCase
- Data properties: camelCase
- Use 2-space indentation
- Semicolons required
### General
- UTF-8 encoding for all files
- French language for user-facing content
- Maintain GPL v2 license headers in PHP files
## File Organization
```
/
├── api/ # REST API endpoints
│ ├── config/ # Database configuration
│ ├── objects/ # Data models
│ └── score/ # API endpoints
├── frontend/score/ # Vue.js application
│ ├── src/ # Source code
│ └── public/ # Static assets
├── Scripts/ # PHP page controllers
├── fpdf/ # PDF generation library
├── Imgs/ # Image assets
├── Textes/ # Text content files
└── index.php # Main entry point
```
## Database
MySQL database connection configured in `api/config/database.php`:
- Uses legacy `mysql_*` functions
- Database name: `ohmj2`
- Tables: `repertoire` (for scores)
## Error Handling
- PHP: Uses `@` error suppression operator in some places
- Vue: Uses try/catch with console.log for errors
- Return HTTP 200 on success in API responses
## Security Notes
- API uses `Access-Control-Allow-Origin: *` (CORS enabled for all)
- SQL queries use string concatenation (vulnerable to SQL injection)
- Database credentials stored in plain text in `api/config/database.php`
- Sanitize user inputs before database queries
## Git
- No CI/CD configured
- Commit to main branch
- Standard `.gitignore` for Node.js projects
## Dependencies
### Frontend
- Vue 2.6.11
- Bootstrap Vue 2.17.3
- Axios 0.21.0
- Vue CLI 4.5.0
### PHP
- FPDF library for PDF generation
- MySQL extension (legacy)
## Notes
- This is a legacy codebase with mixed coding styles
- Prefer consistency with existing code over strict style enforcement
- Site targets French-speaking users
- Production URL: `ohmj2.free.fr`
## Temporary Work Files
- Use `_builds/` directory for temporary scripts and working files
- Only `scripts/convert_final_v2.js` should be kept in the scripts folder (committed to git)
- CSV output files belong in `_builds/`