This commit is contained in:
Stefan Menner
2025-06-16 16:52:00 +02:00
parent 6e7ac29a27
commit 5a4bbc5297
7 changed files with 28 additions and 14 deletions

2
src/db/mod.rs Normal file
View File

@@ -0,0 +1,2 @@
pub mod models;
pub use models::*;

View File

@@ -2,11 +2,13 @@
#![allow(unused)]
#![allow(clippy::all)]
use diesel::{
prelude::Queryable,
sql_types::{Json, Uuid},
};
use uuid::Uuid;
#[derive(Queryable, Debug)]
pub struct Icon {
pub struct RowIcon {
pub id: Uuid,
pub name: String,
pub content_type: Option<String>,
@@ -17,7 +19,7 @@ pub struct Icon {
}
#[derive(Queryable, Debug)]
pub struct Ingredient {
pub struct RowIngredient {
pub id: Uuid,
pub resource: Uuid,
pub quantity: i32,
@@ -26,7 +28,7 @@ pub struct Ingredient {
}
#[derive(Queryable, Debug)]
pub struct Recipe {
pub struct RowRecipe {
pub id: Uuid,
pub resource: Uuid,
pub recipe_type: String,
@@ -35,7 +37,7 @@ pub struct Recipe {
}
#[derive(Queryable, Debug)]
pub struct Resource {
pub struct RowResource {
pub id: Uuid,
pub name: String,
pub title: String,
@@ -43,4 +45,3 @@ pub struct Resource {
pub icon: Option<Uuid>,
pub state: Option<Json>,
}

View File

@@ -1,6 +1,6 @@
mod db;
mod parse;
mod types;
use std::{fs::File, io::Read};
use parse::parse;

View File

@@ -1,13 +1,11 @@
use std::collections::HashMap;
use crate::types::{Duration, Icon, Ingredient, Recipe, RecipeType, Resource, ResourceState};
use regex::Regex;
use select::{
document::Document,
node::Node,
predicate::{Attr, Name, Or},
};
use crate::types::{Duration, Icon, Ingredient, Recipe, RecipeType, Resource, ResourceState};
use std::collections::HashMap;
#[derive(Debug, PartialEq, Eq)]
enum ParseType {