Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 08bfe1d417 | |||
| 3593011d6d | |||
| 5ae11f6625 | |||
| a61bca7d81 | |||
| fb3b033f45 | |||
| 91a2d0dd1e | |||
| 04c643561b | |||
| 526bd40255 | |||
| 1889f6cada | |||
| c1dd9a60f2 | |||
| ec869c54c3 | |||
| b440c0a42b | |||
| baa826c52c | |||
| 6b530529e3 | |||
| a633b52949 | |||
| c103d1979c | |||
| 82c01cb7bf | |||
| 43bc552698 | |||
| bb6a8e3090 | |||
| 565e9199d4 | |||
| c5de46040d | |||
| 934b1b2301 | |||
| 302152449f | |||
| 0f591bd111 | |||
|
|
ea04c000cf | ||
| b0825fe7cb | |||
| 8a2debcaa8 | |||
| 609c8d46db | |||
| 1387fb1af5 | |||
| 1f73aa3b87 | |||
| 47ca6d7311 | |||
| 64443a5076 | |||
| 20d5bc4004 | |||
| 9257786191 | |||
|
|
963a708ab8 |
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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
BIN
backend/.DS_Store
vendored
Binary file not shown.
@@ -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
|
||||||
|
|||||||
@@ -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}"
|
||||||
|
|||||||
@@ -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"]
|
||||||
|
|||||||
@@ -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/ {
|
||||||
|
|||||||
Reference in New Issue
Block a user