CognxSafeTrack commited on
Commit
3e52c7d
·
1 Parent(s): 752165b

feat(media): complete T4-T5 unique images — all T1-T5 tracks now have full image coverage

Browse files

T4 added (J3-J7):
- bes3_credibilite, bes4_organisation, bes5_stock
- bes6_cahier_cash, bes7_plan_action

T5 added (J1-J6):
- bes1_banque, bes2_5c_credit, bes3_chiffres
- bes4_garanties, bes5_pitch_financeur, bes6_certification

Total: 28 tracks × 2 langs = 56 days with unique imageUrls on R2
T1(13) + T2(7) + T3(8) + T4(7) + T5(6) = 41 unique images on R2

apps/api/src/scripts/upload-t4t5-final.ts ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import dotenv from 'dotenv';
2
+ dotenv.config({ path: '/Volumes/sms/edtech/.env' });
3
+
4
+ const { R2_ACCOUNT_ID, R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_PUBLIC_URL } = process.env;
5
+ if (!R2_ACCOUNT_ID || !R2_BUCKET || !R2_ACCESS_KEY_ID || !R2_SECRET_ACCESS_KEY || !R2_PUBLIC_URL) {
6
+ console.error('❌ Missing R2 credentials'); process.exit(1);
7
+ }
8
+
9
+ import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
10
+ import fs from 'fs';
11
+ import path from 'path';
12
+
13
+ const ARTIFACTS = '/Users/macbookair/.gemini/antigravity/brain/ea618d02-1ee0-47c1-a2b7-aed00a3604bc';
14
+ const TRACKS_DIR = '/Volumes/sms/edtech/packages/database/content/tracks';
15
+ const base = R2_PUBLIC_URL!.replace(/\/$/, '');
16
+
17
+ const client = new S3Client({
18
+ region: 'auto',
19
+ endpoint: `https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com`,
20
+ credentials: { accessKeyId: R2_ACCESS_KEY_ID!, secretAccessKey: R2_SECRET_ACCESS_KEY! },
21
+ });
22
+
23
+ const IMAGE_MAP = [
24
+ { src: 't4_j3_credibilite_1772319157261.png', r2: 'images/t4/bes3_credibilite.png', track: 'T4', day: 3 },
25
+ { src: 't4_j4_organisation_1772319168678.png', r2: 'images/t4/bes4_organisation.png', track: 'T4', day: 4 },
26
+ { src: 't4_j5_stock_1772319180883.png', r2: 'images/t4/bes5_stock.png', track: 'T4', day: 5 },
27
+ { src: 't4_j6_cahier_cash_1772319194657.png', r2: 'images/t4/bes6_cahier_cash.png', track: 'T4', day: 6 },
28
+ { src: 't4_j7_plan_action_1772319265677.png', r2: 'images/t4/bes7_plan_action.png', track: 'T4', day: 7 },
29
+ { src: 't5_j1_banque_1772319281497.png', r2: 'images/t5/bes1_banque.png', track: 'T5', day: 1 },
30
+ { src: 't5_j2_5c_credit_1772319295980.png', r2: 'images/t5/bes2_5c_credit.png', track: 'T5', day: 2 },
31
+ { src: 't5_j3_chiffres_1772319309609.png', r2: 'images/t5/bes3_chiffres.png', track: 'T5', day: 3 },
32
+ { src: 't5_j4_garanties_1772319396014.png', r2: 'images/t5/bes4_garanties.png', track: 'T5', day: 4 },
33
+ { src: 't5_j5_pitch_financeur_1772319407304.png', r2: 'images/t5/bes5_pitch_financeur.png', track: 'T5', day: 5 },
34
+ { src: 't5_j6_certification_1772319420509.png', r2: 'images/t5/bes6_certification.png', track: 'T5', day: 6 },
35
+ ];
36
+
37
+ async function upload(srcFile: string, r2Key: string): Promise<string> {
38
+ const buf = fs.readFileSync(path.join(ARTIFACTS, srcFile));
39
+ await client.send(new PutObjectCommand({
40
+ Bucket: R2_BUCKET!, Key: r2Key, Body: buf,
41
+ ContentType: 'image/png', CacheControl: 'public, max-age=31536000'
42
+ }));
43
+ return `${base}/${r2Key}`;
44
+ }
45
+
46
+ function inject(track: string, day: number, imageUrl: string) {
47
+ for (const lang of ['FR', 'WO']) {
48
+ const fp = path.join(TRACKS_DIR, `${track}-${lang}.json`);
49
+ if (!fs.existsSync(fp)) continue;
50
+ const data = JSON.parse(fs.readFileSync(fp, 'utf-8'));
51
+ for (const d of data.days) { if (d.dayNumber === day) d.imageUrl = imageUrl; }
52
+ fs.writeFileSync(fp, JSON.stringify(data, null, 2));
53
+ console.log(` 📝 ${track}-${lang}.json J${day} → ${imageUrl.split('/').pop()}`);
54
+ }
55
+ }
56
+
57
+ async function main() {
58
+ console.log(`\n🚀 Uploading ${IMAGE_MAP.length} images to R2...\n`);
59
+ let ok = 0;
60
+ for (const img of IMAGE_MAP) {
61
+ try {
62
+ const url = await upload(img.src, img.r2);
63
+ console.log(`✅ ${img.r2}`);
64
+ inject(img.track, img.day, url);
65
+ ok++;
66
+ } catch (e: any) {
67
+ console.error(`❌ ${img.r2}: ${e.message}`);
68
+ }
69
+ }
70
+ console.log(`\n✅ Done: ${ok}/${IMAGE_MAP.length} uploaded and injected.`);
71
+ }
72
+
73
+ main().catch(e => { console.error(e); process.exit(1); });
packages/database/content/tracks/T4-FR.json CHANGED
@@ -80,7 +80,7 @@
80
  }
