Skip to content

Commit

Permalink
Fix boolean not string (#145)
Browse files Browse the repository at this point in the history
* Fix boolean not string

* Add test case
  • Loading branch information
karatakis authored Oct 9, 2023
1 parent 44ec378 commit 4203b82
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions examples/postgres/tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,3 +895,37 @@ async fn enumeration_filter() {
"#,
)
}

#[tokio::test]
async fn test_boolean_field() {
let schema = get_schema().await;

assert_eq(
schema
.execute(
r#"
{
customer(filters: { customerId: { eq: 1 } }) {
nodes {
customerId
activebool
}
}
}
"#,
)
.await,
r#"
{
"customer": {
"nodes": [
{
"customerId": 1,
"activebool": true
}
]
}
}
"#,
)
}
2 changes: 1 addition & 1 deletion src/outputs/entity_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl EntityObjectBuilder {
match object.get(column) {
sea_orm::sea_query::Value::Bool(value) => FieldFuture::new(async move {
match value {
Some(value) => Ok(Some(Value::from(value.to_string()))),
Some(value) => Ok(Some(Value::from(value))),
None => Ok(None),
}
}),
Expand Down

0 comments on commit 4203b82

Please sign in to comment.