From abc91b3b17d81588a21ca575438c3468bc191d0c Mon Sep 17 00:00:00 2001
From: Steve <steve.magne@gmail.com>
Date: Sat, 14 Dec 2024 21:56:00 -0400
Subject: [PATCH] =?UTF-8?q?Ajout=20des=20instructions=20personnalis=C3=A9e?=
 =?UTF-8?q?s=20pour=20Copilot=20et=20configuration=20des=20workflows=20CI/?=
 =?UTF-8?q?CD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .github/copilot-instructions.md | 98 +++++++++++++++++++++++++++++++++
 .github/workflows/ci.yml        | 36 ++++++++++++
 .github/workflows/deploy.yml    | 51 +++++++++++++++++
 README.md                       | 82 ++++++++++++++++++++++++++-
 4 files changed, 265 insertions(+), 2 deletions(-)
 create mode 100644 .github/copilot-instructions.md
 create mode 100644 .github/workflows/ci.yml
 create mode 100644 .github/workflows/deploy.yml

diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
new file mode 100644
index 0000000..9285d7b
--- /dev/null
+++ b/.github/copilot-instructions.md
@@ -0,0 +1,98 @@
+
+# Custom Instructions for Copilot
+
+## General Instructions
+
+- **Naming**: Use explicit names for variables and functions.
+- **Structure**: Ensure modular and well-organized architecture.
+- **Security**: Protect against vulnerabilities such as XSS, CSRF, and others.
+- **SOLID**: Adhere to SOLID principles.
+- **Imports**: When generating code, add the import if it is missing.
+
+## Front-end Instructions
+
+- **User Friendly**: Intuitive, easy-to-use, and modern interface.
+- **Accessibility**: WAG 2.1.1 (A) - Interactive components are keyboard accessible.
+- **Responsive Design**: Mobile First approach.
+- **Performance**: Lighthouse score of 90+.
+- **SEO**: Use HTML5 semantic tags and metadata. Implement sitemap, robots.txt, Open Graph, Twitter Card, etc.
+- **Internationalization**: Support for American English and French with i18n.
+- **CSS Framework**: Bootstrap 5.
+- **JavaScript Framework**: Vue.js 3 (Composition API).
+- **Tests**: Jest.
+- **Design Pattern**: Atomic Design.
+- **Type Checking**: TypeScript.
+- **UI**: Modern and minimalist.
+
+## Back-end Instructions
+
+- **REST API**: Follow REST principles and best practices.
+- **Tests**: Unit tests with pyTest and 80% code coverage.
+- **Exception Handling**: Proper exception management. Add comments to list possible causes of exceptions and always provide clear error messages.
+  - Explicitly re-raise using `raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail='An error occurred while checking login attempts') from e`.
+  - Explicitly re-raise using `except Exception as exc` and `raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='Token has expired') from exc`.
+- **Validation**: Validate input and output data with Pydantic V2.
+- **ORM**: Use SQLAlchemy V2.
+- **Dependencies**: Use Poetry for dependency management.
+- **Naming Conventions**: Follow PEP8 naming conventions.
+- **Logger**: Use the singleton logger from `from app.core.logger_config import logger` for logging.
+
+### Architecture
+
+- Separation of concerns: Use a layered architecture (Controllers, Services, Repositories).
+- Centralized session management.
+- Dependency injection.
+- Consistent use of HTTP status codes.
+
+## Pydantic Schema
+
+- Class Naming: `ModelNameSchema`.
+- Link with Postgres:
+
+```python
+model_config = {"from_attributes": True}
+```
+
+- Add necessary validations:
+
+```python
+from pydantic import BaseModel, Field, field_validator
+
+@field_validator('coach_apply_date', mode='before')
+@classmethod
+def parse_coach_date(cls, value):
+    ...
+```
+
+## API Endpoints
+
+- Example of a standard route:
+
+```python
+from fastapi import APIRouter, HTTPException, status
+from sqlalchemy.exc import IntegrityError
+
+@router.delete(
+    "/themes/{theme_id}",
+    status_code=status.HTTP_204_NO_CONTENT,
+    response_model=None,
+    responses={
+        404: {"description": "Theme not found"},
+        403: {"description": "Not enough permissions"},
+        409: {"description": "Theme cannot be deleted - has dependencies"}
+    }
+)
+@role_required(UserRole.COACH)
+async def delete_theme(
+    theme_id: int,
+    db: AsyncSession = Depends(get_db),
+    current_user: User = Depends(get_current_user)
+):
+    try:
+        await theme_service.delete(theme_id)
+    except IntegrityError:
+        raise HTTPException(
+            status_code=status.HTTP_409_CONFLICT,
+            detail="Theme cannot be deleted as it has associated content"
+        )
+```
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..4d6be9a
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,36 @@
+name: CI
+
+on:
+  push:
+    branches: [ main ]
+  pull_request:
+    branches: [ main ]
+  workflow_dispatch:
+
+permissions:
+  contents: read
+  pages: write
+  id-token: write
+
+jobs:
+  lint-and-build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+
+      - name: Set up Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: '20'
+          cache: 'npm'
+
+      - name: Install dependencies
+        run: npm install
+
+      - name: Run linter
+        run: npm run lint
+
+      - name: Build Project
+        run: npm run build
+
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..778b67d
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,51 @@
+name: Deploy to GitHub Pages
+
+on:
+  push:
+    branches: [ main ]
+  workflow_dispatch:
+
+permissions:
+  contents: read
+  pages: write
+  id-token: write
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Setup Node
+        uses: actions/setup-node@v4
+        with:
+          node-version: '20'
+          cache: 'npm'
+
+      - name: Setup Pages
+        uses: actions/configure-pages@v5
+
+      - name: Install dependencies
+        run: npm ci
+
+      - name: Build project
+        run: npm run build
+
+      - name: Upload artifact
+        uses: actions/upload-pages-artifact@v3
+        with:
+          path: './dist'
+
+  deploy:
+    needs: build
+    runs-on: ubuntu-latest
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+
+    steps:
+      - name: Deploy to GitHub Pages
+        id: deployment
+        uses: actions/deploy-pages@v4
\ No newline at end of file
diff --git a/README.md b/README.md
index 9d1c842..fd32966 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,81 @@
-# json-template-generator
+# JSON Template Generator
 
