summaryrefslogtreecommitdiff
path: root/src/db/mod.rs
blob: 1d64ed876f8d01f6ea2ca55783f5ed4f3294ffbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use sqlx::SqlitePool;

use crate::error::AppError;
use async_trait::async_trait;

pub mod game;
pub mod gametag;
pub mod product;
pub mod story;
pub mod storytag;
pub mod tag;
pub mod tool;
pub mod tooltag;

#[async_trait]
pub trait ProductDatabaseHandler {
    async fn get_all(pool: SqlitePool) -> Result<Vec<Self>, AppError>
    where
        Self: Sized;

    async fn post(
        &self,
        pool: &SqlitePool,
        name: String,
        description: String,
    ) -> Result<Self, AppError>
    where
        Self: Sized;
}