Skip to content

Commit

Permalink
fix: expose boltsCount and pitches in GraphQL mutation SingleClim…
Browse files Browse the repository at this point in the history
…bChangeInput (#365)

* expose boltsCount and pitches in GraphQL mutation, harmonise naming of  disciplines/type variable between Climb and Pitches
  • Loading branch information
l4u532 authored Jan 10, 2024
1 parent 5055dbe commit d649c6d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/db/ClimbTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface IPitch {
parentId: MUUID
pitchNumber: number
grades?: Partial<Record<GradeScalesTypes, string>>
type?: DisciplineType
disciplines?: DisciplineType
length?: number
boltsCount?: number
description?: string
Expand Down Expand Up @@ -169,8 +169,8 @@ export interface PitchChangeInputType {
id?: string
parentId?: string
pitchNumber?: number
disciplines?: DisciplineType
grades?: Partial<Record<GradeScalesTypes, string>>
type?: DisciplineType
length?: number
boltsCount?: number
description?: string
Expand All @@ -180,7 +180,7 @@ export interface ClimbChangeInputType {
id?: string
name?: string
disciplines?: DisciplineType
grade?: string // actual grade value (e.g. "7a", "5+")
grade?: string // single, atomic grade value (e.g. "7a", "5+")
leftRightIndex?: number
description?: string
location?: string
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/schema/Climb.gql
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ type Pitch {
length: Int
boltsCount: Int
description: String
}
}
33 changes: 23 additions & 10 deletions src/graphql/schema/ClimbEdit.gql
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,45 @@ input SingleClimbChangeInput {
fa: String
"Length in meters"
length: Int
"Number of fixed anchors"
boltsCount: Int
"List of Pitch objects representing individual pitches of a multi-pitch climb"
pitches: [PitchInput]
experimentalAuthor: ExperimentalAuthorType
}

input GradeTypeInput {
vscale: String
yds: String
ewbank: String
french: String
brazilianCrux: String
font: String
uiaa: String
}

input PitchInput {
id: ID!
parentId: ID!
pitchNumber: Int!
grades: GradeTypeInput
disciplines: DisciplineType
}

input DisciplineType {
"https://en.wikipedia.org/wiki/Traditional_climbing"
trad: Boolean
"https://en.wikipedia.org/wiki/Sport_climbing"
sport: Boolean
"https://en.wikipedia.org/wiki/Bouldering"
bouldering: Boolean
"https://en.wikipedia.org/wiki/Deep-water_soloing"
deepwatersolo: Boolean
"https://en.wikipedia.org/wiki/Alpine_climbing"
alpine: Boolean
"https://en.wikipedia.org/wiki/Ice_climbing"
snow: Boolean
"https://en.wikipedia.org/wiki/Ice_climbing"
ice: Boolean
mixed: Boolean
"https://en.wikipedia.org/wiki/Aid_climbing"
aid: Boolean
"https://en.wikipedia.org/wiki/Top_rope_climbing"
tr: Boolean
}

input ExperimentalAuthorType {
displayName: String!
url: String!
}
}
8 changes: 4 additions & 4 deletions src/model/__tests__/MutableClimbDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ describe('Climb CRUD', () => {
{
pitchNumber: 1,
grades: { uiaa: '7' },
type: { sport: true },
disciplines: { sport: true },
length: 30,
boltsCount: 5,
description: 'First pitch description'
},
{
pitchNumber: 2,
grades: { uiaa: '6+' },
type: { sport: true },
disciplines: { sport: true },
length: 40,
boltsCount: 6,
description: 'Second pitch description'
Expand Down Expand Up @@ -653,7 +653,7 @@ describe('Climb CRUD', () => {
parentId: originalPitch1ParentID,
pitchNumber: 1,
grades: { ewbank: '19' },
type: { sport: false, alpine: true },
disciplines: { sport: false, alpine: true },
length: 20,
boltsCount: 6,
description: 'Updated first pitch description'
Expand All @@ -664,7 +664,7 @@ describe('Climb CRUD', () => {
parentId: originalPitch2ParentID,
pitchNumber: 2,
grades: { ewbank: '18' },
type: { sport: false, alpine: true },
disciplines: { sport: false, alpine: true },
length: 25,
boltsCount: 5,
description: 'Updated second pitch description'
Expand Down

0 comments on commit d649c6d

Please sign in to comment.