from app import db
from app.dao.decorators import transactional


@transactional
def dao_create_record(record):
    db.session.add(record)


@transactional
def dao_update_record(data_type, id, **kwargs):
    return data_type.query.filter_by(id=id).update(
        kwargs
    )


def dao_get_record_by_id(data_type, id):
    return data_type.query.filter_by(id=id).one()


def dao_get_record_by_old_id(data_type, old_id):
    return data_type.query.filter_by(old_id=old_id).first()

from app import db
from app.dao.decorators import transactional


@transactional
def dao_create_record(record):
    db.session.add(record)


# @transactional
# def dao_update_record(data_type, id, **kwargs):
#     return data_type.query.filter_by(id=id).update(
#         kwargs
#     )


# def dao_get_record_by_id(data_type, id):
#     return data_type.query.filter_by(id=id).one()


# def dao_get_record_by_old_id(data_type, old_id):
#     return data_type.query.filter_by(old_id=old_id).first()

Comment out generic db functions as not used yet
Comment out generic db functions as not used yet

  from app import db
  from app.dao.decorators import transactional
  
  
  @transactional
  def dao_create_record(record):
      db.session.add(record)
  
  
- @transactional
+ # @transactional
- def dao_update_record(data_type, id, **kwargs):
+ # def dao_update_record(data_type, id, **kwargs):
-     return data_type.query.filter_by(id=id).update(
+ #     return data_type.query.filter_by(id=id).update(
-         kwargs
+ #         kwargs
-     )
+ #     )
  
  
- def dao_get_record_by_id(data_type, id):
+ # def dao_get_record_by_id(data_type, id):
-     return data_type.query.filter_by(id=id).one()
+ #     return data_type.query.filter_by(id=id).one()
  
  
- def dao_get_record_by_old_id(data_type, old_id):
+ # def dao_get_record_by_old_id(data_type, old_id):
-     return data_type.query.filter_by(old_id=old_id).first()
+ #     return data_type.query.filter_by(old_id=old_id).first()
  
Comment out generic db functions as not used yet
## Code Before:
from app import db
from app.dao.decorators import transactional


@transactional
def dao_create_record(record):
    db.session.add(record)


@transactional
def dao_update_record(data_type, id, **kwargs):
    return data_type.query.filter_by(id=id).update(
        kwargs
    )


def dao_get_record_by_id(data_type, id):
    return data_type.query.filter_by(id=id).one()


def dao_get_record_by_old_id(data_type, old_id):
    return data_type.query.filter_by(old_id=old_id).first()

## Instruction:
Comment out generic db functions as not used yet
## Code After:
from app import db
from app.dao.decorators import transactional


@transactional
def dao_create_record(record):
    db.session.add(record)


# @transactional
# def dao_update_record(data_type, id, **kwargs):
#     return data_type.query.filter_by(id=id).update(
#         kwargs
#     )


# def dao_get_record_by_id(data_type, id):
#     return data_type.query.filter_by(id=id).one()


# def dao_get_record_by_old_id(data_type, old_id):
#     return data_type.query.filter_by(old_id=old_id).first()
