Skip to content

Commit

Permalink
expose boltsCount and pitches in GraphQL mutation, harmonise naming o…
Browse files Browse the repository at this point in the history
…f disciplines variable
  • Loading branch information
l4u532 committed Dec 9, 2023
1 parent 2e9f04c commit 8dacaeb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 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
1 change: 1 addition & 0 deletions src/graphql/climb/ClimbMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ const ClimbMutations = {
}

export default ClimbMutations

35 changes: 26 additions & 9 deletions src/graphql/schema/ClimbEdit.gql
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,49 @@ 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: [Pitch]
experimentalAuthor: ExperimentalAuthorType
}

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 GradeType {
vscale: String
yds: String
ewbank: String
french: String
brazilianCrux: String
font: String
uiaa: String
}

input ExperimentalAuthorType {
displayName: String!
url: String!
}

input Pitch {
id: ID!
parentId: ID!
pitchNumber: Int!
grades: GradeType
type: DisciplineType
length: Int
boltsCount: Int
description: 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 8dacaeb

Please sign in to comment.