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: Refactor time_tracker_events for deployment #101
  • Loading branch information
EliuX committed Apr 30, 2020
commit b6ab54d5cf3236c96de1c4e292606bcdb033aaf6
Binary file removed .DS_Store
Binary file not shown.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ automatically [pip](https://pip.pypa.io/en/stable/) as well.
* `prod`: For anything deployed


Remember to do it with Python 3.
Remember to do it with Python 3.

Bear in mind that the requirements for `time_tracker_events`, must be located on its local requirements.txt, by
[convention](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#folder-structure).

- Run `pre-commit install`. For more details, check out Development > Git hooks.

Expand Down Expand Up @@ -134,6 +137,16 @@ following notes regarding to the manipulation of the data from and towards the A
- The [recommended](https://docs.microsoft.com/en-us/azure/cosmos-db/working-with-dates#storing-datetimes) format for
DateTime strings in Azure Cosmos DB is `YYYY-MM-DDThh:mm:ss.fffffffZ` which follows the ISO 8601 **UTC standard**.

The Azure function project `time_tracker_events` also have some constraints to have into account. It is recommended that
you read the [Azure Functions Python developer guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#folder-structure).

If you require to deploy `time_tracker_events` from your local machine to Azure Functions, you can execute:

```bash
func azure functionapp publish time-tracker-events --build local
```


## Development

### Git hooks
Expand Down
5 changes: 2 additions & 3 deletions requirements/time_tracker_events/prod.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# requirements/time_tracker_events/prod.txt

# Azure Functions library
azure-functions

# Include the requirements of that folder, required there by convention
-r ../../time_tracker_events/requirements.txt
Empty file.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import azure.functions as func
from faker import Faker

from time_tracker_events.handle_events_trigger import main as main_handler
from time_tracker_events.shared_code.handle_events_trigger import main as main_handler

fake = Faker()

Expand Down
2 changes: 1 addition & 1 deletion time_tracker_api/time_entries/time_entries_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def delete(self, id):

@ns.route('/<string:id>/stop')
@ns.response(HTTPStatus.NOT_FOUND, 'Running time entry not found')
@ns.response(HTTPStatus.UNPROCESSABLE_ENTITY, '"The specified time entry is already stopped')
@ns.response(HTTPStatus.UNPROCESSABLE_ENTITY, 'The specified time entry is already stopped')
@ns.param('id', 'The unique identifier of a running time entry')
class StopTimeEntry(Resource):
@ns.doc('stop_time_entry')
Expand Down
3 changes: 2 additions & 1 deletion time_tracker_events/.funcignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

run.sh
.vscode
2 changes: 1 addition & 1 deletion time_tracker_events/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ venv.bak/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
*$py.class
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ..handle_events_trigger import main as handler
from ..shared_code import handle_events_trigger

main = handler
main = handle_events_trigger.main
2 changes: 1 addition & 1 deletion time_tracker_events/handle_customer_trigger/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ..handle_events_trigger import main as handler
from ..shared_code.handle_events_trigger import main as handler

main = handler
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ..handle_events_trigger import main as handler
from ..shared_code.handle_events_trigger import main as handler

main = handler
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ..handle_events_trigger import main as handler
from ..shared_code.handle_events_trigger import main as handler

main = handler
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ..handle_events_trigger import main as handler
from __app__.shared_code.handle_events_trigger import main as handler

main = handler
2 changes: 1 addition & 1 deletion time_tracker_events/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}
}
8 changes: 0 additions & 8 deletions time_tracker_events/local.settings.json

This file was deleted.

4 changes: 4 additions & 0 deletions time_tracker_events/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# time_tracker_events/requirements.txt

# Azure Functions library
azure-functions