Initial commit
This commit is contained in:
117
scripts/generate-logos.py
Normal file
117
scripts/generate-logos.py
Normal file
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Script pour générer les logos BTPXpress dans différentes variantes
|
||||
"""
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import os
|
||||
|
||||
def create_logo_base(width, height, bg_color, text_color, border_color=None):
|
||||
"""Crée un logo de base BTPXpress"""
|
||||
img = Image.new('RGBA', (width, height), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Calculer les dimensions du badge
|
||||
badge_size = min(width, height) - 10
|
||||
badge_x = (width - badge_size) // 2
|
||||
badge_y = (height - badge_size) // 2
|
||||
|
||||
# Dessiner le badge principal
|
||||
draw.rounded_rectangle(
|
||||
[badge_x, badge_y, badge_x + badge_size, badge_y + badge_size],
|
||||
radius=badge_size // 8,
|
||||
fill=bg_color,
|
||||
outline=border_color,
|
||||
width=2 if border_color else 0
|
||||
)
|
||||
|
||||
# Calculer la taille de police
|
||||
font_size = badge_size // 3
|
||||
try:
|
||||
font = ImageFont.truetype("arial.ttf", font_size)
|
||||
except:
|
||||
font = ImageFont.load_default()
|
||||
|
||||
# Dessiner le texte "BTP"
|
||||
text = "BTP"
|
||||
bbox = draw.textbbox((0, 0), text, font=font)
|
||||
text_width = bbox[2] - bbox[0]
|
||||
text_height = bbox[3] - bbox[1]
|
||||
|
||||
text_x = badge_x + (badge_size - text_width) // 2
|
||||
text_y = badge_y + (badge_size - text_height) // 2
|
||||
|
||||
draw.text((text_x, text_y), text, fill=text_color, font=font)
|
||||
|
||||
return img
|
||||
|
||||
def create_appname_base(width, height, text_color, bg_transparent=True):
|
||||
"""Crée le nom de l'application BTPXpress"""
|
||||
bg_color = (0, 0, 0, 0) if bg_transparent else (255, 255, 255, 255)
|
||||
img = Image.new('RGBA', (width, height), bg_color)
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Calculer la taille de police
|
||||
font_size = height // 2
|
||||
try:
|
||||
font = ImageFont.truetype("arial.ttf", font_size)
|
||||
except:
|
||||
font = ImageFont.load_default()
|
||||
|
||||
# Dessiner le texte "Xpress"
|
||||
text = "Xpress"
|
||||
bbox = draw.textbbox((0, 0), text, font=font)
|
||||
text_width = bbox[2] - bbox[0]
|
||||
text_height = bbox[3] - bbox[1]
|
||||
|
||||
text_x = (width - text_width) // 2
|
||||
text_y = (height - text_height) // 2
|
||||
|
||||
draw.text((text_x, text_y), text, fill=text_color, font=font)
|
||||
|
||||
return img
|
||||
|
||||
def generate_all_logos():
|
||||
"""Génère tous les logos nécessaires"""
|
||||
output_dir = "../public/layout/images/logo"
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# Couleurs BTPXpress
|
||||
orange = (249, 115, 22, 255) # #f97316
|
||||
white = (255, 255, 255, 255)
|
||||
black = (0, 0, 0, 255)
|
||||
gray = (107, 114, 128, 255) # #6b7280
|
||||
|
||||
# Dimensions basées sur les fichiers existants
|
||||
logo_size = (64, 64) # Taille standard pour les logos
|
||||
appname_size = (120, 24) # Taille pour le nom de l'app
|
||||
|
||||
# Générer les logos principaux
|
||||
logos = {
|
||||
'logo-light.png': create_logo_base(*logo_size, white, orange, orange),
|
||||
'logo-dark.png': create_logo_base(*logo_size, orange, white),
|
||||
'logo-gray.png': create_logo_base(*logo_size, gray, white),
|
||||
}
|
||||
|
||||
# Générer les noms d'application
|
||||
appnames = {
|
||||
'appname-light.png': create_appname_base(*appname_size, white),
|
||||
'appname-dark.png': create_appname_base(*appname_size, black),
|
||||
'appname-gray.png': create_appname_base(*appname_size, gray),
|
||||
}
|
||||
|
||||
# Créer un logo principal optimisé pour remplacer btpxpress-logo.png
|
||||
main_logo = create_logo_base(128, 128, orange, white)
|
||||
|
||||
# Sauvegarder tous les fichiers
|
||||
all_images = {**logos, **appnames, 'btpxpress-logo-optimized.png': main_logo}
|
||||
|
||||
for filename, img in all_images.items():
|
||||
filepath = os.path.join(output_dir, filename)
|
||||
img.save(filepath, 'PNG', optimize=True)
|
||||
print(f"✅ Généré: {filename}")
|
||||
|
||||
print(f"\n🎉 Tous les logos ont été générés dans {output_dir}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate_all_logos()
|
||||
103
scripts/test-api.js
Normal file
103
scripts/test-api.js
Normal file
@@ -0,0 +1,103 @@
|
||||
// Script de test pour vérifier la connectivité API et créer des données de test
|
||||
|
||||
const API_BASE_URL = 'http://localhost:8080/api/v1';
|
||||
|
||||
async function testAPI() {
|
||||
console.log('🚀 Test de connectivité API BTPXpress...\n');
|
||||
|
||||
try {
|
||||
// Test 1: Vérifier la santé de l'API
|
||||
console.log('1. Test de santé de l\'API...');
|
||||
const healthResponse = await fetch(`${API_BASE_URL}/health`);
|
||||
console.log(` Status: ${healthResponse.status}`);
|
||||
|
||||
// Test 2: Lister les chantiers
|
||||
console.log('\n2. Test GET /api/v1/chantiers...');
|
||||
const chantiersResponse = await fetch(`${API_BASE_URL}/chantiers`);
|
||||
console.log(` Status: ${chantiersResponse.status}`);
|
||||
const chantiers = await chantiersResponse.json();
|
||||
console.log(` Nombre de chantiers: ${chantiers.length}`);
|
||||
|
||||
// Test 3: Lister les clients
|
||||
console.log('\n3. Test GET /api/clients...');
|
||||
const clientsResponse = await fetch(`${API_BASE_URL}/clients`);
|
||||
console.log(` Status: ${clientsResponse.status}`);
|
||||
const clients = await clientsResponse.json();
|
||||
console.log(` Nombre de clients: ${clients.length}`);
|
||||
|
||||
// Test 4: Créer un client de test si aucun n'existe
|
||||
if (clients.length === 0) {
|
||||
console.log('\n4. Création d\'un client de test...');
|
||||
const clientData = {
|
||||
nom: 'Client Test',
|
||||
email: 'test@btpxpress.dev',
|
||||
telephone: '0123456789',
|
||||
adresse: '123 Rue de Test',
|
||||
ville: 'Paris',
|
||||
codePostal: '75001',
|
||||
typeClient: 'PARTICULIER',
|
||||
actif: true
|
||||
};
|
||||
|
||||
const createClientResponse = await fetch(`${API_BASE_URL}/clients`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(clientData)
|
||||
});
|
||||
|
||||
console.log(` Status: ${createClientResponse.status}`);
|
||||
if (createClientResponse.ok) {
|
||||
const newClient = await createClientResponse.json();
|
||||
console.log(` Client créé avec ID: ${newClient.id}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Test 5: Créer un chantier de test si aucun n'existe
|
||||
if (chantiers.length === 0 && clients.length > 0) {
|
||||
console.log('\n5. Création d\'un chantier de test...');
|
||||
const chantierData = {
|
||||
nom: 'Chantier Test',
|
||||
description: 'Chantier de démonstration',
|
||||
adresse: '456 Avenue de Test',
|
||||
ville: 'Lyon',
|
||||
codePostal: '69001',
|
||||
clientId: clients[0].id,
|
||||
statut: 'EN_PREPARATION',
|
||||
typeChantier: 'CONSTRUCTION_NEUVE',
|
||||
dateDebutPrevue: new Date().toISOString(),
|
||||
dateFinPrevue: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(),
|
||||
budgetPrevisionnel: 50000,
|
||||
pourcentageAvancement: 0,
|
||||
actif: true
|
||||
};
|
||||
|
||||
const createChantierResponse = await fetch(`${API_BASE_URL}/chantiers`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(chantierData)
|
||||
});
|
||||
|
||||
console.log(` Status: ${createChantierResponse.status}`);
|
||||
if (createChantierResponse.ok) {
|
||||
const newChantier = await createChantierResponse.json();
|
||||
console.log(` Chantier créé avec ID: ${newChantier.id}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\n✅ Tests API terminés avec succès !');
|
||||
|
||||
} catch (error) {
|
||||
console.error('\n❌ Erreur lors des tests API:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Exécuter les tests si le script est appelé directement
|
||||
if (typeof window === 'undefined') {
|
||||
testAPI();
|
||||
}
|
||||
|
||||
module.exports = { testAPI };
|
||||
Reference in New Issue
Block a user