updated initilazer
This commit is contained in:
parent
2d418644bb
commit
113e43c7d7
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -56,14 +56,23 @@ export const PaginationToolsComponent: React.FC<
|
|||
|
||||
{/* Navigation buttons - center */}
|
||||
<div className="flex items-center space-x-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handlePageChange(pagination.page - 1)}
|
||||
disabled={pagination.next}
|
||||
>
|
||||
{t.previous}
|
||||
</Button>
|
||||
|
||||
|
||||
{
|
||||
pagination.back ? (<><Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handlePageChange(pagination.page - 1)}
|
||||
|
||||
>
|
||||
{t.previous}
|
||||
</Button></>) : (<><Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
>
|
||||
{t.previous}
|
||||
</Button></>)
|
||||
}
|
||||
|
||||
{/* Page number buttons */}
|
||||
<div className="flex items-center space-x-1">
|
||||
|
|
@ -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<
|
|||
)}
|
||||
</div>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handlePageChange(pagination.page + 1)}
|
||||
disabled={pagination.back}
|
||||
>
|
||||
{t.next}
|
||||
</Button>
|
||||
{
|
||||
pagination.page < pagination.totalPages ? (<><Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handlePageChange(pagination.page + 1)}
|
||||
>
|
||||
{t.next}
|
||||
</Button></>) : (<><Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
>
|
||||
{t.next}
|
||||
</Button></>)
|
||||
}
|
||||
|
||||
{/* Page text display */}
|
||||
<span className="px-4 py-1 text-sm text-muted-foreground">
|
||||
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
|
|
@ -36,14 +36,10 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
|||
const handleSearch = (query: string, url: string, type: "employee" | "occupant") => {
|
||||
const searchParams: Record<string, string> = {};
|
||||
|
||||
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<SearchComponentProps> = ({
|
|||
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<SearchComponentProps> = ({
|
|||
size="sm"
|
||||
className="ml-2"
|
||||
onClick={() => {
|
||||
if (searchQuery.length >= 3) {
|
||||
handleSearch(searchQuery, selectedUrl, selectedType);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Search className="h-4 w-4" />
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue