diff --git a/ApiServices/InitialService/init_app_defaults.py b/ApiServices/InitialService/init_app_defaults.py index 76ade66..8f3094b 100644 --- a/ApiServices/InitialService/init_app_defaults.py +++ b/ApiServices/InitialService/init_app_defaults.py @@ -444,14 +444,25 @@ def create_application_defaults(db_session): f"{str(company_management.uu_id)}*Domain", ) with mongo_handler.collection(collection_name) as mongo_engine: - mongo_engine.insert_one( - document={ - "user_uu_id": str(gen_manager_user.uu_id), - "other_domains_list": [main_domain], - "main_domain": main_domain, - "modified_at": arrow.now().timestamp(), - } - ) + existing_record = mongo_engine.find_one({"user_uu_id": str(gen_manager_user.uu_id)}) + if not existing_record: + mongo_engine.insert_one( + document={ + "user_uu_id": str(gen_manager_user.uu_id), + "other_domains_list": [main_domain], + "main_domain": main_domain, + "modified_at": arrow.now().timestamp(), + } + ) + else: + mongo_engine.update_one( + {"user_uu_id": str(gen_manager_user.uu_id)}, + {"$set": { + "other_domains_list": [main_domain], + "main_domain": main_domain, + "modified_at": arrow.now().timestamp(), + }} + ) app_manager_user = Users.find_or_create( person_id=app_manager.id, @@ -472,14 +483,25 @@ def create_application_defaults(db_session): app_manager_user.password_token = PasswordModule.generate_refresher_token() with mongo_handler.collection(collection_name) as mongo_engine: - mongo_engine.insert_one( - document={ - "user_uu_id": str(app_manager_user.uu_id), - "other_domains_list": [main_domain], - "main_domain": main_domain, - "modified_at": arrow.now().timestamp(), - } - ) + existing_record = mongo_engine.find_one({"user_uu_id": str(app_manager_user.uu_id)}) + if not existing_record: + mongo_engine.insert_one( + document={ + "user_uu_id": str(app_manager_user.uu_id), + "other_domains_list": [main_domain], + "main_domain": main_domain, + "modified_at": arrow.now().timestamp(), + } + ) + else: + mongo_engine.update_one( + {"user_uu_id": str(app_manager_user.uu_id)}, + {"$set": { + "other_domains_list": [main_domain], + "main_domain": main_domain, + "modified_at": arrow.now().timestamp(), + }} + ) sup_manager_employee = Users.find_or_create( person_id=sup_manager.id, @@ -502,14 +524,27 @@ def create_application_defaults(db_session): sup_manager_employee.password_expiry_begins = str(arrow.now()) sup_manager_employee.password_token = PasswordModule.generate_refresher_token() with mongo_handler.collection(collection_name) as mongo_engine: - mongo_engine.insert_one( - document={ - "user_uu_id": str(sup_manager_employee.uu_id), - "other_domains_list": [main_domain], - "main_domain": main_domain, - "modified_at": arrow.now().timestamp(), - } - ) + existing_record = mongo_engine.find_one({"user_uu_id": str(sup_manager_employee.uu_id)}) + + if not existing_record: + mongo_engine.insert_one( + document={ + "user_uu_id": str(sup_manager_employee.uu_id), + "other_domains_list": [main_domain], + "main_domain": main_domain, + "modified_at": arrow.now().timestamp(), + } + ) + else: + # Optionally update the existing record if needed + mongo_engine.update_one( + {"user_uu_id": str(sup_manager_employee.uu_id)}, + {"$set": { + "other_domains_list": [main_domain], + "main_domain": main_domain, + "modified_at": arrow.now().timestamp(), + }} + ) db_session.commit() print("All Defaults Create is now completed") diff --git a/WebServices/management-frontend/src/components/Pages/application/PaginationToolsComponent.tsx b/WebServices/management-frontend/src/components/Pages/application/PaginationToolsComponent.tsx index 0edcc58..76b144c 100644 --- a/WebServices/management-frontend/src/components/Pages/application/PaginationToolsComponent.tsx +++ b/WebServices/management-frontend/src/components/Pages/application/PaginationToolsComponent.tsx @@ -56,14 +56,23 @@ export const PaginationToolsComponent: React.FC< {/* Navigation buttons - center */}
- + + + { + pagination.back ? (<>) : (<>) + } {/* Page number buttons */}
@@ -75,7 +84,7 @@ export const PaginationToolsComponent: React.FC< 1, Math.ceil( (pagination.totalCount && - pagination.totalCount !== pagination.allCount + pagination.totalCount !== pagination.allCount ? pagination.totalCount : pagination.allCount || 0) / pagination.size ) @@ -89,7 +98,7 @@ export const PaginationToolsComponent: React.FC< 1, Math.ceil( (pagination.totalCount && - pagination.totalCount !== pagination.allCount + pagination.totalCount !== pagination.allCount ? pagination.totalCount : pagination.allCount || 0) / pagination.size ) @@ -120,14 +129,20 @@ export const PaginationToolsComponent: React.FC< )}
- + { + pagination.page < pagination.totalPages ? (<>) : (<>) + } {/* Page text display */} @@ -136,7 +151,7 @@ export const PaginationToolsComponent: React.FC< 1, Math.ceil( (pagination.totalCount && - pagination.totalCount !== pagination.allCount + pagination.totalCount !== pagination.allCount ? pagination.totalCount : pagination.allCount || 0) / pagination.size ) diff --git a/WebServices/management-frontend/src/components/Pages/application/SearchComponent.tsx b/WebServices/management-frontend/src/components/Pages/application/SearchComponent.tsx index 81cbe5b..14840b1 100644 --- a/WebServices/management-frontend/src/components/Pages/application/SearchComponent.tsx +++ b/WebServices/management-frontend/src/components/Pages/application/SearchComponent.tsx @@ -36,14 +36,10 @@ export const SearchComponent: React.FC = ({ const handleSearch = (query: string, url: string, type: "employee" | "occupant") => { const searchParams: Record = {}; - if (query && query.length > 3) { - searchParams.name = query; - } - if (url) { searchParams.site_url = url; } - + searchParams.name = query searchParams.application_for = type === "employee" ? "EMP" : "OCC"; // Call onSearch with the search parameters @@ -99,7 +95,7 @@ export const SearchComponent: React.FC = ({ value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} onKeyUp={(e) => { - if (e.key === 'Enter' && searchQuery.length >= 3) { + if (e.key === 'Enter') { handleSearch(searchQuery, selectedUrl, selectedType); } }} @@ -111,9 +107,7 @@ export const SearchComponent: React.FC = ({ size="sm" className="ml-2" onClick={() => { - if (searchQuery.length >= 3) { handleSearch(searchQuery, selectedUrl, selectedType); - } }} > diff --git a/docker-compose.yml b/docker-compose.yml index 48e9b09..7c01b10 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,8 +12,9 @@ services: # - NODE_ENV=development # cpus: 1 # mem_limit: 2048m - # volumes: - # - client-frontend:/WebServices/client-frontend + + # volumes: + # - client-frontend:/WebServices/client-frontend management_frontend: container_name: management_frontend @@ -26,7 +27,7 @@ services: - "3001:3001" environment: - NODE_ENV=development - cpus: 2 + cpus: 1 mem_limit: 2048m auth_service: @@ -165,7 +166,6 @@ services: networks: wag-services: - # template_service: # container_name: template_service # build: