112 lines
2.8 KiB
TypeScript
112 lines
2.8 KiB
TypeScript
// Service de génération de données de test pour le développement
|
|
// Ce fichier fournit des données factices pour les tests et le développement
|
|
|
|
export interface TestClient {
|
|
id: number;
|
|
nom: string;
|
|
prenom: string;
|
|
email: string;
|
|
telephone: string;
|
|
}
|
|
|
|
export interface TestChantier {
|
|
id: number;
|
|
nom: string;
|
|
type: string;
|
|
client: TestClient;
|
|
dateDebut: Date;
|
|
dateFin?: Date;
|
|
statut: string;
|
|
}
|
|
|
|
export interface TestPhase {
|
|
id: number;
|
|
nom: string;
|
|
description: string;
|
|
chantierId: number;
|
|
ordre: number;
|
|
statut: string;
|
|
dateDebut?: Date;
|
|
dateFin?: Date;
|
|
prerequis?: number[];
|
|
}
|
|
|
|
class TestDataService {
|
|
generateTestClient(id: number): TestClient {
|
|
return {
|
|
id,
|
|
nom: `Client${id}`,
|
|
prenom: `Prénom${id}`,
|
|
email: `client${id}@example.com`,
|
|
telephone: `+33 6 00 00 00 ${id.toString().padStart(2, '0')}`
|
|
};
|
|
}
|
|
|
|
generateTestChantier(id: number, type: string, client: TestClient): TestChantier {
|
|
return {
|
|
id,
|
|
nom: `Chantier ${type} ${id}`,
|
|
type,
|
|
client,
|
|
dateDebut: new Date(),
|
|
statut: 'EN_COURS'
|
|
};
|
|
}
|
|
|
|
generatePhasesWithPrerequisites(chantier: TestChantier): TestPhase[] {
|
|
const phases: TestPhase[] = [
|
|
{
|
|
id: 1,
|
|
nom: 'Préparation du terrain',
|
|
description: 'Terrassement et préparation',
|
|
chantierId: chantier.id,
|
|
ordre: 1,
|
|
statut: 'TERMINE',
|
|
prerequis: []
|
|
},
|
|
{
|
|
id: 2,
|
|
nom: 'Fondations',
|
|
description: 'Coulage des fondations',
|
|
chantierId: chantier.id,
|
|
ordre: 2,
|
|
statut: 'EN_COURS',
|
|
prerequis: [1]
|
|
},
|
|
{
|
|
id: 3,
|
|
nom: 'Élévation des murs',
|
|
description: 'Construction des murs porteurs',
|
|
chantierId: chantier.id,
|
|
ordre: 3,
|
|
statut: 'A_FAIRE',
|
|
prerequis: [2]
|
|
},
|
|
{
|
|
id: 4,
|
|
nom: 'Charpente',
|
|
description: 'Pose de la charpente',
|
|
chantierId: chantier.id,
|
|
ordre: 4,
|
|
statut: 'A_FAIRE',
|
|
prerequis: [3]
|
|
},
|
|
{
|
|
id: 5,
|
|
nom: 'Couverture',
|
|
description: 'Pose de la toiture',
|
|
chantierId: chantier.id,
|
|
ordre: 5,
|
|
statut: 'A_FAIRE',
|
|
prerequis: [4]
|
|
}
|
|
];
|
|
|
|
return phases;
|
|
}
|
|
}
|
|
|
|
const testDataService = new TestDataService();
|
|
export default testDataService;
|
|
|