fix(Container): moved into apporpriate folders

This commit is contained in:
2024-12-14 16:04:17 -07:00
parent 99bfecce23
commit 2cca4777de
35 changed files with 38 additions and 12 deletions

@ -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

@ -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
)
)

@ -0,0 +1,4 @@
fastapi[standard]
pandas
openpyxl
PyYAML

18
Dockerfile Normal file

@ -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"]

Binary file not shown.

Before

(image error) Size: 13 KiB

After

(image error) Size: 13 KiB

Before

(image error) Size: 12 KiB

After

(image error) Size: 12 KiB

Before

(image error) Size: 13 KiB

After

(image error) Size: 13 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

10
docker-compose.yaml Normal file

@ -0,0 +1,10 @@
services:
bajacloud:
container_name: bajacloud
ports:
- 8080:8080
volumes:
- ./mock:/Interviews
build: .
# networks:
# - testnet

@ -1,4 +0,0 @@
"fastapi[standard]"
pandas
openpyxl
yaml