81
  }
82
  },
83
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
84
  },
85
  {
86
  "dayNumber": 4,
@@ -102,7 +102,7 @@
102
  "title": "Pas du tout"
103
  }
104
  ],
105
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
106
  },
107
  {
108
  "dayNumber": 5,
@@ -130,7 +130,7 @@
130
  },
131
  "videoUrl": "https://r2.xamle.sn/videos/v5_3.mp4",
132
  "videoCaption": "📦 Stock : Bul bàyyi sa marchandise di gaañu !",
133
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
134
  },
135
  {
136
  "dayNumber": 6,
@@ -158,7 +158,7 @@
158
  },
159
  "videoUrl": "https://r2.xamle.sn/videos/v9_3.mp4",
160
  "videoCaption": "💸 Wave Business : Gérer son argent comme un pro !",
161
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
162
  },
163
  {
164
  "dayNumber": 7,
@@ -198,7 +198,7 @@
198
  ],
199
  "videoUrl": "https://r2.xamle.sn/videos/v10_1.mp4",
200
  "videoCaption": "🛡️ Sécurité : Épargne bi ngay muccé.",
201
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
202
  }
203
  ]
204
  }
 
80
  }
81
  }
82
  },
83
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes3_credibilite.png"
84
  },
85
  {
86
  "dayNumber": 4,
 
102
  "title": "Pas du tout"
103
  }
104
  ],
105
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes4_organisation.png"
106
  },
107
  {
108
  "dayNumber": 5,
 
130
  },
131
  "videoUrl": "https://r2.xamle.sn/videos/v5_3.mp4",
132
  "videoCaption": "📦 Stock : Bul bàyyi sa marchandise di gaañu !",
133
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes5_stock.png"
134
  },
135
  {
136
  "dayNumber": 6,
 
158
  },
159
  "videoUrl": "https://r2.xamle.sn/videos/v9_3.mp4",
160
  "videoCaption": "💸 Wave Business : Gérer son argent comme un pro !",
161
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes6_cahier_cash.png"
162
  },
163
  {
164
  "dayNumber": 7,
 
198
  ],
