core
: Support meta titles
This commit is contained in:
parent
f2d73c1798
commit
8a49903eca
1 changed files with 20 additions and 1 deletions
|
@ -22,6 +22,7 @@ pub struct MetaLink {
|
||||||
pub rel: String,
|
pub rel: String,
|
||||||
pub type_: Option<String>,
|
pub type_: Option<String>,
|
||||||
pub href: Option<String>,
|
pub href: Option<String>,
|
||||||
|
pub template: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Queryable, QueryableByName, Identifiable, Selectable, Insertable, Associations)]
|
#[derive(Debug, Queryable, QueryableByName, Identifiable, Selectable, Insertable, Associations)]
|
||||||
|
@ -34,6 +35,16 @@ pub struct MetaLinkProperty {
|
||||||
pub value: Option<String>,
|
pub value: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Queryable, QueryableByName, Identifiable, Selectable, Insertable, Associations)]
|
||||||
|
#[diesel(belongs_to(MetaLink))]
|
||||||
|
#[diesel(table_name = schema::meta_link_titles)]
|
||||||
|
pub struct MetaLinkTitle {
|
||||||
|
pub id: Uuid,
|
||||||
|
pub meta_link_id: Uuid,
|
||||||
|
pub language: String,
|
||||||
|
pub value: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Queryable, QueryableByName, Identifiable, Selectable, Insertable)]
|
#[derive(Debug, Queryable, QueryableByName, Identifiable, Selectable, Insertable)]
|
||||||
#[diesel(table_name = schema::meta_properties)]
|
#[diesel(table_name = schema::meta_properties)]
|
||||||
pub struct MetaProperty {
|
pub struct MetaProperty {
|
||||||
|
@ -44,7 +55,6 @@ pub struct MetaProperty {
|
||||||
pub value: Option<String>,
|
pub value: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl MetaAlias {
|
impl MetaAlias {
|
||||||
pub async fn query_matching(conn: &mut AsyncPgConnection, doc: &str, subject: &str) -> QueryResult<Vec<MetaAlias>> {
|
pub async fn query_matching(conn: &mut AsyncPgConnection, doc: &str, subject: &str) -> QueryResult<Vec<MetaAlias>> {
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
|
@ -88,6 +98,15 @@ impl MetaLink {
|
||||||
.load(conn)
|
.load(conn)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn query_titles(&self, conn: &mut AsyncPgConnection) -> QueryResult<Vec<MetaLinkTitle>> {
|
||||||
|
use diesel::prelude::*;
|
||||||
|
use diesel_async::RunQueryDsl;
|
||||||
|
|
||||||
|
MetaLinkTitle::belonging_to(self)
|
||||||
|
.load(conn)
|
||||||
|
.await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaProperty {
|
impl MetaProperty {
|
||||||
|
|
Loading…
Reference in a new issue