Gérez vos clients, contrats & événements depuis un simple terminal – en toute sécurité, avec journalisation Sentry.
- Pré‑requis
- Installation pas‑à‑pas
- Configuration
.env
- Initialiser la base & données de démo
- Lancer l’application
- Vérifier l’intégration Sentry
- 🎯 Tests, couverture & qualité
- 🗺️ Schéma SQL (ERD)
- 🤝 Contribuer
Outil | Version mini | Pourquoi ? |
---|---|---|
Python | 3.12 |
langage principal |
MySQL / MariaDB | 5.7+ |
base de données (prod & tests d’intégration) |
Git | – | cloner le dépôt |
git clone https://github.com/VincentDesmouceaux/P12_Epic-Events.git
cd P12_Epic-Events
cp .env.example .env
puis ouvrez .env et remplissez vos vraies valeurs
pipx install pipenv
pipenv install
pipenv shell
DB_ENGINE=mysql+pymysql
DB_USER=epicuser
DB_PASSWORD=
DB_HOST=localhost
DB_PORT=3306
DB_NAME=epic_db
SENTRY_DSN=<votre_dsn_sentry>
SENTRY_ENV=prod
SENTRY_TRACES=1.0
SENTRY_PROFILE=1.0
SENTRY_SEND_PII=true
JWT_SECRET=
JWT_ALGORITHM=
JWT_EXPIRATION_MINUTES=
mysql -u root -p
mysql> DROP DATABASE IF EXISTS epic_db;
mysql> DROP USER IF EXISTS 'epicuser'@'localhost';
mysql> CREATE DATABASE epic_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
mysql> SHOW VARIABLES LIKE 'validate_password.policy';
mysql> SET GLOBAL validate_password.policy = 0;
mysql> SET GLOBAL validate_password.length = 8;
mysql> CREATE USER 'epicuser'@'%' IDENTIFIED BY 'some_strong_password';
mysql> GRANT ALL PRIVILEGES ON epic_db.* TO 'epicuser'@'%';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
python3 -m main (cela aura pour effet d'initialiser les données de seed_db.py)
Utiliser les informations se trouvant dans les données d'exemple du fichier seed_db.py pour tester l'application.
Test | Variable d’environnement | Commande à exécuter | Résultat attendu dans Sentry |
---|---|---|---|
Ping (simple message) | SENTRY_TEST=ping |
SENTRY_TEST=ping python -m main |
Nouveau event de type message intitulé “Sentry ping …” (niveau info) |
Exception volontaire | SENTRY_TEST=1 |
SENTRY_TEST=1 python -m main |
Un event error “ZeroDivisionError: division by zero” |
⚠️ Les variables d’environnement doivent être placées avant la commande Python (elles ne sont valables que pour cette exécution).
python3 -m unittest discover -s tests
flake8
pipenv run coverage run -m unittest discover -s tests
pipenv run coverage html
ROLE ||--o{ USER : "1‑n"
USER ||--o{ CLIENT : "1‑n (commercial_id)"
USER ||--o{ CONTRACT : "1‑n (commercial_id)"
USER ||--o{ EVENT : "1‑n (support_id)"
CLIENT ||--o{ CONTRACT : "1‑n"
CONTRACT ||--|{ EVENT : "1‑1"
ROLE {
int id PK
varchar name UNIQUE
varchar description
}
USER {
int id PK
varchar employee_number UNIQUE
varchar first_name
varchar last_name
varchar email UNIQUE
varchar password_hash
int role_id FK→ROLE.id
}
CLIENT {
int id PK
varchar full_name
varchar email
varchar phone
varchar company_name
datetime date_created
datetime date_last_contact
int commercial_id FK→USER.id
}
CONTRACT {
int id PK
float total_amount
float remaining_amount
datetime date_created
bool is_signed
int client_id FK→CLIENT.id
int commercial_id FK→USER.id
}
EVENT {
int id PK
datetime date_start
datetime date_end
varchar location
int attendees
text notes
int contract_id FK→CONTRACT.id
int support_id FK→USER.id (nullable)
}
-
Fork puis créez une branche (
feat/ma-feature
) -
Installez les dépendances : pipenv install --dev
-
Codez !💚
-
Open Pull‑Request ✨
Happy coding & have an Epic day ! 🚀