199
  "videoUrl": "https://r2.xamle.sn/videos/v10_1.mp4",
200
  "videoCaption": "🛡️ Sécurité : Épargne bi ngay muccé.",
201
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes7_plan_action.png"
202
  }
203
  ]
204
  }
packages/database/content/tracks/T4-WO.json CHANGED
@@ -80,7 +80,7 @@
80
  }
81
  }
82
  },
83
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
84
  },
85
  {
86
  "dayNumber": 4,
@@ -102,7 +102,7 @@
102
  "title": "Déet, amul"
103
  }
104
  ],
105
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
106
  },
107
  {
108
  "dayNumber": 5,
@@ -130,7 +130,7 @@
130
  },
131
  "videoUrl": "https://r2.xamle.sn/videos/v5_3.mp4",
132
  "videoCaption": "📦 Stock : Bul bàyyi sa marchandise di gaañu !",
133
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
134
  },
135
  {
136
  "dayNumber": 6,
@@ -158,7 +158,7 @@
158
  },
159
  "videoUrl": "https://r2.xamle.sn/videos/v9_3.mp4",
160
  "videoCaption": "💸 Wave Business : Gérer son argent comme un pro !",
161
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
162
  },
163
  {
164
  "dayNumber": 7,
@@ -198,7 +198,7 @@
198
  ],
199
  "videoUrl": "https://r2.xamle.sn/videos/v10_1.mp4",
200
  "videoCaption": "🛡️ Sécurité : Épargne bi ngay muccé.",
201
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
202
  }
203
  ]
204
  }
 
80
  }
81
  }
82
  },
83
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes3_credibilite.png"
84
  },
85
  {
86
  "dayNumber": 4,
 
102
  "title": "Déet, amul"
103
  }
104
  ],
105
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes4_organisation.png"
106
  },
107
  {
108
  "dayNumber": 5,
 
130
  },
131
  "videoUrl": "https://r2.xamle.sn/videos/v5_3.mp4",
132
  "videoCaption": "📦 Stock : Bul bàyyi sa marchandise di gaañu !",
133
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes5_stock.png"
134
  },
135
  {
136
  "dayNumber": 6,
 
158
  },
159
  "videoUrl": "https://r2.xamle.sn/videos/v9_3.mp4",
160
  "videoCaption": "💸 Wave Business : Gérer son argent comme un pro !",
161
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes6_cahier_cash.png"
162
  },
163
  {
164
  "dayNumber": 7,
 
198
  ],
199
  "videoUrl": "https://r2.xamle.sn/videos/v10_1.mp4",
200
  "videoCaption": "🛡️ Sécurité : Épargne bi ngay muccé.",
201
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t4/bes7_plan_action.png"
202
  }
203
  ]
204
  }
packages/database/content/tracks/T5-FR.json CHANGED
@@ -34,7 +34,7 @@
34
  },
35
  "videoUrl": "https://r2.xamle.sn/videos/v8_1.mp4",
36
  "videoCaption": "🚀 Croissance : Bul gawu dax !",
37
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
38
  },
39
  {
40
  "dayNumber": 2,
@@ -56,7 +56,7 @@
56
  "title": "Capital propre"
57
  }
58
  ],
59
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
60
  },
61
  {
62
  "dayNumber": 3,
@@ -84,7 +84,7 @@
84
  },
85
  "videoUrl": "https://r2.xamle.sn/videos/v8_2.mp4",
86
  "videoCaption": "🏁 Indicateurs : Xoolal sa tableau de bord.",
87
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
88
  },
89
  {
90
  "dayNumber": 4,
@@ -110,7 +110,7 @@
110
  }
111
  }
112
  },
113
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
114
  },
115
  {
116
  "dayNumber": 5,
@@ -150,7 +150,7 @@
150
  "format": "3_lines"
151
  }
152
  },
153
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
154
  },
155
  {
156
  "dayNumber": 6,
@@ -180,7 +180,7 @@
180
  "B_MODULE_5_OK",
181
  "B_GRADUATED_XAMLE"
182
  ],
