Skip to content

Commit

Permalink
Fix examples CI
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Aug 12, 2024
1 parent c28ed57 commit 368b112
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 30 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,16 @@ jobs:
examples/basic,
examples/graphql_example,
examples/jsonrpsee_example,
# examples/loco_example,
# examples/loco_starter,
# examples/loco_seaography,
examples/loco_example,
examples/loco_starter,
examples/loco_seaography,
examples/poem_example,
examples/proxy_gluesql_example,
# examples/react_admin,
examples/react_admin,
examples/rocket_example,
examples/rocket_okapi_example,
examples/salvo_example,
# examples/seaography_example,
examples/seaography_example,
examples/tonic_example,
]
steps:
Expand Down
3 changes: 2 additions & 1 deletion examples/loco_example/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ use todolist::app::App;

#[tokio::main]
async fn main() -> eyre::Result<()> {
cli::main::<App, Migrator>().await
cli::main::<App, Migrator>().await?;
Ok(())
}
7 changes: 4 additions & 3 deletions examples/loco_example/tests/tasks/seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//! ```sh
//! cargo run task seed_data refresh:true
//! ```
use std::collections::BTreeMap;

use loco_rs::{db, prelude::*};
use migration::Migrator;
Expand All @@ -29,8 +28,10 @@ impl Task for SeedData {
detail: "Task for seeding data".to_string(),
}
}
async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true");
async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
let refresh = vars
.cli_arg("refresh")
.is_ok_and(|refresh| refresh == "true");

if refresh {
db::reset::<Migrator>(&app_context.db).await?;
Expand Down
2 changes: 1 addition & 1 deletion examples/loco_seaography/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ include_dir = "0.7"
uuid = { version = "1.6.0", features = ["v4"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] }

seaography = { version = "1.0.0", features = ["with-decimal", "with-chrono"] }
seaography = { version = "1.1.0-rc.1", features = ["with-decimal", "with-chrono"] }
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
async-graphql-axum = { version = "7.0" }
lazy_static = { version = "1.4" }
Expand Down
3 changes: 2 additions & 1 deletion examples/loco_seaography/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ use migration::Migrator;

#[tokio::main]
async fn main() -> eyre::Result<()> {
cli::main::<App, Migrator>().await
cli::main::<App, Migrator>().await?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/loco_seaography/src/models/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl super::_entities::users::Model {
///
/// when could not convert user claims to jwt token
pub fn generate_jwt(&self, secret: &str, expiration: &u64) -> ModelResult<String> {
Ok(jwt::JWT::new(secret).generate_token(expiration, self.pid.to_string())?)
Ok(jwt::JWT::new(secret).generate_token(expiration, self.pid.to_string(), None)?)
}
}

Expand Down
7 changes: 4 additions & 3 deletions examples/loco_seaography/src/tasks/seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//! ```sh
//! cargo run task seed_data refresh:true
//! ```
use std::collections::BTreeMap;

use loco_rs::{db, prelude::*};
use migration::Migrator;
Expand All @@ -31,8 +30,10 @@ impl Task for SeedData {
}
}

async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true");
async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
let refresh = vars
.cli_arg("refresh")
.is_ok_and(|refresh| refresh == "true");

if refresh {
db::reset::<Migrator>(&app_context.db).await?;
Expand Down
3 changes: 2 additions & 1 deletion examples/loco_starter/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ use migration::Migrator;

#[tokio::main]
async fn main() -> eyre::Result<()> {
cli::main::<App, Migrator>().await
cli::main::<App, Migrator>().await?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/loco_starter/src/models/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl super::_entities::users::Model {
///
/// when could not convert user claims to jwt token
pub fn generate_jwt(&self, secret: &str, expiration: &u64) -> ModelResult<String> {
Ok(jwt::JWT::new(secret).generate_token(expiration, self.pid.to_string())?)
Ok(jwt::JWT::new(secret).generate_token(expiration, self.pid.to_string(), None)?)
}
}

Expand Down
7 changes: 4 additions & 3 deletions examples/loco_starter/src/tasks/seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//! ```sh
//! cargo run task seed_data refresh:true
//! ```
use std::collections::BTreeMap;

use loco_rs::{db, prelude::*};
use migration::Migrator;
Expand All @@ -31,8 +30,10 @@ impl Task for SeedData {
}
}

async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true");
async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
let refresh = vars
.cli_arg("refresh")
.is_ok_and(|refresh| refresh == "true");

if refresh {
db::reset::<Migrator>(&app_context.db).await?;
Expand Down
2 changes: 1 addition & 1 deletion examples/react_admin/backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ include_dir = "0.7"
uuid = { version = "1.6.0", features = ["v4"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] }

seaography = { version = "1.0.0", features = ["with-decimal", "with-chrono"] }
seaography = { version = "1.1.0-rc.1", features = ["with-decimal", "with-chrono"] }
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
async-graphql-axum = { version = "7.0" }
lazy_static = { version = "1.4" }
Expand Down
3 changes: 2 additions & 1 deletion examples/react_admin/backend/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ use migration::Migrator;

#[tokio::main]
async fn main() -> eyre::Result<()> {
cli::main::<App, Migrator>().await
cli::main::<App, Migrator>().await?;
Ok(())
}
2 changes: 1 addition & 1 deletion examples/react_admin/backend/src/models/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl super::_entities::users::Model {
///
/// when could not convert user claims to jwt token
pub fn generate_jwt(&self, secret: &str, expiration: &u64) -> ModelResult<String> {
Ok(jwt::JWT::new(secret).generate_token(expiration, self.pid.to_string())?)
Ok(jwt::JWT::new(secret).generate_token(expiration, self.pid.to_string(), None)?)
}
}

Expand Down
7 changes: 4 additions & 3 deletions examples/react_admin/backend/src/tasks/seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//! ```sh
//! cargo run task seed_data refresh:true
//! ```
use std::collections::BTreeMap;

use loco_rs::{db, prelude::*};
use migration::Migrator;
Expand All @@ -31,8 +30,10 @@ impl Task for SeedData {
}
}

async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true");
async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
let refresh = vars
.cli_arg("refresh")
.is_ok_and(|refresh| refresh == "true");

if refresh {
db::reset::<Migrator>(&app_context.db).await?;
Expand Down
5 changes: 1 addition & 4 deletions examples/seaography_example/graphql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" }

[dependencies.seaography]
version = "1.0.0" # seaography version
features = ["with-decimal", "with-chrono"]
seaography = { version = "1.1.0-rc.1", features = ["with-decimal", "with-chrono"] }

[dev-dependencies]
serde_json = { version = "1.0.103" }
Expand Down

0 comments on commit 368b112

Please sign in to comment.