-[Edit in StackBlitz next generation editor ⚡️](https://stackblitz.com/~/github.com/MovingLive/json-template-generator)
\ No newline at end of file
+Un générateur de modèles JSON interactif et intuitif développé avec React et TypeScript.
+
+## 🌟 Caractéristiques
+
+- Génération automatique de modèles JSON à partir de données existantes
+- Interface utilisateur moderne et réactive
+- Support du glisser-déposer pour les fichiers JSON
+- Validation JSON en temps réel
+- Copie en un clic et export des modèles générés
+- Interface responsive et accessible
+
+## 🔍 Architecture
+
+```mermaid
+graph TB
+    UI[Interface Utilisateur]
+    JsonInput[Composant JsonInput] --> UI
+    JsonOutput[Composant JsonOutput] --> UI
+    Utils[jsonUtils] --> UI
+    Types[Types JSON] --> UI
+
+    JsonInput --> Types
+    JsonOutput --> Types
+    Utils --> Types
+
+    style UI fill:#ddf,stroke:#333
+    style JsonInput fill:#fdd,stroke:#333
+    style JsonOutput fill:#fdd,stroke:#333
+    style Utils fill:#dfd,stroke:#333
+    style Types fill:#ffd,stroke:#333
+```
+
+## 🚀 Démarrage Rapide
+
+### Installation
+
+### Développement
+
+### Production
+
+## 🛠️ Technologies
+
+- React 18
+- TypeScript
+- Tailwind CSS
+- Vite
+- Lucide React Icons
+
+## 📚 Structure du Projet
+
+## 🔄 Flux de Travail
+
+1. Entrez ou uploadez votre JSON source
+2. Vérification automatique de la validité
+3. Génération du modèle avec types préservés
+4. Export ou copie du résultat
+
+## 🌐 Demo en Ligne
+
+- Editer sur StackBlitz ⚡️
+
+## 📦 Scripts Disponibles
+
+- `npm run dev` - Lance le serveur de développement
+- `npm run build` - Compile pour la production
+- `npm run lint` - Vérifie le code
+- `npm run preview` - Prévisualise la version de production
+
+## 🤝 Contribution
+
+1. Forkez le projet
+2. Créez votre branche (`git checkout -b feature/AmazingFeature`)
+3. Commitez vos changements (`git commit -m 'Add some AmazingFeature'`)
+4. Poussez vers la branche (`git push origin feature/AmazingFeature`)
+5. Ouvrez une Pull Request
+
+## 📝 Licence
+
+Distribué sous la licence MIT. Voir LICENSE pour plus d'informations.