academe-kit 0.9.5 → 0.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1282,6 +1282,68 @@ export interface paths {
1282
1282
  patch?: never;
1283
1283
  trace?: never;
1284
1284
  };
1285
+ "/certificates/{userId}/download-all": {
1286
+ parameters: {
1287
+ query?: never;
1288
+ header?: never;
1289
+ path?: never;
1290
+ cookie?: never;
1291
+ };
1292
+ /**
1293
+ * Download all certificates of a user as a single PDF
1294
+ * @description Downloads all certificates of the given user merged into a single PDF file.
1295
+ * Each certificate occupies one page in the resulting file.
1296
+ * PDFs are downloaded from S3 in parallel and merged using pdf-lib.
1297
+ */
1298
+ get: {
1299
+ parameters: {
1300
+ query?: never;
1301
+ header?: never;
1302
+ path: {
1303
+ /** @description ID of the user whose certificates will be downloaded */
1304
+ userId: string;
1305
+ };
1306
+ cookie?: never;
1307
+ };
1308
+ requestBody?: never;
1309
+ responses: {
1310
+ /** @description Merged PDF file containing all user certificates */
1311
+ 200: {
1312
+ headers: {
1313
+ /** @description attachment; filename="Meus-Certificados.pdf" */
1314
+ "Content-Disposition"?: string;
1315
+ [name: string]: unknown;
1316
+ };
1317
+ content: {
1318
+ "application/pdf": string;
1319
+ };
1320
+ };
1321
+ 401: components["responses"]["Unauthorized"];
1322
+ /** @description No certificates found for the user */
1323
+ 404: {
1324
+ headers: {
1325
+ [name: string]: unknown;
1326
+ };
1327
+ content: {
1328
+ "application/json": {
1329
+ /** @example error */
1330
+ status?: string;
1331
+ /** @example No certificates found for this user */
1332
+ message?: string;
1333
+ };
1334
+ };
1335
+ };
1336
+ 500: components["responses"]["ServerError"];
1337
+ };
1338
+ };
1339
+ put?: never;
1340
+ post?: never;
1341
+ delete?: never;
1342
+ options?: never;
1343
+ head?: never;
1344
+ patch?: never;
1345
+ trace?: never;
1346
+ };
1285
1347
  "/certificates": {
1286
1348
  parameters: {
1287
1349
  query?: never;
@@ -1291,13 +1353,24 @@ export interface paths {
1291
1353
  };
1292
1354
  /**
1293
1355
  * List all certificates
1294
- * @description Retrieve a list of all certificates in the system.
1356
+ * @description Retrieve a paginated list of all certificates in the system.
1295
1357
  * Each certificate includes course information (id, title, description) when available.
1296
1358
  * Course data is extracted from the related Quiz through QuizAttempt.
1297
1359
  */
1298
1360
  get: {
1299
1361
  parameters: {
1300
- query?: never;
1362
+ query?: {
1363
+ /** @description Filter certificates by user ID */
1364
+ userId?: string;
1365
+ /** @description Search term */
1366
+ search?: components["parameters"]["search"];
1367
+ /** @description Page number */
1368
+ page?: components["parameters"]["page"];
1369
+ /** @description Items per page */
1370
+ limit?: components["parameters"]["limit"];
1371
+ /** @description Whether to include course data in the response (default true). Pass false to skip course lookup. */
1372
+ includeCourse?: boolean;
1373
+ };
1301
1374
  header?: never;
1302
1375
  path?: never;
1303
1376
  cookie?: never;
@@ -1314,6 +1387,16 @@ export interface paths {
1314
1387
  /** @example success */
1315
1388
  status?: string;
1316
1389
  data?: components["schemas"]["Certificate"][];
1390
+ meta?: {
1391
+ /** @example 10 */
1392
+ total?: number;
1393
+ /** @example 1 */
1394
+ page?: number;
1395
+ /** @example 10 */
1396
+ limit?: number;
1397
+ /** @example 1 */
1398
+ totalPages?: number;
1399
+ };
1317
1400
  };
1318
1401
  };
1319
1402
  };
@@ -1349,8 +1432,6 @@ export interface paths {
1349
1432
  /** @example success */
1350
1433
  status?: string;
1351
1434
  data?: components["schemas"]["Certificate"];
1352
- /** @example Certificate created successfully */
1353
- message?: string;
1354
1435
  };
1355
1436
  };
1356
1437
  };
