Commit 8bfeedb0 authored by harshavardhan.c's avatar harshavardhan.c

Merge branch 'develop' of...

Merge branch 'develop' of https://gitlab-pm.knowledgelens.com/Harshavardhan.C/oee-services into develop
parents 50912331 c4e18dcf
...@@ -21,8 +21,10 @@ class Endpoints: ...@@ -21,8 +21,10 @@ class Endpoints:
# OEE SERVICES # OEE SERVICES
oee_services = "/oee" oee_services = "/oee"
oee_services = "/oee_post" oee_services_mapping = "/oee_mapping"
oee_services_getting = "/oee_getting"
delete_oee_service = "/oee_service_update"
update_oee_services = "/oee_services_delete"
# tag_lists # tag_lists
api_tags_lists = "/tag_lists" api_tags_lists = "/tag_lists"
api_tags = "/tags" api_tags = "/tags"
......
from scripts.config import DBConf from scripts.config import DBConf
from scripts.utils.mongo_util import MongoConnect from scripts.utils.mongo_util import MongoConnect, MongoCollectionBaseClass
mongo_client = MongoConnect(uri=DBConf.MONGO_URI)() mongo_client = MongoConnect(uri=DBConf.MONGO_URI)()
mongo_connection = MongoCollectionBaseClass(mongo_client=mongo_client, database="ilens_configuration",
collection="customer_projects")
...@@ -4,12 +4,14 @@ from scripts.constants.db_connections import mongo_client ...@@ -4,12 +4,14 @@ from scripts.constants.db_connections import mongo_client
from scripts.db.mongo.ilens_configuration.collections import collection_constants from scripts.db.mongo.ilens_configuration.collections import collection_constants
from scripts.logging import logger from scripts.logging import logger
from scripts.schemas.oee_config_schema import Oee_Tag_Mapping_List, Get_Oee_Tag, Update_Oee_Tags, Get_Project_Id from scripts.schemas.oee_config_schema import Oee_Tag_Mapping_List, Get_Oee_Tag, Update_Oee_Tags, Get_Project_Id
from scripts.constants.db_connections import mongo_connection
class Oee_Services: class Oee_Services:
def __init__(self, project_id=Get_Project_Id.project_id): def __init__(self, project_id=Get_Project_Id.project_id):
try: try:
self.connect = collection_constants(mongo_client=mongo_client) self.connect = collection_constants(mongo_client=mongo_client)
self.mongo_connect = mongo_connection
except Exception as e: except Exception as e:
tb = traceback.format_exc() tb = traceback.format_exc()
logger.exception(e) logger.exception(e)
...@@ -81,3 +83,12 @@ class Oee_Services: ...@@ -81,3 +83,12 @@ class Oee_Services:
logger.exception(tb) logger.exception(tb)
logger.exception(f"Exception occurred while fetching data as {e}") logger.exception(f"Exception occurred while fetching data as {e}")
raise raise
def get_project_tz(self):
connection = self.mongo_connect
project_tz = connection.find()
return_json = {}
for each_project in project_tz:
for each_tz in each_project:
return_json.update({str(each_tz.get("customer_project_name")): str(each_tz.get("timezone"))})
return return_json
...@@ -8,7 +8,7 @@ from scripts.schemas.batch_oee import GetOeeServices ...@@ -8,7 +8,7 @@ from scripts.schemas.batch_oee import GetOeeServices
oee_services = APIRouter(prefix=Endpoints.oee_services, tags=["OEE Calculator"]) oee_services = APIRouter(prefix=Endpoints.oee_services, tags=["OEE Calculator"])
@oee_services.post(Endpoints.oee_services) @oee_services.post(Endpoints.oee_services_mapping)
async def oee_tag_mapping(oee_tag_mapping_list: GetOeeServices): async def oee_tag_mapping(oee_tag_mapping_list: GetOeeServices):
try: try:
tag_mapping = oee_tag_mapping_list.dict() tag_mapping = oee_tag_mapping_list.dict()
...@@ -19,7 +19,7 @@ async def oee_tag_mapping(oee_tag_mapping_list: GetOeeServices): ...@@ -19,7 +19,7 @@ async def oee_tag_mapping(oee_tag_mapping_list: GetOeeServices):
raise logger.exception("Exception occurred while inserting data") raise logger.exception("Exception occurred while inserting data")
@oee_services.post(Endpoints.oee_services) @oee_services.post(Endpoints.oee_services_getting)
async def get_oee_tag_mapping(get_oee_tags: GetOeeServices): async def get_oee_tag_mapping(get_oee_tags: GetOeeServices):
try: try:
get_oee_tags = get_oee_tags.dict() get_oee_tags = get_oee_tags.dict()
...@@ -30,7 +30,7 @@ async def get_oee_tag_mapping(get_oee_tags: GetOeeServices): ...@@ -30,7 +30,7 @@ async def get_oee_tag_mapping(get_oee_tags: GetOeeServices):
raise logger.exception(f"Error while getting information as {e}") raise logger.exception(f"Error while getting information as {e}")
@oee_services.post(Endpoints.oee_services) @oee_services.post(Endpoints.delete_oee_service)
async def delete_oee_tagging(delete_oee_tags: GetOeeServices): async def delete_oee_tagging(delete_oee_tags: GetOeeServices):
try: try:
delete_oee_tags = delete_oee_tags.dict() delete_oee_tags = delete_oee_tags.dict()
...@@ -41,7 +41,7 @@ async def delete_oee_tagging(delete_oee_tags: GetOeeServices): ...@@ -41,7 +41,7 @@ async def delete_oee_tagging(delete_oee_tags: GetOeeServices):
raise logger.exception(f"Error while getting information as {e}") raise logger.exception(f"Error while getting information as {e}")
@oee_services.post(Endpoints.oee_services) @oee_services.post(Endpoints.update_oee_services)
async def update_oee_tagging(update_oee_tags: GetOeeServices): async def update_oee_tagging(update_oee_tags: GetOeeServices):
try: try:
update_oee_tags = update_oee_tags.dict() update_oee_tags = update_oee_tags.dict()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment