This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/ereuse_devicehub/resources/lot/__init__.py

21 lines
539 B
Python
Raw Normal View History

2018-08-08 19:25:53 +00:00
import pathlib
2018-09-07 10:38:02 +00:00
from teal.resource import Converters, Resource
2018-08-08 19:25:53 +00:00
from ereuse_devicehub.db import db
from ereuse_devicehub.resources.lot import schemas
from ereuse_devicehub.resources.lot.views import LotView
class LotDef(Resource):
SCHEMA = schemas.Lot
VIEW = LotView
AUTH = True
ID_CONVERTER = Converters.uuid
def init_db(self, db: 'db.SQLAlchemy'):
# Create functions
with pathlib.Path(__file__).parent.joinpath('dag.sql').open() as f:
sql = f.read()
db.session.execute(sql)