-
Notifications
You must be signed in to change notification settings - Fork 0
Implement activities model #44
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
804120c
Fixes #14 - Add Activity model
Angeluz-07 d5c11c5
Fixes #14 - Add tests for activity
Angeluz-07 587855b
Fixes #14 - replace http codes by constants
Angeluz-07 63bcdd4
Fixes #14 - merge with time-entry model
Angeluz-07 b683c62
Fixes #14 - apply PR observations
Angeluz-07 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Fixes #14 - Add Activity model
- Loading branch information
commit 804120c276d1a173f51ce2e063b4aa47f1fa6c8f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| from flask import Flask | ||
|
|
||
| from time_tracker_api.database import CRUDDao | ||
|
|
||
|
|
||
| class ActivityDao(CRUDDao): | ||
| pass | ||
|
|
||
|
|
||
| def create_dao(app: Flask) -> ActivityDao: | ||
| from time_tracker_api.sql_repository import db | ||
| from time_tracker_api.sql_repository import SQLCRUDDao, AuditedSQLModel, SQLModel | ||
|
|
||
| class ActivitySQLModel(db.Model, SQLModel, AuditedSQLModel): | ||
| __tablename__ = 'activity' | ||
| id = db.Column(db.Integer, primary_key=True) | ||
| name = db.Column(db.String(50), unique=True, nullable=False) | ||
| description = db.Column(db.String(250), unique=False, nullable=False) | ||
|
|
||
| def __repr__(self): | ||
| return '<Activity %r>' % self.name | ||
|
|
||
| def __str___(self): | ||
| return "the activity \"%s\"" % self.name | ||
|
|
||
| class ActivitySQLDao(SQLCRUDDao): | ||
| def __init__(self): | ||
| SQLCRUDDao.__init__(self, ActivitySQLModel) | ||
|
|
||
| return ActivitySQLDao() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.