@@ -1428,18 +1509,11 @@ export interface paths {
1428
1509
  requestBody?: never;
1429
1510
  responses: {
1430
1511
  /** @description Certificate deleted successfully */
1431
- 200: {
1512
+ 204: {
1432
1513
  headers: {
1433
1514
  [name: string]: unknown;
1434
1515
  };
1435
- content: {
1436
- "application/json": {
1437
- /** @example success */
1438
- status?: string;
1439
- /** @example Certificate deleted successfully */
1440
- message?: string;
1441
- };
1442
- };
1516
+ content?: never;
1443
1517
  };
1444
1518
  400: components["responses"]["BadRequest"];
1445
1519
  401: components["responses"]["Unauthorized"];
@@ -1479,8 +1553,6 @@ export interface paths {
1479
1553
  /** @example success */
1480
1554
  status?: string;
1481
1555
  data?: components["schemas"]["Certificate"];
1482
- /** @example Certificate updated successfully */
1483
- message?: string;
1484
1556
  };
1485
1557
  };
1486
1558
  };
@@ -1492,6 +1564,123 @@ export interface paths {
1492
1564
  };
1493
1565
  trace?: never;
1494
1566
  };
1567
+ "/certificates/{id}/download": {
1568
+ parameters: {
1569
+ query?: never;
1570
+ header?: never;
1571
+ path?: never;
1572
+ cookie?: never;
1573
+ };
1574
+ /**
1575
+ * Download certificate PDF
1576
+ * @description Download the PDF of a specific certificate.
1577
+ * Acts as a proxy to download from S3, avoiding CORS issues.
1578
+ * Only the certificate owner can download their certificate.
1579
+ */
1580
+ get: {
1581
+ parameters: {
1582
+ query?: never;
1583
+ header?: never;
1584
+ path: {
1585
+ /** @description Resource ID */
1586
+ id: components["parameters"]["id"];
1587
+ };
1588
+ cookie?: never;
1589
+ };
1590
+ requestBody?: never;
1591
+ responses: {
1592
+ /** @description Certificate PDF file */
1593
+ 200: {
1594
+ headers: {
1595
+ [name: string]: unknown;
1596
+ };
1597
+ content: {
1598
+ "application/pdf": string;
1599
+ };
1600
+ };
1601
+ 401: components["responses"]["Unauthorized"];
1602
+ 403: components["responses"]["Forbidden"];
1603
+ 404: components["responses"]["NotFound"];
1604
+ 500: components["responses"]["ServerError"];
1605
+ };
1606
+ };
1607
+ put?: never;
1608
+ post?: never;
1609
+ delete?: never;
1610
+ options?: never;
1611
+ head?: never;
1612
+ patch?: never;
1613
+ trace?: never;
1614
+ };
1615
+ "/certificates/generate": {
1616
+ parameters: {
1617
+ query?: never;
1618
+ header?: never;
1619
+ path?: never;
1620
+ cookie?: never;
1621
+ };
1622
+ get?: never;
1623
+ put?: never;
1624
+ /**
1625
+ * Generate a certificate PDF server-side
1626
+ * @description Generates a certificate PDF on the server and creates the certificate record.
1627
+ * This eliminates CORS issues by downloading the template image on the server.
1628
+ *
1629
+ * If the user is currently on a journey "course" step whose `courseModuleId`
1630
+ * matches the quiz's course module, that step is auto-completed as part of
1631
+ * this call (best-effort; failures here are silent and do not affect the cert).
1632
+ */
1633
+ post: {
1634
+ parameters: {
1635
+ query?: never;
1636
+ header?: never;
1637
+ path?: never;
1638
+ cookie?: never;
1639
+ };
1640
+ requestBody: {
1641
+ content: {
1642
+ "application/json": components["schemas"]["GenerateCertificateDto"];
1643
+ };
1644
+ };
1645
+ responses: {
1646
+ /** @description Certificate generated and created successfully */
1647
+ 201: {
1648
+ headers: {
1649
+ [name: string]: unknown;
1650
+ };
1651
+ content: {
1652
+ "application/json": {
1653
+ /** @example success */
1654
+ status?: string;
1655
+ data?: {
1656
+ certificate?: components["schemas"]["Certificate"];
1657
+ /** @example https://s3.amazonaws.com/bucket/certificate.pdf */
1658
+ pdfUrl?: string;
1659
+ /**
1660
+ * @description True when this generation also concluded the user's current journey "course" step
1661
+ * @example true
1662
+ */
1663
+ stepCompleted?: boolean;
1664
+ /**
1665
+ * Format: uuid
1666
+ * @description ID of the challenge_step that was auto-completed, or null when no step was matched
1667
+ */
1668
+ challengeStepId?: string | null;
1669
+ };
1670
+ };
1671
+ };
1672
+ };
1673
+ 400: components["responses"]["BadRequest"];
1674
+ 401: components["responses"]["Unauthorized"];
1675
+ 500: components["responses"]["ServerError"];
1676
+ };
1677
+ };
1678
+ delete?: never;
1679
+ options?: never;
1680
+ head?: never;
1681
+ patch?: never;
1682
+ trace?: never;
1683
+ };
1495
1684
  "/challenge-groups": {
1496
1685
  parameters: {
1497
1686
  query?: never;
@@ -11357,7 +11546,7 @@ export interface paths {
11357
11546
  /**
11358
11547
  * Create new submission attempt
11359
11548
  * @description Creates a submission with status=submitted. Validations:
11360
- * - Cannot submit to a global template (clone first)
11549
+ * - institutionId is sent by the client (user's institution_registration), not derived from the challenge
11361
11550
  * - For group challenges: groupId is required and user must be a member
11362
11551
  * - For individual challenges: groupId must be omitted
11363
11552
  * - Cannot create when there is already an active submission (submitted/ai_evaluated)
@@ -11377,6 +11566,11 @@ export interface paths {
11377
11566
  "application/json": {
11378
11567
  /** Format: uuid */
11379
11568
  challengeId: string;
11569
+ /**
11570
+ * Format: uuid
11571
+ * @description Institution the user is submitting under (from institution_registration)
11572
+ */
11573
+ institutionId: string;
11380
11574
  /**
11381
11575
  * Format: uuid
11382
11576
  * @description Required when challenge.isGroup=true
@@ -12373,6 +12567,103 @@ export interface paths {
12373
12567
  patch?: never;
12374
12568
  trace?: never;
12375
12569
  };
12570
+ "/users-course-log/me/courses/{courseId}/progress": {
12571
+ parameters: {
12572
+ query?: never;
12573
+ header?: never;
12574
+ path?: never;
12575
+ cookie?: never;
12576
+ };
12577
+ /**
12578
+ * Get authenticated user's progress in a course
12579
+ * @description Returns completed/total active lessons (across every active module of the course)
12580
+ * and a percentage based on `users_course_log` completion events.
12581
+ */
12582
+ get: {
12583
+ parameters: {
12584
+ query?: never;
12585
+ header?: never;
12586
+ path: {
12587
+ courseId: string;
12588
+ };
12589
+ cookie?: never;
12590
+ };
12591
+ requestBody?: never;
12592
+ responses: {
12593
+ /** @description Course progress snapshot */
12594
+ 200: {
12595
+ headers: {
12596
+ [name: string]: unknown;
12597
+ };
12598
+ content: {
12599
+ "application/json": {
12600
+ /** @example success */
12601
+ status?: string;
12602
+ data?: components["schemas"]["UsersCourseLogProgress"];
12603
+ };
12604
+ };
12605
+ };
12606
+ 401: components["responses"]["Unauthorized"];
12607
+ 404: components["responses"]["NotFound"];
12608
+ };
12609
+ };
12610
+ put?: never;
12611
+ post?: never;
12612
+ delete?: never;
12613
+ options?: never;
12614
+ head?: never;
12615
+ patch?: never;
12616
+ trace?: never;
12617
+ };
12618
+ "/users-course-log/me/courses/{courseId}/modules/{moduleId}/progress": {
12619
+ parameters: {
12620
+ query?: never;
12621
+ header?: never;
12622
+ path?: never;
12623
+ cookie?: never;
12624
+ };
12625
+ /**
12626
+ * Get authenticated user's progress in a module
12627
+ * @description Returns completed/total active lessons of the module and a percentage based on
12628
+ * `users_course_log` completion events. Used by the Journey "curso" step.
12629
+ */
12630
+ get: {
12631
+ parameters: {
12632
+ query?: never;
12633
+ header?: never;
12634
+ path: {
12635
+ courseId: string;
12636
+ moduleId: string;
12637
+ };
12638
+ cookie?: never;
12639
+ };
12640
+ requestBody?: never;
12641
+ responses: {
12642
+ /** @description Module progress snapshot */
12643
+ 200: {
12644
+ headers: {
12645
+ [name: string]: unknown;
12646
+ };
12647
+ content: {
12648
+ "application/json": {
12649
+ /** @example success */
12650
+ status?: string;
12651
+ data?: components["schemas"]["UsersCourseLogProgress"];
12652
+ };
12653
+ };
12654
+ };
12655
+ 401: components["responses"]["Unauthorized"];
12656
+ 404: components["responses"]["NotFound"];
12657
+ };
12658
+ };
12659
+ put?: never;
12660
+ post?: never;
12661
+ delete?: never;
12662
+ options?: never;
12663
+ head?: never;
12664
+ patch?: never;
12665
+ trace?: never;
12666
+ };
12376
12667
  "/users/me": {
12377
12668
  parameters: {
12378
12669
  query?: never;
@@ -12846,7 +13137,19 @@ export interface paths {
12846
13137
  head?: never;
12847
13138
  /**
12848
13139
  * Update user
12849
- * @description Update user information
13140
+ * @description Update user information.
13141
+ *
13142
+ * **Profile and seat code behavior:**
13143
+ * - Send `groupId` to change the user's profile/group.
13144
+ * - When `groupId` changes, the system will:
13145
+ * 1. Release the previous seat code used by the user (`isReserved = false`)
13146
+ * 2. Allocate a seat code for the new group in the same institution registration
13147
+ * 3. Create a new seat code automatically if none is available for that group
13148
+ *
13149
+ * **Important:**
13150
+ * - The target group must exist.
13151
+ * - The institution must have a seat configured for the target group.
13152
+ * - If any institution registration cannot be migrated to the new group, the operation fails.
12850
13153
  */
12851
13154
  patch: {
12852
13155
  parameters: {
@@ -14664,6 +14967,29 @@ export interface components {
14664
14967
  /** Format: date-time */
14665
14968
  updatedAt?: string;
14666
14969
  };
14970
+ /** @description Aggregated progress of a user on a course or module, derived from users_course_log completion events */
14971
+ UsersCourseLogProgress: {
14972
+ /**
14973
+ * @description Number of active lessons completed by the user
14974
+ * @example 3
14975
+ */
14976
+ completedLessons?: number;
14977
+ /**
14978
+ * @description Total number of active lessons in scope
14979
+ * @example 5
14980
+ */
14981
+ totalLessons?: number;
14982
+ /**
14983
+ * @description Completion percentage rounded to nearest integer
14984
+ * @example 60
14985
+ */
14986
+ percent?: number;
14987
+ /**
14988
+ * @description True when totalLessons > 0 and completedLessons >= totalLessons
14989
+ * @example false
14990
+ */
14991
+ isCompleted?: boolean;
14992
+ };
14667
14993
  Submission: {
14668
14994
  /** Format: uuid */
14669
14995
  id?: string;
@@ -15771,6 +16097,27 @@ export interface components {
15771
16097
  /** Format: uri */
15772
16098
  url?: string;
15773
16099
  };
16100
+ GenerateCertificateDto: {
16101
+ /** Format: uuid */
16102
+ userId: string;
16103
+ /** Format: uuid */
16104
+ quizAttemptId?: string;
16105
+ /** Format: uuid */
16106
+ certificateTemplateId: string;
16107
+ /** @example João Silva */
16108
+ studentName: string;
16109
+ /** @example Introdução ao JavaScript */
16110
+ quizTitle: string;
16111
+ /** @example 85 */
16112
+ score?: number;
16113
+ /** @example CERT-2024-000001 */
16114
+ certificateNumber?: string;
16115
+ /**
16116
+ * Format: date-time
16117
+ * @example 2024-01-01T00:00:00.000Z
16118
+ */
16119
+ issuedAt?: string;
16120
+ };
15774
16121
  CreateGuardianDto: {
15775
16122
  /**
15776
16123
  * Format: email
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "academe-kit",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "type": "module",
5
5
  "description": "Official React SDK for Academe ecosystem - Authentication, protected routes, API services, and UI components for educational management applications",
6
6
  "main": "dist/index.cjs",