183
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
184
  }
185
  ]
186
  }
 
34
  },
35
  "videoUrl": "https://r2.xamle.sn/videos/v8_1.mp4",
36
  "videoCaption": "🚀 Croissance : Bul gawu dax !",
37
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes1_banque.png"
38
  },
39
  {
40
  "dayNumber": 2,
 
56
  "title": "Capital propre"
57
  }
58
  ],
59
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes2_5c_credit.png"
60
  },
61
  {
62
  "dayNumber": 3,
 
84
  },
85
  "videoUrl": "https://r2.xamle.sn/videos/v8_2.mp4",
86
  "videoCaption": "🏁 Indicateurs : Xoolal sa tableau de bord.",
87
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes3_chiffres.png"
88
  },
89
  {
90
  "dayNumber": 4,
 
110
  }
111
  }
112
  },
113
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes4_garanties.png"
114
  },
115
  {
116
  "dayNumber": 5,
 
150
  "format": "3_lines"
151
  }
152
  },
153
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes5_pitch_financeur.png"
154
  },
155
  {
156
  "dayNumber": 6,
 
180
  "B_MODULE_5_OK",
181
  "B_GRADUATED_XAMLE"
182
  ],
183
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes6_certification.png"
184
  }
185
  ]
186
  }
packages/database/content/tracks/T5-WO.json CHANGED
@@ -34,7 +34,7 @@
34
  },
35
  "videoUrl": "https://r2.xamle.sn/videos/v8_1.mp4",
36
  "videoCaption": "🚀 Croissance : Bul gawu dax !",
37
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
38
  },
39
  {
40
  "dayNumber": 2,
@@ -56,7 +56,7 @@
56
  "title": "Am naa capital"
57
  }
58
  ],
59
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
60
  },
61
  {
62
  "dayNumber": 3,
@@ -84,7 +84,7 @@
84
  },
85
  "videoUrl": "https://r2.xamle.sn/videos/v8_2.mp4",
86
  "videoCaption": "🏁 Indicateurs : Xoolal sa tableau de bord.",
87
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
88
  },
89
  {
90
  "dayNumber": 4,
@@ -110,7 +110,7 @@
110
  }
111
  }
112
  },
113
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
114
  },
115
  {
116
  "dayNumber": 5,
@@ -150,7 +150,7 @@
150
  "format": "3_lines"
151
  }
152
  },
153
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
154
  },
155
  {
156
  "dayNumber": 6,
@@ -180,7 +180,7 @@
180
  "B_MODULE_5_OK",
181
  "B_GRADUATED_XAMLE"
182
  ],
183
- "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t1/bes1_activity.png"
184
  }
185
  ]
186
  }
 
34
  },
35
  "videoUrl": "https://r2.xamle.sn/videos/v8_1.mp4",
36
  "videoCaption": "🚀 Croissance : Bul gawu dax !",
37
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes1_banque.png"
38
  },
39
  {
40
  "dayNumber": 2,
 
56
  "title": "Am naa capital"
57
  }
58
  ],
59
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes2_5c_credit.png"
60
  },
61
  {
62
  "dayNumber": 3,
 
84
  },
85
  "videoUrl": "https://r2.xamle.sn/videos/v8_2.mp4",
86
  "videoCaption": "🏁 Indicateurs : Xoolal sa tableau de bord.",
87
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes3_chiffres.png"
88
  },
89
  {
90
  "dayNumber": 4,
 
110
  }
111
  }
112
  },
113
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes4_garanties.png"
114
  },
115
  {
116
  "dayNumber": 5,
 
150
  "format": "3_lines"
151
  }
152
  },
153
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes5_pitch_financeur.png"
154
  },
155
  {
156
  "dayNumber": 6,
 
180
  "B_MODULE_5_OK",
181
  "B_GRADUATED_XAMLE"
182
  ],
183
+ "imageUrl": "https://pub-e770286d75114b3691f9142d5e451a41.r2.dev/images/t5/bes6_certification.png"
184
  }
185
  ]
186
  }