New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
persistence: add tenant db #26
Conversation
c61d4d1
to
12fc845
Compare
reana_workflow_controller/api.py
Outdated
# granted to it by virtue of its status as an Intergovernmental Organization or | ||
# submit itself to any jurisdiction. | ||
|
||
"""REANA Workflow Controller Rest API.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be good to ponder renaming of api.py
to restapi.py
, so that we distinguish more clearly here and in other REANA packages between:
- API = Pythonic API, CLI API
- RESTAPI = REST API
While some REANA components won't have much of a Pythonic API, and they will be used exclusively over REST API, it may be good to have some naming consistency across all packages for ease of development across packages?
reana_workflow_controller/app.py
Outdated
|
||
def create_app(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed IRL, let's put factory creation into factory.py
and let's leave app.py
to instantiate the application out of it.
reana_workflow_controller/models.py
Outdated
class Tenant(db.Model): | ||
"""Tenant model.""" | ||
|
||
id_ = db.Column(db.String(36), primary_key=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sqlalchemy-utils
has a UUIDType
that we could use, see invenio-records
.
reana_workflow_controller/models.py
Outdated
"""Tenant model.""" | ||
|
||
id_ = db.Column(db.String(36), primary_key=True) | ||
email = db.Column(db.String(120), unique=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 120 enough? Perhaps max out to 255?
reana_workflow_controller/models.py
Outdated
from .app import db | ||
|
||
|
||
class Tenant(db.Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to have some user accounting information, so let's think of new columns like:
- create_date
- last_active_date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and we could even think of future Alembic DB upgrade recipes 😄 to be fully future-proof)
tests/conftest.py
Outdated
def default_tenant(db): | ||
"""Create users.""" | ||
default_tenant = Tenant('00000000-0000-0000-0000-000000000000', | ||
'default@reana.io', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
info@reana.io
7abdc05
to
469b6b7
Compare
603e2ad
to
9e9046f
Compare
Signed-off-by: Diego Rodriguez <diego.rodriguez@cern.ch>
Signed-off-by: Diego Rodriguez <diego.rodriguez@cern.ch>
Signed-off-by: Diego Rodriguez <diego.rodriguez@cern.ch>
* Removes usage of default database. Uses only SQLAlchemy binds. Signed-off-by: Diego Rodriguez <diego.rodriguez@cern.ch>
* (closes reanahub#27). Signed-off-by: Diego Rodriguez <diego.rodriguez@cern.ch>
(let's ignore coveralls since this code will go away soon, see #28) |
Signed-off-by: Diego Rodriguez diego.rodriguez@cern.ch