from flask import Blueprint, request, jsonify, send_file, current_app, render_template
from datetime import datetime
import ast
import os

from db import DB   # Your existing DB wrapper


# =============================================================
# Base Service (common DB operations)
# =============================================================
class BaseService:
    def __init__(self):
        self.db = DB()

    def fetch_all(self, proc, params=None):
        return self.db.fetch_all_proc(proc, params)

    def fetch_one(self, proc, params=None):
        return self.db.fetch_one_proc(proc, params)

    def execute_proc(self, proc, params=None):
        return self.db.exec_proc(proc, params)

    def get_conn(self):
        return self.db.get_connection()
