vanikam/src/inventory/adapters/output/db/postgres/mod.rs
Aravinth Manivannan fcb99cc9ec
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
feat: impl customization name violation for db
2024-07-16 11:37:25 +05:30

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()))
}
}