bug fixed
This commit is contained in:
parent
6fe18fc3db
commit
700b65ba2d
|
@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS sites (
|
|||
id UUID DEFAULT uuid_generate_v4(),
|
||||
url TEXT NOT NULL,
|
||||
show BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
use BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
can_use BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
||||
deleted_at BIGINT,
|
||||
|
|
|
@ -10,6 +10,10 @@ pub struct Site {
|
|||
///
|
||||
pub url: String,
|
||||
///
|
||||
pub show: bool,
|
||||
///
|
||||
pub can_use: bool,
|
||||
///
|
||||
pub created_at: i64,
|
||||
///
|
||||
pub updated_at: i64,
|
||||
|
@ -20,6 +24,10 @@ pub struct Site {
|
|||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FindAll {
|
||||
///
|
||||
pub show: Option<bool>,
|
||||
///
|
||||
pub can_use: Option<bool>,
|
||||
///
|
||||
pub url_like: Option<String>,
|
||||
///
|
||||
|
|
|
@ -61,6 +61,12 @@ impl Repository {
|
|||
) -> Result<i64, Error> {
|
||||
let mut q = sites::table.into_boxed();
|
||||
|
||||
if let Some(sp) = find_all.show {
|
||||
q = q.filter(sites::dsl::show.eq(sp));
|
||||
}
|
||||
if let Some(sp) = find_all.can_use {
|
||||
q = q.filter(sites::dsl::can_use.eq(sp));
|
||||
}
|
||||
if let Some(sp) = find_all.url_like {
|
||||
q = q.filter(sites::dsl::url.like(sp));
|
||||
}
|
||||
|
@ -76,6 +82,12 @@ impl Repository {
|
|||
) -> Result<Vec<models::Site>, Error> {
|
||||
let mut q = sites::table.into_boxed();
|
||||
|
||||
if let Some(sp) = find_all.show {
|
||||
q = q.filter(sites::dsl::show.eq(sp));
|
||||
}
|
||||
if let Some(sp) = find_all.can_use {
|
||||
q = q.filter(sites::dsl::can_use.eq(sp));
|
||||
}
|
||||
if let Some(sp) = find_all.url_like {
|
||||
q = q.filter(sites::dsl::url.like(sp));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@ table! {
|
|||
///
|
||||
url -> Text,
|
||||
///
|
||||
show -> Bool,
|
||||
///
|
||||
can_use -> Bool,
|
||||
///
|
||||
created_at -> BigInt,
|
||||
///
|
||||
updated_at -> BigInt,
|
||||
|
|
Loading…
Reference in New Issue
Block a user