use cfg_if::cfg_if;

pub mod data;
pub mod company;

cfg_if!{
    if #[cfg(feature = "ssr")] {
        use sqlx::PgPool;

        #[derive(Clone)]
        pub struct AppData {
            db_pool: PgPool
        }

        impl AppData {
            pub fn new(db_pool: PgPool) -> Self {
                Self {
                    db_pool
                }
            }

            pub fn db_pool(&self) -> &PgPool {
                &self.db_pool
            }
        }
    }
}