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

5
.gitignore vendored
View File

@@ -20,3 +20,8 @@ Cargo.lock
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.env
.env.*
!.env.example
!.env.*.example
# Ignore the .env file that contains sensitive information

10
.vscode/settings.json vendored
View File

@@ -1,3 +1,11 @@
{
"cSpell.words": ["Quelle", "Verwendung"]
"cSpell.words": [
"Herstellung",
"Kochen",
"Quelle",
"Raffination",
"serde",
"Stück",
"Verwendung"
]
}

View File

@@ -8,7 +8,7 @@ license = "MIT"
repository = "ssh://git@gitea.merlinserver.de:2222/Stefan/merlin_env_helper.git"
[dependencies]
diesel = "2.2.10"
diesel = { version= "2.2.10", features = ["serde_json", "postgres", "uuid"]}
env_logger = "0.11.8"
log = "0.4.27"
merlin_env_helper = { version = "0.2.0", registry = "merlin" }

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 {