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",
|
f"{str(company_management.uu_id)}*Domain",
|
||||||
)
|
)
|
||||||
with mongo_handler.collection(collection_name) as mongo_engine:
|
with mongo_handler.collection(collection_name) as mongo_engine:
|
||||||
mongo_engine.insert_one(
|
existing_record = mongo_engine.find_one({"user_uu_id": str(gen_manager_user.uu_id)})
|
||||||
document={
|
if not existing_record:
|
||||||
"user_uu_id": str(gen_manager_user.uu_id),
|
mongo_engine.insert_one(
|
||||||
"other_domains_list": [main_domain],
|
document={
|
||||||
"main_domain": main_domain,
|
"user_uu_id": str(gen_manager_user.uu_id),
|
||||||
"modified_at": arrow.now().timestamp(),
|
"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(
|
app_manager_user = Users.find_or_create(
|
||||||
person_id=app_manager.id,
|
person_id=app_manager.id,
|
||||||
|
|
@ -472,14 +483,25 @@ def create_application_defaults(db_session):
|
||||||
app_manager_user.password_token = PasswordModule.generate_refresher_token()
|
app_manager_user.password_token = PasswordModule.generate_refresher_token()
|
||||||
|
|
||||||
with mongo_handler.collection(collection_name) as mongo_engine:
|
with mongo_handler.collection(collection_name) as mongo_engine:
|
||||||
mongo_engine.insert_one(
|
existing_record = mongo_engine.find_one({"user_uu_id": str(app_manager_user.uu_id)})
|
||||||
document={
|
if not existing_record:
|
||||||
"user_uu_id": str(app_manager_user.uu_id),
|
mongo_engine.insert_one(
|
||||||
"other_domains_list": [main_domain],
|
document={
|
||||||
"main_domain": main_domain,
|
"user_uu_id": str(app_manager_user.uu_id),
|
||||||
"modified_at": arrow.now().timestamp(),
|
"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(
|
sup_manager_employee = Users.find_or_create(
|
||||||
person_id=sup_manager.id,
|
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_expiry_begins = str(arrow.now())
|
||||||
sup_manager_employee.password_token = PasswordModule.generate_refresher_token()
|
sup_manager_employee.password_token = PasswordModule.generate_refresher_token()
|
||||||
with mongo_handler.collection(collection_name) as mongo_engine:
|
with mongo_handler.collection(collection_name) as mongo_engine:
|
||||||
mongo_engine.insert_one(
|
existing_record = mongo_engine.find_one({"user_uu_id": str(sup_manager_employee.uu_id)})
|
||||||
document={
|
|
||||||
"user_uu_id": str(sup_manager_employee.uu_id),
|
if not existing_record:
|
||||||
"other_domains_list": [main_domain],
|
mongo_engine.insert_one(
|
||||||
"main_domain": main_domain,
|
document={
|
||||||
"modified_at": arrow.now().timestamp(),
|
"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()
|
db_session.commit()
|
||||||
|
|
||||||
print("All Defaults Create is now completed")
|
print("All Defaults Create is now completed")
|
||||||
|
|
|
||||||
|
|
@ -56,14 +56,23 @@ export const PaginationToolsComponent: React.FC<
|
||||||
|
|
||||||
{/* Navigation buttons - center */}
|
{/* Navigation buttons - center */}
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
{
|
||||||
onClick={() => handlePageChange(pagination.page - 1)}
|
pagination.back ? (<><Button
|
||||||
disabled={pagination.next}
|
variant="outline"
|
||||||
>
|
size="sm"
|
||||||
{t.previous}
|
onClick={() => handlePageChange(pagination.page - 1)}
|
||||||
</Button>
|
|
||||||
|
>
|
||||||
|
{t.previous}
|
||||||
|
</Button></>) : (<><Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
{t.previous}
|
||||||
|
</Button></>)
|
||||||
|
}
|
||||||
|
|
||||||
{/* Page number buttons */}
|
{/* Page number buttons */}
|
||||||
<div className="flex items-center space-x-1">
|
<div className="flex items-center space-x-1">
|
||||||
|
|
@ -75,7 +84,7 @@ export const PaginationToolsComponent: React.FC<
|
||||||
1,
|
1,
|
||||||
Math.ceil(
|
Math.ceil(
|
||||||
(pagination.totalCount &&
|
(pagination.totalCount &&
|
||||||
pagination.totalCount !== pagination.allCount
|
pagination.totalCount !== pagination.allCount
|
||||||
? pagination.totalCount
|
? pagination.totalCount
|
||||||
: pagination.allCount || 0) / pagination.size
|
: pagination.allCount || 0) / pagination.size
|
||||||
)
|
)
|
||||||
|
|
@ -89,7 +98,7 @@ export const PaginationToolsComponent: React.FC<
|
||||||
1,
|
1,
|
||||||
Math.ceil(
|
Math.ceil(
|
||||||
(pagination.totalCount &&
|
(pagination.totalCount &&
|
||||||
pagination.totalCount !== pagination.allCount
|
pagination.totalCount !== pagination.allCount
|
||||||
? pagination.totalCount
|
? pagination.totalCount
|
||||||
: pagination.allCount || 0) / pagination.size
|
: pagination.allCount || 0) / pagination.size
|
||||||
)
|
)
|
||||||
|
|
@ -120,14 +129,20 @@ export const PaginationToolsComponent: React.FC<
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button
|
{
|
||||||
variant="outline"
|
pagination.page < pagination.totalPages ? (<><Button
|
||||||
size="sm"
|
variant="outline"
|
||||||
onClick={() => handlePageChange(pagination.page + 1)}
|
size="sm"
|
||||||
disabled={pagination.back}
|
onClick={() => handlePageChange(pagination.page + 1)}
|
||||||
>
|
>
|
||||||
{t.next}
|
{t.next}
|
||||||
</Button>
|
</Button></>) : (<><Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
{t.next}
|
||||||
|
</Button></>)
|
||||||
|
}
|
||||||
|
|
||||||
{/* Page text display */}
|
{/* Page text display */}
|
||||||
<span className="px-4 py-1 text-sm text-muted-foreground">
|
<span className="px-4 py-1 text-sm text-muted-foreground">
|
||||||
|
|
@ -136,7 +151,7 @@ export const PaginationToolsComponent: React.FC<
|
||||||
1,
|
1,
|
||||||
Math.ceil(
|
Math.ceil(
|
||||||
(pagination.totalCount &&
|
(pagination.totalCount &&
|
||||||
pagination.totalCount !== pagination.allCount
|
pagination.totalCount !== pagination.allCount
|
||||||
? pagination.totalCount
|
? pagination.totalCount
|
||||||
: pagination.allCount || 0) / pagination.size
|
: 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 handleSearch = (query: string, url: string, type: "employee" | "occupant") => {
|
||||||
const searchParams: Record<string, string> = {};
|
const searchParams: Record<string, string> = {};
|
||||||
|
|
||||||
if (query && query.length > 3) {
|
|
||||||
searchParams.name = query;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
searchParams.site_url = url;
|
searchParams.site_url = url;
|
||||||
}
|
}
|
||||||
|
searchParams.name = query
|
||||||
searchParams.application_for = type === "employee" ? "EMP" : "OCC";
|
searchParams.application_for = type === "employee" ? "EMP" : "OCC";
|
||||||
|
|
||||||
// Call onSearch with the search parameters
|
// Call onSearch with the search parameters
|
||||||
|
|
@ -99,7 +95,7 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
onKeyUp={(e) => {
|
onKeyUp={(e) => {
|
||||||
if (e.key === 'Enter' && searchQuery.length >= 3) {
|
if (e.key === 'Enter') {
|
||||||
handleSearch(searchQuery, selectedUrl, selectedType);
|
handleSearch(searchQuery, selectedUrl, selectedType);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
@ -111,9 +107,7 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||||
size="sm"
|
size="sm"
|
||||||
className="ml-2"
|
className="ml-2"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (searchQuery.length >= 3) {
|
|
||||||
handleSearch(searchQuery, selectedUrl, selectedType);
|
handleSearch(searchQuery, selectedUrl, selectedType);
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Search className="h-4 w-4" />
|
<Search className="h-4 w-4" />
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,9 @@ services:
|
||||||
# - NODE_ENV=development
|
# - NODE_ENV=development
|
||||||
# cpus: 1
|
# cpus: 1
|
||||||
# mem_limit: 2048m
|
# mem_limit: 2048m
|
||||||
# volumes:
|
|
||||||
# - client-frontend:/WebServices/client-frontend
|
# volumes:
|
||||||
|
# - client-frontend:/WebServices/client-frontend
|
||||||
|
|
||||||
management_frontend:
|
management_frontend:
|
||||||
container_name: management_frontend
|
container_name: management_frontend
|
||||||
|
|
@ -26,7 +27,7 @@ services:
|
||||||
- "3001:3001"
|
- "3001:3001"
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
cpus: 2
|
cpus: 1
|
||||||
mem_limit: 2048m
|
mem_limit: 2048m
|
||||||
|
|
||||||
auth_service:
|
auth_service:
|
||||||
|
|
@ -165,7 +166,6 @@ services:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
wag-services:
|
wag-services:
|
||||||
|
|
||||||
# template_service:
|
# template_service:
|
||||||
# container_name: template_service
|
# container_name: template_service
|
||||||
# build:
|
# build:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue