35 Commits

Author SHA1 Message Date
08bfe1d417 Update build to 118 2025-11-25 16:51:03 +02:00
3593011d6d minio storage uploud fix pt9 2025-11-25 16:47:42 +02:00
5ae11f6625 minio storage uploud fix pt8 2025-11-25 16:40:48 +02:00
a61bca7d81 minio storage uploud fix pt7 2025-11-25 16:31:13 +02:00
fb3b033f45 minio storage uploud fix pt6 2025-11-25 16:11:28 +02:00
91a2d0dd1e minio storage uploud fix pt5 2025-11-25 16:08:20 +02:00
04c643561b minio storage uploud fix pt4 2025-11-25 16:05:53 +02:00
526bd40255 minio storage uploud fix pt3 2025-11-25 15:53:09 +02:00
1889f6cada minio storage uploud fix pt2 2025-11-25 15:39:23 +02:00
c1dd9a60f2 minio storage uploud fix pt1 2025-11-25 15:31:53 +02:00
ec869c54c3 minio storage fix pt14 2025-11-25 15:29:07 +02:00
b440c0a42b minio storage fix pt13 2025-11-25 15:24:02 +02:00
baa826c52c minio storage fix pt12 2025-11-25 15:22:27 +02:00
6b530529e3 minio storage fix pt11 2025-11-25 15:20:58 +02:00
a633b52949 minio storage fix pt10 2025-11-25 15:16:41 +02:00
c103d1979c minio storage fix pt9 2025-11-25 15:12:38 +02:00
82c01cb7bf minio storage fix pt8 2025-11-25 15:05:16 +02:00
43bc552698 minio storage fix pt7 2025-11-25 15:00:20 +02:00
bb6a8e3090 minio storage fix pt6 2025-11-25 14:49:56 +02:00
565e9199d4 minio storage fix pt5 2025-11-25 14:38:59 +02:00
c5de46040d minio storage fix pt4 2025-11-25 14:31:37 +02:00
934b1b2301 minio storage fix pt3 2025-11-25 13:51:42 +02:00
302152449f minio storage fix pt2 2025-11-25 13:42:46 +02:00
0f591bd111 minio storage fix 2025-11-25 13:37:20 +02:00
yaso-meth
ea04c000cf Merge pull request #263 from yaso-meth/V.1.2.3
V.1.2.3
2025-11-25 12:27:36 +02:00
b0825fe7cb optimisation web pt 3 2025-11-14 14:02:55 +02:00
8a2debcaa8 optimisation web pt 2 2025-11-14 13:53:20 +02:00
609c8d46db cancel timeout on load 2025-11-14 13:04:04 +02:00
1387fb1af5 increase timeut time 2025-11-14 12:52:11 +02:00
1f73aa3b87 web load v2 2025-11-14 12:47:15 +02:00
47ca6d7311 revert 2025-11-14 12:33:35 +02:00
64443a5076 web loadtime 2025-11-14 12:22:21 +02:00
20d5bc4004 increase load 2025-11-14 12:07:36 +02:00
9257786191 reduce load speed 2025-11-14 11:28:52 +02:00
yaso-meth
963a708ab8 Merge pull request #262 from yaso-meth/V.1.2.3
V.1.2.3
2025-11-10 17:03:44 +02:00
10 changed files with 55 additions and 35 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -69,6 +69,7 @@ class _MihBusinessDetailsState extends State<MihBusinessDetails> {
children: [ children: [
Center( Center(
child: MihCircleAvatar( child: MihCircleAvatar(
key: UniqueKey(),
imageFile: mzansiProfileProvider.businessProfilePicture, imageFile: mzansiProfileProvider.businessProfilePicture,
width: 150, width: 150,
editable: false, editable: false,

View File

@@ -148,7 +148,7 @@ class MihBusinessDetailsServices {
"Name": busineName, "Name": busineName,
"type": businessType, "type": businessType,
"registration_no": businessRegistrationNo, "registration_no": businessRegistrationNo,
"logo_name": businessLogoFilename, "logo_name": businessLogoFilename.replaceAll(RegExp(r' '), '-'),
"logo_path": "", "logo_path": "",
"contact_no": businessPhoneNumber, "contact_no": businessPhoneNumber,
"bus_email": businessEmail, "bus_email": businessEmail,
@@ -230,7 +230,8 @@ class MihBusinessDetailsServices {
return const Mihloadingcircle(); return const Mihloadingcircle();
}, },
); );
var filePath = "$business_id/business_files/$business_logo_name"; var filePath =
"$business_id/business_files/${business_logo_name.replaceAll(RegExp(r' '), '-')}";
var response = await http.put( var response = await http.put(
Uri.parse("${AppEnviroment.baseApiUrl}/business/update/v2/"), Uri.parse("${AppEnviroment.baseApiUrl}/business/update/v2/"),
headers: <String, String>{ headers: <String, String>{
@@ -241,7 +242,7 @@ class MihBusinessDetailsServices {
"Name": business_name, "Name": business_name,
"type": business_type, "type": business_type,
"registration_no": business_registration_no, "registration_no": business_registration_no,
"logo_name": business_logo_name, "logo_name": business_logo_name.replaceAll(RegExp(r' '), '-'),
"logo_path": filePath, "logo_path": filePath,
"contact_no": business_phone_number, "contact_no": business_phone_number,
"bus_email": business_email, "bus_email": business_email,
@@ -311,8 +312,9 @@ class MihBusinessDetailsServices {
"Name": business_name, "Name": business_name,
"type": business_type, "type": business_type,
"registration_no": business_registration_no, "registration_no": business_registration_no,
"logo_name": business_logo_name, "logo_name": business_logo_name.replaceAll(RegExp(r' '), '-'),
"logo_path": "$business_id/business_files/$business_logo_name", "logo_path":
"$business_id/business_files/${business_logo_name.replaceAll(RegExp(r' '), '-')}",
"contact_no": business_phone_number, "contact_no": business_phone_number,
"bus_email": business_email, "bus_email": business_email,
"gps_location": business_location, "gps_location": business_location,

View File

@@ -47,6 +47,7 @@ class MihMyBusinessUserServices {
return const Mihloadingcircle(); return const Mihloadingcircle();
}, },
); );
String filename = signatureFilename.replaceAll(RegExp(r' '), '-');
String sigPath = "$business_id/business_files/$signatureFilename"; String sigPath = "$business_id/business_files/$signatureFilename";
var response = await http.post( var response = await http.post(
Uri.parse("${AppEnviroment.baseApiUrl}/business-user/insert/"), Uri.parse("${AppEnviroment.baseApiUrl}/business-user/insert/"),
@@ -56,8 +57,8 @@ class MihMyBusinessUserServices {
body: jsonEncode(<String, dynamic>{ body: jsonEncode(<String, dynamic>{
"business_id": business_id, "business_id": business_id,
"app_id": app_id, "app_id": app_id,
"signature": signatureFilename, "signature": filename,
"sig_path": sigPath, "sig_path": sigPath.replaceAll(RegExp(r' '), '-'),
"title": title, "title": title,
"access": access, "access": access,
}), }),
@@ -66,7 +67,7 @@ class MihMyBusinessUserServices {
if (response.statusCode == 201) { if (response.statusCode == 201) {
provider.setBusinessUser( provider.setBusinessUser(
newBusinessUser: BusinessUser( newBusinessUser: BusinessUser(
0, business_id, app_id, signatureFilename, sigPath, title, access), 0, business_id, app_id, filename, sigPath, title, access),
); );
return 201; return 201;
} else { } else {
@@ -91,7 +92,9 @@ class MihMyBusinessUserServices {
return const Mihloadingcircle(); return const Mihloadingcircle();
}, },
); );
var filePath = "$app_id/business_files/$signatureFileName"; var filename = signatureFileName.replaceAll(RegExp(r' '), '-');
var filePath =
"$app_id/business_files/${signatureFileName.replaceAll(RegExp(r' '), '-')}";
var response = await http.put( var response = await http.put(
Uri.parse("${AppEnviroment.baseApiUrl}/business-user/update/"), Uri.parse("${AppEnviroment.baseApiUrl}/business-user/update/"),
headers: <String, String>{ headers: <String, String>{
@@ -100,7 +103,7 @@ class MihMyBusinessUserServices {
body: jsonEncode(<String, dynamic>{ body: jsonEncode(<String, dynamic>{
"business_id": business_id, "business_id": business_id,
"app_id": app_id, "app_id": app_id,
"signature": signatureFileName, "signature": filename,
"sig_path": filePath, "sig_path": filePath,
"title": bUserTitle, "title": bUserTitle,
"access": bUserAccess, "access": bUserAccess,
@@ -113,7 +116,7 @@ class MihMyBusinessUserServices {
provider.businessUser!.idbusiness_users, provider.businessUser!.idbusiness_users,
business_id, business_id,
app_id, app_id,
signatureFileName, filename,
filePath, filePath,
bUserTitle, bUserTitle,
bUserAccess, bUserAccess,

View File

@@ -1,7 +1,7 @@
name: mzansi_innovation_hub name: mzansi_innovation_hub
description: "" description: ""
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.2.4+117 version: 1.2.4+118
# version: 1.1.1+97 #--- Updated version for upgrader package testing # version: 1.1.1+97 #--- Updated version for upgrader package testing
environment: environment:

BIN
backend/.DS_Store vendored

Binary file not shown.

View File

@@ -9,7 +9,7 @@ minioSecret = os.getenv("MINIO_SECRET_KEY")
def minioConnect(env): def minioConnect(env):
if(env == "Dev"): if(env == "Dev"):
return Minio( return Minio(
"minio:9000", endpoint="minio:9000",
# "minio.mzansi-innovation-hub.co.za", # "minio.mzansi-innovation-hub.co.za",
access_key=minioAccess, access_key=minioAccess,
secret_key=minioSecret, secret_key=minioSecret,
@@ -17,8 +17,8 @@ def minioConnect(env):
) )
else: else:
return Minio( return Minio(
#"minio:9000", # endpoint="minio:9000",
"minio.mzansi-innovation-hub.co.za", endpoint="minio.mzansi-innovation-hub.co.za",
access_key=minioAccess, access_key=minioAccess,
secret_key=minioSecret, secret_key=minioSecret,
secure=True secure=True

View File

@@ -22,6 +22,7 @@ from supertokens_python.recipe.session import SessionContainer
from fastapi import Depends from fastapi import Depends
import Minio_Storage.minioConnection import Minio_Storage.minioConnection
from datetime import timedelta
router = APIRouter() router = APIRouter()
@@ -110,13 +111,21 @@ class claimStatementUploud(BaseModel):
@router.get("/minio/pull/file/{env}/{app_id}/{folder}/{file_name}", tags=["Minio"]) @router.get("/minio/pull/file/{env}/{app_id}/{folder}/{file_name}", tags=["Minio"])
async def pull_File_from_user(app_id: str, folder: str, file_name: str, env: str): #, session: SessionContainer = Depends(verify_session()) async def pull_File_from_user(app_id: str, folder: str, file_name: str, env: str): #, session: SessionContainer = Depends(verify_session())
path = app_id + "/" + folder + "/" + file_name path = app_id + "/" + folder + "/" + file_name
print(path)
try: try:
# print(f"env: {env}") # print(f"env: {env}")
# uploudFile(app_id, file.filename, extension[1], content) # uploudFile(app_id, file.filename, extension[1], content)
client = Minio_Storage.minioConnection.minioConnect(env) client = Minio_Storage.minioConnection.minioConnect(env)
# buckets = client.list_buckets()
miniourl = client.presigned_get_object("mih", path) # print("Connected to MinIO successfully!")
# print("Available buckets:", [bucket.name for bucket in buckets])
miniourl = client.presigned_get_object(
bucket_name="mih",
object_name=path,
expires=timedelta(minutes=60)
)
print("Generated presigned URL:", miniourl)
# if(env == "Dev"): # if(env == "Dev"):
# miniourl.replace("minio", "localhost") # miniourl.replace("minio", "localhost")
# temp = minioResponse.data#.encode('utf-8').strip() # temp = minioResponse.data#.encode('utf-8').strip()
@@ -125,7 +134,7 @@ async def pull_File_from_user(app_id: str, folder: str, file_name: str, env: str
# temp = temp.decode('utf-8') # temp = temp.decode('utf-8')
#print(miniourl) #print(miniourl)
except Exception as error: except Exception as error:
raise HTTPException(status_code=404, detail=miniourl) raise HTTPException(status_code=404, detail=f"MinIO connection failed: {str(error)}")
# return {"message": error} # return {"message": error}
if(env == "Dev"): if(env == "Dev"):
return { return {
@@ -144,7 +153,7 @@ async def upload_File_to_user(file: UploadFile = File(...), app_id: str= Form(..
try: try:
uploudFile(app_id, env, folder, file.filename.replace(" ", "-"), extension[1], content) uploudFile(app_id, env, folder, file.filename.replace(" ", "-"), extension[1], content)
except Exception as error: except Exception as error:
raise HTTPException(status_code=404, detail="Failed to Uploud Record") raise HTTPException(status_code=404, detail=str(error))
return {"message": f"Successfully Uploaded {file.filename}"} return {"message": f"Successfully Uploaded {file.filename}"}
# return { # return {
@@ -161,7 +170,10 @@ async def delete_File_of_user(requestItem: minioDeleteRequest, session: SessionC
# uploudFile(app_id, file.filename, extension[1], content) # uploudFile(app_id, file.filename, extension[1], content)
client = Minio_Storage.minioConnection.minioConnect(requestItem.env) client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
minioError = client.remove_object("mih", path) minioError = client.remove_object(
bucket_name="mih",
object_name=path
)
except Exception as error: except Exception as error:
raise HTTPException(status_code=404, detail=minioError) raise HTTPException(status_code=404, detail=minioError)
# return {"message": error} # return {"message": error}
@@ -191,15 +203,16 @@ async def upload_perscription_to_user(requestItem: claimStatementUploud, session
def uploudFile(app_id, env, folder, fileName, extension, content): def uploudFile(app_id, env, folder, fileName, extension, content):
client = Minio_Storage.minioConnection.minioConnect(env) client = Minio_Storage.minioConnection.minioConnect(env)
found = client.bucket_exists("mih") found = client.bucket_exists(bucket_name="mih")
if not found: if not found:
client.make_bucket("mih") client.make_bucket(bucket_name="mih")
else: else:
print("Bucket already exists") print("Bucket already exists")
fname = app_id + "/" + folder + "/" + fileName fname = app_id + "/" + folder + "/" + fileName
client.put_object("mih", client.put_object(
fname, bucket_name="mih",
content, object_name=fname,
data=content,
length=-1, length=-1,
part_size=10*1024*1024, part_size=10*1024*1024,
content_type=f"application/{extension}") content_type=f"application/{extension}")
@@ -208,9 +221,9 @@ def uploudMedCert(requestItem: medCertUploud):
client = Minio_Storage.minioConnection.minioConnect(requestItem.env) client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
generateMedCertPDF(requestItem) generateMedCertPDF(requestItem)
today = datetime.today().strftime('%Y-%m-%d') today = datetime.today().strftime('%Y-%m-%d')
found = client.bucket_exists("mih") found = client.bucket_exists(bucket_name="mih")
if not found: if not found:
client.make_bucket("mih") client.make_bucket(bucket_name="mih")
else: else:
print("Bucket already exists") print("Bucket already exists")
fileName = f"{requestItem.app_id}/patient_files/{requestItem.fileName}" fileName = f"{requestItem.app_id}/patient_files/{requestItem.fileName}"
@@ -285,9 +298,9 @@ def uploudPerscription(requestItem: perscriptionList):
client = Minio_Storage.minioConnection.minioConnect(requestItem.env) client = Minio_Storage.minioConnection.minioConnect(requestItem.env)
generatePerscriptionPDF(requestItem) generatePerscriptionPDF(requestItem)
today = datetime.today().strftime('%Y-%m-%d') today = datetime.today().strftime('%Y-%m-%d')
found = client.bucket_exists("mih") found = client.bucket_exists(bucket_name="mih")
if not found: if not found:
client.make_bucket("mih") client.make_bucket(bucket_name="mih")
else: else:
print("Bucket already exists") print("Bucket already exists")
fileName = f"{requestItem.app_id}/patient_files/{requestItem.fileName}" fileName = f"{requestItem.app_id}/patient_files/{requestItem.fileName}"
@@ -391,9 +404,9 @@ def uploudClaimStatement(requestItem: claimStatementUploud):
generateClaimStatementPDF(requestItem) generateClaimStatementPDF(requestItem)
today = datetime.today().strftime('%Y-%m-%d') today = datetime.today().strftime('%Y-%m-%d')
found = client.bucket_exists("mih") found = client.bucket_exists(bucket_name="mih")
if not found: if not found:
client.make_bucket("mih") client.make_bucket(bucket_name="mih")
else: else:
print("Bucket already exists") print("Bucket already exists")
fileName = f"{requestItem.patient_app_id}/claims-statements/{requestItem.fileName}" fileName = f"{requestItem.patient_app_id}/claims-statements/{requestItem.fileName}"

View File

@@ -137,6 +137,7 @@ services:
environment: environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER} MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PW} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PW}
# MINIO_SERVER_URL: ${MINIO_SERVER_URL}
networks: networks:
- MIH-network - MIH-network
command: ["server", "/data", "--console-address", ":9001"] command: ["server", "/data", "--console-address", ":9001"]

View File

@@ -271,7 +271,7 @@ http {
location / { location / {
proxy_set_header Host $http_host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
@@ -282,12 +282,12 @@ http {
proxy_set_header Connection ""; proxy_set_header Connection "";
chunked_transfer_encoding off; chunked_transfer_encoding off;
proxy_pass http://MIH-Minio:9000; # This uses the upstream directive definition to load balance proxy_pass http://minioAPI; # This uses the upstream directive definition to load balance
} }
location /minio/ui/ { location /minio/ui/ {
rewrite ^/minio/ui/(.*) /$1 break; rewrite ^/minio/ui/(.*) /$1 break;
proxy_set_header Host $http_host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
@@ -308,7 +308,7 @@ http {
chunked_transfer_encoding off; chunked_transfer_encoding off;
proxy_pass http://MIH-Minio:9001; # This uses the upstream directive definition to load balance proxy_pass http://minioUI; # This uses the upstream directive definition to load balance
} }
location ~ /.well-known/acme-challenge/ { location ~ /.well-known/acme-challenge/ {