cargo fmt check

This commit is contained in:
Chris Tsang 2023-06-22 07:42:48 +08:00
parent 6d40569164
commit 27af2c9c05
10 changed files with 25 additions and 37 deletions

View File

@ -251,7 +251,7 @@ jobs:
with: with:
toolchain: stable toolchain: stable
components: rustfmt components: rustfmt
- run: cargo fmt --manifest-path ${{ matrix.path }} --all -- --check - run: cargo fmt --manifest-path ${{ matrix.path }} -- --check
- run: cargo build --manifest-path ${{ matrix.path }} - run: cargo build --manifest-path ${{ matrix.path }}
- run: cargo test --manifest-path ${{ matrix.path }} - run: cargo test --manifest-path ${{ matrix.path }}
- if: ${{ contains(matrix.path, 'core/Cargo.toml') }} - if: ${{ contains(matrix.path, 'core/Cargo.toml') }}

View File

@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*;
pub struct Model { pub struct Model {
#[sea_orm(primary_key)] #[sea_orm(primary_key)]
pub id: i32, pub id: i32,
pub user_id: Option<i32> , pub user_id: Option<i32>,
} }
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
@ -15,7 +15,7 @@ pub enum Relation {
from = "Column::UserId", from = "Column::UserId",
to = "super::users::Column::Id", to = "super::users::Column::Id",
on_update = "NoAction", on_update = "NoAction",
on_delete = "NoAction", on_delete = "NoAction"
)] )]
Users, Users,
#[sea_orm(has_many = "super::users_saved_bills::Entity")] #[sea_orm(has_many = "super::users_saved_bills::Entity")]

View File

@ -16,7 +16,7 @@ pub enum Relation {
from = "Column::BillId", from = "Column::BillId",
to = "super::bills::Column::Id", to = "super::bills::Column::Id",
on_update = "Cascade", on_update = "Cascade",
on_delete = "Cascade", on_delete = "Cascade"
)] )]
Bills, Bills,
#[sea_orm( #[sea_orm(
@ -24,7 +24,7 @@ pub enum Relation {
from = "Column::UserId", from = "Column::UserId",
to = "super::users::Column::Id", to = "super::users::Column::Id",
on_update = "Cascade", on_update = "Cascade",
on_delete = "Cascade", on_delete = "Cascade"
)] )]
Users, Users,
} }

View File

@ -17,7 +17,7 @@ pub enum Relation {
from = "Column::BillId", from = "Column::BillId",
to = "super::bills::Column::Id", to = "super::bills::Column::Id",
on_update = "Cascade", on_update = "Cascade",
on_delete = "Cascade", on_delete = "Cascade"
)] )]
Bills, Bills,
#[sea_orm( #[sea_orm(
@ -25,7 +25,7 @@ pub enum Relation {
from = "Column::UserId", from = "Column::UserId",
to = "super::users::Column::Id", to = "super::users::Column::Id",
on_update = "Cascade", on_update = "Cascade",
on_delete = "Cascade", on_delete = "Cascade"
)] )]
Users, Users,
} }

View File

@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*;
pub struct Model { pub struct Model {
#[sea_orm(primary_key)] #[sea_orm(primary_key)]
pub id: i32, pub id: i32,
pub user_id: Option<i32> , pub user_id: Option<i32>,
} }
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
@ -15,7 +15,7 @@ pub enum Relation {
from = "Column::UserId", from = "Column::UserId",
to = "super::users::Column::Id", to = "super::users::Column::Id",
on_update = "NoAction", on_update = "NoAction",
on_delete = "NoAction", on_delete = "NoAction"
)] )]
Users, Users,
#[sea_orm(has_many = "super::users_votes::Entity")] #[sea_orm(has_many = "super::users_votes::Entity")]

View File

@ -17,7 +17,7 @@ pub enum Relation {
from = "Column::BillId", from = "Column::BillId",
to = "super::bills::Column::Id", to = "super::bills::Column::Id",
on_update = "Cascade", on_update = "Cascade",
on_delete = "Cascade", on_delete = "Cascade"
)] )]
Bills, Bills,
#[sea_orm( #[sea_orm(
@ -25,7 +25,7 @@ pub enum Relation {
from = "Column::UserId", from = "Column::UserId",
to = "super::users::Column::Id", to = "super::users::Column::Id",
on_update = "Cascade", on_update = "Cascade",
on_delete = "Cascade", on_delete = "Cascade"
)] )]
Users, Users,
} }

