From a5b6485d11ca5f44e4d8f6f244208ea0bcf12bf6 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 16 Nov 2024 02:54:55 +0100 Subject: [PATCH] `core`: Allow querying meta objects grouped by parent --- acrate-core/src/meta.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/acrate-core/src/meta.rs b/acrate-core/src/meta.rs index bcfd200..ef66ab7 100644 --- a/acrate-core/src/meta.rs +++ b/acrate-core/src/meta.rs @@ -89,21 +89,25 @@ impl MetaLink { .load(conn) .await } - - pub async fn query_properties(&self, conn: &mut AsyncPgConnection) -> QueryResult> { +} + +impl MetaLinkProperty { + pub async fn query_by_link(conn: &mut AsyncPgConnection, links: &[MetaLink]) -> QueryResult> { use diesel::prelude::*; use diesel_async::RunQueryDsl; - MetaLinkProperty::belonging_to(self) + Self::belonging_to(links) .load(conn) .await } - - pub async fn query_titles(&self, conn: &mut AsyncPgConnection) -> QueryResult> { +} + +impl MetaLinkTitle { + pub async fn query_by_link(conn: &mut AsyncPgConnection, links: &[MetaLink]) -> QueryResult> { use diesel::prelude::*; use diesel_async::RunQueryDsl; - MetaLinkTitle::belonging_to(self) + Self::belonging_to(links) .load(conn) .await }