Initial commit
This commit is contained in:
109
docs/concepts/16-NOTIFICATION.md
Normal file
109
docs/concepts/16-NOTIFICATION.md
Normal file
@@ -0,0 +1,109 @@
|
||||
# 🔔 CONCEPT: NOTIFICATION
|
||||
|
||||
## 📌 Vue d'ensemble
|
||||
|
||||
Le concept **NOTIFICATION** gère les notifications système pour alerter les utilisateurs d'événements importants.
|
||||
|
||||
**Importance**: ⭐⭐ (Concept utile)
|
||||
|
||||
---
|
||||
|
||||
## 🗂️ Fichiers concernés
|
||||
|
||||
### **Entités JPA**
|
||||
| Fichier | Description |
|
||||
|---------|-------------|
|
||||
| `Notification.java` | Entité principale notification |
|
||||
| `TypeNotification.java` | Enum types |
|
||||
| `PrioriteNotification.java` | Enum priorités |
|
||||
|
||||
### **Services**
|
||||
| Fichier | Description |
|
||||
|---------|-------------|
|
||||
| `NotificationService.java` | Service métier notifications |
|
||||
|
||||
### **Resources**
|
||||
| Fichier | Description |
|
||||
|---------|-------------|
|
||||
| `NotificationResource.java` | API REST notifications |
|
||||
|
||||
---
|
||||
|
||||
## 📊 Modèle de données
|
||||
|
||||
```java
|
||||
@Entity
|
||||
@Table(name = "notifications")
|
||||
public class Notification extends PanacheEntityBase {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
private User user;
|
||||
|
||||
@Column(name = "titre", nullable = false)
|
||||
private String titre;
|
||||
|
||||
@Column(name = "message", length = 1000)
|
||||
private String message;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "type")
|
||||
private TypeNotification type;
|
||||
|
||||
@Column(name = "lue")
|
||||
private Boolean lue = false;
|
||||
|
||||
@Column(name = "date_creation")
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
@Column(name = "date_lecture")
|
||||
private LocalDateTime dateLecture;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔌 API REST
|
||||
|
||||
### **Endpoints**
|
||||
|
||||
| Méthode | Endpoint | Description |
|
||||
|---------|----------|-------------|
|
||||
| GET | `/api/v1/notifications` | Liste notifications |
|
||||
| GET | `/api/v1/notifications/non-lues` | Non lues |
|
||||
| PUT | `/api/v1/notifications/{id}/lire` | Marquer comme lue |
|
||||
| PUT | `/api/v1/notifications/tout-lire` | Tout marquer comme lu |
|
||||
| DELETE | `/api/v1/notifications/{id}` | Supprimer |
|
||||
|
||||
---
|
||||
|
||||
## 💻 Exemples
|
||||
|
||||
### **Notifications non lues**
|
||||
|
||||
```bash
|
||||
curl -X GET http://localhost:8080/api/v1/notifications/non-lues
|
||||
```
|
||||
|
||||
**Réponse**:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "uuid",
|
||||
"titre": "Stock faible",
|
||||
"message": "Le stock de ciment est en dessous du seuil minimum",
|
||||
"type": "ALERTE",
|
||||
"lue": false,
|
||||
"dateCreation": "2025-09-30T10:00:00"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Dernière mise à jour**: 2025-09-30
|
||||
**Version**: 1.0
|
||||
|
||||
Reference in New Issue
Block a user