From e1ed69331d5cde9a97475b1c0daebce4fdff7418 Mon Sep 17 00:00:00 2001 From: roberto Date: Tue, 5 May 2020 17:52:40 -0500 Subject: [PATCH 1/2] fix(time-entries): add owner_id in data when create time-entry --- .../time_entries/time_entries_model.py | 199 ++++++++++++------ 1 file changed, 136 insertions(+), 63 deletions(-) diff --git a/time_tracker_api/time_entries/time_entries_model.py b/time_tracker_api/time_entries/time_entries_model.py index 10cd7989..31044f55 100644 --- a/time_tracker_api/time_entries/time_entries_model.py +++ b/time_tracker_api/time_entries/time_entries_model.py @@ -5,8 +5,16 @@ from azure.cosmos import PartitionKey from flask_restplus._http import HTTPStatus -from commons.data_access_layer.cosmos_db import CosmosDBDao, CosmosDBRepository, CustomError, current_datetime_str, \ - CosmosDBModel, get_date_range_of_month, get_current_year, get_current_month +from commons.data_access_layer.cosmos_db import ( + CosmosDBDao, + CosmosDBRepository, + CustomError, + current_datetime_str, + CosmosDBModel, + get_date_range_of_month, + get_current_year, + get_current_month, +) from commons.data_access_layer.database import EventContext from time_tracker_api.database import CRUDDao, APICosmosDBDao from time_tracker_api.security import current_user_id @@ -34,10 +42,8 @@ def restart(self, id: str): 'id': 'time_entry', 'partition_key': PartitionKey(path='/tenant_id'), 'unique_key_policy': { - 'uniqueKeys': [ - {'paths': ['/owner_id', '/end_date', '/deleted']}, - ] - } + 'uniqueKeys': [{'paths': ['/owner_id', '/end_date', '/deleted']}] + }, } @@ -66,15 +72,20 @@ def __repr__(self): return '