Skip to content

Commit dac0005

Browse files
committed
feat: add description parameters for add formation and climb mutations
1 parent 8c4a625 commit dac0005

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/schema/mod.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ impl MutationRoot {
652652
&self,
653653
ctx: &Context<'_>,
654654
#[graphql(desc = "Climb name")] name: Option<String>,
655+
#[graphql(desc = "Climb description")] description: Option<String>,
655656
#[graphql(desc = "Climb parent")] parent: Option<ClimbParentInput>,
656657
) -> Result<Climb> {
657658
let data = ctx.data::<AppData>()?;
@@ -666,8 +667,13 @@ impl MutationRoot {
666667

667668
let id = transaction
668669
.query_one(
669-
"INSERT INTO climb.climbs (name) VALUES ($1) RETURNING id",
670-
&[&name],
670+
"
671+
INSERT INTO
672+
climb.climbs (name, description)
673+
VALUES ($1, $2)
674+
RETURNING id
675+
",
676+
&[&name, &description],
671677
)
672678
.await?
673679
.get::<_, i32>(0);
@@ -1035,6 +1041,7 @@ impl MutationRoot {
10351041
&self,
10361042
ctx: &Context<'_>,
10371043
#[graphql(desc = "Formation name")] name: Option<String>,
1044+
#[graphql(desc = "Formation description")] description: Option<String>,
10381045
#[graphql(desc = "Formation location")] location: Option<Coordinate>,
10391046
#[graphql(desc = "Formation parent")] parent: Option<FormationParentInput>,
10401047
) -> Result<Formation> {
@@ -1053,8 +1060,12 @@ impl MutationRoot {
10531060

10541061
let id = transaction
10551062
.query_one(
1056-
"INSERT INTO climb.formations (name, location) VALUES ($1, $2) RETURNING id",
1057-
&[&name, &point],
1063+
"
1064+
INSERT INTO
1065+
climb.formations (name, description, location)
1066+
VALUES ($1, $2, $3)
1067+
RETURNING id",
1068+
&[&name, &description, &point],
10581069
)
10591070
.await?
10601071
.get::<_, i32>(0);

0 commit comments

Comments
 (0)