Skip to content

Commit

Permalink
feat: support topoData field in climb/area tag api (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
vnugent authored May 5, 2024
1 parent 27401ed commit 958d9e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/js/graphql/gql/tags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { gql } from '@apollo/client'
import { EntityTag, TagTargetType, UserMedia } from '../../types'
import { AnyJson, EntityTag, TagTargetType, UserMedia } from '../../types'

export const FRAGMENT_ENTITY_TAG = gql`
fragment EntityTagFields on EntityTag {
Expand All @@ -9,6 +9,7 @@ export const FRAGMENT_ENTITY_TAG = gql`
areaName
ancestors
type
topoData
}
`

Expand All @@ -30,6 +31,7 @@ export interface AddEntityTagProps {
mediaId: string
entityId: string
entityType: TagTargetType
topoData?: AnyJson
}

/**
Expand All @@ -45,12 +47,13 @@ export interface AddEntityTagMutationReturn {
*/
export const MUTATION_ADD_ENTITY_TAG = gql`
${FRAGMENT_ENTITY_TAG}
mutation addEntityTag($mediaId: ID!, $entityId: ID!, $entityType: Int!) {
mutation addEntityTag($mediaId: ID!, $entityId: ID!, $entityType: Int!, $topoData: JSONObject) {
addEntityTag(
input: {
mediaId: $mediaId,
entityId: $entityId,
entityType: $entityType
topoData: $topoData
}
) {
... EntityTagFields
Expand Down
6 changes: 6 additions & 0 deletions src/js/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { GradeContexts } from './grades/Grade'

export type { IUserProfile }
export { UserRole }

export type AnyJson = boolean | number | string | null | JsonArray | JsonMap
export interface JsonMap { [key: string]: AnyJson }
export interface JsonArray extends Array<AnyJson> {}

export interface AreaMetadataType {
leaf: boolean
isDestination: boolean
Expand Down Expand Up @@ -250,6 +255,7 @@ export interface EntityTag {
ancestors: string
climbName?: string
areaName: string
topoData?: AnyJson
}

export enum MediaFormat {
Expand Down

0 comments on commit 958d9e1

Please sign in to comment.