Skip to content

Commit 689548a

Browse files
committed
Improve the todo search in /api/todos [GET]
1 parent 261fe64 commit 689548a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/api/todo/list.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ pub async fn list(
3333
let mut query = TodoEntity::find().filter(TodoColumn::UserId.eq(user.id));
3434

3535
if let Some(title) = &params.title {
36-
query = query.filter(TodoColumn::Title.like(title));
36+
query = query.filter(
37+
TodoColumn::Title
38+
.contains(title)
39+
.or(TodoColumn::Title.eq(title.as_str()))
40+
.or(TodoColumn::Title.like(title)),
41+
);
3742
}
3843
if let Some(status) = &params.status {
3944
query = query.filter(TodoColumn::Status.eq(status.clone()));

0 commit comments

Comments
 (0)