site is changed

This commit is contained in:
병준 박 2022-08-10 02:43:22 +00:00
parent c894033251
commit 0cd715ddb9
10 changed files with 45 additions and 21 deletions

View File

@ -30,7 +30,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tokio-cron-scheduler = { version = "0" }
uuid = { version = "0", features = ["serde", "v4", "v5"] }
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.28-snapshot" }
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.11-snapshot" }
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.29-snapshot" }
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.12-snapshot" }
[build-dependencies]

View File

@ -1,11 +1,12 @@
CREATE TABLE IF NOT EXISTS sites (
id UUID DEFAULT uuid_generate_v4(),
url TEXT NOT NULL,
name TEXT NOT NULL,
name TEXT,
path TEXT,
show BOOLEAN NOT NULL DEFAULT TRUE,
can_use BOOLEAN NOT NULL DEFAULT TRUE,
expires_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
memo TEXT,
expires_at BIGINT,
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
PRIMARY KEY (id),

View File

@ -70,8 +70,8 @@ INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('b6a2b66
-- identity.signout
INSERT INTO role_resource_actions (role_id, resource_action_id) VALUES ('b6a2b662-e21e-44e7-a96c-dacd86f9d6b8', '37b99823-188b-4b30-afb7-815a7e79662b');
INSERT INTO sites (id, url, name, path, show, expires_at) VALUES ('d7cbae26-53b6-4cb1-85a4-66b956cbe1d4', '*', '전체', '/', false, (extract(epoch from now() + INTERVAL '10 year') * 1000));
INSERT INTO sites (id, url, name, path, show, expires_at) VALUES ('8429a7ab-b9de-400b-a209-28ff46e22bec', '127.0.0.1', '개발용', '/', true, (extract(epoch from now() + INTERVAL '3 month') * 1000));
INSERT INTO sites (id, url, name, path, show) VALUES ('d7cbae26-53b6-4cb1-85a4-66b956cbe1d4', '*', '전체', '/', false);
INSERT INTO sites (id, url, name, path, show) VALUES ('8429a7ab-b9de-400b-a209-28ff46e22bec', '127.0.0.1', '개발용', '/', false);
INSERT INTO member_levels (id, name, sort_order, show) VALUES ('c238463f-949d-49eb-92ab-dca7a09371db', 'LEVEL0', 0, false);

View File

@ -58,6 +58,7 @@ impl Composition {
s.path as s_path,
s.show as s_show,
s.can_use as s_can_use,
s.memo as s_memo,
s.expires_at as s_expires_at,
s.created_at as s_created_at,
s.updated_at as s_updated_at,

View File

@ -77,6 +77,7 @@ impl QueryableByName<diesel::pg::Pg> for Member {
path: row.get("s_path")?,
show: row.get("s_show")?,
can_use: row.get("s_can_use")?,
memo: row.get("s_memo")?,
expires_at: row.get("s_expires_at")?,
created_at: row.get("s_created_at")?,
updated_at: row.get("s_updated_at")?,

View File

@ -10,15 +10,17 @@ pub struct Site {
///
pub url: String,
///
pub name: String,
pub name: Option<String>,
///
pub path: String,
pub path: Option<String>,
///
pub show: bool,
///
pub can_use: bool,
///
pub expires_at: i64,
pub memo: Option<String>,
///
pub expires_at: Option<i64>,
///
pub created_at: i64,
///
@ -32,15 +34,17 @@ pub struct NewSite {
///
pub url: String,
///
pub name: String,
pub name: Option<String>,
///
pub path: String,
pub path: Option<String>,
///
pub show: bool,
///
pub can_use: bool,
///
pub expires_at: i64,
pub memo: Option<String>,
///
pub expires_at: Option<i64>,
}
///
@ -50,15 +54,17 @@ pub struct ModifySite {
///
pub url: String,
///
pub name: String,
pub name: Option<String>,
///
pub path: String,
pub path: Option<String>,
///
pub show: bool,
///
pub can_use: bool,
///
pub expires_at: i64,
pub memo: Option<String>,
///
pub expires_at: Option<i64>,
}
///
@ -75,6 +81,8 @@ pub struct FindAll {
///
pub can_use: Option<bool>,
///
pub memo_like: Option<String>,
///
pub pagination: Option<bcr::models::pagination::Pagination>,
///
pub sorts: Option<Vec<bcr::models::pagination::Sort>>,

View File

@ -97,6 +97,9 @@ impl Repository {
if let Some(sp) = find_all.can_use {
q = q.filter(sites::dsl::can_use.eq(sp));
}
if let Some(sp) = find_all.memo_like {
q = q.filter(sites::dsl::memo.like(sp));
}
q.count().get_result(conn)
}
@ -124,6 +127,9 @@ impl Repository {
if let Some(sp) = find_all.can_use {
q = q.filter(sites::dsl::can_use.eq(sp));
}
if let Some(sp) = find_all.memo_like {
q = q.filter(sites::dsl::memo.like(sp));
}
if let Some(p) = find_all.pagination {
let page = p.page.unwrap_or(1);

View File

@ -9,15 +9,17 @@ table! {
///
url -> Text,
///
name -> Text,
name -> Nullable<Text>,
///
path -> Text,
path -> Nullable<Text>,
///
show -> Bool,
///
can_use -> Bool,
///
expires_at -> BigInt,
memo -> Nullable<Text>,
///
expires_at -> Nullable<BigInt>,
///
created_at -> BigInt,
///

View File

@ -10,7 +10,8 @@ impl From<&repositories::site::models::Site> for bpr::models::domain::Site {
path: d.path.clone(),
show: d.show,
can_use: d.can_use,
expires_at: d.expires_at as u64,
memo: d.memo.clone(),
expires_at: d.expires_at.map(|d| d as u64),
created_at: d.created_at as u64,
updated_at: d.updated_at as u64,
}

View File

@ -140,6 +140,7 @@ impl Service {
url_like: None,
name_like: None,
path_like: None,
memo_like: None,
show: None,
can_use: None,
pagination: req
@ -171,6 +172,7 @@ impl Service {
url_like: None,
name_like: None,
path_like: None,
memo_like: None,
show: None,
can_use: None,
pagination: req
@ -289,7 +291,8 @@ impl Service {
path: req.path,
show: req.show,
can_use: req.can_use,
expires_at: req.expires_at as i64,
memo: req.memo,
expires_at: req.expires_at.map(|d| d as i64),
},
)
.map_err(|e| {
@ -406,7 +409,8 @@ impl Service {
path: req.path,
show: req.show,
can_use: req.can_use,
expires_at: req.expires_at as i64,
memo: req.memo,
expires_at: req.expires_at.map(|d| d as i64),
},
)
.map_err(|e| {