musora-content-services 2.104.4 → 2.104.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.
- package/.claude/settings.local.json +3 -10
- package/.coderabbit.yaml +0 -0
- package/.editorconfig +0 -0
- package/.github/pull_request_template.md +0 -0
- package/.github/workflows/conventional-commits.yaml +0 -0
- package/.github/workflows/docs.js.yml +0 -0
- package/.github/workflows/node.js.yml +0 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/CHANGELOG.md +17 -0
- package/CLAUDE.md +0 -0
- package/README.md +0 -0
- package/babel.config.cjs +0 -0
- package/jest.config.js +0 -0
- package/jsdoc.json +0 -0
- package/package.json +1 -1
- package/src/constants/award-assets.js +0 -0
- package/src/contentMetaData.js +0 -0
- package/src/filterBuilder.js +0 -0
- package/src/infrastructure/http/HttpClient.ts +0 -0
- package/src/infrastructure/http/executors/FetchRequestExecutor.ts +0 -0
- package/src/infrastructure/http/index.ts +0 -0
- package/src/infrastructure/http/interfaces/HeaderProvider.ts +0 -0
- package/src/infrastructure/http/interfaces/HttpError.ts +0 -0
- package/src/infrastructure/http/interfaces/NetworkError.ts +0 -0
- package/src/infrastructure/http/interfaces/RequestExecutor.ts +0 -0
- package/src/infrastructure/http/interfaces/RequestOptions.ts +0 -0
- package/src/infrastructure/http/providers/DefaultHeaderProvider.ts +0 -0
- package/src/lib/ads/monoid.ts +0 -0
- package/src/lib/ads/semigroup.ts +0 -0
- package/src/lib/brands.ts +0 -0
- package/src/lib/httpHelper.js +0 -0
- package/src/lib/lastUpdated.js +0 -0
- package/src/lib/sanity/filter.ts +13 -0
- package/src/lib/sanity/query.ts +0 -0
- package/src/services/api/types.js +0 -0
- package/src/services/api/types.ts +0 -0
- package/src/services/awards/award-callbacks.js +0 -0
- package/src/services/awards/internal/.indexignore +0 -0
- package/src/services/awards/internal/award-definitions.js +0 -0
- package/src/services/awards/internal/award-events.js +0 -0
- package/src/services/awards/internal/certificate-builder.js +0 -0
- package/src/services/awards/internal/completion-data-generator.js +0 -0
- package/src/services/awards/internal/content-progress-observer.js +0 -0
- package/src/services/awards/internal/image-utils.js +0 -0
- package/src/services/awards/internal/message-generator.js +0 -0
- package/src/services/awards/internal/types.js +0 -0
- package/src/services/awards/types.d.ts +0 -0
- package/src/services/awards/types.js +0 -0
- package/src/services/config.js +0 -0
- package/src/services/content/artist.ts +17 -25
- package/src/services/content/content.ts +0 -0
- package/src/services/content/genre.ts +17 -25
- package/src/services/content/instructor.ts +15 -23
- package/src/services/content-org/content-org.js +0 -0
- package/src/services/content-org/guided-courses.ts +0 -0
- package/src/services/content-org/learning-paths.ts +87 -37
- package/src/services/content-org/playlists-types.js +0 -0
- package/src/services/contentAggregator.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/contentProgress.js +0 -0
- package/src/services/dataContext.js +0 -0
- package/src/services/dateUtils.js +0 -0
- package/src/services/eventsAPI.js +0 -0
- package/src/services/forums/categories.ts +0 -0
- package/src/services/forums/forums.ts +0 -0
- package/src/services/forums/posts.ts +0 -0
- package/src/services/forums/threads.ts +0 -0
- package/src/services/forums/types.ts +0 -0
- package/src/services/gamification/awards.ts +0 -0
- package/src/services/gamification/gamification.js +0 -0
- package/src/services/imageSRCBuilder.js +0 -0
- package/src/services/imageSRCVerify.js +0 -0
- package/src/services/liveTesting.ts +0 -0
- package/src/services/permissions/PermissionsAdapter.ts +0 -0
- package/src/services/permissions/PermissionsAdapterFactory.ts +0 -0
- package/src/services/permissions/PermissionsV1Adapter.ts +0 -0
- package/src/services/permissions/PermissionsV2Adapter.ts +0 -0
- package/src/services/permissions/README.md +0 -0
- package/src/services/permissions/index.ts +0 -0
- package/src/services/progress-events.js +0 -0
- package/src/services/progress-row/method-card.js +38 -24
- package/src/services/recommendations.js +0 -0
- package/src/services/reporting/README.md +0 -0
- package/src/services/reporting/types.ts +0 -0
- package/src/services/sanity.js +8 -4
- package/src/services/sentry/.indexignore +0 -0
- package/src/services/sentry/index.ts +0 -0
- package/src/services/sync/.indexignore +0 -0
- package/src/services/sync/adapters/factory.ts +0 -0
- package/src/services/sync/adapters/lokijs.ts +0 -0
- package/src/services/sync/adapters/sqlite.ts +0 -0
- package/src/services/sync/concurrency-safety.ts +0 -0
- package/src/services/sync/context/index.ts +0 -0
- package/src/services/sync/context/providers/base.ts +0 -0
- package/src/services/sync/context/providers/connectivity.ts +0 -0
- package/src/services/sync/context/providers/durability.ts +0 -0
- package/src/services/sync/context/providers/index.ts +0 -0
- package/src/services/sync/context/providers/session.ts +0 -0
- package/src/services/sync/context/providers/tabs.ts +0 -0
- package/src/services/sync/context/providers/visibility.ts +0 -0
- package/src/services/sync/database/factory.ts +0 -0
- package/src/services/sync/errors/boundary.ts +0 -0
- package/src/services/sync/errors/index.ts +0 -0
- package/src/services/sync/fetch.ts +0 -0
- package/src/services/sync/index.ts +0 -0
- package/src/services/sync/manager.ts +0 -0
- package/src/services/sync/models/Base.ts +0 -0
- package/src/services/sync/models/ContentLike.ts +0 -0
- package/src/services/sync/models/ContentProgress.ts +0 -0
- package/src/services/sync/models/Practice.ts +0 -0
- package/src/services/sync/models/PracticeDayNote.ts +0 -0
- package/src/services/sync/models/UserAwardProgress.ts +0 -0
- package/src/services/sync/models/index.ts +0 -0
- package/src/services/sync/repositories/base.ts +0 -0
- package/src/services/sync/repositories/content-likes.ts +0 -0
- package/src/services/sync/repositories/content-progress.ts +0 -0
- package/src/services/sync/repositories/index.ts +0 -0
- package/src/services/sync/repositories/practice-day-notes.ts +0 -0
- package/src/services/sync/repositories/practices.ts +0 -0
- package/src/services/sync/repository-proxy.ts +0 -0
- package/src/services/sync/resolver.ts +0 -0
- package/src/services/sync/retry.ts +0 -0
- package/src/services/sync/run-scope.ts +0 -0
- package/src/services/sync/schema/index.ts +0 -0
- package/src/services/sync/serializers/index.ts +0 -0
- package/src/services/sync/serializers/model.ts +0 -0
- package/src/services/sync/serializers/raw.ts +0 -0
- package/src/services/sync/store/index.ts +0 -0
- package/src/services/sync/store/push-coalescer.ts +0 -0
- package/src/services/sync/store-configs.ts +0 -0
- package/src/services/sync/strategies/base.ts +0 -0
- package/src/services/sync/strategies/index.ts +0 -0
- package/src/services/sync/strategies/initial.ts +0 -0
- package/src/services/sync/strategies/polling.ts +0 -0
- package/src/services/sync/telemetry/index.ts +0 -0
- package/src/services/sync/telemetry/sampling.ts +0 -0
- package/src/services/sync/utils/event-emitter.ts +0 -0
- package/src/services/sync/utils/index.ts +0 -0
- package/src/services/sync/utils/throttle.ts +0 -0
- package/src/services/sync/utils/timers.ts +0 -0
- package/src/services/types.js +0 -0
- package/src/services/user/account.ts +0 -0
- package/src/services/user/chat.js +0 -0
- package/src/services/user/interests.js +0 -0
- package/src/services/user/management.js +0 -0
- package/src/services/user/memberships.ts +0 -0
- package/src/services/user/notifications.js +0 -0
- package/src/services/user/onboarding.ts +0 -0
- package/src/services/user/payments.ts +0 -0
- package/src/services/user/permissions.js +0 -0
- package/src/services/user/profile.js +0 -0
- package/src/services/user/sessions.js +0 -0
- package/src/services/user/types.d.ts +0 -0
- package/src/services/user/types.js +0 -0
- package/src/services/user/user-management-system.js +0 -0
- package/src/services/userActivity.js +0 -0
- package/test/HttpClient.test.js +0 -0
- package/test/awards/award-alacarte-observer.test.js +0 -0
- package/test/awards/award-auto-refresh.test.js +0 -0
- package/test/awards/award-calculations.test.js +0 -0
- package/test/awards/award-certificate-display.test.js +0 -0
- package/test/awards/award-collection-edge-cases.test.js +0 -0
- package/test/awards/award-collection-filtering.test.js +0 -0
- package/test/awards/award-exclusion-handling.test.js +0 -0
- package/test/awards/award-multi-lesson.test.js +0 -0
- package/test/awards/award-observer-integration.test.js +0 -0
- package/test/awards/award-query-messages.test.js +0 -0
- package/test/awards/award-user-collection.test.js +0 -0
- package/test/awards/duplicate-prevention.test.js +0 -0
- package/test/awards/helpers/completion-mock.js +0 -0
- package/test/awards/helpers/index.js +0 -0
- package/test/awards/helpers/mock-setup.js +0 -0
- package/test/awards/helpers/progress-emitter.js +0 -0
- package/test/awards/message-generator.test.js +0 -0
- package/test/content.test.js +0 -0
- package/test/contentLikes.test.js +0 -0
- package/test/contentProgress.test.js +0 -0
- package/test/dataContext.test.js +0 -0
- package/test/forum.test.js +0 -0
- package/test/imageSRCBuilder.test.js +0 -0
- package/test/imageSRCVerify.test.js +0 -0
- package/test/initializeTests.js +0 -0
- package/test/learningPaths.test.js +0 -0
- package/test/lib/__snapshots__/filter.test.ts.snap +0 -0
- package/test/lib/filter.test.ts +0 -0
- package/test/lib/lastUpdated.test.js +0 -0
- package/test/lib/query.test.ts +0 -0
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/mockData/award-definitions.js +0 -0
- package/test/mockData/mockData_fetchByRailContentIds_one_content.json +0 -0
- package/test/mockData/mockData_progress_content.json +0 -0
- package/test/mockData/mockData_sanity_progress_content.json +0 -0
- package/test/mockData/mockData_user_practices.json +0 -0
- package/test/notifications.test.js +0 -0
- package/test/progressRows.test.js +0 -0
- package/test/sanityQueryService.test.js +0 -0
- package/test/streakMessage.test.js +0 -0
- package/test/sync/adapter.ts +0 -0
- package/test/sync/initialize-sync-manager.js +0 -0
- package/test/sync/models/award-database-integration.test.js +0 -0
- package/test/user/permissions.test.js +0 -0
- package/test/userActivity.test.js +0 -0
- package/tools/generate-index.cjs +0 -0
- package/.yarnrc.yml +0 -1
- package/check_content.js +0 -30
- package/check_content.mjs +0 -32
- package/test/reporting.test.js +0 -132
- package/test_owned_navigate.js +0 -74
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"Bash(find:*)",
|
|
7
|
-
"Bash(sed:*)",
|
|
8
|
-
"Read(//app/**)",
|
|
9
|
-
"Bash(cat:*)",
|
|
10
|
-
"Bash(docker exec:*)",
|
|
11
|
-
"Bash(npm config:*)"
|
|
4
|
+
"Bash(rg:*)",
|
|
5
|
+
"Bash(npm run lint:*)"
|
|
12
6
|
],
|
|
13
|
-
"deny": []
|
|
14
|
-
"ask": []
|
|
7
|
+
"deny": []
|
|
15
8
|
}
|
|
16
9
|
}
|
package/.coderabbit.yaml
CHANGED
|
File without changes
|
package/.editorconfig
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/.prettierignore
CHANGED
|
File without changes
|
package/.prettierrc
CHANGED
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
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.104.7](https://github.com/railroadmedia/musora-content-services/compare/v2.104.6...v2.104.7) (2025-12-16)
|
|
6
|
+
|
|
7
|
+
### [2.104.6](https://github.com/railroadmedia/musora-content-services/compare/v2.104.5...v2.104.6) (2025-12-16)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* method card previous dailies ([#649](https://github.com/railroadmedia/musora-content-services/issues/649)) ([14f1c39](https://github.com/railroadmedia/musora-content-services/commit/14f1c390530a126d063eff3c7062e4fe2a09567c))
|
|
13
|
+
* **MU2-1315:** agi lessons permissions ([#657](https://github.com/railroadmedia/musora-content-services/issues/657)) ([b3ff00a](https://github.com/railroadmedia/musora-content-services/commit/b3ff00a2bb57e149981b18b5060ab2ec257db912))
|
|
14
|
+
|
|
15
|
+
### [2.104.5](https://github.com/railroadmedia/musora-content-services/compare/v2.104.4...v2.104.5) (2025-12-12)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* conditionally update the active path ([#653](https://github.com/railroadmedia/musora-content-services/issues/653)) ([4775e89](https://github.com/railroadmedia/musora-content-services/commit/4775e89c375aedac310ded0effce4786d48ffcd2))
|
|
21
|
+
|
|
5
22
|
### [2.104.4](https://github.com/railroadmedia/musora-content-services/compare/v2.104.3...v2.104.4) (2025-12-12)
|
|
6
23
|
|
|
7
24
|
### [2.104.3](https://github.com/railroadmedia/musora-content-services/compare/v2.104.0...v2.104.3) (2025-12-12)
|
package/CLAUDE.md
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/babel.config.cjs
CHANGED
|
File without changes
|
package/jest.config.js
CHANGED
|
File without changes
|
package/jsdoc.json
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
File without changes
|
package/src/contentMetaData.js
CHANGED
|
File without changes
|
package/src/filterBuilder.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/lib/ads/monoid.ts
CHANGED
|
File without changes
|
package/src/lib/ads/semigroup.ts
CHANGED
|
File without changes
|
package/src/lib/brands.ts
CHANGED
|
File without changes
|
package/src/lib/httpHelper.js
CHANGED
|
File without changes
|
package/src/lib/lastUpdated.js
CHANGED
|
File without changes
|
package/src/lib/sanity/filter.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { filtersToGroq } from '../../contentTypeConfig'
|
|
2
2
|
import { getPermissionsAdapter } from '../../services/permissions/index'
|
|
3
3
|
import type { UserPermissions } from '../../services/permissions/PermissionsAdapter'
|
|
4
|
+
import { Brands } from '../brands'
|
|
4
5
|
import { filterOps } from './query'
|
|
5
6
|
|
|
6
7
|
// ============================================
|
|
@@ -454,6 +455,18 @@ export class Filters {
|
|
|
454
455
|
static progressIds(progressIds: number[]): string {
|
|
455
456
|
return progressIds.length > 0 ? Filters.idIn(progressIds) : Filters.empty
|
|
456
457
|
}
|
|
458
|
+
|
|
459
|
+
static async lessonCount(brand?: Brands | string): Promise<string> {
|
|
460
|
+
return Filters.count(
|
|
461
|
+
await Filters.combineAsync(
|
|
462
|
+
Filters.status(),
|
|
463
|
+
Filters.publishedDate(),
|
|
464
|
+
Filters.notDeprecated(),
|
|
465
|
+
Filters.referencesParent(),
|
|
466
|
+
brand ? Filters.brand(brand) : Filters.empty
|
|
467
|
+
)
|
|
468
|
+
)
|
|
469
|
+
}
|
|
457
470
|
}
|
|
458
471
|
|
|
459
472
|
// Default export
|
package/src/lib/sanity/query.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/config.js
CHANGED
|
File without changes
|
|
@@ -12,7 +12,7 @@ export interface Artist {
|
|
|
12
12
|
slug: string
|
|
13
13
|
name: string
|
|
14
14
|
thumbnail: string
|
|
15
|
-
|
|
15
|
+
lesson_count: number
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface Artists {
|
|
@@ -33,35 +33,27 @@ export interface Artists {
|
|
|
33
33
|
*/
|
|
34
34
|
export async function fetchArtists(
|
|
35
35
|
brand: Brands | string,
|
|
36
|
-
options: BuildQueryOptions
|
|
36
|
+
options: BuildQueryOptions
|
|
37
37
|
): Promise<Artists> {
|
|
38
|
-
const lessonFilter = f.combine(f.brand(brand), f.referencesParent())
|
|
39
38
|
const type = f.type('artist')
|
|
40
|
-
const
|
|
41
|
-
const
|
|
39
|
+
const postFilter = `lesson_count > 0`
|
|
40
|
+
const { sort = 'lower(name)', offset = 0, limit = 20 } = options
|
|
42
41
|
|
|
43
42
|
const data = query()
|
|
44
43
|
.and(type)
|
|
45
|
-
.order(
|
|
46
|
-
.slice(
|
|
44
|
+
.order(getSortOrder(sort, brand))
|
|
45
|
+
.slice(offset, limit)
|
|
47
46
|
.select(
|
|
48
47
|
'name',
|
|
49
48
|
`"slug": slug.current`,
|
|
50
49
|
`"thumbnail": thumbnail_url.asset->url`,
|
|
51
|
-
`"
|
|
50
|
+
`"lesson_count": ${await f.lessonCount(brand)}`
|
|
52
51
|
)
|
|
53
52
|
.postFilter(postFilter)
|
|
54
53
|
.build()
|
|
55
54
|
|
|
56
|
-
const total = query()
|
|
57
|
-
.and(type)
|
|
58
|
-
.select(`"lessonCount": ${lessonCount}`)
|
|
59
|
-
.postFilter(postFilter)
|
|
60
|
-
.build()
|
|
61
|
-
|
|
62
55
|
const q = `{
|
|
63
56
|
"data": ${data},
|
|
64
|
-
"total": count(${total})
|
|
65
57
|
}`
|
|
66
58
|
|
|
67
59
|
return fetchSanity(q, true, { processNeedAccess: false, processPageType: false })
|
|
@@ -83,8 +75,6 @@ export async function fetchArtistBySlug(
|
|
|
83
75
|
slug: string,
|
|
84
76
|
brand?: Brands | string
|
|
85
77
|
): Promise<Artist | null> {
|
|
86
|
-
const filter = f.combine(brand ? f.brand(brand) : f.empty, f.referencesParent())
|
|
87
|
-
|
|
88
78
|
const q = query()
|
|
89
79
|
.and(f.type('artist'))
|
|
90
80
|
.and(f.slug(slug))
|
|
@@ -92,7 +82,7 @@ export async function fetchArtistBySlug(
|
|
|
92
82
|
'name',
|
|
93
83
|
`"slug": slug.current`,
|
|
94
84
|
`"thumbnail": thumbnail_url.asset->url`,
|
|
95
|
-
`"
|
|
85
|
+
`"lesson_count": ${await f.lessonCount(brand)}`
|
|
96
86
|
)
|
|
97
87
|
.first()
|
|
98
88
|
.build()
|
|
@@ -146,15 +136,17 @@ export async function fetchArtistLessons(
|
|
|
146
136
|
sort = getSortOrder(sort, brand)
|
|
147
137
|
|
|
148
138
|
const restrictions = await f.combineAsync(
|
|
149
|
-
f.
|
|
150
|
-
f.
|
|
139
|
+
f.status(),
|
|
140
|
+
f.publishedDate(),
|
|
141
|
+
f.notDeprecated(),
|
|
142
|
+
f.referencesIDWithFilter(f.combine(f.type('artist'), f.slug(slug))),
|
|
143
|
+
f.brand(brand),
|
|
144
|
+
f.searchMatch('title', searchTerm),
|
|
145
|
+
f.includedFields(includedFields),
|
|
146
|
+
f.progressIds(progressIds)
|
|
151
147
|
)
|
|
152
148
|
|
|
153
149
|
const data = query()
|
|
154
|
-
.and(f.brand(brand))
|
|
155
|
-
.and(f.searchMatch('title', searchTerm))
|
|
156
|
-
.and(f.includedFields(includedFields))
|
|
157
|
-
.and(f.progressIds(progressIds))
|
|
158
150
|
.and(restrictions)
|
|
159
151
|
.order(sort)
|
|
160
152
|
.slice(offset, limit)
|
|
@@ -168,5 +160,5 @@ export async function fetchArtistLessons(
|
|
|
168
160
|
"total": count(${total})
|
|
169
161
|
}`
|
|
170
162
|
|
|
171
|
-
return fetchSanity(q, true, { processNeedAccess:
|
|
163
|
+
return fetchSanity(q, true, { processNeedAccess: true, processPageType: false })
|
|
172
164
|
}
|
|
File without changes
|
|
@@ -11,8 +11,8 @@ import { Filters as f } from '../../lib/sanity/filter'
|
|
|
11
11
|
export interface Genre {
|
|
12
12
|
name: string
|
|
13
13
|
slug: string
|
|
14
|
-
lessons_count: number
|
|
15
14
|
thumbnail: string
|
|
15
|
+
lesson_count: number
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface Genres {
|
|
@@ -33,35 +33,27 @@ export interface Genres {
|
|
|
33
33
|
*/
|
|
34
34
|
export async function fetchGenres(
|
|
35
35
|
brand: Brands | string,
|
|
36
|
-
options: BuildQueryOptions
|
|
36
|
+
options: BuildQueryOptions
|
|
37
37
|
): Promise<Genres> {
|
|
38
|
-
const lesson = f.combine(f.brand(brand), f.referencesParent())
|
|
39
38
|
const type = f.type('genre')
|
|
40
|
-
const
|
|
41
|
-
const
|
|
39
|
+
const postFilter = `lesson_count > 0`
|
|
40
|
+
const { sort = 'lower(name)', offset = 0, limit = 20 } = options
|
|
42
41
|
|
|
43
42
|
const data = query()
|
|
44
43
|
.and(type)
|
|
45
|
-
.order(
|
|
46
|
-
.slice(
|
|
44
|
+
.order(getSortOrder(sort, brand))
|
|
45
|
+
.slice(offset, limit)
|
|
47
46
|
.select(
|
|
48
47
|
'name',
|
|
49
48
|
`"slug": slug.current`,
|
|
50
49
|
`"thumbnail": thumbnail_url.asset->url`,
|
|
51
|
-
`"
|
|
50
|
+
`"lesson_count": ${await f.lessonCount(brand)}`
|
|
52
51
|
)
|
|
53
52
|
.postFilter(postFilter)
|
|
54
53
|
.build()
|
|
55
54
|
|
|
56
|
-
const total = query()
|
|
57
|
-
.and(type)
|
|
58
|
-
.select(`"lessons_count": ${lessonCount}`)
|
|
59
|
-
.postFilter(postFilter)
|
|
60
|
-
.build()
|
|
61
|
-
|
|
62
55
|
const q = `{
|
|
63
56
|
"data": ${data},
|
|
64
|
-
"total": count(${total})
|
|
65
57
|
}`
|
|
66
58
|
|
|
67
59
|
return fetchSanity(q, true, { processNeedAccess: false, processPageType: false })
|
|
@@ -83,8 +75,6 @@ export async function fetchGenreBySlug(
|
|
|
83
75
|
slug: string,
|
|
84
76
|
brand?: Brands | string
|
|
85
77
|
): Promise<Genre | null> {
|
|
86
|
-
const filter = f.combine(brand ? f.brand(brand) : f.empty, f.referencesParent())
|
|
87
|
-
|
|
88
78
|
const q = query()
|
|
89
79
|
.and(f.type('genre'))
|
|
90
80
|
.and(f.slug(slug))
|
|
@@ -92,7 +82,7 @@ export async function fetchGenreBySlug(
|
|
|
92
82
|
'name',
|
|
93
83
|
`"slug": slug.current`,
|
|
94
84
|
`"thumbnail": thumbnail_url.asset->url`,
|
|
95
|
-
`"
|
|
85
|
+
`"lesson_count": ${await f.lessonCount(brand)}`
|
|
96
86
|
)
|
|
97
87
|
.first()
|
|
98
88
|
.build()
|
|
@@ -145,15 +135,17 @@ export async function fetchGenreLessons(
|
|
|
145
135
|
sort = getSortOrder(sort, brand)
|
|
146
136
|
|
|
147
137
|
const restrictions = await f.combineAsync(
|
|
148
|
-
f.
|
|
149
|
-
f.
|
|
138
|
+
f.status(),
|
|
139
|
+
f.publishedDate(),
|
|
140
|
+
f.notDeprecated(),
|
|
141
|
+
f.referencesIDWithFilter(f.combine(f.type('genre'), f.slug(slug))),
|
|
142
|
+
f.brand(brand),
|
|
143
|
+
f.searchMatch('title', searchTerm),
|
|
144
|
+
f.includedFields(includedFields),
|
|
145
|
+
f.progressIds(progressIds)
|
|
150
146
|
)
|
|
151
147
|
|
|
152
148
|
const data = query()
|
|
153
|
-
.and(f.brand(brand))
|
|
154
|
-
.and(f.searchMatch('title', searchTerm))
|
|
155
|
-
.and(f.includedFields(includedFields))
|
|
156
|
-
.and(f.progressIds(progressIds))
|
|
157
149
|
.and(restrictions)
|
|
158
150
|
.order(sort)
|
|
159
151
|
.slice(offset, limit)
|
|
@@ -167,5 +159,5 @@ export async function fetchGenreLessons(
|
|
|
167
159
|
"total": count(${total})
|
|
168
160
|
}`
|
|
169
161
|
|
|
170
|
-
return fetchSanity(q, true, { processNeedAccess:
|
|
162
|
+
return fetchSanity(q, true, { processNeedAccess: true, processPageType: false })
|
|
171
163
|
}
|
|
@@ -9,7 +9,7 @@ import { Brands } from '../../lib/brands'
|
|
|
9
9
|
import { Filters as f } from '../../lib/sanity/filter'
|
|
10
10
|
|
|
11
11
|
export interface Instructor {
|
|
12
|
-
|
|
12
|
+
lesson_count: number
|
|
13
13
|
slug: string
|
|
14
14
|
name: string
|
|
15
15
|
short_bio: string
|
|
@@ -37,32 +37,24 @@ export async function fetchInstructors(
|
|
|
37
37
|
options: BuildQueryOptions
|
|
38
38
|
): Promise<Instructors> {
|
|
39
39
|
const type = f.type('instructor')
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const postFilter = `lessonCount > 0`
|
|
40
|
+
const postFilter = `lesson_count > 0`
|
|
41
|
+
const { sort = 'lower(name)', offset = 0, limit = 20 } = options
|
|
43
42
|
|
|
44
43
|
const data = query()
|
|
45
44
|
.and(type)
|
|
46
|
-
.order(
|
|
47
|
-
.slice(
|
|
45
|
+
.order(getSortOrder(sort, brand))
|
|
46
|
+
.slice(offset, limit)
|
|
48
47
|
.select(
|
|
49
48
|
'name',
|
|
50
49
|
`"slug": slug.current`,
|
|
51
50
|
`"thumbnail": thumbnail_url.asset->url`,
|
|
52
|
-
`"
|
|
51
|
+
`"lesson_count": ${await f.lessonCount(brand)}`
|
|
53
52
|
)
|
|
54
53
|
.postFilter(postFilter)
|
|
55
54
|
.build()
|
|
56
55
|
|
|
57
|
-
const total = query()
|
|
58
|
-
.and(type)
|
|
59
|
-
.select(`"lessonCount": ${lessonCount}`)
|
|
60
|
-
.postFilter(postFilter)
|
|
61
|
-
.build()
|
|
62
|
-
|
|
63
56
|
const q = `{
|
|
64
57
|
"data": ${data},
|
|
65
|
-
"total": count(${total})
|
|
66
58
|
}`
|
|
67
59
|
|
|
68
60
|
return fetchSanity(q, true, { processNeedAccess: false, processPageType: false })
|
|
@@ -84,8 +76,6 @@ export async function fetchInstructorBySlug(
|
|
|
84
76
|
slug: string,
|
|
85
77
|
brand?: Brands | string
|
|
86
78
|
): Promise<Instructor | null> {
|
|
87
|
-
const filter = f.combine(brand ? f.brand(brand) : f.empty, f.referencesParent())
|
|
88
|
-
|
|
89
79
|
const q = query()
|
|
90
80
|
.and(f.type('instructor'))
|
|
91
81
|
.and(f.slug(slug))
|
|
@@ -94,7 +84,7 @@ export async function fetchInstructorBySlug(
|
|
|
94
84
|
`"slug": slug.current`,
|
|
95
85
|
'short_bio',
|
|
96
86
|
`"thumbnail": thumbnail_url.asset->url`,
|
|
97
|
-
`"
|
|
87
|
+
`"lesson_count": ${await f.lessonCount(brand)}`
|
|
98
88
|
)
|
|
99
89
|
.first()
|
|
100
90
|
.build()
|
|
@@ -144,14 +134,16 @@ export async function fetchInstructorLessons(
|
|
|
144
134
|
sort = getSortOrder(sort, brand)
|
|
145
135
|
|
|
146
136
|
const restrictions = await f.combineAsync(
|
|
147
|
-
f.
|
|
148
|
-
f.
|
|
137
|
+
f.status(),
|
|
138
|
+
f.publishedDate(),
|
|
139
|
+
f.notDeprecated(),
|
|
140
|
+
f.referencesIDWithFilter(f.combine(f.type('instructor'), f.slug(slug))),
|
|
141
|
+
f.brand(brand),
|
|
142
|
+
f.searchMatch('title', searchTerm),
|
|
143
|
+
f.includedFields(includedFields)
|
|
149
144
|
)
|
|
150
145
|
|
|
151
146
|
const data = query()
|
|
152
|
-
.and(f.brand(brand))
|
|
153
|
-
.and(f.searchMatch('title', searchTerm))
|
|
154
|
-
.and(f.includedFields(includedFields))
|
|
155
147
|
.and(restrictions)
|
|
156
148
|
.order(sort)
|
|
157
149
|
.slice(offset, limit)
|
|
@@ -165,5 +157,5 @@ export async function fetchInstructorLessons(
|
|
|
165
157
|
"total": count(${total})
|
|
166
158
|
}`
|
|
167
159
|
|
|
168
|
-
return fetchSanity(q, true, { processNeedAccess:
|
|
160
|
+
return fetchSanity(q, true, { processNeedAccess: true, processPageType: false })
|
|
169
161
|
}
|
|
File without changes
|
|
File without changes
|