Skip to content

Commit

Permalink
Change maxParallelSession type from Option<StringNumber> to `Opti…
Browse files Browse the repository at this point in the history
…on<i32>`
  • Loading branch information
div-seungha committed Jan 13, 2025
1 parent f7c31d6 commit 4be2b51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ Versioning](https://semver.org/spec/v2.0.0.html).
set to an empty string were not saved to the `config` in the database.
- Fixed an issue where configuration conversion failures were silently ignored,
leading to incorrect None handling.
- The `maxParallelSession` field in `Account` has been updated to use
`Option<i32>`. Previously, it was returned as an `Option<StringNumber>` type.
The `max_parallel_sessions` type in review-database has been updated from
`Option<u32>` to `Option<u8>`, the related code has been revised accordingly.
And since GraphQL does not support unsigned integers, the type has been
changed to a signed type `Option<i32>`, which can cover `Option<u8>`.
## [0.24.0] - 2024-11-19
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ num-traits = "0.2"
reqwest = { version = "0.12", default-features = false, features = [
"rustls-tls-native-roots",
] }
review-database = { git = "https://github.com/petabi/review-database.git", rev = "f59bef0" }
review-database = { git = "https://github.com/petabi/review-database.git", rev = "3be5e9f" }
roxy = { git = "https://github.com/aicers/roxy.git", tag = "0.3.0" }
rustls = { version = "0.23", default-features = false, features = [
"ring",
Expand Down
14 changes: 6 additions & 8 deletions src/graphql/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use anyhow::anyhow;
use async_graphql::connection::OpaqueCursor;
use async_graphql::{
connection::{Connection, EmptyFields},
Context, Enum, InputObject, Object, Result, SimpleObject, StringNumber,
Context, Enum, InputObject, Object, Result, SimpleObject,
};
use chrono::{DateTime, NaiveDateTime, TimeZone, Utc};
use review_database::{
Expand Down Expand Up @@ -173,7 +173,7 @@ impl AccountMutation {
language: Option<String>,
theme: Option<String>,
allow_access_from: Option<Vec<IpAddress>>,
max_parallel_sessions: Option<u32>,
max_parallel_sessions: Option<u8>,
) -> Result<String> {
let store = crate::graphql::get_store(ctx).await?;
let table = store.account_map();
Expand Down Expand Up @@ -673,10 +673,8 @@ impl Account {
.map(|ips| ips.iter().map(ToString::to_string).collect::<Vec<String>>())
}

/// The max sessions that can be run in parallel in string within the
/// representable range of `u32`.
async fn max_parallel_sessions(&self) -> Option<StringNumber<u32>> {
self.inner.max_parallel_sessions.map(StringNumber)
async fn max_parallel_sessions(&self) -> Option<i32> {
self.inner.max_parallel_sessions.map(i32::from)
}
}

Expand Down Expand Up @@ -754,8 +752,8 @@ struct UpdateAllowAccessFrom {
/// The old and new values of `maxParallelSessions` to update.
#[derive(InputObject)]
struct UpdateMaxParallelSessions {
old: Option<u32>,
new: Option<u32>,
old: Option<u8>,
new: Option<u8>,
}

struct AccountTotalCount;
Expand Down

0 comments on commit 4be2b51

Please sign in to comment.