diff --git a/app/config.py.default b/app/config.py.default index 7933bf2..695325d 100644 --- a/app/config.py.default +++ b/app/config.py.default @@ -28,6 +28,9 @@ class Settings(BaseSettings): HTTP_STATUS_LI[503] = { 'name': 'Service Unavailable', 'message': 'The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.' } HTTP_STATUS_LI[504] = { 'name': 'Gateway Timeout', 'message': 'The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.' } + PATH_HOSTED_FILES_ROOT = '/mnt/data_drive/srv/data/osit_app/hosted_hashed_dev' # Will contain only hashed files + PATH_HOSTED_TMP_ROOT = '/mnt/data_drive/srv/data/osit_app/hosted_tmp_dev' # Will contain only temporary files + DB_CFG_FASTAPI_ID = 0 settings = Settings() diff --git a/app/lib_general.py b/app/lib_general.py index ee47b37..04b6aaf 100644 --- a/app/lib_general.py +++ b/app/lib_general.py @@ -7,6 +7,7 @@ from pydantic import BaseModel, EmailStr, Field from typing import Dict, List, Optional, Set, Union from app.log import log, logging, logger_reset +from app.config import settings from app.db_sql import redis_lookup_id_random, sql_select @@ -114,7 +115,7 @@ def decode_jwt( # ### BEGIN ### API Lib General ### create_export() ### -# Updated 2021-07-14 +# Updated 2021-11-23 @logger_reset def create_export_file( data_dict_list: list, @@ -125,10 +126,11 @@ def create_export_file( log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL log.debug(locals()) - hosted_temp_path = 'admin/temp' - log.info(f'Hosted Temp Path: {hosted_temp_path}') + hosted_tmp_path = settings.PATH_HOSTED_TMP_ROOT + # hosted_tmp_path = 'admin/temp' + log.info(f'Hosted Temp Path: {hosted_tmp_path}') - subdirectory_dest = os.path.join(hosted_temp_path, subdir_path) + subdirectory_dest = os.path.join(hosted_tmp_path, subdir_path) log.debug(subdirectory_dest) pathlib.Path(subdirectory_dest).mkdir(parents=True, exist_ok=True) file_dest_w_subdir = os.path.join(subdirectory_dest, filename) @@ -154,5 +156,4 @@ def create_export_file( return False return True - # ### END ### API Lib General ### create_export() ### diff --git a/app/routers/order_line.py b/app/routers/order_line.py index 34758a1..eb87d44 100644 --- a/app/routers/order_line.py +++ b/app/routers/order_line.py @@ -95,10 +95,10 @@ async def get_obj_id_order_line_list( if create_export: datetime_format='%Y-%m-%d_%H%M' - current_datetime = datetime.datetime.now() - # current_datetime_string = current_datetime.isoformat() - current_datetime_string = current_datetime.strftime(datetime_format) - filename = f'order_line_list_{current_datetime_string}' + # current_datetime = datetime.datetime.now() # Servers timezone (Eastern) + current_datetime_utc = datetime.datetime.utcnow() + current_datetime_utc = current_datetime_utc.strftime(datetime_format) + filename = f'order_line_list_{current_datetime_utc}' create_export_file(data_dict_list=data_dict_list_for_export, subdir_path='order_line', filename=filename, export_type='Excel') # print(response_data)