Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: TT-401 resolved comments
  • Loading branch information
ararcos committed Nov 24, 2021
commit 3658c9f24e83d74cc1b7b03cc5b258d8014a9557
13 changes: 6 additions & 7 deletions V2/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.PHONY: help
help:
@echo "---------------HELP-----------------"
@echo "To install the dependencies type make install"
@echo "To test the project type make test"
@echo "To test a specific test of the project make test specific_test=name of test"
@echo "To run the local database type make start-local"
@echo "To run all comands type make ci"
@echo "- make install --> Install the dependencies"
@echo "- make test --> Run all tests"
@echo "- make test specific_test=<name_of_the_test> --> Run specific test"
@echo "- make start-local --> Run local database"
@echo "- make ci --> Install the dependencies and run all tests"
@echo "------------------------------------"

.PHONY: install
Expand All @@ -18,14 +18,13 @@ install:

.PHONY: test
test: export ENVIRONMENT = test
test: export TEST_DB_CONNECTION = sqlite:///file:memory?mode=memory&cache=shared&uri=true
test:
@echo "=========================================Lint with flake8========================================="
flake8 . --show-source --statistics
@echo "Completed flake8!"
@echo "=========================================Test with pytest========================================="
@if [ "$(specific_test)" ]; then \
python -m pytest -v -k $(specific_test);\
python -m pytest -vv -s -k $(specific_test);\
else \
python -m pytest -v;\
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ def create_time_entry(req: func.HttpRequest) -> func.HttpResponse:


def _validate_time_entry(time_entry_data: dict) -> typing.List[str]:
time_entry_fields = [field.name for field in dataclasses.fields(_domain.TimeEntry)]
time_entry_fields.pop(8)
time_entry_fields.pop(0)
time_entry_fields = [field.name for field in dataclasses.fields(_domain.TimeEntry)
if field.type != typing.Optional[field.type]]
missing_keys = [field for field in time_entry_fields if field not in time_entry_data]
return [
f'The {missing_key} key is missing in the input data'
Expand Down
6 changes: 3 additions & 3 deletions V2/time_tracker/time_entries/_domain/_entities/_time_entry.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from dataclasses import dataclass
from typing import List
from typing import List, Optional


@dataclass(frozen=True)
class TimeEntry:
id: int
id: Optional[int]
start_date: str
owner_id: int
description: str
activity_id: int
uri: str
technologies: List[str]
end_date: str
deleted: bool
deleted: Optional[bool]
timezone_offset: str
project_id: int