update roadmap view and classification by epic/theme

This commit is contained in:
feeling committed 2026-12-03 13:52:16 +01:00
1 parent 5ffd56b020
commit 6b7a4e452d
4 files changed
+151 -45

No files matched your search

+14 -9
View File
@@ -146,11 +146,9 @@ app.post('/api/extract', async (req, res) => {
if (id) customFieldsMap.push({ id, label: label || id });
});
}
const fieldsToRequest = [
...standardFields,
...customFieldsMap.map(cf => cf.id)
].join(',');
const epicThemeField = customFieldsMap.find(cf => cf.id === 'customfield_10202');
if (epicThemeField) epicThemeField.label = 'Epic/Theme';
else customFieldsMap.push({ id: 'customfield_10202', label: 'Epic/Theme' });
const queryJql = jql || `project = "${projectKey}" ORDER BY created DESC`;
@@ -161,6 +159,11 @@ app.post('/api/extract', async (req, res) => {
try {
console.log(`[EXTRACT] Début pour ${projectKey} (JQL: ${queryJql.substring(0, 50)}...)`);
const fieldsToRequest = [
...standardFields,
...customFieldsMap.map(cf => cf.id)
].join(',');
// Pagination automatique
while (true) {
const response = await jiraClient.get('/rest/api/2/search', {
@@ -212,7 +215,9 @@ app.post('/api/extract', async (req, res) => {
// Ajout des champs personnalisés
customFieldsMap.forEach(cf => {
const val = f[cf.id];
if (val !== null && val !== undefined) {
if (cf.id === 'customfield_10202') {
ticket[cf.label] = Array.isArray(val) ? val : [];
} else if (val !== null && val !== undefined) {
// Pour les dates Jira, formater proprement
if (typeof val === 'string' && (val.match(/^\d{4}-\d{2}-\d{2}/) || val.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/))) {
ticket[cf.label] = val;
@@ -232,7 +237,7 @@ app.post('/api/extract', async (req, res) => {
}
console.log(`[EXTRACT] Terminé. ${allTickets.length} tickets extraits.`);
res.json({ success: true, total: allTickets.length, tickets: allTickets });
res.json({ success: true, total: allTickets.length, tickets: allTickets, customFieldsMap });
} catch (error) {
console.error('[EXTRACT ERROR]', error.response?.data || error.message);
@@ -345,14 +350,14 @@ app.put('/api/update', async (req, res) => {
} catch (error) {
console.error('[UPDATE ERROR]', error.response?.data || error.message);
res.status(error.response?.status || 500).json({
error: error.response?.data?.errorMessages?.[0] || error.message,
error: error.response?.data?.errorMessages?.[0] || Object.values(error.response?.data?.errors || {})[0] || error.message,
details: error.response?.data || null
});
}
});
// Démarrage
const PORT = config.server?.port || 3000;
const PORT = process.env.PORT || config.server?.port || 3000;
app.listen(PORT, '0.0.0.0', () => {
console.log('');
console.log('============================================');