Skip to content

Commit d5ff31e

Browse files
committed
fix(torii-grpc): models filter for historical
1 parent 51378b2 commit d5ff31e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/grpc/server/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ impl DojoWorld {
223223
where_clause: &str,
224224
mut bind_values: Vec<String>,
225225
pagination: Pagination,
226+
models: Vec<Felt>,
226227
) -> Result<Page<proto::types::Entity>, Error> {
227228
if !pagination.order_by.is_empty() {
228229
return Err(QueryError::UnsupportedQuery(
@@ -236,6 +237,10 @@ impl DojoWorld {
236237
conditions.push(where_clause.to_string());
237238
}
238239

240+
if !models.is_empty() {
241+
conditions.push(format!("model_id IN ({})", models.iter().map(|m| format!("'{:#x}'", m)).collect::<Vec<_>>().join(", ")));
242+
}
243+
239244
// Add cursor condition if present
240245
if let Some(ref cursor) = pagination.cursor {
241246
match pagination.direction {
@@ -379,6 +384,7 @@ impl DojoWorld {
379384
&where_clause,
380385
bind_values,
381386
pagination,
387+
models,
382388
)
383389
.await;
384390
}
@@ -474,6 +480,7 @@ impl DojoWorld {
474480
&where_clause,
475481
bind_values,
476482
pagination,
483+
models,
477484
)
478485
.await;
479486
}

0 commit comments

Comments
 (0)