feature/proxy-service #14
@@ -173,7 +173,7 @@ impl UpstreamService for UpstreamServiceImpl {
|
|||||||
let count_info = with_conn!(&*self.connection, tx, conn, {
|
let count_info = with_conn!(&*self.connection, tx, conn, {
|
||||||
upstream::Entity::find()
|
upstream::Entity::find()
|
||||||
.select_only()
|
.select_only()
|
||||||
.column_as(upstream::Column::Id, "count")
|
.column_as(upstream::Column::Id.count(), "count")
|
||||||
.into_model::<CountResult>()
|
.into_model::<CountResult>()
|
||||||
.one(*conn)
|
.one(*conn)
|
||||||
.await?
|
.await?
|
||||||
@@ -199,9 +199,10 @@ impl UpstreamService for UpstreamServiceImpl {
|
|||||||
)))?;
|
)))?;
|
||||||
let targets = upstream_target::Entity::find()
|
let targets = upstream_target::Entity::find()
|
||||||
.filter(upstream_target::Column::UpstreamId.eq(upstream_id))
|
.filter(upstream_target::Column::UpstreamId.eq(upstream_id))
|
||||||
.apply_if(Some(concrete_options.filter_by_enabled), |query, _v| {
|
.apply_if(
|
||||||
query.filter(upstream_target::Column::Enabled.eq(true))
|
concrete_options.filter_by_enabled.then_some(true),
|
||||||
})
|
|query, _v| query.filter(upstream_target::Column::Enabled.eq(true)),
|
||||||
|
)
|
||||||
.all(*conn)
|
.all(*conn)
|
||||||
.await?;
|
.await?;
|
||||||
(up, targets)
|
(up, targets)
|
||||||
|
|||||||
Reference in New Issue
Block a user