diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/__init__.py | 1 | ||||
-rw-r--r-- | app/controllers/__init__.py | 4 | ||||
-rw-r--r-- | app/controllers/sessions_controller.py | 6 | ||||
-rw-r--r-- | app/database/__init__.py | 7 | ||||
-rw-r--r-- | app/models/__init__.py | 0 | ||||
-rw-r--r-- | app/models/user.py | 13 |
6 files changed, 31 insertions, 0 deletions
diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1 @@ + diff --git a/app/controllers/__init__.py b/app/controllers/__init__.py new file mode 100644 index 0000000..69ae175 --- /dev/null +++ b/app/controllers/__init__.py @@ -0,0 +1,4 @@ +from flask import Blueprint, current_app + + +sessions_blueprint = Blueprint('sessions_controller', '__sessions_controller__') diff --git a/app/controllers/sessions_controller.py b/app/controllers/sessions_controller.py new file mode 100644 index 0000000..dc0a3eb --- /dev/null +++ b/app/controllers/sessions_controller.py @@ -0,0 +1,6 @@ +from flask import Blueprint +from app.controllers import sessions_blueprint + +@sessions_blueprint.route('/') +def hello(): + return '<p>Hello, world!</p>' diff --git a/app/database/__init__.py b/app/database/__init__.py new file mode 100644 index 0000000..4f0223a --- /dev/null +++ b/app/database/__init__.py @@ -0,0 +1,7 @@ +from flask_sqlalchemy import SQLAlchemy +from sqlalchemy.orm import DeclarativeBase, MappedAsDataclass + +class Base(DeclarativeBase, MappedAsDataclass): + pass + +db = SQLAlchemy(model_class=Base) diff --git a/app/models/__init__.py b/app/models/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/models/__init__.py diff --git a/app/models/user.py b/app/models/user.py new file mode 100644 index 0000000..a76fb2e --- /dev/null +++ b/app/models/user.py @@ -0,0 +1,13 @@ +from sqlalchemy import BigInteger, String, Date +from sqlalchemy.orm import mapped_column +from app.database import db + +class User(db.Model): + __tablename__ = 'users' + + id = mapped_column(BigInteger, primary_key=True) + email = mapped_column(String, nullable=False) + first_name = mapped_column(String, nullable=False) + last_name = mapped_column(String, nullable=False) + role = mapped_column(String(10), nullable=False) + created_at = mapped_column(Date, nullable=False) |