Fix examples CI

This commit is contained in:
Billy Chan 2024-08-12 11:27:58 +08:00
parent c28ed57a0a
commit 368b1126f7
No known key found for this signature in database
GPG Key ID: 45461E52F22E0279
15 changed files with 35 additions and 30 deletions

View File

@ -238,16 +238,16 @@ jobs:
examples/basic, examples/basic,
examples/graphql_example, examples/graphql_example,
examples/jsonrpsee_example, examples/jsonrpsee_example,
# examples/loco_example, examples/loco_example,
# examples/loco_starter, examples/loco_starter,
# examples/loco_seaography, examples/loco_seaography,
examples/poem_example, examples/poem_example,
examples/proxy_gluesql_example, examples/proxy_gluesql_example,
# examples/react_admin, examples/react_admin,
examples/rocket_example, examples/rocket_example,
examples/rocket_okapi_example, examples/rocket_okapi_example,
examples/salvo_example, examples/salvo_example,
# examples/seaography_example, examples/seaography_example,
examples/tonic_example, examples/tonic_example,
] ]
steps: steps:

View File

@ -4,5 +4,6 @@ use todolist::app::App;
#[tokio::main] #[tokio::main]
async fn main() -> eyre::Result<()> { async fn main() -> eyre::Result<()> {
cli::main::<App, Migrator>().await cli::main::<App, Migrator>().await?;
Ok(())
} }

View File

@ -13,7 +13,6 @@
//! ```sh //! ```sh
//! cargo run task seed_data refresh:true //! cargo run task seed_data refresh:true
//! ``` //! ```
use std::collections::BTreeMap;
use loco_rs::{db, prelude::*}; use loco_rs::{db, prelude::*};
use migration::Migrator; use migration::Migrator;
@ -29,8 +28,10 @@ impl Task for SeedData {
detail: "Task for seeding data".to_string(), detail: "Task for seeding data".to_string(),
} }
} }
async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> { async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true"); let refresh = vars
.cli_arg("refresh")
.is_ok_and(|refresh| refresh == "true");
if refresh { if refresh {
db::reset::<Migrator>(&app_context.db).await?; db::reset::<Migrator>(&app_context.db).await?;

View File

@ -26,7 +26,7 @@ include_dir = "0.7"
uuid = { version = "1.6.0", features = ["v4"] } uuid = { version = "1.6.0", features = ["v4"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] } 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 = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
async-graphql-axum = { version = "7.0" } async-graphql-axum = { version = "7.0" }
lazy_static = { version = "1.4" } lazy_static = { version = "1.4" }

View File

@ -4,5 +4,6 @@ use migration::Migrator;
#[tokio::main] #[tokio::main]
async fn main() -> eyre::Result<()> { async fn main() -> eyre::Result<()> {
cli::main::<App, Migrator>().await cli::main::<App, Migrator>().await?;
Ok(())
} }

View File

@ -192,7 +192,7 @@ impl super::_entities::users::Model {
/// ///
/// when could not convert user claims to jwt token /// when could not convert user claims to jwt token
pub fn generate_jwt(&self, secret: &str, expiration: &u64) -> ModelResult<String> { 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)?)
} }
} }

View File

@ -13,7 +13,6 @@
//! ```sh //! ```sh
//! cargo run task seed_data refresh:true //! cargo run task seed_data refresh:true
//! ``` //! ```
use std::collections::BTreeMap;
use loco_rs::{db, prelude::*}; use loco_rs::{db, prelude::*};
use migration::Migrator; use migration::Migrator;
@ -31,8 +30,10 @@ impl Task for SeedData {
} }
} }
async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> { async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true"); let refresh = vars
.cli_arg("refresh")
.is_ok_and(|refresh| refresh == "true");
if refresh { if refresh {
db::reset::<Migrator>(&app_context.db).await?; db::reset::<Migrator>(&app_context.db).await?;

View File

@ -4,5 +4,6 @@ use migration::Migrator;
#[tokio::main] #[tokio::main]
async fn main() -> eyre::Result<()> { async fn main() -> eyre::Result<()> {
cli::main::<App, Migrator>().await cli::main::<App, Migrator>().await?;
Ok(())
} }

View File

@ -192,7 +192,7 @@ impl super::_entities::users::Model {
/// ///
/// when could not convert user claims to jwt token /// when could not convert user claims to jwt token
pub fn generate_jwt(&self, secret: &str, expiration: &u64) -> ModelResult<String> { 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)?)
} }
} }

View File

@ -13,7 +13,6 @@
//! ```sh //! ```sh
//! cargo run task seed_data refresh:true //! cargo run task seed_data refresh:true
//! ``` //! ```
use std::collections::BTreeMap;
use loco_rs::{db, prelude::*}; use loco_rs::{db, prelude::*};
use migration::Migrator; use migration::Migrator;
@ -31,8 +30,10 @@ impl Task for SeedData {
} }
} }
async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> { async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true"); let refresh = vars
.cli_arg("refresh")
.is_ok_and(|refresh| refresh == "true");
if refresh { if refresh {
db::reset::<Migrator>(&app_context.db).await?; db::reset::<Migrator>(&app_context.db).await?;

View File

@ -26,7 +26,7 @@ include_dir = "0.7"
uuid = { version = "1.6.0", features = ["v4"] } uuid = { version = "1.6.0", features = ["v4"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] } 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 = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
async-graphql-axum = { version = "7.0" } async-graphql-axum = { version = "7.0" }
lazy_static = { version = "1.4" } lazy_static = { version = "1.4" }

View File

@ -4,5 +4,6 @@ use migration::Migrator;
#[tokio::main] #[tokio::main]
async fn main() -> eyre::Result<()> { async fn main() -> eyre::Result<()> {
cli::main::<App, Migrator>().await cli::main::<App, Migrator>().await?;
Ok(())
} }

View File

@ -192,7 +192,7 @@ impl super::_entities::users::Model {
/// ///
/// when could not convert user claims to jwt token /// when could not convert user claims to jwt token
pub fn generate_jwt(&self, secret: &str, expiration: &u64) -> ModelResult<String> { 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)?)
} }
} }

View File

@ -13,7 +13,6 @@
//! ```sh //! ```sh
//! cargo run task seed_data refresh:true //! cargo run task seed_data refresh:true
//! ``` //! ```
use std::collections::BTreeMap;
use loco_rs::{db, prelude::*}; use loco_rs::{db, prelude::*};
use migration::Migrator; use migration::Migrator;
@ -31,8 +30,10 @@ impl Task for SeedData {
} }
} }
async fn run(&self, app_context: &AppContext, vars: &BTreeMap<String, String>) -> Result<()> { async fn run(&self, app_context: &AppContext, vars: &task::Vars) -> Result<()> {
let refresh = vars.get("refresh").is_some_and(|refresh| refresh == "true"); let refresh = vars
.cli_arg("refresh")
.is_ok_and(|refresh| refresh == "true");
if refresh { if refresh {
db::reset::<Migrator>(&app_context.db).await?; db::reset::<Migrator>(&app_context.db).await?;

View File

@ -15,10 +15,7 @@ tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" } tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" } tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" } lazy_static = { version = "1.4.0" }
seaography = { version = "1.1.0-rc.1", features = ["with-decimal", "with-chrono"] }
[dependencies.seaography]
version = "1.0.0" # seaography version
features = ["with-decimal", "with-chrono"]
[dev-dependencies] [dev-dependencies]
serde_json = { version = "1.0.103" } serde_json = { version = "1.0.103" }