Skip to content

Commit 472c001

Browse files
committed
feat: add moveCrag mutation
1 parent 34e5ba2 commit 472c001

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/schema/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,25 @@ impl MutationRoot {
996996
Ok(Climb(id))
997997
}
998998

999+
async fn move_crag(
1000+
&self,
1001+
ctx: &Context<'_>,
1002+
id: ID,
1003+
region_id: Option<ID>
1004+
) -> Result<Crag> {
1005+
let db_client = ctx.db_client().await?;
1006+
1007+
let id: i32 = id.parse()?;
1008+
let region_id: Option<i32> = region_id.map(|r| r.parse()).transpose()?;
1009+
1010+
let _ = db_client.execute(
1011+
"
1012+
UPDATE climb.crags SET region_id = $1 WHERE id = $2
1013+
", &[&region_id, &id]).await;
1014+
1015+
Ok(Crag(id))
1016+
}
1017+
9991018
async fn add_climb_grade(
10001019
&self,
10011020
ctx: &Context<'_>,

0 commit comments

Comments
 (0)