-
Notifications
You must be signed in to change notification settings - Fork 0
Fixes #64 - Update current models to meet new design. #65
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
Changes from 2 commits
159dd08
eca5943
d7b8191
77a3f80
03d46a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,11 +9,13 @@ def create_dao() -> ActivityDao: | |
| from time_tracker_api.sql_repository import db | ||
| from time_tracker_api.sql_repository import SQLCRUDDao, AuditedSQLModel | ||
|
|
||
| class ActivitySQLModel(db.Model, AuditedSQLModel): | ||
| class ActivitySQLModel(db.Model): | ||
| __tablename__ = 'activity' | ||
| id = db.Column(db.Integer, primary_key=True) | ||
| id = db.Column(db.String, primary_key=True) | ||
| name = db.Column(db.String(50), unique=True, nullable=False) | ||
| description = db.Column(db.String(250), unique=False, nullable=False) | ||
| deleted = db.Column(db.String, default=None) | ||
| tenant_id = db.Column(db.String, nullable=False) | ||
|
||
|
|
||
| def __repr__(self): | ||
| return '<Activity %r>' % self.name | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,15 @@ | |
|
|
||
| # Common models structure | ||
| audit_fields = { | ||
| 'deleted': fields.String( | ||
| readOnly=True, | ||
| required=True, | ||
| title='Last event Identifier', | ||
| description='Last event over this resource', | ||
| example=faker.uuid4(), | ||
| ), | ||
| } | ||
| """ | ||
| 'created_at': fields.Date( | ||
| readOnly=True, | ||
| title='Created', | ||
|
|
@@ -41,6 +50,7 @@ | |
| example='anonymous', | ||
| ), | ||
| } | ||
| """ | ||
|
||
|
|
||
| # APIs | ||
| from time_tracker_api.projects import projects_namespace | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,13 +21,15 @@ def create_dao() -> ProjectDao: | |
| from time_tracker_api.database import COMMENTS_MAX_LENGTH | ||
| from time_tracker_api.sql_repository import SQLCRUDDao, AuditedSQLModel | ||
|
|
||
| class ProjectSQLModel(db.Model, AuditedSQLModel): | ||
| class ProjectSQLModel(db.Model): | ||
| __tablename__ = 'project' | ||
| id = db.Column(db.Integer, primary_key=True) | ||
| id = db.Column(db.String, primary_key=True) | ||
|
||
| name = db.Column(db.String(50), unique=True, nullable=False) | ||
| description = db.Column(db.String(COMMENTS_MAX_LENGTH), unique=False, nullable=False) | ||
| type = db.Column(db.String(10), nullable=False) | ||
| active = db.Column(db.Boolean, default=True) | ||
| project_type_id = db.Column(db.String, default=None) | ||
| customer_id = db.Column(db.String, nullable=False) | ||
| deleted = db.Column(db.String, default=None) | ||
| tenant_id = db.Column(db.String, nullable=False) | ||
|
|
||
| def __repr__(self): | ||
| return '<Project %r>' % self.name | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,28 +14,17 @@ | |
|
|
||
| # TimeEntry Model | ||
| time_entry_input = ns.model('TimeEntryInput', { | ||
| 'project_id': fields.Integer( | ||
| 'project_id': fields.String( | ||
| required=True, | ||
| title='Project', | ||
| description='The id of the selected project', | ||
| example=faker.random_int(1, 9999), | ||
| example=faker.uuid4(), | ||
| ), | ||
| 'activity_id': fields.Integer( | ||
| 'activity_id': fields.String( | ||
| required=True, | ||
| title='Activity', | ||
| description='The id of the selected activity', | ||
| example=faker.random_int(1, 9999), | ||
| ), | ||
| 'technologies': fields.List( | ||
| fields.String( | ||
| required=True, | ||
| title='Technologies', | ||
| description='Technology names used in this time-entry', | ||
| ), | ||
| example=faker.words( | ||
| 3, | ||
| ['java', 'elixir', 'python', 'docker'], | ||
| unique=True | ||
| ) | ||
| example=faker.uuid4(), | ||
| ), | ||
| 'description': fields.String( | ||
| title='Comments', | ||
|
|
@@ -54,14 +43,34 @@ | |
| description='When the user ended doing this activity', | ||
| example=faker.iso8601(end_datetime=None), | ||
| ), | ||
| 'uri': fields.String( | ||
| title='Uniform Resource identifier', | ||
| description='Either identifier or locator', | ||
| example=faker.words( | ||
| 1, | ||
| ['http://example.com/mypage.html', '/some/page.html'] | ||
|
||
| ), | ||
| ), | ||
| 'owner_id': fields.String( | ||
| required=True, | ||
| title='Owner of time entry', | ||
| description='User who owns the time entry', | ||
| example=faker.uuid4(), | ||
| ), | ||
| 'tenant_id': fields.String( | ||
| required=True, | ||
| title='Identifier of Tenant', | ||
| description='Tenant this project belongs to', | ||
| example=faker.uuid4(), | ||
| ), | ||
| }) | ||
|
|
||
| time_entry_response_fields = { | ||
| 'id': fields.String( | ||
| readOnly=True, | ||
| title='Identifier', | ||
| description='The unique identifier', | ||
| example=faker.random_int(1, 9999), | ||
| example=faker.uuid4(), | ||
| ), | ||
| 'running': fields.Boolean( | ||
| readOnly=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.
The model in LucidCharts has this field as
owneronly. @EliuX should we change the PR or update the LucidCharts diagram?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.
Sure