You've already forked AstralRinth
forked from didirus/AstralRinth
Finish database code
This commit is contained in:
@@ -4,7 +4,7 @@ use dotenv::dotenv;
|
||||
use std::env;
|
||||
|
||||
pub fn connect() -> PgConnection{
|
||||
dotenv.ok();
|
||||
dotenv().ok();
|
||||
|
||||
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set!");
|
||||
PgConnection::establish(&database_url).expect(&format!("Error connecting to {}", database_url))
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::schema::mods;
|
||||
use chrono::NaiveDate;
|
||||
|
||||
#[derive(Queryable)]
|
||||
pub struct Mod {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub published: String,
|
||||
pub published: NaiveDate,
|
||||
pub author: String,
|
||||
pub downloads: i32,
|
||||
pub categories: Vec<String>,
|
||||
@@ -17,12 +15,12 @@ pub struct Mod {
|
||||
|
||||
#[derive(Queryable)]
|
||||
pub struct Version {
|
||||
pub id: i32,
|
||||
pub version_id: i32,
|
||||
pub mod_id: i32,
|
||||
pub title: String,
|
||||
pub changelog_path: String,
|
||||
pub files_path: Vec<String>,
|
||||
pub date_published: String,
|
||||
pub date_published: NaiveDate,
|
||||
pub author: String,
|
||||
pub downloads: i32,
|
||||
pub dependencies: Vec<String>,
|
||||
|
||||
Reference in New Issue
Block a user