Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct findMediaByAreaId() call signature #404

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions src/db/utils/jobs/MapTiles/exportCmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ import { ClimbType } from '../../../ClimbTypes.js'
import MutableMediaDataSource from '../../../../model/MutableMediaDataSource.js'
import { workingDir } from './init.js'

const MEDIA_PROJECTION = {
width: 1,
height: 1,
mediaUrl: 1,
format: 1,
_id: 0,
'entityTags.targetId': 1,
'entityTags.ancestors': 1,
'entityTags.climbName': 1,
'entityTags.areaName': 1,
'entityTags.type': 1
}

/**
* Export leaf areas as Geojson. Leaf areas are crags/boulders that have climbs.
*/
Expand Down Expand Up @@ -72,8 +85,8 @@ async function exportLeafCrags (): Promise<void> {
content,
media: await MutableMediaDataSource.getInstance().findMediaByAreaId(
metadata.area_id,
ancestors
),
MEDIA_PROJECTION,
true),
climbs: climbs.map(({ _id, name, type, grades }: ClimbType) => ({
id: _id.toUUID().toString(),
name,
Expand Down Expand Up @@ -169,7 +182,8 @@ async function exportAreas (): Promise<void> {
metadata: {
isDestination: 1,
polygon: 1,
leftRightIndex: 1
leftRightIndex: 1,
level: { $size: { $split: ['$ancestors', ','] } }
},
pathTokens: 1,
ancestors: { $split: ['$ancestors', ','] },
Expand All @@ -192,19 +206,7 @@ async function exportAreas (): Promise<void> {
{
type: 'areas',
...doc,
media: await MutableMediaDataSource.getInstance().findMediaByAreaId(muuid.from(doc.id), {
width: 1,
height: 1,
mediaUrl: 1,
format: 1,
_id: 0,
'entityTags.targetId': 1,
'entityTags.ancestors': 1,
'entityTags.climbName': 1,
'entityTags.areaName': 1,
'entityTags.type': 1
},
true),
media: await MutableMediaDataSource.getInstance().findMediaByAreaId(muuid.from(doc.id), MEDIA_PROJECTION, true),
metadata: doc.metadata
},
{
Expand Down
Loading