feat(utils): adds routes constants dictionary and db utils
This commit is contained in:
2
app/utils/__init__.py
Normal file
2
app/utils/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
from app.utils.db_utils import DBUtils
|
||||||
|
from app.utils.route_const import ROUTES
|
||||||
16
app/utils/db_utils.py
Normal file
16
app/utils/db_utils.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from app.extensions import db
|
||||||
|
from app.models.user import User
|
||||||
|
from app.models.pet import Pet
|
||||||
|
from app.models.pet_kind import PetKind
|
||||||
|
from app.models.adoptions import Adoptions
|
||||||
|
from app.models.adoption_status import AdoptionStatus
|
||||||
|
|
||||||
|
class DBUtils():
|
||||||
|
def setup_db(app):
|
||||||
|
if not app:
|
||||||
|
Exception("this function needs app context to be ran, please provide app")
|
||||||
|
with app.app_context():
|
||||||
|
db.create_all()
|
||||||
|
|
||||||
|
def drop_db():
|
||||||
|
db.drop_all()
|
||||||
10
app/utils/route_const.py
Normal file
10
app/utils/route_const.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
ROUTES = {
|
||||||
|
'home': '/',
|
||||||
|
'users': {
|
||||||
|
'login' : '/users/login',
|
||||||
|
'register' : '/users/register',
|
||||||
|
},
|
||||||
|
'pets': '/pets',
|
||||||
|
'about-us' : '/us/about',
|
||||||
|
'contact-us' : '/us/contact'
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user