musora-content-services 2.86.1 → 2.87.0
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.
- package/.claude/settings.local.json +8 -0
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/index.d.ts +1 -3
- package/src/index.js +1 -3
- package/src/services/content-org/learning-paths.ts +12 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.87.0](https://github.com/railroadmedia/musora-content-services/compare/v2.86.1...v2.87.0) (2025-11-26)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **BEH-1418:** refactor learning path endpoints ([#589](https://github.com/railroadmedia/musora-content-services/issues/589)) ([e3637f6](https://github.com/railroadmedia/musora-content-services/commit/e3637f6359ddf8f4295eead890de6457b942b4ea))
|
|
11
|
+
|
|
5
12
|
### [2.86.1](https://github.com/railroadmedia/musora-content-services/compare/v2.86.0...v2.86.1) (2025-11-25)
|
|
6
13
|
|
|
7
14
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -41,7 +41,6 @@ import {
|
|
|
41
41
|
mapContentToParent,
|
|
42
42
|
resetAllLearningPaths,
|
|
43
43
|
startLearningPath,
|
|
44
|
-
updateActivePath,
|
|
45
44
|
updateDailySession
|
|
46
45
|
} from './services/content-org/learning-paths.ts';
|
|
47
46
|
|
|
@@ -413,7 +412,7 @@ import {
|
|
|
413
412
|
} from './services/userActivity.js';
|
|
414
413
|
|
|
415
414
|
import {
|
|
416
|
-
default as EventsAPI
|
|
415
|
+
default as EventsAPI
|
|
417
416
|
} from './services/eventsAPI';
|
|
418
417
|
|
|
419
418
|
declare module 'musora-content-services' {
|
|
@@ -702,7 +701,6 @@ declare module 'musora-content-services' {
|
|
|
702
701
|
unlockThread,
|
|
703
702
|
unpinProgressRow,
|
|
704
703
|
unpinThread,
|
|
705
|
-
updateActivePath,
|
|
706
704
|
updateDailySession,
|
|
707
705
|
updateDisplayName,
|
|
708
706
|
updateForumCategory,
|
package/src/index.js
CHANGED
|
@@ -41,7 +41,6 @@ import {
|
|
|
41
41
|
mapContentToParent,
|
|
42
42
|
resetAllLearningPaths,
|
|
43
43
|
startLearningPath,
|
|
44
|
-
updateActivePath,
|
|
45
44
|
updateDailySession
|
|
46
45
|
} from './services/content-org/learning-paths.ts';
|
|
47
46
|
|
|
@@ -413,7 +412,7 @@ import {
|
|
|
413
412
|
} from './services/userActivity.js';
|
|
414
413
|
|
|
415
414
|
import {
|
|
416
|
-
default as EventsAPI
|
|
415
|
+
default as EventsAPI
|
|
417
416
|
} from './services/eventsAPI';
|
|
418
417
|
|
|
419
418
|
export {
|
|
@@ -701,7 +700,6 @@ export {
|
|
|
701
700
|
unlockThread,
|
|
702
701
|
unpinProgressRow,
|
|
703
702
|
unpinThread,
|
|
704
|
-
updateActivePath,
|
|
705
703
|
updateDailySession,
|
|
706
704
|
updateDisplayName,
|
|
707
705
|
updateForumCategory,
|
|
@@ -32,9 +32,9 @@ interface ActiveLearningPathResponse {
|
|
|
32
32
|
*/
|
|
33
33
|
export async function getDailySession(brand: string, userDate: Date) {
|
|
34
34
|
const stringDate = userDate.toISOString().split('T')[0]
|
|
35
|
-
const url: string = `${LEARNING_PATHS_PATH}/daily-session/get
|
|
35
|
+
const url: string = `${LEARNING_PATHS_PATH}/daily-session/get`
|
|
36
36
|
const body = { brand: brand, userDate: stringDate }
|
|
37
|
-
return await fetchHandler(url, '
|
|
37
|
+
return await fetchHandler(url, 'GET', null, body)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -49,7 +49,7 @@ export async function updateDailySession(
|
|
|
49
49
|
keepFirstLearningPath: boolean
|
|
50
50
|
) {
|
|
51
51
|
const stringDate = userDate.toISOString().split('T')[0]
|
|
52
|
-
const url: string = `${LEARNING_PATHS_PATH}/daily-session/
|
|
52
|
+
const url: string = `${LEARNING_PATHS_PATH}/daily-session/create`
|
|
53
53
|
const body = { brand: brand, userDate: stringDate, keepFirstLearningPath: keepFirstLearningPath }
|
|
54
54
|
return await fetchHandler(url, 'POST', null, body)
|
|
55
55
|
}
|
|
@@ -59,30 +59,18 @@ export async function updateDailySession(
|
|
|
59
59
|
* @param brand
|
|
60
60
|
*/
|
|
61
61
|
export async function getActivePath(brand: string) {
|
|
62
|
-
const url: string = `${LEARNING_PATHS_PATH}/active-path/get
|
|
63
|
-
const body = { brand: brand }
|
|
64
|
-
return await fetchHandler(url, 'POST', null, body)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// todo this should be removed once we handle active path gen only through
|
|
68
|
-
// finish method intro or complete current active path
|
|
69
|
-
/**
|
|
70
|
-
* Updates user's active learning path.
|
|
71
|
-
* @param brand
|
|
72
|
-
*/
|
|
73
|
-
export async function updateActivePath(brand: string) {
|
|
74
|
-
const url: string = `${LEARNING_PATHS_PATH}/active-path/update`
|
|
62
|
+
const url: string = `${LEARNING_PATHS_PATH}/active-path/get`
|
|
75
63
|
const body = { brand: brand }
|
|
76
|
-
return await fetchHandler(url, '
|
|
64
|
+
return await fetchHandler(url, 'GET', null, body)
|
|
77
65
|
}
|
|
78
66
|
|
|
79
67
|
/**
|
|
80
|
-
*
|
|
68
|
+
* Sets a new learning path as the user's active learning path.
|
|
81
69
|
* @param brand
|
|
82
70
|
* @param learningPathId
|
|
83
71
|
*/
|
|
84
72
|
export async function startLearningPath(brand: string, learningPathId: number) {
|
|
85
|
-
const url: string = `${LEARNING_PATHS_PATH}/
|
|
73
|
+
const url: string = `${LEARNING_PATHS_PATH}/active-path/set`
|
|
86
74
|
const body = { brand: brand, learning_path_id: learningPathId }
|
|
87
75
|
return await fetchHandler(url, 'POST', null, body)
|
|
88
76
|
}
|
|
@@ -172,10 +160,11 @@ export async function fetchLearningPathLessons(
|
|
|
172
160
|
brand: string,
|
|
173
161
|
userDate: Date
|
|
174
162
|
) {
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
163
|
+
const learningPath = await getEnrichedLearningPath(learningPathId)
|
|
164
|
+
let dailySession = await getDailySession(brand, userDate)
|
|
165
|
+
if (!dailySession) {
|
|
166
|
+
dailySession = await updateDailySession(brand, userDate, false)
|
|
167
|
+
}
|
|
179
168
|
|
|
180
169
|
const isActiveLearningPath = (dailySession?.active_learning_path_id || 0) == learningPathId
|
|
181
170
|
if (!isActiveLearningPath) {
|