Make mod category nullable
This commit is contained in:
parent
b2d17f6217
commit
6136ac18fa
1
migrations/20210809010234_make_mod_category_nullable.sql
Normal file
1
migrations/20210809010234_make_mod_category_nullable.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE "mods" ALTER COLUMN "category" DROP NOT NULL;
|
@ -12,7 +12,7 @@ pub struct Mod {
|
||||
pub name: String,
|
||||
pub nexus_mod_id: i32,
|
||||
pub author: String,
|
||||
pub category: String,
|
||||
pub category: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub game_id: i32,
|
||||
pub updated_at: NaiveDateTime,
|
||||
@ -25,7 +25,7 @@ pub struct UnsavedMod<'a> {
|
||||
pub name: &'a str,
|
||||
pub nexus_mod_id: i32,
|
||||
pub author: &'a str,
|
||||
pub category: &'a str,
|
||||
pub category: Option<&'a str>,
|
||||
pub description: Option<&'a str>,
|
||||
pub game_id: i32,
|
||||
}
|
||||
@ -68,7 +68,7 @@ pub async fn insert(
|
||||
name: &str,
|
||||
nexus_mod_id: i32,
|
||||
author: &str,
|
||||
category: &str,
|
||||
category: Option<&str>,
|
||||
description: Option<&str>,
|
||||
game_id: i32,
|
||||
) -> Result<Mod> {
|
||||
@ -103,7 +103,7 @@ pub async fn batched_insert<'a>(
|
||||
let mut names: Vec<&str> = vec![];
|
||||
let mut nexus_mod_ids: Vec<i32> = vec![];
|
||||
let mut authors: Vec<&str> = vec![];
|
||||
let mut categories: Vec<&str> = vec![];
|
||||
let mut categories: Vec<Option<&str>> = vec![];
|
||||
let mut descriptions: Vec<Option<&str>> = vec![];
|
||||
let mut game_ids: Vec<i32> = vec![];
|
||||
batch.into_iter().for_each(|unsaved_mod| {
|
||||
|
@ -11,7 +11,7 @@ pub struct ModListResponse {
|
||||
pub struct ScrapedMod<'a> {
|
||||
pub nexus_mod_id: i32,
|
||||
pub name: &'a str,
|
||||
pub category: &'a str,
|
||||
pub category: Option<&'a str>,
|
||||
pub author: &'a str,
|
||||
pub desc: Option<&'a str>,
|
||||
}
|
||||
@ -89,8 +89,7 @@ impl ModListResponse {
|
||||
.expect("Missing category link for mod");
|
||||
let category = category_elem
|
||||
.text()
|
||||
.next()
|
||||
.expect("Missing category text for mod");
|
||||
.next();
|
||||
let author_elem = right
|
||||
.select(&author_select)
|
||||
.next()
|
||||
|
Loading…
Reference in New Issue
Block a user