diff --git a/NoSheet.py b/ContainerContents/NoSheet.py similarity index 100% rename from NoSheet.py rename to ContainerContents/NoSheet.py diff --git a/ReadDB.py b/ContainerContents/ReadDB.py similarity index 100% rename from ReadDB.py rename to ContainerContents/ReadDB.py diff --git a/WriteDB.py b/ContainerContents/WriteDB.py similarity index 96% rename from WriteDB.py rename to ContainerContents/WriteDB.py index bd302c4..e9329a8 100644 --- a/WriteDB.py +++ b/ContainerContents/WriteDB.py @@ -35,7 +35,6 @@ def ReadDatabase(file_path, lock_path): for _, row in df.iterrows(): # Convert Date and Start Time to string format for easier comparison date = str(row['Date']).split(" ")[0] # Format date to YYYY-MM-DD - # print(date) start_time = str(row['Start Time Slot']) # Calculate the slot capacity and current number of interviewees @@ -47,7 +46,6 @@ def ReadDatabase(file_path, lock_path): if interviewee_count < slot_capacity: # Organize data by date and time, keeping track of available slots and meeting duration if date not in interview_data: - # print(date) interview_data[date] = {} interview_data[date][start_time] = { 'Meeting Duration': row['Meeting Duration'], @@ -68,13 +66,11 @@ def AppendAppointment(file_path, date, start_time, interviewee_name, interviewee ``Contact``: ahmad.ahmad1@ucalgary.ca, darkicewolf50@gmail.com """ - # print(f"{file_path}\n{date}\n{start_time}\n{interviewee_name}\n{interviewee_email}") + lock_path = file_path + ".lock" available_slots = ReadDatabase(file_path, lock_path) - print(date) - print(available_slots) - print(date in available_slots) + # Check if the requested slot is available in the `available_slots` structure if date in available_slots and start_time in available_slots[date]: with FileLock(lock_path): # Ensure process-safe access to the file @@ -108,7 +104,7 @@ def AppendAppointment(file_path, date, start_time, interviewee_name, interviewee workbook.save(file_path) send_email(interviewee_email, interviewee_name, date, start_time) return True - print("False") + # If no slots available, return that the slot is unavailable return False diff --git a/interviewPackagers.py b/ContainerContents/interviewPackagers.py similarity index 100% rename from interviewPackagers.py rename to ContainerContents/interviewPackagers.py diff --git a/main.py b/ContainerContents/main.py similarity index 97% rename from main.py rename to ContainerContents/main.py index 3dfa9dc..7b82e46 100644 --- a/main.py +++ b/ContainerContents/main.py @@ -11,6 +11,7 @@ year_donation = int(str(datetime.datetime.now().year)[2:]) + 1 # gets the last t # Define the path to the Excel file and the lock file file_name = f"./Interviews/OR{year_donation}-L-Interview Data.xlsx" if not os.path.isfile(file_name): + os.makedirs(os.path.dirname(file_name), exist_ok=True) NoSheet(file_name) app = FastAPI() @@ -123,4 +124,5 @@ async def postSelectInterview(rawRequest: Appointment): }, # status_code=200 commented out just to show how to change it if you wanted - ) \ No newline at end of file + ) + diff --git a/ContainerContents/requirements.txt b/ContainerContents/requirements.txt new file mode 100644 index 0000000..5b1ff2d --- /dev/null +++ b/ContainerContents/requirements.txt @@ -0,0 +1,4 @@ +fastapi[standard] +pandas +openpyxl +PyYAML \ No newline at end of file diff --git a/send_email.py b/ContainerContents/send_email.py similarity index 100% rename from send_email.py rename to ContainerContents/send_email.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f65975b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# Use an official Python runtime as a parent image +FROM python:3.10-slim + +# Set the working directory inside the container +WORKDIR /BajaCloudBackend + +# Copy the current directory contents into the container at /app +COPY ./ContainerContents /BajaCloudBackend + +# Install any necessary dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Expose port 8080 for the container to listen on +EXPOSE 8080 + +# Command to run the Python server when the container starts +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--reload"] + diff --git a/Interviews/OR25-L-Interview Data.xlsx b/Interviews/OR25-L-Interview Data.xlsx deleted file mode 100644 index 69195be..0000000 Binary files a/Interviews/OR25-L-Interview Data.xlsx and /dev/null differ diff --git a/AfterMergeCodeapceTestResults.png b/Other Items/AfterMergeCodeapceTestResults.png similarity index 100% rename from AfterMergeCodeapceTestResults.png rename to Other Items/AfterMergeCodeapceTestResults.png diff --git a/ConversionToExcel.py b/Other Items/ConversionToExcel.py similarity index 100% rename from ConversionToExcel.py rename to Other Items/ConversionToExcel.py diff --git a/FastAPI test 1000 requests.png b/Other Items/FastAPI test 1000 requests.png similarity index 100% rename from FastAPI test 1000 requests.png rename to Other Items/FastAPI test 1000 requests.png diff --git a/OR-L-Interview Data.xlsx b/Other Items/OR-L-Interview Data.xlsx similarity index 100% rename from OR-L-Interview Data.xlsx rename to Other Items/OR-L-Interview Data.xlsx diff --git a/README.md b/Other Items/README.md similarity index 100% rename from README.md rename to Other Items/README.md diff --git a/TestBookAppointment.py b/Other Items/TestBookAppointment.py similarity index 100% rename from TestBookAppointment.py rename to Other Items/TestBookAppointment.py diff --git a/TestResultsCodeSpace.png b/Other Items/TestResultsCodeSpace.png similarity index 100% rename from TestResultsCodeSpace.png rename to Other Items/TestResultsCodeSpace.png diff --git a/interview_database.yaml b/Other Items/interview_database.yaml similarity index 100% rename from interview_database.yaml rename to Other Items/interview_database.yaml diff --git a/testhttp.py b/Other Items/testhttp.py similarity index 100% rename from testhttp.py rename to Other Items/testhttp.py diff --git a/web1.html b/Other Items/web1.html similarity index 100% rename from web1.html rename to Other Items/web1.html diff --git a/__pycache__/GetSchedulePackager.cpython-312.pyc b/__pycache__/GetSchedulePackager.cpython-312.pyc deleted file mode 100644 index cedba80..0000000 Binary files a/__pycache__/GetSchedulePackager.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/GetSchedulePackager.cpython-313.pyc b/__pycache__/GetSchedulePackager.cpython-313.pyc deleted file mode 100644 index 33a56b0..0000000 Binary files a/__pycache__/GetSchedulePackager.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/NoSheet.cpython-313.pyc b/__pycache__/NoSheet.cpython-313.pyc deleted file mode 100644 index 749dea5..0000000 Binary files a/__pycache__/NoSheet.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/ReadDB.cpython-313.pyc b/__pycache__/ReadDB.cpython-313.pyc deleted file mode 100644 index bffd474..0000000 Binary files a/__pycache__/ReadDB.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/WriteDB.cpython-312.pyc b/__pycache__/WriteDB.cpython-312.pyc deleted file mode 100644 index 401e4ac..0000000 Binary files a/__pycache__/WriteDB.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/WriteDB.cpython-313.pyc b/__pycache__/WriteDB.cpython-313.pyc deleted file mode 100644 index f749142..0000000 Binary files a/__pycache__/WriteDB.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/interviewPackagers.cpython-313.pyc b/__pycache__/interviewPackagers.cpython-313.pyc deleted file mode 100644 index 6a400f3..0000000 Binary files a/__pycache__/interviewPackagers.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/main.cpython-313.pyc b/__pycache__/main.cpython-313.pyc deleted file mode 100644 index 203f206..0000000 Binary files a/__pycache__/main.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/newMain.cpython-312.pyc b/__pycache__/newMain.cpython-312.pyc deleted file mode 100644 index 53923eb..0000000 Binary files a/__pycache__/newMain.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/newMain.cpython-313.pyc b/__pycache__/newMain.cpython-313.pyc deleted file mode 100644 index d5bbeed..0000000 Binary files a/__pycache__/newMain.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/postSelectAppointment.cpython-312.pyc b/__pycache__/postSelectAppointment.cpython-312.pyc deleted file mode 100644 index da2fced..0000000 Binary files a/__pycache__/postSelectAppointment.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/postSelectAppointment.cpython-313.pyc b/__pycache__/postSelectAppointment.cpython-313.pyc deleted file mode 100644 index e444b41..0000000 Binary files a/__pycache__/postSelectAppointment.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/send_email.cpython-312.pyc b/__pycache__/send_email.cpython-312.pyc deleted file mode 100644 index 1b561ac..0000000 Binary files a/__pycache__/send_email.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/send_email.cpython-313.pyc b/__pycache__/send_email.cpython-313.pyc deleted file mode 100644 index 9495a50..0000000 Binary files a/__pycache__/send_email.cpython-313.pyc and /dev/null differ diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..f05e221 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,10 @@ +services: + bajacloud: + container_name: bajacloud + ports: + - 8080:8080 + volumes: + - ./mock:/Interviews + build: . + # networks: + # - testnet diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 0ca6768..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -"fastapi[standard]" -pandas -openpyxl -yaml \ No newline at end of file