fix: grab the committee name since we can use that to match up against teh suers
This commit is contained in:
parent
cab04a068f
commit
4eeb7f2135
2 changed files with 6 additions and 2 deletions
|
@ -5,6 +5,7 @@ DROP TABLE committee;
|
||||||
CREATE TABLE IF NOT EXISTS committees (
|
CREATE TABLE IF NOT EXISTS committees (
|
||||||
id integer PRIMARY KEY,
|
id integer PRIMARY KEY,
|
||||||
name_profile text not null,
|
name_profile text not null,
|
||||||
|
name_plain text not null,
|
||||||
name_full text not null,
|
name_full text not null,
|
||||||
link text not null,
|
link text not null,
|
||||||
committee text not null
|
committee text not null
|
||||||
|
|
|
@ -178,6 +178,7 @@ pub mod committees {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub name_full: String,
|
pub name_full: String,
|
||||||
pub name_profile: String,
|
pub name_profile: String,
|
||||||
|
pub name_plain: String,
|
||||||
pub link: String,
|
pub link: String,
|
||||||
#[sqlx(json)]
|
#[sqlx(json)]
|
||||||
pub committee: Vec<i64>,
|
pub committee: Vec<i64>,
|
||||||
|
@ -189,6 +190,7 @@ pub mod committees {
|
||||||
id: value.id,
|
id: value.id,
|
||||||
name_full: value.name_full,
|
name_full: value.name_full,
|
||||||
name_profile: value.name_profile,
|
name_profile: value.name_profile,
|
||||||
|
name_plain: value.name_plain,
|
||||||
link: value.link,
|
link: value.link,
|
||||||
committee: value.committee,
|
committee: value.committee,
|
||||||
}
|
}
|
||||||
|
@ -219,14 +221,15 @@ pub mod committees {
|
||||||
async fn add_committee(db: &Pool<Sqlite>, committee: &Committees) {
|
async fn add_committee(db: &Pool<Sqlite>, committee: &Committees) {
|
||||||
match sqlx::query_as::<_, Committees>(
|
match sqlx::query_as::<_, Committees>(
|
||||||
"
|
"
|
||||||
INSERT INTO committees (id, name_profile, name_full, link, committee)
|
INSERT INTO committees (id, name_profile, name_full, name_plain, link, committee)
|
||||||
VALUES ($1, $2, $3, $4, $5)
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
ON CONFLICT(id) DO UPDATE SET committee = $4
|
ON CONFLICT(id) DO UPDATE SET committee = $4
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.bind(committee.id)
|
.bind(committee.id)
|
||||||
.bind(&committee.name_profile)
|
.bind(&committee.name_profile)
|
||||||
.bind(&committee.name_full)
|
.bind(&committee.name_full)
|
||||||
|
.bind(&committee.name_plain)
|
||||||
.bind(&committee.link)
|
.bind(&committee.link)
|
||||||
.bind(serde_json::to_string(&committee.committee).unwrap_or_default())
|
.bind(serde_json::to_string(&committee.committee).unwrap_or_default())
|
||||||
.fetch_optional(db)
|
.fetch_optional(db)
|
||||||
|
|
Loading…
Add table
Reference in a new issue