From 264e5ff691e0283e639dc70a1191b13053ccdf5c Mon Sep 17 00:00:00 2001 From: WriterV2 Date: Sat, 26 Oct 2024 23:31:37 +0200 Subject: Feat: Add initial entities --- src/db/game.rs | 6 ++++++ src/db/gametag.rs | 5 +++++ src/db/mod.rs | 8 ++++++++ src/db/product.rs | 8 ++++++++ src/db/story.rs | 8 ++++++++ src/db/storytag.rs | 5 +++++ src/db/tag.rs | 5 +++++ src/db/tool.rs | 6 ++++++ src/db/tooltag.rs | 5 +++++ src/main.rs | 2 ++ 10 files changed, 58 insertions(+) create mode 100644 src/db/game.rs create mode 100644 src/db/gametag.rs create mode 100644 src/db/mod.rs create mode 100644 src/db/product.rs create mode 100644 src/db/story.rs create mode 100644 src/db/storytag.rs create mode 100644 src/db/tag.rs create mode 100644 src/db/tool.rs create mode 100644 src/db/tooltag.rs (limited to 'src') diff --git a/src/db/game.rs b/src/db/game.rs new file mode 100644 index 0000000..6afbbec --- /dev/null +++ b/src/db/game.rs @@ -0,0 +1,6 @@ +#[derive(Debug, serde::Serialize, sqlx::FromRow)] +pub struct Game { + pub id: i64, + pub repolink: String, + pub pid: i64, +} diff --git a/src/db/gametag.rs b/src/db/gametag.rs new file mode 100644 index 0000000..335d2a4 --- /dev/null +++ b/src/db/gametag.rs @@ -0,0 +1,5 @@ +#[derive(Debug, serde::Serialize, sqlx::FromRow)] +pub struct Gametag { + pub gid: i64, + pub tgid: i64, +} diff --git a/src/db/mod.rs b/src/db/mod.rs new file mode 100644 index 0000000..b5b1488 --- /dev/null +++ b/src/db/mod.rs @@ -0,0 +1,8 @@ +mod game; +mod gametag; +mod product; +mod story; +mod storytag; +mod tag; +mod tool; +mod tooltag; diff --git a/src/db/product.rs b/src/db/product.rs new file mode 100644 index 0000000..e112679 --- /dev/null +++ b/src/db/product.rs @@ -0,0 +1,8 @@ +#[derive(Debug, serde::Serialize, sqlx::FromRow)] +pub struct Product { + pub id: i64, + pub name: String, + pub description: String, + pub uploaddate: i64, + pub updatedate: i64, +} diff --git a/src/db/story.rs b/src/db/story.rs new file mode 100644 index 0000000..10fc49b --- /dev/null +++ b/src/db/story.rs @@ -0,0 +1,8 @@ +#[derive(Debug, serde::Serialize, sqlx::FromRow)] +pub struct Story { + pub id: i64, + pub language: String, + pub pdf: Vec, + pub epub: Vec, + pub pid: i64, +} diff --git a/src/db/storytag.rs b/src/db/storytag.rs new file mode 100644 index 0000000..0953fc2 --- /dev/null +++ b/src/db/storytag.rs @@ -0,0 +1,5 @@ +#[derive(Debug, serde::Serialize, sqlx::FromRow)] +pub struct Storytag { + pub sid: i64, + pub tgid: i64, +} diff --git a/src/db/tag.rs b/src/db/tag.rs new file mode 100644 index 0000000..df55a8a --- /dev/null +++ b/src/db/tag.rs @@ -0,0 +1,5 @@ +#[derive(Debug, serde::Serialize, sqlx::FromRow)] +pub struct Tag { + pub id: i64, + pub name: String, +} diff --git a/src/db/tool.rs b/src/db/tool.rs new file mode 100644 index 0000000..5e6ea0a --- /dev/null +++ b/src/db/tool.rs @@ -0,0 +1,6 @@ +#[derive(Debug, serde::Serialize, sqlx::FromRow)] +pub struct Tool { + pub id: i64, + pub repolink: String, + pub pid: i64, +} diff --git a/src/db/tooltag.rs b/src/db/tooltag.rs new file mode 100644 index 0000000..393e687 --- /dev/null +++ b/src/db/tooltag.rs @@ -0,0 +1,5 @@ +#[derive(Debug, serde::Serialize, sqlx::FromRow)] +pub struct Tooltag { + pub tid: i64, + pub tgid: i64, +} diff --git a/src/main.rs b/src/main.rs index d99fbe9..b8e1302 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,8 @@ use maud::{html, Markup, DOCTYPE}; use sqlx::sqlite::SqlitePoolOptions; use tower_http::services::ServeDir; +mod db; + struct AppError(anyhow::Error); impl IntoResponse for AppError { -- cgit v1.2.3