actions of member is added
This commit is contained in:
parent
57dc1fed92
commit
92eb996bbd
|
@ -30,7 +30,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
||||||
tokio-cron-scheduler = { version = "0" }
|
tokio-cron-scheduler = { version = "0" }
|
||||||
uuid = { version = "0", features = ["serde", "v4", "v5"] }
|
uuid = { version = "0", features = ["serde", "v4", "v5"] }
|
||||||
|
|
||||||
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.33-snapshot" }
|
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.35-snapshot" }
|
||||||
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.16-snapshot" }
|
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.18-snapshot" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
|
@ -78,17 +78,17 @@ impl Repository {
|
||||||
pub fn select_all_count(
|
pub fn select_all_count(
|
||||||
&self,
|
&self,
|
||||||
conn: &diesel::PgConnection,
|
conn: &diesel::PgConnection,
|
||||||
find_all: models::FindAll,
|
find_all: &models::FindAll,
|
||||||
) -> Result<i64, Error> {
|
) -> Result<i64, Error> {
|
||||||
let mut q = sites::table.into_boxed();
|
let mut q = sites::table.into_boxed();
|
||||||
|
|
||||||
if let Some(sp) = find_all.url_like {
|
if let Some(sp) = &find_all.url_like {
|
||||||
q = q.filter(sites::dsl::url.like(sp));
|
q = q.filter(sites::dsl::url.like(sp));
|
||||||
}
|
}
|
||||||
if let Some(sp) = find_all.name_like {
|
if let Some(sp) = &find_all.name_like {
|
||||||
q = q.filter(sites::dsl::url.like(sp));
|
q = q.filter(sites::dsl::url.like(sp));
|
||||||
}
|
}
|
||||||
if let Some(sp) = find_all.path_like {
|
if let Some(sp) = &find_all.path_like {
|
||||||
q = q.filter(sites::dsl::path.like(sp));
|
q = q.filter(sites::dsl::path.like(sp));
|
||||||
}
|
}
|
||||||
if let Some(sp) = find_all.show {
|
if let Some(sp) = find_all.show {
|
||||||
|
@ -97,7 +97,7 @@ impl Repository {
|
||||||
if let Some(sp) = find_all.can_use {
|
if let Some(sp) = find_all.can_use {
|
||||||
q = q.filter(sites::dsl::can_use.eq(sp));
|
q = q.filter(sites::dsl::can_use.eq(sp));
|
||||||
}
|
}
|
||||||
if let Some(sp) = find_all.memo_like {
|
if let Some(sp) = &find_all.memo_like {
|
||||||
q = q.filter(sites::dsl::memo.like(sp));
|
q = q.filter(sites::dsl::memo.like(sp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,17 +108,17 @@ impl Repository {
|
||||||
pub fn select_all(
|
pub fn select_all(
|
||||||
&self,
|
&self,
|
||||||
conn: &diesel::PgConnection,
|
conn: &diesel::PgConnection,
|
||||||
find_all: models::FindAll,
|
find_all: &models::FindAll,
|
||||||
) -> Result<Vec<models::Site>, Error> {
|
) -> Result<Vec<models::Site>, Error> {
|
||||||
let mut q = sites::table.into_boxed();
|
let mut q = sites::table.into_boxed();
|
||||||
|
|
||||||
if let Some(sp) = find_all.url_like {
|
if let Some(sp) = &find_all.url_like {
|
||||||
q = q.filter(sites::dsl::url.like(sp));
|
q = q.filter(sites::dsl::url.like(sp));
|
||||||
}
|
}
|
||||||
if let Some(sp) = find_all.name_like {
|
if let Some(sp) = &find_all.name_like {
|
||||||
q = q.filter(sites::dsl::url.like(sp));
|
q = q.filter(sites::dsl::url.like(sp));
|
||||||
}
|
}
|
||||||
if let Some(sp) = find_all.path_like {
|
if let Some(sp) = &find_all.path_like {
|
||||||
q = q.filter(sites::dsl::path.like(sp));
|
q = q.filter(sites::dsl::path.like(sp));
|
||||||
}
|
}
|
||||||
if let Some(sp) = find_all.show {
|
if let Some(sp) = find_all.show {
|
||||||
|
@ -127,11 +127,11 @@ impl Repository {
|
||||||
if let Some(sp) = find_all.can_use {
|
if let Some(sp) = find_all.can_use {
|
||||||
q = q.filter(sites::dsl::can_use.eq(sp));
|
q = q.filter(sites::dsl::can_use.eq(sp));
|
||||||
}
|
}
|
||||||
if let Some(sp) = find_all.memo_like {
|
if let Some(sp) = &find_all.memo_like {
|
||||||
q = q.filter(sites::dsl::memo.like(sp));
|
q = q.filter(sites::dsl::memo.like(sp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(p) = find_all.pagination {
|
if let Some(p) = &find_all.pagination {
|
||||||
let page = p.page.unwrap_or(1);
|
let page = p.page.unwrap_or(1);
|
||||||
|
|
||||||
if let Some(page_size) = p.page_size {
|
if let Some(page_size) = p.page_size {
|
||||||
|
@ -139,7 +139,7 @@ impl Repository {
|
||||||
q = q.limit(page_size as i64);
|
q = q.limit(page_size as i64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(orderbys) = find_all.sorts {
|
if let Some(orderbys) = &find_all.sorts {
|
||||||
for s in orderbys {
|
for s in orderbys {
|
||||||
match s {
|
match s {
|
||||||
bcr::models::pagination::Sort::ASC(property) => match property.as_str() {
|
bcr::models::pagination::Sort::ASC(property) => match property.as_str() {
|
||||||
|
|
|
@ -54,6 +54,8 @@ impl Service {
|
||||||
self.list_members(),
|
self.list_members(),
|
||||||
self.get_member(),
|
self.get_member(),
|
||||||
self.get_member_by_username(),
|
self.get_member_by_username(),
|
||||||
|
self.update_member(),
|
||||||
|
self.delete_member(),
|
||||||
self.event_after_signin()
|
self.event_after_signin()
|
||||||
)
|
)
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
|
@ -127,6 +129,87 @@ impl Service {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let site_id = match req.site_id {
|
||||||
|
Some(d) => match uuid::Uuid::from_str(d.as_str()) {
|
||||||
|
Ok(dd) => Some(dd),
|
||||||
|
Err(e) => {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid site_id param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "site_id".to_string(),
|
||||||
|
value: d.clone(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: e.to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
let member_class_id = match req.member_class_id {
|
||||||
|
Some(d) => match uuid::Uuid::from_str(d.as_str()) {
|
||||||
|
Ok(dd) => Some(dd),
|
||||||
|
Err(e) => {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid member_class_id param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "member_class_id".to_string(),
|
||||||
|
value: d.clone(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: e.to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
let member_level_id = match req.member_level_id {
|
||||||
|
Some(d) => match uuid::Uuid::from_str(d.as_str()) {
|
||||||
|
Ok(dd) => Some(dd),
|
||||||
|
Err(e) => {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid member_level_id param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "member_level_id".to_string(),
|
||||||
|
value: d.clone(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: e.to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
let referrer_member_id = match req.referrer_member_id {
|
||||||
|
Some(d) => match uuid::Uuid::from_str(d.as_str()) {
|
||||||
|
Ok(dd) => Some(dd),
|
||||||
|
Err(e) => {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid referrer_member_id param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "referrer_member_id".to_string(),
|
||||||
|
value: d.clone(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: e.to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
let conn = self.pool.get().map_err(|e| {
|
let conn = self.pool.get().map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
@ -136,16 +219,18 @@ impl Service {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let find_all = repositories::member::models::FindAll {
|
let find_all = repositories::member::models::FindAll {
|
||||||
site_id: None,
|
site_id,
|
||||||
member_class_id: None,
|
member_class_id,
|
||||||
member_level_id: None,
|
member_level_id,
|
||||||
referrer_member_id: None,
|
referrer_member_id,
|
||||||
username_like: None,
|
username_like: req.username_like,
|
||||||
nickname_like: None,
|
nickname_like: req.nickname_like,
|
||||||
mobile_phone_number_like: None,
|
mobile_phone_number_like: req.mobile_phone_number_like,
|
||||||
last_signined_ip: None,
|
last_signined_ip: req.last_signined_ip,
|
||||||
state: None,
|
state: req
|
||||||
deleted_at: None,
|
.state
|
||||||
|
.map(repositories::member::schema::MemberState::from),
|
||||||
|
deleted_at: req.deleted_at.map(|d| d > 0),
|
||||||
pagination: req
|
pagination: req
|
||||||
.pagination
|
.pagination
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -421,6 +506,282 @@ impl Service {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn update_member(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let s = self
|
||||||
|
.connection_broker
|
||||||
|
.queue_subscribe(
|
||||||
|
bpr::ss::member::member::SUBJECT_UPDATE_MEMBER,
|
||||||
|
self.queue_broker.as_str(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
while let Some(message) = s.next().await {
|
||||||
|
if let Err(e) = async {
|
||||||
|
let req = bpr::ss::member::member::UpdateMemberRequest::decode(message.data.as_slice())
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest {
|
||||||
|
message: format!("invalid request: {}", e),
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let id = uuid::Uuid::from_str(req.id.as_str()).map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid id param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "id".to_string(),
|
||||||
|
value: req.id.clone(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: e.to_string(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let site_id = match req.site_id {
|
||||||
|
Some(d) => match uuid::Uuid::from_str(d.as_str()) {
|
||||||
|
Ok(dd) => Some(dd),
|
||||||
|
Err(e) => {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid site_id param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "site_id".to_string(),
|
||||||
|
value: d.clone(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: e.to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let member_level_id = match req.member_level_id {
|
||||||
|
Some(d) => match uuid::Uuid::from_str(d.as_str()) {
|
||||||
|
Ok(dd) => Some(dd),
|
||||||
|
Err(e) => {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid member_level_id param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "member_level_id".to_string(),
|
||||||
|
value: d.clone(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: e.to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let client = match req.client {
|
||||||
|
Some(c) => c,
|
||||||
|
None => {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid client information".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "client".to_string(),
|
||||||
|
value: "".to_string(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: "".to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let conn = self.pool.get().map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let modify_member = repositories::member::models::ModifyMember {
|
||||||
|
site_id,
|
||||||
|
member_level_id,
|
||||||
|
password: req.password,
|
||||||
|
mobile_phone_number: req.mobile_phone_number,
|
||||||
|
state: req
|
||||||
|
.state
|
||||||
|
.map(repositories::member::schema::MemberState::from),
|
||||||
|
};
|
||||||
|
|
||||||
|
let _affected = self
|
||||||
|
.member_repository
|
||||||
|
.update(&conn, id, &modify_member)
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let m = self.member_composition.select(&conn, id).map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::ss::member::member::UpdateMemberResponse {
|
||||||
|
error: None,
|
||||||
|
result: Some(bpr::ss::member::member::update_member_response::Result {
|
||||||
|
member: m.map(|d| bpr::models::member::MemberModel::from(&d)),
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
.encode_to_vec(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
Ok::<(), bcr::error::rpc::Error>(())
|
||||||
|
}
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::ss::member::member::UpdateMemberResponse {
|
||||||
|
error: Some(bpr::protobuf::rpc::Error::from(e)),
|
||||||
|
result: None,
|
||||||
|
}
|
||||||
|
.encode_to_vec(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn delete_member(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let s = self
|
||||||
|
.connection_broker
|
||||||
|
.queue_subscribe(
|
||||||
|
bpr::ss::member::member::SUBJECT_DELETE_MEMBER,
|
||||||
|
self.queue_broker.as_str(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
while let Some(message) = s.next().await {
|
||||||
|
if let Err(e) = async {
|
||||||
|
let req = bpr::ss::member::member::DeleteMemberRequest::decode(message.data.as_slice())
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest {
|
||||||
|
message: format!("invalid request: {}", e),
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let id = uuid::Uuid::from_str(req.id.as_str()).map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid id param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "id".to_string(),
|
||||||
|
value: req.id.clone(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: e.to_string(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let client = match req.client {
|
||||||
|
Some(c) => c,
|
||||||
|
None => {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid client information".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "client".to_string(),
|
||||||
|
value: "".to_string(),
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: "".to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let conn = self.pool.get().map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let deleted_at = chrono::Utc::now().timestamp();
|
||||||
|
|
||||||
|
let modify_member = repositories::member::models::ModifyMember4DeletedAt {
|
||||||
|
deleted_at: Some(deleted_at),
|
||||||
|
};
|
||||||
|
|
||||||
|
let m = self
|
||||||
|
.member_repository
|
||||||
|
.update_deleted_at(&conn, id, &modify_member)
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::ss::member::member::DeleteMemberResponse {
|
||||||
|
error: None,
|
||||||
|
result: Some(bpr::ss::member::member::delete_member_response::Result {}),
|
||||||
|
}
|
||||||
|
.encode_to_vec(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
|
Ok::<(), bcr::error::rpc::Error>(())
|
||||||
|
}
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
message
|
||||||
|
.respond(
|
||||||
|
bpr::ss::member::member::DeleteMemberResponse {
|
||||||
|
error: Some(bpr::protobuf::rpc::Error::from(e)),
|
||||||
|
result: None,
|
||||||
|
}
|
||||||
|
.encode_to_vec(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
async fn event_after_signin(&self) -> Result<(), Box<dyn std::error::Error>> {
|
async fn event_after_signin(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let s = self
|
let s = self
|
||||||
.connection_broker
|
.connection_broker
|
||||||
|
|
|
@ -132,30 +132,29 @@ impl Service {
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
let find_all = repositories::site::models::FindAll {
|
||||||
|
url_like: None,
|
||||||
|
name_like: None,
|
||||||
|
path_like: None,
|
||||||
|
memo_like: None,
|
||||||
|
show: None,
|
||||||
|
can_use: None,
|
||||||
|
pagination: req
|
||||||
|
.pagination
|
||||||
|
.as_ref()
|
||||||
|
.map(|d| bcr::models::pagination::Pagination::from(d)),
|
||||||
|
sorts: Some(
|
||||||
|
req
|
||||||
|
.sorts
|
||||||
|
.iter()
|
||||||
|
.map(|d| beteran_common_rust::models::pagination::Sort::from(d))
|
||||||
|
.collect(),
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
let count = self
|
let count = self
|
||||||
.site_repository
|
.site_repository
|
||||||
.select_all_count(
|
.select_all_count(&conn, &find_all)
|
||||||
&conn,
|
|
||||||
repositories::site::models::FindAll {
|
|
||||||
url_like: None,
|
|
||||||
name_like: None,
|
|
||||||
path_like: None,
|
|
||||||
memo_like: None,
|
|
||||||
show: None,
|
|
||||||
can_use: None,
|
|
||||||
pagination: req
|
|
||||||
.pagination
|
|
||||||
.as_ref()
|
|
||||||
.map(|d| bcr::models::pagination::Pagination::from(d)),
|
|
||||||
sorts: Some(
|
|
||||||
req
|
|
||||||
.sorts
|
|
||||||
.iter()
|
|
||||||
.map(|d| beteran_common_rust::models::pagination::Sort::from(d))
|
|
||||||
.collect(),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
@ -166,28 +165,7 @@ impl Service {
|
||||||
|
|
||||||
let list = self
|
let list = self
|
||||||
.site_repository
|
.site_repository
|
||||||
.select_all(
|
.select_all(&conn, &find_all)
|
||||||
&conn,
|
|
||||||
repositories::site::models::FindAll {
|
|
||||||
url_like: None,
|
|
||||||
name_like: None,
|
|
||||||
path_like: None,
|
|
||||||
memo_like: None,
|
|
||||||
show: None,
|
|
||||||
can_use: None,
|
|
||||||
pagination: req
|
|
||||||
.pagination
|
|
||||||
.as_ref()
|
|
||||||
.map(|d| bcr::models::pagination::Pagination::from(d)),
|
|
||||||
sorts: Some(
|
|
||||||
req
|
|
||||||
.sorts
|
|
||||||
.iter()
|
|
||||||
.map(|d| beteran_common_rust::models::pagination::Sort::from(d))
|
|
||||||
.collect(),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
code: bpr::protobuf::rpc::Error::SERVER_00,
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user