Skip to content

Commit

Permalink
Change maxParallelSessions type to Option<u8>
Browse files Browse the repository at this point in the history
  • Loading branch information
div-seungha committed Jan 14, 2025
1 parent f7c31d6 commit 81a2a61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Versioning](https://semver.org/spec/v2.0.0.html).
type instead of `usize` type value for the `cluster_id` field.
- Updated `insertNode` GraphQL API to no longer require `config` for the
`agents` parameter.
- Updated account-related GraphQL APIs to reflect the type change of
`Account::max_parallel_sessions` from `Option<u32>` to `Option<u8>`.
- The `account` and related queries such as `accountList` now return
`maxParallelSessions` as an `Int` within the range of `u8`.
- The `insertAccount` and `updateAccount` GraphQL APIs remain unchanged in
their interfaces but now only accept parameters related to max parallel
sessions within the range of `u8`.
### Removed
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
19 changes: 10 additions & 9 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,10 @@ 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)
/// The max sessions that can be run in parallel within the
/// representable range of `u8`.
async fn max_parallel_sessions(&self) -> Option<u8> {
self.inner.max_parallel_sessions
}
}

Expand Down Expand Up @@ -751,11 +751,12 @@ struct UpdateAllowAccessFrom {
new: Option<Vec<IpAddress>>,
}

/// The old and new values of `maxParallelSessions` to update.
/// The old and new values of `maxParallelSessions` to update,
/// and the values must be in the range of `u8`.
#[derive(InputObject)]
struct UpdateMaxParallelSessions {
old: Option<u32>,
new: Option<u32>,
old: Option<u8>,
new: Option<u8>,
}

struct AccountTotalCount;
Expand Down

0 comments on commit 81a2a61

Please sign in to comment.