37 lines
846 B
Rust
37 lines
846 B
Rust
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
use std::sync::Arc;
|
|
|
|
use sqlx::postgres::PgPool;
|
|
|
|
use crate::db::{migrate::RunMigrations, sqlx_postgres::Postgres};
|
|
|
|
mod category_id_exists;
|
|
mod category_name_exists_for_store;
|
|
mod category_view;
|
|
mod customization_id_exists;
|
|
mod customization_name_exists_for_product;
|
|
mod errors;
|
|
mod product_id_exists;
|
|
mod product_name_exists_for_category;
|
|
mod product_view;
|
|
mod store_id_exists;
|
|
mod store_name_exists;
|
|
mod store_view;
|
|
|
|
#[derive(Clone)]
|
|
pub struct InventoryDBPostgresAdapter {
|
|
pool: PgPool,
|
|
}
|
|
|
|
impl InventoryDBPostgresAdapter {
|
|
pub fn new(pool: PgPool) -> Self {
|
|
Self { pool }
|
|
}
|
|
|
|
pub fn migratable(&self) -> Arc<dyn RunMigrations> {
|
|
Arc::new(Postgres::new(self.pool.clone()))
|
|
}
|
|
}
|