-
Notifications
You must be signed in to change notification settings - Fork 0
feat: TT-403 delete v2 time entries #346
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 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4676dc4
feat: TT-401 Implemented service, end-point, dao, test- time entries
ararcos 39d2b24
feat: TT-401 validated request create time entry
ararcos ddf305c
fix: TT-401 implemented faker url
ararcos 5c6d669
feat: TT-403 created end-point to DELETE of time_entries
ararcos 21ff57c
fix: TT-403 validation of id as integer
ararcos 4bc146a
fix: TT-403 remove method POST
ararcos 93d8f16
feat: TT-403 rebase with master
mandres2015 486c997
feat: TT-403 tests added
mandres2015 b79d442
refactor: TT-403 correct flake8 lint syntax
mandres2015 0e1413c
fix: TT-403 comments solved
mandres2015 878bc24
fix: TT-403 correction of rebase
mandres2015 08df504
refactor: TT-403 renamed of delete test
ararcos 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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# flake8: noqa | ||
from ._time_entries import create_time_entry | ||
from ._time_entries import create_time_entry, delete_time_entry |
3 changes: 2 additions & 1 deletion
3
V2/time_tracker/time_entries/_application/_time_entries/__init__.py
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# flake8: noqa | ||
from ._create_time_entry import create_time_entry | ||
from ._create_time_entry import create_time_entry | ||
from ._delete_time_entry import delete_time_entry |
36 changes: 36 additions & 0 deletions
36
V2/time_tracker/time_entries/_application/_time_entries/_delete_time_entry.py
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,36 @@ | ||
import json | ||
|
||
import azure.functions as func | ||
|
||
from ... import _domain | ||
from ... import _infrastructure | ||
from time_tracker._infrastructure import DB | ||
|
||
|
||
def delete_time_entry(req: func.HttpRequest) -> func.HttpResponse: | ||
time_entry_dao = _infrastructure.TimeEntriesSQLDao(DB()) | ||
time_entry_service = _domain.TimeEntryService(time_entry_dao) | ||
use_case = _domain._use_cases.DeleteTimeEntryUseCase(time_entry_service) | ||
|
||
try: | ||
time_entry_id = int(req.route_params.get("id")) | ||
ararcos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
deleted_time_entry = use_case.delete_time_entry(time_entry_id) | ||
if not deleted_time_entry: | ||
return func.HttpResponse( | ||
body="Not found", | ||
status_code=404, | ||
mimetype="application/json" | ||
) | ||
|
||
return func.HttpResponse( | ||
body=json.dumps(deleted_time_entry.__dict__, default=str), | ||
status_code=200, | ||
mimetype="application/json", | ||
) | ||
|
||
except ValueError: | ||
return func.HttpResponse( | ||
body=b"Invalid Format ID", | ||
status_code=400, | ||
mimetype="application/json" | ||
) |
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
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
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# flake8: noqa | ||
from ._create_time_entry_use_case import CreateTimeEntryUseCase | ||
from ._delete_time_entry_use_case import DeleteTimeEntryUseCase |
10 changes: 10 additions & 0 deletions
10
V2/time_tracker/time_entries/_domain/_use_cases/_delete_time_entry_use_case.py
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,10 @@ | ||
from time_tracker.time_entries._domain import TimeEntry, TimeEntryService | ||
|
||
|
||
class DeleteTimeEntryUseCase: | ||
|
||
def __init__(self, time_entry_service: TimeEntryService): | ||
self.time_entry_service = time_entry_service | ||
|
||
def delete_time_entry(self, id: int) -> TimeEntry: | ||
return self.time_entry_service.delete(id) |
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# flake8: noqa | ||
from ._application import create_time_entry | ||
from ._application import create_time_entry | ||
from ._application import delete_time_entry |
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.