Merge branch 'main' into stateless

This commit is contained in:
khorshuheng 2024-12-26 11:53:41 +08:00
commit 3c1da30663
2 changed files with 9 additions and 5 deletions

View File

@ -55,7 +55,7 @@ pub async fn select_quick_notes_with_one_more_than_limit<
let json_path_query = format!("'$.**.insert ? (@ like_regex \".*{}.*\")'", search_term); let json_path_query = format!("'$.**.insert ? (@ like_regex \".*{}.*\")'", search_term);
query_builder.push(json_path_query); query_builder.push(json_path_query);
} }
query_builder.push(" ORDER BY created_at DESC"); query_builder.push(" ORDER BY updated_at DESC");
if let Some(limit) = limit { if let Some(limit) = limit {
query_builder.push(" LIMIT "); query_builder.push(" LIMIT ");
query_builder.push_bind(limit); query_builder.push_bind(limit);

View File

@ -21,6 +21,8 @@ async fn quick_note_crud_test() {
// To ensure that the creation time is different // To ensure that the creation time is different
time::sleep(Duration::from_millis(1)).await; time::sleep(Duration::from_millis(1)).await;
} }
let quick_note_id_1 = quick_note_ids[0];
let quick_note_id_2 = quick_note_ids[1];
let quick_notes = client let quick_notes = client
.api_client .api_client
.list_quick_notes(workspace_uuid, None, None, None) .list_quick_notes(workspace_uuid, None, None, None)
@ -81,12 +83,14 @@ async fn quick_note_crud_test() {
]); ]);
client client
.api_client .api_client
.update_quick_note(workspace_uuid, quick_note_id_1, data_1) .update_quick_note(workspace_uuid, quick_note_id_2, data_2)
.await .await
.expect("update quick note"); .expect("update quick note");
// To ensure that the update time is different
time::sleep(Duration::from_millis(1)).await;
client client
.api_client .api_client
.update_quick_note(workspace_uuid, quick_note_id_2, data_2) .update_quick_note(workspace_uuid, quick_note_id_1, data_1)
.await .await
.expect("update quick note"); .expect("update quick note");
let quick_notes = client let quick_notes = client
@ -110,7 +114,7 @@ async fn quick_note_crud_test() {
assert!(!quick_notes_with_offset_and_limit.has_more); assert!(!quick_notes_with_offset_and_limit.has_more);
assert_eq!( assert_eq!(
quick_notes_with_offset_and_limit.quick_notes[0].id, quick_notes_with_offset_and_limit.quick_notes[0].id,
quick_note_id_1 quick_note_id_2
); );
let quick_notes_with_offset_and_limit = client let quick_notes_with_offset_and_limit = client
.api_client .api_client
@ -121,7 +125,7 @@ async fn quick_note_crud_test() {
assert!(quick_notes_with_offset_and_limit.has_more); assert!(quick_notes_with_offset_and_limit.has_more);
assert_eq!( assert_eq!(
quick_notes_with_offset_and_limit.quick_notes[0].id, quick_notes_with_offset_and_limit.quick_notes[0].id,
quick_note_id_2 quick_note_id_1
); );
let filtered_quick_notes = client let filtered_quick_notes = client
.api_client .api_client