|
1 | 1 | import type { CreateCVDto } from "src/cvs/dto/create-cv.dto"; |
2 | | -import { sortByStartDateAsc } from "src/shared/utils"; |
| 2 | +import { sortByDate } from "src/shared/utils"; |
3 | 3 |
|
4 | 4 | import type { LocaleContent } from "../locales"; |
5 | 5 |
|
|
272 | 272 | ? ` |
273 | 273 | <section> |
274 | 274 | <h2>${localeContent.Experience}</h2> |
275 | | -${sortByStartDateAsc(dto.experience) |
| 275 | +${sortByDate(dto.experience, (e) => e.startDate, "desc") |
276 | 276 | .map( |
277 | 277 | (e) => ` |
278 | 278 | <div class="item"> |
|
294 | 294 | ? ` |
295 | 295 | <section> |
296 | 296 | <h2>${localeContent.Education}</h2> |
297 | | - ${dto.education |
298 | | - .map( |
299 | | - (e) => ` |
| 297 | +${sortByDate(dto.education, (e) => e.startDate, "desc") |
| 298 | + .map( |
| 299 | + (e) => ` |
300 | 300 | <div class="item"> |
301 | 301 | <div class="item-title">${e.degree} em ${e.fieldOfStudy}</div> |
302 | 302 | <div class="item-subtitle">${e.institution}</div> |
|
307 | 307 | ${e.grade ? `<p>${localeContent.Grade}: ${e.grade}</p>` : ""} |
308 | 308 | ${e.description ? `<p>${e.description}</p>` : ""} |
309 | 309 | </div>`, |
310 | | - ) |
311 | | - .join("")} |
| 310 | + ) |
| 311 | + .join("")} |
312 | 312 | </section>` |
313 | 313 | : "" |
314 | 314 | } |
|
318 | 318 | ? ` |
319 | 319 | <section> |
320 | 320 | <h2>${localeContent.Projects}</h2> |
321 | | -${sortByStartDateAsc(dto.projects) |
| 321 | +${sortByDate(dto.projects, (p) => p.startDate, "desc") |
322 | 322 | .map( |
323 | 323 | (p) => ` |
324 | | - <div class="item"> |
325 | | - <div class="item-title">${p.name}</div> |
326 | | - <div class="dates"> |
327 | | - ${p.startDate} ${p.endDate ? `– ${p.endDate}` : ""} |
328 | | - ${p.location ? ` | ${p.location}` : ""} |
329 | | - </div> |
330 | | - <p>${p.description}</p> |
331 | | - ${p.link ? `<a href="${p.link}">${p.link}</a>` : ""} |
332 | | - </div>`, |
| 324 | + <div class="item"> |
| 325 | + <div class="item-title">${p.name}</div> |
| 326 | + <div class="dates"> |
| 327 | + ${p.startDate} ${p.endDate ? `– ${p.endDate}` : ""} |
| 328 | + ${p.location ? ` | ${p.location}` : ""} |
| 329 | + </div> |
| 330 | + <p>${p.description}</p> |
| 331 | + ${p.link ? `<a href="${p.link}">${p.link}</a>` : ""} |
| 332 | + </div>`, |
333 | 333 | ) |
334 | 334 | .join("")} |
335 | 335 | </section>` |
|
341 | 341 | ? ` |
342 | 342 | <section> |
343 | 343 | <h2>${localeContent.Certifications}</h2> |
344 | | - ${dto.certifications |
345 | | - .map( |
346 | | - (c) => ` |
347 | | - <div class="item"> |
348 | | - <div class="item-title">${c.name}</div> |
349 | | - <div class="item-subtitle">${c.issuingOrganization}</div> |
350 | | - <div class="dates"> |
351 | | - ${c.issueDate} |
352 | | - ${c.expirationDate ? `– ${c.expirationDate}` : ""} |
353 | | - </div> |
354 | | - ${c.credentialID ? `<p>ID: ${c.credentialID}</p>` : ""} |
355 | | - ${c.credentialURL ? `<a href="${c.credentialURL}">${c.credentialURL}</a>` : ""} |
356 | | - </div>`, |
357 | | - ) |
358 | | - .join("")} |
| 344 | +${sortByDate(dto.certifications, (c) => c.issueDate, "desc") |
| 345 | + .map( |
| 346 | + (c) => ` |
| 347 | + <div class="item"> |
| 348 | + <div class="item-title">${c.name}</div> |
| 349 | + <div class="item-subtitle">${c.issuingOrganization}</div> |
| 350 | + <div class="dates"> |
| 351 | + ${c.issueDate} |
| 352 | + ${c.expirationDate ? `– ${c.expirationDate}` : ""} |
| 353 | + </div> |
| 354 | + ${c.credentialID ? `<p>ID: ${c.credentialID}</p>` : ""} |
| 355 | + ${c.credentialURL ? `<a href="${c.credentialURL}">${c.credentialURL}</a>` : ""} |
| 356 | + </div>`, |
| 357 | + ) |
| 358 | + .join("")} |
359 | 359 | </section>` |
360 | 360 | : "" |
361 | 361 | } |
|
365 | 365 | ? ` |
366 | 366 | <section> |
367 | 367 | <h2>${localeContent.OtherExperiences}</h2> |
368 | | - ${dto.otherExperiences |
369 | | - .map( |
370 | | - (o) => ` |
371 | | - <div class="item"> |
372 | | - <div class="item-title">${o.title}</div> |
373 | | - <div class="dates"> |
374 | | - ${o.startDate ?? ""} ${o.endDate ? `– ${o.endDate}` : ""} |
375 | | - ${o.location ? ` | ${o.location}` : ""} |
376 | | - </div> |
377 | | - <p>${o.description}</p> |
378 | | - </div>`, |
379 | | - ) |
380 | | - .join("")} |
| 368 | +${sortByDate(dto.otherExperiences, (o) => o.startDate, "desc") |
| 369 | + .map( |
| 370 | + (o) => ` |
| 371 | + <div class="item"> |
| 372 | + <div class="item-title">${o.title}</div> |
| 373 | + <div class="dates"> |
| 374 | + ${o.startDate ?? ""} ${o.endDate ? `– ${o.endDate}` : ""} |
| 375 | + ${o.location ? ` | ${o.location}` : ""} |
| 376 | + </div> |
| 377 | + <p>${o.description}</p> |
| 378 | + </div>`, |
| 379 | + ) |
| 380 | + .join("")} |
381 | 381 | </section>` |
382 | 382 | : "" |
383 | 383 | } |
|
0 commit comments