From 958d9e1d221ace72d499a77ba1972c089b45c4e8 Mon Sep 17 00:00:00 2001 From: Viet Nguyen <3805254+vnugent@users.noreply.github.com> Date: Sun, 5 May 2024 03:19:44 -0700 Subject: [PATCH] feat: support topoData field in climb/area tag api (#1127) --- src/js/graphql/gql/tags.ts | 7 +++++-- src/js/types.ts | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/js/graphql/gql/tags.ts b/src/js/graphql/gql/tags.ts index d730c8308..8038384eb 100644 --- a/src/js/graphql/gql/tags.ts +++ b/src/js/graphql/gql/tags.ts @@ -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 { @@ -9,6 +9,7 @@ export const FRAGMENT_ENTITY_TAG = gql` areaName ancestors type + topoData } ` @@ -30,6 +31,7 @@ export interface AddEntityTagProps { mediaId: string entityId: string entityType: TagTargetType + topoData?: AnyJson } /** @@ -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 diff --git a/src/js/types.ts b/src/js/types.ts index 553020e86..4224ba6ca 100644 --- a/src/js/types.ts +++ b/src/js/types.ts @@ -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 {} + export interface AreaMetadataType { leaf: boolean isDestination: boolean @@ -250,6 +255,7 @@ export interface EntityTag { ancestors: string climbName?: string areaName: string + topoData?: AnyJson } export enum MediaFormat {