fix: broken contact query
Some checks failed
/ integration-test--firefox (push) Failing after 3m5s

This commit is contained in:
Robert Perce 2026-01-26 17:56:00 -06:00
parent d42adbe274
commit 69e23fd9bb
4 changed files with 15 additions and 12 deletions

View file

@ -33,7 +33,7 @@ tokio = { version = "1.47.1", features = ["macros", "rt-mu
tower-http = { version = "0.6.6", features = ["fs"] } tower-http = { version = "0.6.6", features = ["fs"] }
tower-sessions = { version = "0.14.0", features = ["signed"] } tower-sessions = { version = "0.14.0", features = ["signed"] }
tower-sessions-sqlx-store = { version = "0.15.0", features = ["sqlite"] } tower-sessions-sqlx-store = { version = "0.15.0", features = ["sqlite"] }
tracing = "0.1.41" tracing = { version = "0.1.41", features = ["attributes"] }
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] } tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
vcard = "0.4.13" vcard = "0.4.13"

View file

@ -55,12 +55,12 @@ insert into journal_entries(id, date, value) values
(5, '2024-02-18', 'With [[Bazel]] gone, dissolved [[ABC]] Corp. Start discussions for a potential ACE, Inc. with [[Alexi]] and [[Eleanor]].'); (5, '2024-02-18', 'With [[Bazel]] gone, dissolved [[ABC]] Corp. Start discussions for a potential ACE, Inc. with [[Alexi]] and [[Eleanor]].');
insert into mentions (entity_id, entity_type, input_text, byte_range_start, byte_range_end, url) values insert into mentions (entity_id, entity_type, input_text, byte_range_start, byte_range_end, url) values
(0, 'journal_entry', 'Bazel Bagend', 11, 27, '/contact/1'), (0, 0, 'Bazel Bagend', 11, 27, '/contact/1'),
(1, 'journal_entry', 'Alexi', 12, 21, '/contact/0'), (1, 0, 'Alexi', 12, 21, '/contact/0'),
(3, 'journal_entry', 'ABC', 24, 31, '/group/ABC'), (3, 0, 'ABC', 24, 31, '/group/ABC'),
(4, 'journal_entry', 'Bazel', 22, 31, '/contact/1'), (4, 0, 'Bazel', 22, 31, '/contact/1'),
(4, 'journal_entry', 'Eleanor Edgeworth', 37, 58, '/contact/3'), (4, 0, 'Eleanor Edgeworth', 37, 58, '/contact/3'),
(5, 'journal_entry', 'Eleanor', 108, 119, '/contact/3'), (5, 0, 'Eleanor', 108, 119, '/contact/3'),
(5, 'journal_entry', 'Alexi', 94, 103, '/contact/0'), (5, 0, 'Alexi', 94, 103, '/contact/0'),
(5, 'journal_entry', 'Bazel', 5, 14, '/contact/1'), (5, 0, 'Bazel', 5, 14, '/contact/1'),
(5, 'journal_entry', 'ABC', 31, 38, '/group/ABC'); (5, 0, 'ABC', 31, 38, '/group/ABC');

View file

@ -23,12 +23,14 @@ impl Database {
let pool = SqlitePoolOptions::new().connect_with(db_options).await?; let pool = SqlitePoolOptions::new().connect_with(db_options).await?;
tracing::debug!("migrating...");
sqlx::migrate!("./migrations/each_user/").run(&pool).await?; sqlx::migrate!("./migrations/each_user/").run(&pool).await?;
if user.username == "demo" { if user.username == "demo" {
sqlx::query_file!("./migrations/demo.sql") sqlx::query_file!("./migrations/demo.sql")
.execute(&pool) .execute(&pool)
.await?; .await?;
}; };
tracing::debug!("...done.");
Ok(Self { pool }) Ok(Self { pool })
} }

View file

@ -85,6 +85,7 @@ fn birthdays_section(
}) })
} }
#[tracing::instrument(level = "info")]
pub async fn journal_section( pub async fn journal_section(
pool: &SqlitePool, pool: &SqlitePool,
entries: &Vec<JournalEntry>, entries: &Vec<JournalEntry>,
@ -110,7 +111,7 @@ pub async fn journal_section(
.entries { .entries {
@for entry in entries { @for entry in entries {
(Into::<MentionHost>::into(entry).format_pool(pool).await?) (entry.to_html(pool).await?)
} }
} }
} }
@ -129,7 +130,7 @@ pub mod get {
let pool = &state.db(&user).pool; let pool = &state.db(&user).pool;
let contacts: Vec<HydratedContact> = sqlx::query_as( let contacts: Vec<HydratedContact> = sqlx::query_as(
"select id, birthday, manually_freshened_at, ( "select *, (
select string_agg(name,'\x1c' order by sort) select string_agg(name,'\x1c' order by sort)
from names where contact_id = c.id from names where contact_id = c.id
) as names, ( ) as names, (