View File

@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*;
pub struct Model { pub struct Model {
#[sea_orm(primary_key)] #[sea_orm(primary_key)]
pub id: i32, pub id: i32,
pub user_id: Option<i32> , pub user_id: Option<i32>,
} }
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
@ -15,7 +15,7 @@ pub enum Relation {
from = "Column::UserId", from = "Column::UserId",
to = "super::users::Column::Id", to = "super::users::Column::Id",
on_update = "NoAction", on_update = "NoAction",
on_delete = "NoAction", on_delete = "NoAction"
)] )]
Users, Users,
} }

View File

@ -7,8 +7,8 @@ pub struct Model {
pub user_id: i32, pub user_id: i32,
#[sea_orm(primary_key, auto_increment = false)] #[sea_orm(primary_key, auto_increment = false)]
pub bill_id: i32, pub bill_id: i32,
pub user_idd: Option<i32> , pub user_idd: Option<i32>,
pub bill_idd: Option<i32> , pub bill_idd: Option<i32>,
pub vote: bool, pub vote: bool,
} }
@ -17,25 +17,25 @@ pub enum Relation {
#[sea_orm( #[sea_orm(
belongs_to = "super::bills::Entity", belongs_to = "super::bills::Entity",
from = "Column::BillIdd", from = "Column::BillIdd",
to = "super::bills::Column::Id", to = "super::bills::Column::Id"
)] )]
Bills2, Bills2,
#[sea_orm( #[sea_orm(
belongs_to = "super::bills::Entity", belongs_to = "super::bills::Entity",
from = "Column::BillId", from = "Column::BillId",
to = "super::bills::Column::Id", to = "super::bills::Column::Id"
)] )]
Bills1, Bills1,
#[sea_orm( #[sea_orm(
belongs_to = "super::users::Entity", belongs_to = "super::users::Entity",
from = "Column::UserIdd", from = "Column::UserIdd",
to = "super::users::Column::Id", to = "super::users::Column::Id"
)] )]
Users2, Users2,
#[sea_orm( #[sea_orm(
belongs_to = "super::users::Entity", belongs_to = "super::users::Entity",
from = "Column::UserId", from = "Column::UserId",
to = "super::users::Column::Id", to = "super::users::Column::Id"
)] )]
Users1, Users1,
} }

View File

@ -5,16 +5,12 @@ use sea_orm::entity::prelude::*;
pub struct Model { pub struct Model {
#[sea_orm(primary_key)] #[sea_orm(primary_key)]
pub id: i32, pub id: i32,
pub self_id: Option<i32> , pub self_id: Option<i32>,
} }
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation { pub enum Relation {
#[sea_orm( #[sea_orm(belongs_to = "Entity", from = "Column::SelfId", to = "Column::Id")]
belongs_to = "Entity",
from = "Column::SelfId",
to = "Column::Id",
)]
SelfRef, SelfRef,
} }

View File

@ -5,23 +5,15 @@ use sea_orm::entity::prelude::*;
pub struct Model { pub struct Model {
#[sea_orm(primary_key)] #[sea_orm(primary_key)]
pub id: i32, pub id: i32,
pub self_id: Option<i32> , pub self_id: Option<i32>,
pub self_idd: Option<i32> , pub self_idd: Option<i32>,
} }
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation { pub enum Relation {
#[sea_orm( #[sea_orm(belongs_to = "Entity", from = "Column::SelfId", to = "Column::Id")]
belongs_to = "Entity",
from = "Column::SelfId",
to = "Column::Id",
)]
SelfRef2, SelfRef2,
#[sea_orm( #[sea_orm(belongs_to = "Entity", from = "Column::SelfIdd", to = "Column::Id")]
belongs_to = "Entity",
from = "Column::SelfIdd",
to = "Column::Id",
)]
SelfRef1, SelfRef1,
} }