feat(Packagers): Added some comments and started on the what if first time

This commit is contained in:
darkicewolf50 2024-12-07 11:24:09 -07:00
parent 3a53014d57
commit 3b46d56339
7 changed files with 117 additions and 13 deletions

35
NoSheet.py Normal file
View File

@ -0,0 +1,35 @@
import openpyxl
import yaml
import json
yamlraw = """
Interview TimeTable:
- Date: Null
- Meeting Duration: 30 min
- Start Time Slot: Null
- Interviewee Name: Null
- Interviewee Email: Null
- Category (if not general): Null
- Interviewer(s) Name(s): Null
- Status: Dropdown (Options in datahelp)
Recruitment Responses:
- Frist Name (What we should call them): Null
- Last Name: Null
- Ucalgary Email: Null
- What Subsystem/SubTeam are you interested in?: Null
- Major: Null
- Academic Year: Null
- Why are you interested in joining UCalgary BAJA?: Null
- Where did you hear about us?: Null
- Are you available for team meetings/work days? Saturdays 10 am - 4 pm: Null #add condiftional formatting for no to make whole line red
Data Help:
- Status Dropdown:
- Unknown
- Done
- No Show
- Cancelled/Moved
"""
yamlsheet = yaml.safe_load(yamlraw)
print(json.dumps(yamlsheet, indent=4))

BIN
OR-L-Interview Data.xlsx Normal file

Binary file not shown.

View File

@ -4,12 +4,12 @@ from filelock import FileLock, Timeout
import time import time
# Define the path to the Excel file and the lock file # Define the path to the Excel file and the lock file
excel_file_path = "./interview_database.xlsx" excel_file_path = "./OR-L-Interview Data.xlsx"
lock_file_path = "./interview_database.xlsx.lock" lock_file_path = "./OR-L-Interview Data.xlsx.lock"
def ReadDatabase(): def ReadDatabase():
""" """
Reads the Database Reads the database for which slots are available
``REQUIRES``: None ``REQUIRES``: None

View File

@ -70,7 +70,7 @@ def AppendAppointment(date, start_time, interviewee_name, interviewee_email):
with FileLock(lock_path): # Ensure process-safe access to the file with FileLock(lock_path): # Ensure process-safe access to the file
# Load workbook and select "Sheet1" for updating appointments # Load workbook and select "Sheet1" for updating appointments
workbook = load_workbook(file_path) workbook = load_workbook(file_path)
sheet = workbook["Sheet1"] sheet = workbook["Interview Timetable"]
df = pd.read_excel(file_path) df = pd.read_excel(file_path)
# Find and update the row that matches the provided date and start time # Find and update the row that matches the provided date and start time

25
emp.yml Normal file
View File

@ -0,0 +1,25 @@
Interview TimeTable:
- Date: Null
- Meeting Duration: 30 min
- Start Time Slot: Null
- Interviewee Name: Null
- Interviewee Email: Null
- Category (if not general): Null
- Interviewer(s) Name(s): Null
- Status: Dropdown (Options in datahelp)
Recruitment Responses:
- Frist Name (What we should call them): Null
- Last Name: Null
- Ucalgary Email: Null
- What Subsystem/SubTeam are you interested in?: Null
- Major: Null
- Academic Year: Null
- Why are you interested in joining UCalgary BAJA?: Null
- Where did you hear about us?: Null
- Are you available for team meetings/work days? Saturdays 10 am - 4 pm: Null #add condiftional formatting for no to make whole line red
Data Help:
- Status Dropdown:
- Unknown
- Done
- No Show
- Cancelled/Moved

Binary file not shown.

62
main.py
View File

@ -7,7 +7,20 @@ app = FastAPI()
@app.get("/") @app.get("/")
def get_root(): def get_root():
res = {"message": "Hello World"} """
This does nothing, allows for pings to check for life
``REQUIRES``: ```None`` Nothing
``PROMISES``: ``JSON`` returns a short message in the body
``Develop in part by``: Brock
``Contact``: darkicewolf50@gmail.com
"""
res = {"message": "Hello I am alive, this does nothing"}
# Return the response with the custom header # Return the response with the custom header
return JSONResponse( return JSONResponse(
@ -15,22 +28,29 @@ def get_root():
"isBase64Encoded": "false", # Header Modification "isBase64Encoded": "false", # Header Modification
}, },
content={ content={
"body": res "body": res # Ensure res is a dict or do json.dumps to enusre it is stringified
}, },
# status_code=200 commented out just to show how to change it if you wanted # status_code=200 commented out just to show how to change it if you wanted
) )
# # Set headers
# headers = {
# "isBase64Encoded": "false", # Header Modification
# }
from GetSchedulePackager import getSchedulePackager from GetSchedulePackager import getSchedulePackager
@app.get("/getAppointments") @app.get("/getAppointments")
async def getAppointments(): async def getAppointments():
"""
checks for all available slots in the database
``REQUIRES``: ```None`` Nothing
``PROMISES``: ``JSON`` returns all of the avaialbe slots by date then time
``Develop in part by``: Brock
``Contact``: darkicewolf50@gmail.com
"""
res = getSchedulePackager() res = getSchedulePackager()
@ -39,7 +59,7 @@ async def getAppointments():
"isBase64Encoded": "false", # Header Modification "isBase64Encoded": "false", # Header Modification
}, },
content={ content={
"body": res "body": res # Ensure res is a dict or do json.dumps to enusre it is stringified
}, },
# status_code=200 commented out just to show how to change it if you wanted # status_code=200 commented out just to show how to change it if you wanted
@ -48,6 +68,18 @@ async def getAppointments():
from postSelectAppointment import SelectAppointment from postSelectAppointment import SelectAppointment
class Appointment(BaseModel): class Appointment(BaseModel):
"""
The formatted
``REQUIRES``: Correct Format
``PROMISES``: Formatted class, needs to be converted into dict os that it can be used in another file
``Develop in part by``: Brock
``Contact``: darkicewolf50@gmail.com
"""
intervieweeName: str intervieweeName: str
date: str date: str
startTime: str startTime: str
@ -56,6 +88,18 @@ class Appointment(BaseModel):
@app.post("/SelectInterview") @app.post("/SelectInterview")
async def postSelectInterview(rawRequest: Appointment): async def postSelectInterview(rawRequest: Appointment):
"""
Books an interview, first checks if the slot is valid
``REQUIRES``: ```Appointment`` A specifically formatted request
``PROMISES``: ``JSON`` returns if the booking was successful or not
``Develop in part by``: Brock
``Contact``: darkicewolf50@gmail.com
"""
requestDict = {key: str(value) for key, value in rawRequest.dict().items()} requestDict = {key: str(value) for key, value in rawRequest.dict().items()}
res = SelectAppointment(requestDict) res = SelectAppointment(requestDict)
@ -65,7 +109,7 @@ async def postSelectInterview(rawRequest: Appointment):
"isBase64Encoded": "false", # Header Modification "isBase64Encoded": "false", # Header Modification
}, },
content={ content={
"body": res "body": res # Ensure res is a dict or do json.dumps to enusre it is stringified
}, },
# status_code=200 commented out just to show how to change it if you wanted # status_code=200 commented out just to show how to change it if you wanted