chore: refactor dependencies

This commit is contained in:
EETagent 2022-10-29 12:34:10 +02:00
parent ba34a6cf3d
commit 515d4d1298
18 changed files with 46 additions and 110 deletions

View file

@ -1,5 +1,5 @@
[package]
name = "sea-orm-rocket-example"
name = "portfolio"
version = "0.1.0"
authors = ["Vojtěch Jungmann", "Sebastian Pravda"]
edition = "2021"

View file

@ -5,22 +5,23 @@ edition = "2021"
publish = false
[dependencies]
rocket = { version = "^0.5.0-rc.2", features = [
"json",
] }
async-stream = { version = "^0.3" }
async-trait = { version = "0.1" }
futures = { version = "^0.3" }
futures-util = { version = "^0.3" }
rocket = { version = "0.5.0-rc.2", features = [
"json",
] }
dotenv = "0.15.0"
tokio = "^1.21"
serde_json = { version = "^1" }
dotenv = "^0.15"
serde_json = { version = "^1.0" }
portfolio-entity = { path = "../entity" }
portfolio-migration = { path = "../migration" }
portfolio-core = { path = "../core" }
tokio = "1.21.2"
[dependencies.sea-orm-rocket]
version = "0.5.1"
version = "^0.5"

View file

@ -2,29 +2,40 @@
name = "portfolio-core"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
portfolio-entity = { path = "../entity" }
rand = "0.8.5"
chrono = "0.4.22"
jsonwebtoken = "8.1.1"
dotenv = "0.15.0"
tokio = "1.21.2"
futures = "0.3.25"
async-compat = "0.2.1"
chrono = "^0.4"
infer = "0.9"
# serialization & deserialization
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
portfolio-entity = { path = "../entity" }
# tokens
jsonwebtoken = "^8.1"
# env
dotenv = "^0.15"
# async
tokio = "^1.21"
futures = "^0.3"
async-compat = "^0.2"
# file identifier
infer = "^0.9"
# crypto
argon2 = { version = "0.4", features = ["std"] }
age = { version = "0.9", features = ["async"] }
secrecy = { version = "0.8.0" }
base64 = "0.13"
rand = "^0.8"
argon2 = { version = "^0.4", features = ["std"] }
age = { version = "^0.9", features = ["async"] }
secrecy = { version = "^0.8" }
base64 = "^0.13"
[dependencies.sea-orm]
version = "^0.10.0"
version = "^0.10"
features = [
"runtime-tokio-native-tls",
"sqlx-postgres",
@ -32,5 +43,5 @@ features = [
]
[dev-dependencies]
tokio = "1.21"
async-tempfile = "0.2.0"
tokio = "^1.21"
async-tempfile = "^0.2"

View file

@ -9,10 +9,8 @@ name = "entity"
path = "src/lib.rs"
[dependencies]
rocket = { version = "0.5.0-rc.2", features = [
"json",
] }
chrono = "0.4.22"
serde = { version = "^1.0", features = ["derive"] }
chrono = "^0.4"
[dependencies.sea-orm]
version = "^0.10.0"
version = "^0.10"

View file

@ -1,5 +1,3 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]

View file

@ -1,11 +1,8 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;
use rocket::serde::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[serde(crate = "rocket::serde")]
#[sea_orm(table_name = "candidate")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]

View file

@ -1,5 +1,3 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
pub mod prelude;
pub mod admin;

View file

@ -1,5 +1,3 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]

View file

@ -1,5 +1,3 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
pub use super::admin::Entity as Admin;
pub use super::candidate::Entity as Candidate;
pub use super::parent::Entity as Parent;

View file

@ -1,5 +1,3 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]

View file

@ -9,11 +9,10 @@ name = "migration"
path = "src/lib.rs"
[dependencies]
rocket = { version = "0.5.0-rc.2" }
async-std = { version = "^1", features = ["attributes", "tokio1"] }
chrono = "0.4.22"
serde = { version = "^1.0", features = ["derive"] }
chrono = "^0.4"
portfolio-entity = { path = "../entity" }
[dependencies.sea-orm-migration]
version = "^0.10.0"
version = "^0.10"
features = [ "runtime-tokio-native-tls", "sqlx-postgres", "sqlx-sqlite"]

View file

@ -1,37 +0,0 @@
# Running Migrator CLI
- Apply all pending migrations
```sh
cargo run
```
```sh
cargo run -- up
```
- Apply first 10 pending migrations
```sh
cargo run -- up -n 10
```
- Rollback last applied migrations
```sh
cargo run -- down
```
- Rollback last 10 applied migrations
```sh
cargo run -- down -n 10
```
- Drop all tables from the database, then reapply all migrations
```sh
cargo run -- fresh
```
- Rollback all applied migrations, then reapply all migrations
```sh
cargo run -- refresh
```
- Rollback all applied migrations
```sh
cargo run -- reset
```
- Check the status of all migrations
```sh
cargo run -- status
```

View file

@ -36,7 +36,6 @@ impl MigrationTrait for Migration {
}
}
/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Admin {
Table,

View file

@ -48,7 +48,6 @@ impl MigrationTrait for Migration {
}
}
/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Candidate {
Table,

View file

@ -36,7 +36,6 @@ impl MigrationTrait for Migration {
}
}
/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Parent {
Table,

View file

@ -40,8 +40,6 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let db = manager.get_connection();
print!("{:?}", self.admin.clone().id);
self.admin.to_owned().delete(db).await?;
Ok(())

View file

@ -34,7 +34,6 @@ impl MigrationTrait for Migration {
}
}
/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Session {
Table,

View file

@ -1,17 +0,0 @@
use sea_orm_migration::prelude::*;
#[async_std::main]
async fn main() {
// Setting `DATABASE_URL` environment variable
let key = "DATABASE_URL";
if std::env::var(key).is_err() {
// Getting the database URL from Rocket.toml if it's not set
let figment = rocket::Config::figment();
let database_url: String = figment
.extract_inner("databases.sea_orm.url")
.expect("Cannot find Database URL in Rocket.toml");
std::env::set_var(key, database_url);
}
cli::run_cli(migration::Migrator).await;
}