Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(cursor): query::sort variant encodes filter type (#85)
Sean Ayeee36cf26f31a
diff --git a/rust/cloud-storage/email_service/src/api/email/threads/previews/cursor.rs b/rust/cloud-storage/email_service/src/api/email/threads/previews/cursor.rsindex f85596d2ba..6c0f88bd90 100644--- a/rust/cloud-storage/email_service/src/api/email/threads/previews/cursor.rs+++ b/rust/cloud-storage/email_service/src/api/email/threads/previews/cursor.rs@@ -154,7 +154,7 @@ pub async fn previews_handler(view: preview_view,link_id: link.id,limit: params.limit,- query: cursor.into_query(params.sort_method),+ query: cursor.into_query(params.sort_method, ()),};let sort_method = *query.query.sort_method();diff --git a/rust/cloud-storage/frecency/src/domain/models.rs b/rust/cloud-storage/frecency/src/domain/models.rsindex f4cf630179..0130f83b35 100644--- a/rust/cloud-storage/frecency/src/domain/models.rs+++ b/rust/cloud-storage/frecency/src/domain/models.rs@@ -306,7 +306,7 @@ pub struct FrecencyPageRequest<'a> {/// the limit to the number of results to return on the pagepub limit: u32,/// the filter ast that should remove values from the output- pub filters: EntityFilterAst,+ pub filters: Option<EntityFilterAst>,}/// the response which contains the single page of frecency from the servicediff --git a/rust/cloud-storage/item_filters/src/ast.rs b/rust/cloud-storage/item_filters/src/ast.rsindex dd2b81e55e..0899095585 100644--- a/rust/cloud-storage/item_filters/src/ast.rs+++ b/rust/cloud-storage/item_filters/src/ast.rs@@ -51,7 +51,8 @@ pub enum ExpandErr {}/// Describes a bundle of filters that should be applied across different entity types-#[derive(Default, Debug, Serialize, Deserialize)]+#[derive(Debug, Serialize, Deserialize)]+#[non_exhaustive]pub struct EntityFilterInner {/// the filters that should be applied to the document entity#[serde(default)]@@ -65,7 +66,8 @@ pub struct EntityFilterInner {}/// wrapper over [EntityFilterInner] which gives us cheaper clones-#[derive(Default, Debug, Serialize, Deserialize, Clone)]+#[derive(Debug, Serialize, Deserialize, Clone)]+#[non_exhaustive]pub struct EntityFilterAst {/// we wrap the inner type in an arc to avoid large allocations when cloning boxed valuespub inner: Arc<EntityFilterInner>,@@ -73,17 +75,17 @@ pub struct EntityFilterAst {impl EntityFilterAst {/// expand the input [EntityFilters] into an ast representation- pub fn new_from_filters(entity_filter: EntityFilters) -> Result<Self, ExpandErr> {+ pub fn new_from_filters(entity_filter: EntityFilters) -> Result<Option<Self>, ExpandErr> {if entity_filter.is_empty() {- return Ok(Self::default());+ return Ok(None);}- Ok(Self {+ Ok(Some(Self {inner: Arc::new(EntityFilterInner {document_filter: DocumentFilters::expand_ast(entity_filter.document_filters)?,project_filter: ProjectFilters::expand_ast(entity_filter.project_filters)?,chat_filter: ChatFilters::expand_ast(entity_filter.chat_filters)?,}),- })+ }))}}diff --git a/rust/cloud-storage/item_filters/src/ast/tests.rs b/rust/cloud-storage/item_filters/src/ast/tests.rsindex 0c0687875d..0bb8a80556 100644--- a/rust/cloud-storage/item_filters/src/ast/tests.rs+++ b/rust/cloud-storage/item_filters/src/ast/tests.rs@@ -33,7 +33,7 @@ fn it_expands_filters() {..Default::default()};- let ast = Arc::into_inner(EntityFilterAst::new_from_filters(f).unwrap().inner)+ let ast = Arc::into_inner(EntityFilterAst::new_from_filters(f).unwrap().unwrap().inner).unwrap().document_filter.unwrap();diff --git a/rust/cloud-storage/models_pagination/src/axum.rs b/rust/cloud-storage/models_pagination/src/axum.rsindex 19a24321c1..4f4627a1e1 100644--- a/rust/cloud-storage/models_pagination/src/axum.rs+++ b/rust/cloud-storage/models_pagination/src/axum.rs@@ -30,8 +30,8 @@ impl<Id, S: Sortable, F> CursorExtractor<Id, S, F> {}}/// convert self into a [Query] by supplying a fallback- pub fn into_query(self, sort: S) -> crate::cursor::Query<Id, S, F> {- crate::cursor::Query::new(self.into_option(), sort)+ pub fn into_query(self, sort: S, filter: F) -> crate::cursor::Query<Id, S, F> {+ crate::cursor::Query::new(self.into_option(), sort, filter)}}@@ -71,7 +71,7 @@ whereSort: Sortable + DeserializeOwned,Sort::Value: DeserializeOwned,Id: DeserializeOwned,- F: DeserializeOwned + Default,+ F: DeserializeOwned,{type Rejection = CusorExtractErr;diff --git a/rust/cloud-storage/models_pagination/src/cursor.rs b/rust/cloud-storage/models_pagination/src/cursor.rsindex f51e984935..7c2701dfdd 100644--- a/rust/cloud-storage/models_pagination/src/cursor.rs+++ b/rust/cloud-storage/models_pagination/src/cursor.rs@@ -58,7 +58,6 @@ pub struct CursorVal<C: Sortable, F> {/// the last value of the [Sortable] from the previous pagepub last_val: C::Value,/// the value that we are filtering on- #[serde(default)]pub filter: F,}@@ -325,7 +324,7 @@ where#[derive(Debug)]pub enum Query<I, T: Sortable, F> {/// a Sort method T- Sort(T),+ Sort(T, F),/// a [CursorWithVal]Cursor(CursorWithValAndFilter<I, T, F>),}@@ -339,7 +338,7 @@ where{fn clone(&self) -> Self {match self {- Query::Sort(s) => Query::Sort(s.clone()),+ Query::Sort(s, f) => Query::Sort(s.clone(), f.clone()),Query::Cursor(cursor) => Query::Cursor(cursor.clone()),}}@@ -347,26 +346,62 @@ whereimpl<I, T: Sortable, F> Query<I, T, F> {/// create an instance of [Query] from optionally a [CursorWithVal], fallling back to T if it does not exist- pub fn new(maybe_cursor: Option<CursorWithValAndFilter<I, T, F>>, fallback: T) -> Self {+ pub fn new(maybe_cursor: Option<CursorWithValAndFilter<I, T, F>>, sort: T, filter: F) -> Self {match maybe_cursor {Some(c) => Self::Cursor(c),- None => Self::Sort(fallback),+ None => Self::Sort(sort, filter),}}/// returns the inner sort method [Sortable] for this querypub fn sort_method(&self) -> &T {match self {- Query::Sort(s) => s,+ Query::Sort(s, _) => s,Query::Cursor(cursor) => &cursor.val.sort_type,}}+ /// returns a reference to the inner filter type+ pub fn filter(&self) -> &F {+ match self {+ Query::Sort(_, f) => f,+ Query::Cursor(cursor) => &cursor.val.filter,+ }+ }+/// returns the entity [Uuid] and [Sortable::Value] if they existpub fn vals(&self) -> (Option<&I>, Option<&T::Value>) {match self {- Query::Sort(_) => (None, None),+ Query::Sort(_, _) => (None, None),Query::Cursor(cursor) => (Some(&cursor.id), Some(&cursor.val.last_val)),}}++ /// maps the type of filter from one type to another+ pub fn map_filter<Cb, U>(self, cb: Cb) -> Query<I, T, U>+ where+ Cb: FnOnce(F) -> U,+ {+ match self {+ Query::Sort(s, f) => Query::Sort(s, cb(f)),+ Query::Cursor(Cursor {+ id,+ limit,+ val:+ CursorVal {+ sort_type,+ last_val,+ filter,+ },+ }) => Query::Cursor(Cursor {+ id,+ limit,+ val: CursorVal {+ sort_type,+ last_val,+ filter: cb(filter),+ },+ }),+ }+ }}diff --git a/rust/cloud-storage/notification_db_client/src/user_notification/get/get_all.rs b/rust/cloud-storage/notification_db_client/src/user_notification/get/get_all.rsindex 5d33b888e4..00adf2ce5a 100644--- a/rust/cloud-storage/notification_db_client/src/user_notification/get/get_all.rs+++ b/rust/cloud-storage/notification_db_client/src/user_notification/get/get_all.rs@@ -113,14 +113,14 @@ mod tests {use super::*;use chrono::DateTime;use models_pagination::{- Base64Str, Cursor, CursorVal, CursorWithVal, Paginate, PaginateOn, TypeEraseCursor,+ Base64Str, Cursor, CursorVal, CursorWithVal, PaginateOn, TypeEraseCursor,};use sqlx::{Pool, Postgres};#[sqlx::test(fixtures(path = "../../../fixtures", scripts("user_notifications")))]async fn test_get_user_notifications(pool: Pool<Postgres>) -> anyhow::Result<()> {let paginated_result =- get_all_user_notifications(&pool, "macro|[email protected]", 1, Query::Sort(CreatedAt))+ get_all_user_notifications(&pool, "macro|[email protected]", 1, Query::Sort(CreatedAt, ())).await?;assert_eq!(paginated_result.len(), 1);@@ -160,7 +160,7 @@ mod tests {"macro|[email protected]",&["test"],1,- Query::Sort(CreatedAt),+ Query::Sort(CreatedAt, ()),).await?.into_iter()diff --git a/rust/cloud-storage/notification_service/src/api/user_notification/bulk_get_user_notifications_by_event_item_id.rs b/rust/cloud-storage/notification_service/src/api/user_notification/bulk_get_user_notifications_by_event_item_id.rsindex 5e82f94b19..281df6fe3b 100644--- a/rust/cloud-storage/notification_service/src/api/user_notification/bulk_get_user_notifications_by_event_item_id.rs+++ b/rust/cloud-storage/notification_service/src/api/user_notification/bulk_get_user_notifications_by_event_item_id.rs@@ -68,7 +68,7 @@ pub async fn handler(&user_context.user_id,&req.event_item_ids,limit,- cursor.into_query(CreatedAt)+ cursor.into_query(CreatedAt, ())).await.map_err(|e| {diff --git a/rust/cloud-storage/notification_service/src/api/user_notification/get_user_notification.rs b/rust/cloud-storage/notification_service/src/api/user_notification/get_user_notification.rsindex 918587050b..e4e6155a83 100644--- a/rust/cloud-storage/notification_service/src/api/user_notification/get_user_notification.rs+++ b/rust/cloud-storage/notification_service/src/api/user_notification/get_user_notification.rs@@ -55,7 +55,7 @@ pub async fn handler(&ctx.db,&user_context.user_id,limit,- cursor.into_query(CreatedAt),+ cursor.into_query(CreatedAt, ()),).await.map_err(|e| {diff --git a/rust/cloud-storage/notification_service/src/api/user_notification/get_user_notifications_by_event_item_id.rs b/rust/cloud-storage/notification_service/src/api/user_notification/get_user_notifications_by_event_item_id.rsindex 5a1e4dd727..1a5b53c310 100644--- a/rust/cloud-storage/notification_service/src/api/user_notification/get_user_notifications_by_event_item_id.rs+++ b/rust/cloud-storage/notification_service/src/api/user_notification/get_user_notifications_by_event_item_id.rs@@ -57,7 +57,7 @@ pub async fn handler(&user_context.user_id,&[&event_item_id],limit,- cursor.into_query(CreatedAt)+ cursor.into_query(CreatedAt, ())).await.map_err(|e| {diff --git a/rust/cloud-storage/soup/src/domain/models.rs b/rust/cloud-storage/soup/src/domain/models.rsindex c4107c861e..3e8ca03855 100644--- a/rust/cloud-storage/soup/src/domain/models.rs+++ b/rust/cloud-storage/soup/src/domain/models.rs@@ -14,32 +14,25 @@ pub enum SoupType {UnExpanded,}-/// possible things we can exclude from the results-#[derive(Debug)]-pub(crate) enum SoupFilter {- /// excludes any item that has a frecency record from the results- Frecency,- Ast(AstFilter),-}--#[derive(Debug)]-#[expect(dead_code)]-pub(crate) enum AstFilter {- Normal(EntityFilterAst),- Frecency(EntityFilterAst),-}-/// the parameters required for a [SimpleSortMethod]#[derive(Debug)]pub struct SimpleSortRequest<'a> {/// the limit of the number of items to return- pub limit: u16,- /// the [ParsedCursor] the client passes (if any)- pub cursor: Query<String, SimpleSortMethod, EntityFilterAst>,+ pub(crate) limit: u16,+ /// the [Query] the client passes (if any)+ pub(crate) cursor: Query<String, SimpleSortMethod, Option<SimpleSortFilter>>,/// the id of the user- pub user_id: MacroUserIdStr<'a>,- /// a list of things that should be excluded from the query- pub(crate) filters: Option<SoupFilter>,+ pub(crate) user_id: MacroUserIdStr<'a>,+}++/// the types of values we can potentially filter out of a [SimpleSortRequest]+#[derive(Debug)]+pub enum SimpleSortFilter {+ /// remove frecency values from output+ Frecency(Frecency),+ /// remove the ast values from output+ Ast(EntityFilterAst),+ FrecencyAst(Frecency, EntityFilterAst),}#[derive(Debug)]@@ -49,8 +42,17 @@ pub struct AdvancedSortParams<'a> {}pub enum SoupQuery {- Simple(Query<String, SimpleSortMethod, EntityFilterAst>),- Frecency(Query<String, Frecency, EntityFilterAst>),+ Simple(Query<String, SimpleSortMethod, Option<EntityFilterAst>>),+ Frecency(Query<String, Frecency, Option<EntityFilterAst>>),+}++impl SoupQuery {+ pub(crate) fn filter(&self) -> Option<&EntityFilterAst> {+ match self {+ SoupQuery::Simple(query) => query.filter().as_ref(),+ SoupQuery::Frecency(query) => query.filter().as_ref(),+ }+ }}pub struct SoupRequest {@@ -58,7 +60,6 @@ pub struct SoupRequest {pub limit: u16,pub cursor: SoupQuery,pub user: MacroUserIdStr<'static>,- pub filters: EntityFilterAst,}/// a [SoupItem] with an associated frecency scorediff --git a/rust/cloud-storage/soup/src/domain/ports.rs b/rust/cloud-storage/soup/src/domain/ports.rsindex cde74f36f1..8a77115e83 100644--- a/rust/cloud-storage/soup/src/domain/ports.rs+++ b/rust/cloud-storage/soup/src/domain/ports.rs@@ -35,10 +35,10 @@ pub trait SoupRepo: Send + Sync + 'static {/// 1. The item type is [FrecencySoupItem]/// 1. The id type is [String] (this should be changed to uuid)/// 1. The sort method is [Either] [SimpleSortMethod] or [Frecency]-/// 1. The filter type is [EntityFilterAst]+/// 1. The filter type is an [Option] [EntityFilterAst]pub type SoupOutput = Either<- PaginatedCursor<FrecencySoupItem, String, SimpleSortMethod, EntityFilterAst>,- PaginatedCursor<FrecencySoupItem, String, Frecency, EntityFilterAst>,+ PaginatedCursor<FrecencySoupItem, String, SimpleSortMethod, Option<EntityFilterAst>>,+ PaginatedCursor<FrecencySoupItem, String, Frecency, Option<EntityFilterAst>>,>;pub trait SoupService: Send + Sync + 'static {diff --git a/rust/cloud-storage/soup/src/domain/service.rs b/rust/cloud-storage/soup/src/domain/service.rsindex c555bec495..7736e039b2 100644--- a/rust/cloud-storage/soup/src/domain/service.rs+++ b/rust/cloud-storage/soup/src/domain/service.rs@@ -1,6 +1,6 @@use crate::domain::{models::{- AdvancedSortParams, AstFilter, FrecencySoupItem, SimpleSortRequest, SoupErr, SoupFilter,+ AdvancedSortParams, FrecencySoupItem, SimpleSortFilter, SimpleSortRequest, SoupErr,SoupQuery, SoupRequest, SoupType,},ports::{SoupOutput, SoupRepo, SoupService},@@ -17,7 +17,6 @@ use models_pagination::{Cursor, CursorVal, Frecency, FrecencyValue, PaginateOn, Query, SimpleSortMethod,};use models_soup::item::SoupItem;-use non_empty::IsEmpty;use std::cmp::Ordering;#[cfg(test)]@@ -95,9 +94,11 @@ wheresoup_type,SimpleSortRequest {limit: remainder_to_fetch.try_into().unwrap_or(500),- cursor: Query::Sort(SimpleSortMethod::UpdatedAt),+ cursor: Query::Sort(+ SimpleSortMethod::UpdatedAt,+ Some(SimpleSortFilter::Frecency(Frecency)),+ ),user_id: user,- filters: Some(SoupFilter::Frecency),},).await?;@@ -106,13 +107,13 @@ whereasync fn handle_advanced_sort(&self,- cursor: Query<String, Frecency, EntityFilterAst>,+ cursor: Query<String, Frecency, Option<EntityFilterAst>>,soup_type: SoupType,user: MacroUserIdStr<'static>,limit: u16,) -> Result<impl Iterator<Item = FrecencySoupItem>, SoupErr> {let from_score = match cursor {- Query::Sort(_) => None,+ Query::Sort(_, _) => None,Query::Cursor(Cursor {val:CursorVal {@@ -130,7 +131,7 @@ whereCursorVal {sort_type: Frecency,last_val: FrecencyValue::UpdatedAt(updated),- filter,+ filter: _,},}) => {return Ok(Either::Left(@@ -144,11 +145,10 @@ whereval: CursorVal {sort_type: SimpleSortMethod::UpdatedAt,last_val: updated,- filter,+ filter: Some(SimpleSortFilter::Frecency(Frecency)),},}),user_id: user,- filters: Some(SoupFilter::Frecency),},).await?,@@ -164,7 +164,7 @@ whereasync fn handle_frecency_cursor(&self,- #[expect(unused_variables)] from_value: Option<(f64, EntityFilterAst)>,+ #[expect(unused_variables)] from_value: Option<(f64, Option<EntityFilterAst>)>,soup_type: SoupType,user: MacroUserIdStr<'static>,limit: u16,@@ -175,7 +175,7 @@ whereuser_id: user.copied(),from_score: None,limit: limit as u32,- filters: Default::default(),+ filters: None,}).await?;@@ -220,6 +220,7 @@ where{async fn get_user_soup(&self, req: SoupRequest) -> Result<SoupOutput, SoupErr> {let limit = req.limit.clamp(20, 500);+ let paginate_filter = req.cursor.filter().cloned();match req.cursor {SoupQuery::Simple(cursor) => {let sort_method = *cursor.sort_method();@@ -229,25 +230,19 @@ wherereq.soup_type,SimpleSortRequest {limit,- cursor,+ cursor: cursor.map_filter(|cur| cur.map(SimpleSortFilter::Ast)),user_id: req.user,- filters: match req.filters.is_empty() {- true => None,- false => {- Some(SoupFilter::Ast(AstFilter::Normal(req.filters.clone())))- }- },},).await?- .paginate_filter_on(limit.into(), sort_method, req.filters)+ .paginate_filter_on(limit.into(), sort_method, paginate_filter).into_page(),))}SoupQuery::Frecency(cursor) => Ok(Either::Right(self.handle_advanced_sort(cursor, req.soup_type, req.user, limit).await?- .paginate_filter_on(limit.into(), Frecency, req.filters)+ .paginate_filter_on(limit.into(), Frecency, paginate_filter).into_page(),)),}diff --git a/rust/cloud-storage/soup/src/domain/service/tests.rs b/rust/cloud-storage/soup/src/domain/service/tests.rsindex c63660ea45..eaf75a890a 100644--- a/rust/cloud-storage/soup/src/domain/service/tests.rs+++ b/rust/cloud-storage/soup/src/domain/service/tests.rs@@ -1,3 +1,5 @@+use crate::domain::models::SimpleSortFilter;+use crate::domain::ports::MockSoupRepo;use chrono::Days;use cool_asserts::assert_matches;use frecency::domain::models::FrecencyPageResponse;@@ -5,16 +7,11 @@ use frecency::domain::ports::MockFrecencyQueryService;use frecency::domain::services::FrecencyQueryServiceImpl;use frecency::{domain::models::AggregateFrecency, outbound::mock::MockFrecencyStorage};use model_entity::EntityType;-use models_pagination::{- Base64Str, Cursor, CursorVal, CursorWithValAndFilter, FrecencyValue, SimpleSortMethod,- TypeEraseCursor,-};+use models_pagination::{Cursor, CursorVal, FrecencyValue, SimpleSortMethod, TypeEraseCursor};use models_soup::document::SoupDocument;use ordered_float::OrderedFloat;use sqlx::types::chrono::{DateTime, Utc};-use crate::domain::ports::MockSoupRepo;-use super::*;fn soup_document(id: String) -> SoupDocument {@@ -51,10 +48,8 @@ async fn it_should_not_query_frecency() {SimpleSortRequest {limit: 20,user_id,- cursor: models_pagination::Query::Sort(SimpleSortMethod::ViewedUpdated),- filters+ cursor: models_pagination::Query::Sort(SimpleSortMethod::ViewedUpdated, None),} => {- assert_matches!(filters, None);assert_eq!(user_id.as_ref(), "macro|[email protected]");true}@@ -79,9 +74,8 @@ async fn it_should_not_query_frecency() {.get_user_soup(SoupRequest {soup_type: SoupType::UnExpanded,limit: 0,- cursor: SoupQuery::Simple(Query::Sort(SimpleSortMethod::ViewedUpdated)),+ cursor: SoupQuery::Simple(Query::Sort(SimpleSortMethod::ViewedUpdated, None)),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap()@@ -148,9 +142,8 @@ async fn it_should_query_frecency() {.get_user_soup(SoupRequest {soup_type: SoupType::UnExpanded,limit: u16::MAX,- cursor: SoupQuery::Frecency(Query::Sort(Frecency)),+ cursor: SoupQuery::Frecency(Query::Sort(Frecency, None)),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap()@@ -217,9 +210,8 @@ async fn it_should_sort_frecency_descending() {.get_user_soup(SoupRequest {soup_type: SoupType::UnExpanded,limit: u16::MAX,- cursor: SoupQuery::Frecency(Query::Sort(Frecency)),+ cursor: SoupQuery::Frecency(Query::Sort(Frecency, None)),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap()@@ -274,11 +266,9 @@ async fn frecency_should_fallback() {params,SimpleSortRequest {limit: 75,- cursor: Query::Sort(SimpleSortMethod::UpdatedAt),- filters,+ cursor: Query::Sort(SimpleSortMethod::UpdatedAt, Some(SimpleSortFilter::Frecency(Frecency))),..} => {- assert_matches!(filters, Some(SoupFilter::Frecency));true})@@ -302,13 +292,12 @@ async fn frecency_should_fallback() {.get_user_soup(SoupRequest {soup_type: SoupType::UnExpanded,limit: 100,- cursor: SoupQuery::Frecency(Query::Sort(Frecency)),+ cursor: SoupQuery::Frecency(Query::Sort(Frecency, None)),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap()- .type_erase();+ .unwrap_right();// output should be the limitassert_eq!(res.items.len(), 100);@@ -321,15 +310,10 @@ async fn frecency_should_fallback() {assert!(v.frecency_score.is_none());});// cursor should encode correct info- let typed_cursor =- <Base64Str<CursorWithValAndFilter<String, Frecency, EntityFilterAst>>>::new_from_string(- res.next_cursor.unwrap(),- )- .decode_json()- .unwrap();+ let typed_cursor = res.next_cursor.unwrap().decode_json().unwrap();assert_matches!(typed_cursor,- Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::UpdatedAt(updated), filter: _ }} => {+ Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::UpdatedAt(updated), filter: None }} => {assert_eq!(id, "doc-100");assert_eq!(updated, <DateTime<Utc>>::default() + Days::new(100));@@ -372,13 +356,12 @@ async fn frecency_should_paginate() {.get_user_soup(SoupRequest {soup_type: SoupType::UnExpanded,limit: 100,- cursor: SoupQuery::Frecency(Query::Sort(Frecency)),+ cursor: SoupQuery::Frecency(Query::Sort(Frecency, None)),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap()- .type_erase();+ .unwrap_right();// output should be the limitassert_eq!(res.items.len(), 100);@@ -393,15 +376,10 @@ async fn frecency_should_paginate() {);// cursor should encode correct info- let typed_cursor =- <Base64Str<CursorWithValAndFilter<String, Frecency, EntityFilterAst>>>::new_from_string(- res.next_cursor.unwrap(),- )- .decode_json()- .unwrap();+ let typed_cursor = res.next_cursor.unwrap().decode_json().unwrap();assert_matches!(typed_cursor,- Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::FrecencyScore(score), filter: _ }} => {+ Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::FrecencyScore(score), filter: None }} => {assert_eq!(id, "doc-1");// last item should be the lowest score because we sort descassert_eq!(score as u32, 1u32);@@ -454,11 +432,10 @@ async fn frecency_should_resume_cursor() {},})),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap()- .type_erase();+ .unwrap_right();// first all items should be frecencyassert!(@@ -470,15 +447,10 @@ async fn frecency_should_resume_cursor() {);// cursor should encode correct info- let typed_cursor =- <Base64Str<CursorWithValAndFilter<String, Frecency, EntityFilterAst>>>::new_from_string(- res.next_cursor.unwrap(),- )- .decode_json()- .unwrap();+ let typed_cursor = res.next_cursor.unwrap().decode_json().unwrap();assert_matches!(typed_cursor,- Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::FrecencyScore(score), filter: _ }} => {+ Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::FrecencyScore(score), filter: None }} => {assert_eq!(id, "doc-next-100");// last item should be the lowest score because we sort descassert_eq!(score as u32, 4u32);@@ -502,13 +474,11 @@ async fn frecency_fallback_cursor_should_resume() {val: CursorVal {sort_type: SimpleSortMethod::UpdatedAt,last_val,- filter: _+ filter: Some(SimpleSortFilter::Frecency(Frecency))}}),- filters,..} => {- assert_matches!(filters, Some(SoupFilter::Frecency));let expected_time = <DateTime<Utc>>::default() + Days::new(5);assert_eq!(last_val, &expected_time);assert_eq!(id, "doc-100");@@ -540,24 +510,18 @@ async fn frecency_fallback_cursor_should_resume() {val: CursorVal {sort_type: Frecency,last_val: FrecencyValue::UpdatedAt(DateTime::default() + Days::new(5)),- filter: Default::default(),+ filter: None,},})),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap()- .type_erase();+ .unwrap_right();assert!(res.items.iter().all(|v| v.frecency_score.is_none()));- let cursor =- <Base64Str<CursorWithValAndFilter<String, Frecency, EntityFilterAst>>>::new_from_string(- res.next_cursor.unwrap(),- )- .decode_json()- .unwrap();- assert_matches!(cursor, Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::UpdatedAt(updated), filter: _ } } => {+ let cursor = res.next_cursor.unwrap().decode_json().unwrap();+ assert_matches!(cursor, Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::UpdatedAt(updated), filter: None } } => {assert_eq!(id, "doc-next-100");let expected_date = <DateTime<Utc>>::default() + Days::new(100);assert_eq!(updated, expected_date);@@ -576,10 +540,8 @@ async fn cursor_should_return_simple_sort() {SimpleSortRequest {limit: 20,user_id,- cursor: models_pagination::Query::Sort(SimpleSortMethod::ViewedUpdated),- filters+ cursor: models_pagination::Query::Sort(SimpleSortMethod::ViewedUpdated, None),} => {- assert_matches!(filters, None);assert_eq!(user_id.as_ref(), "macro|[email protected]");true}@@ -601,9 +563,8 @@ async fn cursor_should_return_simple_sort() {.get_user_soup(SoupRequest {soup_type: SoupType::UnExpanded,limit: 0,- cursor: SoupQuery::Simple(Query::Sort(SimpleSortMethod::ViewedUpdated)),+ cursor: SoupQuery::Simple(Query::Sort(SimpleSortMethod::ViewedUpdated, None)),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap();@@ -614,7 +575,7 @@ async fn cursor_should_return_simple_sort() {assert_eq!(id, "my-document-19");let date: DateTime<Utc> = Default::default();assert_eq!(last_val, date);- assert!(filter.is_empty());+ assert!(filter.is_none());})}@@ -654,9 +615,8 @@ async fn cursor_should_return_frecency() {.get_user_soup(SoupRequest {soup_type: SoupType::UnExpanded,limit: 100,- cursor: SoupQuery::Frecency(Query::Sort(Frecency)),+ cursor: SoupQuery::Frecency(Query::Sort(Frecency, None)),user: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),- filters: Default::default(),}).await.unwrap();@@ -666,6 +626,6 @@ async fn cursor_should_return_frecency() {assert_matches!(cursor_decoded, Cursor { id, limit: 100, val: CursorVal { sort_type: Frecency, last_val: FrecencyValue::FrecencyScore(1.0), filter } } => {// frecency sort is descending so the last item is id 1assert_eq!(id, "doc-1");- assert!(filter.is_empty());+ assert!(filter.is_none());})}diff --git a/rust/cloud-storage/soup/src/inbound/axum_router.rs b/rust/cloud-storage/soup/src/inbound/axum_router.rsindex 89087d8025..186cb47913 100644--- a/rust/cloud-storage/soup/src/inbound/axum_router.rs+++ b/rust/cloud-storage/soup/src/inbound/axum_router.rs@@ -99,6 +99,8 @@ wherePostSoupRequest { filters, params }: PostSoupRequest,cursor: SoupCursor,) -> Result<Json<PaginatedOpaqueCursor<SoupApiItem>>, SoupHandlerErr> {+ let filters = EntityFilterAst::new_from_filters(filters)?;+let create_fallback = move || {let params_sort = params.sort_method@@ -106,10 +108,10 @@ where.unwrap_or(SortMethod::Simple(SimpleSortMethod::ViewedAt));match params_sort {SortMethod::Simple(simple_sort_method) => {- SoupQuery::Simple(models_pagination::Query::Sort(simple_sort_method))+ SoupQuery::Simple(models_pagination::Query::Sort(simple_sort_method, filters))}SortMethod::Advanced(frecency) => {- SoupQuery::Frecency(models_pagination::Query::Sort(frecency))+ SoupQuery::Frecency(models_pagination::Query::Sort(frecency, filters))}}};@@ -137,7 +139,6 @@ wherelimit: params.limit.unwrap_or(20),cursor,user: macro_user_id,- filters: EntityFilterAst::new_from_filters(filters)?,}).await?;@@ -244,8 +245,8 @@ pub struct PostSoupRequest {}type SoupCursor = EitherWrapper<- CursorExtractor<String, SimpleSortMethod, EntityFilterAst>,- CursorExtractor<String, Frecency, EntityFilterAst>,+ CursorExtractor<String, SimpleSortMethod, Option<EntityFilterAst>>,+ CursorExtractor<String, Frecency, Option<EntityFilterAst>>,>;/// Gets the items the user has access todiff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rsindex ebe03b74dc..6bdb7c12b4 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo.rs@@ -1,5 +1,5 @@use crate::domain::{- models::{AdvancedSortParams, SimpleSortRequest, SoupFilter},+ models::{AdvancedSortParams, SimpleSortFilter, SimpleSortRequest},ports::SoupRepo,};use either::Either;@@ -26,21 +26,22 @@ impl SoupRepo for PgSoupRepo {&self,req: SimpleSortRequest<'a>,) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send {- match req.filters {- Some(SoupFilter::Ast(_ast)) => todo!(),- Some(SoupFilter::Frecency) => {+ match req.cursor.filter() {+ Some(SimpleSortFilter::Ast(_ast) | SimpleSortFilter::FrecencyAst(_, _ast)) => todo!(),+ Some(SimpleSortFilter::Frecency(f)) => {+ let f = *f;Either::Left(expanded::by_cursor::no_frecency_expanded_generic_soup(&self.inner,req.user_id,req.limit,- req.cursor,+ req.cursor.map_filter(|_| f),))}None => Either::Right(expanded::by_cursor::expanded_generic_cursor_soup(&self.inner,req.user_id,req.limit,- req.cursor,+ req.cursor.map_filter(|_| ()),)),}}@@ -49,21 +50,22 @@ impl SoupRepo for PgSoupRepo {&self,req: SimpleSortRequest<'a>,) -> impl Future<Output = Result<Vec<SoupItem>, Self::Err>> + Send {- match req.filters {- Some(SoupFilter::Ast(_ast)) => todo!(),- Some(SoupFilter::Frecency) => {+ match req.cursor.filter() {+ Some(SimpleSortFilter::Ast(_ast) | SimpleSortFilter::FrecencyAst(_, _ast)) => todo!(),+ Some(SimpleSortFilter::Frecency(f)) => {+ let f = *f;Either::Left(expanded::by_cursor::no_frecency_expanded_generic_soup(&self.inner,req.user_id,req.limit,- req.cursor,+ req.cursor.map_filter(|_| f),))}None => Either::Right(unexpanded::by_cursor::unexpanded_generic_cursor_soup(&self.inner,req.user_id,req.limit,- req.cursor,+ req.cursor.map_filter(|_| ()),)),}}diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rsindex 74ce49d255..8f9131b3ad 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/by_cursor.rs@@ -1,6 +1,5 @@-use item_filters::ast::EntityFilterAst;use macro_user_id::user_id::MacroUserIdStr;-use models_pagination::{Query, SimpleSortMethod};+use models_pagination::{Frecency, Query, SimpleSortMethod};use models_soup::project::map_soup_project;use models_soup::{chat::map_soup_chat, document::map_soup_document, item::SoupItem};use sqlx::PgPool;@@ -17,7 +16,7 @@ pub async fn expanded_generic_cursor_soup(db: &PgPool,user_id: MacroUserIdStr<'_>,limit: u16,- cursor: Query<String, SimpleSortMethod, EntityFilterAst>,+ cursor: Query<String, SimpleSortMethod, ()>,) -> Result<Vec<SoupItem>, sqlx::Error> {let query_limit = limit as i64;let sort_method_str = cursor.sort_method().to_string();@@ -244,7 +243,7 @@ pub async fn no_frecency_expanded_generic_soup(db: &PgPool,user_id: MacroUserIdStr<'_>,limit: u16,- cursor: Query<String, SimpleSortMethod, EntityFilterAst>,+ cursor: Query<String, SimpleSortMethod, Frecency>,) -> Result<Vec<SoupItem>, sqlx::Error> {let query_limit = limit as i64;let sort_method_str = cursor.sort_method().to_string();diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rsindex 5b6ed5c97e..75c5ad0a00 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs@@ -6,7 +6,7 @@ use item_filters::ast::EntityFilterAst;use macro_db_migrator::MACRO_DB_MIGRATIONS;use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};use model_entity::EntityType;-use models_pagination::{PaginateOn, Query, SimpleSortMethod};+use models_pagination::{Frecency, PaginateOn, Query, SimpleSortMethod};use models_soup::item::SoupItem;use sqlx::{Pool, Postgres};use std::collections::HashSet;@@ -21,9 +21,13 @@ use std::collections::HashSet;)]async fn test_viewed_at_orders_nulls_last(pool: Pool<Postgres>) -> anyhow::Result<()> {let user_id = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();- let items =- expanded_generic_cursor_soup(&pool, user_id, 20, Query::Sort(SimpleSortMethod::ViewedAt))- .await?;+ let items = expanded_generic_cursor_soup(+ &pool,+ user_id,+ 20,+ Query::Sort(SimpleSortMethod::ViewedAt, ()),+ )+ .await?;assert_eq!(items.len(), 13, "Should get 13 total items");@@ -143,11 +147,11 @@ async fn test_get_user_items_expanded_cursor(pool: Pool<Postgres>) -> anyhow::Re&pool,user_id.copied(),1,- Query::Sort(SimpleSortMethod::ViewedAt),+ Query::Sort(SimpleSortMethod::ViewedAt, ()),).await?.into_iter()- .paginate_filter_on(1, SimpleSortMethod::ViewedAt, EntityFilterAst::default())+ .paginate_filter_on(1, SimpleSortMethod::ViewedAt, ()).into_page();let items = result.items;@@ -170,6 +174,7 @@ async fn test_get_user_items_expanded_cursor(pool: Pool<Postgres>) -> anyhow::ReQuery::new(result.next_cursor.map(|s| s.decode_json().unwrap()),SimpleSortMethod::ViewedAt,+ (),),).await?;@@ -219,7 +224,7 @@ async fn test_expanded_generic_sorting_methods(pool: Pool<Postgres>) -> anyhow::&pool,user_id.copied(),10,- Query::Sort(SimpleSortMethod::ViewedAt),+ Query::Sort(SimpleSortMethod::ViewedAt, ()),).await?;assert_eq!(@@ -250,7 +255,7 @@ async fn test_expanded_generic_sorting_methods(pool: Pool<Postgres>) -> anyhow::&pool,user_id.copied(),10,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, ()),).await?;assert_eq!(items.len(), 6, "UpdatedAt should return all 6 items");@@ -277,7 +282,7 @@ async fn test_expanded_generic_sorting_methods(pool: Pool<Postgres>) -> anyhow::&pool,user_id,10,- Query::Sort(SimpleSortMethod::CreatedAt),+ Query::Sort(SimpleSortMethod::CreatedAt, ()),).await?;assert_eq!(items.len(), 6, "CreatedAt should return all 6 items");@@ -411,7 +416,7 @@ async fn test_no_frecency_expanded_filters_out_frecency_items(&pool,user_id,20,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, Frecency),).await?;@@ -495,7 +500,7 @@ async fn test_no_frecency_expanded_sorting_methods(pool: Pool<Postgres>) -> anyh&pool,user_id.copied(),20,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, Frecency),).await?;assert_eq!(items.len(), 5, "UpdatedAt should return 5 items");@@ -522,7 +527,7 @@ async fn test_no_frecency_expanded_sorting_methods(pool: Pool<Postgres>) -> anyh&pool,user_id.copied(),20,- Query::Sort(SimpleSortMethod::CreatedAt),+ Query::Sort(SimpleSortMethod::CreatedAt, Frecency),).await?;assert_eq!(items.len(), 5, "CreatedAt should return 5 items");@@ -549,7 +554,7 @@ async fn test_no_frecency_expanded_sorting_methods(pool: Pool<Postgres>) -> anyh&pool,user_id,20,- Query::Sort(SimpleSortMethod::ViewedAt),+ Query::Sort(SimpleSortMethod::ViewedAt, Frecency),).await?;assert_eq!(items.len(), 5, "ViewedAt should return 5 items");@@ -589,11 +594,11 @@ async fn test_no_frecency_expanded_cursor_pagination(pool: Pool<Postgres>) -> an&pool,user_id.copied(),2,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, Frecency),).await?.into_iter()- .paginate_filter_on(2, SimpleSortMethod::UpdatedAt, EntityFilterAst::default())+ .paginate_filter_on(2, SimpleSortMethod::UpdatedAt, Frecency).into_page();assert_eq!(result.items.len(), 2, "Should get 2 items in first page");@@ -627,6 +632,7 @@ async fn test_no_frecency_expanded_cursor_pagination(pool: Pool<Postgres>) -> anQuery::new(result.next_cursor.map(|s| s.decode_json().unwrap()),SimpleSortMethod::UpdatedAt,+ Frecency,),).await?;diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rsindex 34953a5613..b2ebaae4e5 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs@@ -1,4 +1,3 @@-use item_filters::ast::EntityFilterAst;use macro_user_id::user_id::MacroUserIdStr;use models_pagination::{Query, SimpleSortMethod};use models_soup::{@@ -18,7 +17,7 @@ pub async fn unexpanded_generic_cursor_soup(db: &PgPool,user_id: MacroUserIdStr<'_>,limit: u16,- cursor: Query<String, SimpleSortMethod, EntityFilterAst>,+ cursor: Query<String, SimpleSortMethod, ()>,) -> Result<Vec<SoupItem>, sqlx::Error> {let query_limit = limit as i64;let sort_method_str = cursor.sort_method().to_string();diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/tests.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/tests.rsindex 365c828851..7a00af82f3 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/tests.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/tests.rs@@ -2,7 +2,6 @@ use crate::outbound::pg_soup_repo::unexpanded::{by_cursor::{no_frecency_unexpanded_generic_cursor_soup, unexpanded_generic_cursor_soup},by_ids::unexpanded_soup_by_ids,};-use item_filters::ast::EntityFilterAst;use macro_db_migrator::MACRO_DB_MIGRATIONS;use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};use model_entity::EntityType;@@ -38,7 +37,7 @@ async fn test_unexpanded_generic_sorting_methods(pool: Pool<Postgres>) -> anyhow&pool,user_id.copied(),10,- Query::Sort(SimpleSortMethod::ViewedAt),+ Query::Sort(SimpleSortMethod::ViewedAt, ()),).await?;assert_eq!(result.len(), 3, "LastViewed should return 3 items");@@ -56,7 +55,7 @@ async fn test_unexpanded_generic_sorting_methods(pool: Pool<Postgres>) -> anyhow&pool,user_id.copied(),10,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, ()),).await?;assert_eq!(result.len(), 3, "UpdatedAt should return 3 items");@@ -74,7 +73,7 @@ async fn test_unexpanded_generic_sorting_methods(pool: Pool<Postgres>) -> anyhow&pool,user_id,10,- Query::Sort(SimpleSortMethod::CreatedAt),+ Query::Sort(SimpleSortMethod::CreatedAt, ()),).await?;assert_eq!(result.len(), 3, "CreatedAt should return 3 items");@@ -119,7 +118,7 @@ async fn test_unexpanded_generic_mixed_types_sorting(pool: Pool<Postgres>) -> an&pool,user_id.copied(),10,- Query::Sort(SimpleSortMethod::ViewedAt),+ Query::Sort(SimpleSortMethod::ViewedAt, ()),).await?;assert_eq!(result.len(), 3, "LastViewed should return 3 items");@@ -168,7 +167,7 @@ async fn test_unexpanded_generic_mixed_types_sorting(pool: Pool<Postgres>) -> an&pool,user_id.copied(),10,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, ()),).await?;assert_eq!(result.len(), 3, "UpdatedAt should return 3 items");@@ -187,7 +186,7 @@ async fn test_unexpanded_generic_mixed_types_sorting(pool: Pool<Postgres>) -> an&pool,user_id,10,- Query::Sort(SimpleSortMethod::CreatedAt),+ Query::Sort(SimpleSortMethod::CreatedAt, ()),).await?;assert_eq!(result.len(), 3, "CreatedAt should return 3 items");@@ -217,11 +216,11 @@ async fn test_get_user_items_unexpanded_cursor(pool: Pool<Postgres>) -> anyhow::&pool,user_id.copied(),1,- Query::Sort(SimpleSortMethod::ViewedAt),+ Query::Sort(SimpleSortMethod::ViewedAt, ()),).await?.into_iter()- .paginate_filter_on(1, SimpleSortMethod::ViewedAt, EntityFilterAst::default())+ .paginate_filter_on(1, SimpleSortMethod::ViewedAt, ()).into_page();assert_eq!(result.items.len(), 1, "Should get 1 item");@@ -243,6 +242,7 @@ async fn test_get_user_items_unexpanded_cursor(pool: Pool<Postgres>) -> anyhow::Query::new(result.next_cursor.map(|s| s.decode_json().unwrap()),SimpleSortMethod::ViewedAt,+ (),),).await?;@@ -437,7 +437,7 @@ async fn test_no_frecency_unexpanded_filters_out_frecency_items(&pool,user_id,20,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, ()),).await?;@@ -520,7 +520,7 @@ async fn test_no_frecency_unexpanded_sorting_methods(pool: Pool<Postgres>) -> an&pool,user_id.copied(),20,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, ()),).await?;assert_eq!(items.len(), 5, "UpdatedAt should return 5 items");@@ -547,7 +547,7 @@ async fn test_no_frecency_unexpanded_sorting_methods(pool: Pool<Postgres>) -> an&pool,user_id.copied(),20,- Query::Sort(SimpleSortMethod::CreatedAt),+ Query::Sort(SimpleSortMethod::CreatedAt, ()),).await?;assert_eq!(items.len(), 5, "CreatedAt should return 5 items");@@ -574,7 +574,7 @@ async fn test_no_frecency_unexpanded_sorting_methods(pool: Pool<Postgres>) -> an&pool,user_id,20,- Query::Sort(SimpleSortMethod::ViewedAt),+ Query::Sort(SimpleSortMethod::ViewedAt, ()),).await?;assert_eq!(items.len(), 5, "ViewedAt should return 5 items");@@ -614,7 +614,7 @@ async fn test_no_frecency_unexpanded_cursor_pagination(pool: Pool<Postgres>) ->&pool,user_id.copied(),2,- Query::Sort(SimpleSortMethod::UpdatedAt),+ Query::Sort(SimpleSortMethod::UpdatedAt, ()),).await?.into_iter()@@ -652,6 +652,7 @@ async fn test_no_frecency_unexpanded_cursor_pagination(pool: Pool<Postgres>) ->Query::new(result.next_cursor.map(|s| s.decode_json().unwrap()),SimpleSortMethod::UpdatedAt,+ (),),).await?;