mirror of
https://github.com/UofCBaja/BajaCloud.git
synced 2025-06-15 05:04:17 -06:00
feat(InterviewBooking): almost preped for merge into one repo
This commit is contained in:
parent
0de072a5ad
commit
9eae4153ad
4
.github/workflows/Actions.yaml
vendored
4
.github/workflows/Actions.yaml
vendored
@ -12,7 +12,7 @@ on:
|
|||||||
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- master
|
||||||
|
|
||||||
# each workflow must have at least one job.
|
# each workflow must have at least one job.
|
||||||
# jobs run in parallel by default (we can change that).
|
# jobs run in parallel by default (we can change that).
|
||||||
@ -47,7 +47,7 @@ jobs:
|
|||||||
Dockerhub:
|
Dockerhub:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: ruffLint # will only run if linter is successful
|
needs: ruffLint # will only run if linter is successful
|
||||||
if: ${{ github.ref == 'refs/heads/main' || github.event.pull_request.merged == true }} # Runs if it's a push to 'main' or a merged PR to 'main'
|
if: ${{ github.ref == 'refs/heads/master' || github.event.pull_request.merged == true }} # Runs if it's a push to 'main' or a merged PR to 'main'
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -5,12 +5,14 @@ FROM python:3.10-slim
|
|||||||
WORKDIR /BajaCloudBackend
|
WORKDIR /BajaCloudBackend
|
||||||
|
|
||||||
# Copy the current directory contents into the container at /app
|
# Copy the current directory contents into the container at /app
|
||||||
COPY ./ContainerContents /BajaCloudBackend
|
COPY ./InterviewBooking /BajaCloudBackend/InterviewBooking
|
||||||
|
# Copy the main file to the working directory
|
||||||
|
COPY main.py /BajaCloudBackend
|
||||||
|
|
||||||
# Install any necessary dependencies
|
# Install any necessary dependencies
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Expose port 8080 for the container to listen on
|
# Expose port 8000 for the container to listen on
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Command to run the Python server when the container starts
|
# Command to run the Python server when the container starts
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
@ -1,17 +0,0 @@
|
|||||||
# Use an official Python runtime as a parent image
|
|
||||||
FROM python:3.10-slim
|
|
||||||
|
|
||||||
# Set the working directory inside the container
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy the current directory contents into the container at /app
|
|
||||||
COPY ./mock /app
|
|
||||||
|
|
||||||
# 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 ["python", "server.py"]
|
|
@ -1,10 +0,0 @@
|
|||||||
services:
|
|
||||||
test-http-container:
|
|
||||||
container_name: test-http-container
|
|
||||||
ports:
|
|
||||||
- 8080:8080
|
|
||||||
volumes:
|
|
||||||
- ./mock:/app
|
|
||||||
build: .
|
|
||||||
# networks:
|
|
||||||
# - testnet
|
|
Binary file not shown.
@ -1,49 +0,0 @@
|
|||||||
import json
|
|
||||||
import signal
|
|
||||||
import sys
|
|
||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
||||||
from django.http import HttpResponse
|
|
||||||
|
|
||||||
|
|
||||||
# Function to generate the response
|
|
||||||
def send_funct():
|
|
||||||
ymlschedule = {"message": False}
|
|
||||||
to_send = {
|
|
||||||
"statusCode": 200,
|
|
||||||
"isBase64ENcoded": "false",
|
|
||||||
"body": json.dumps(ymlschedule)
|
|
||||||
}
|
|
||||||
return json.dumps(to_send)
|
|
||||||
|
|
||||||
# Define request handler
|
|
||||||
class RequestHandler(BaseHTTPRequestHandler):
|
|
||||||
def do_GET(self):
|
|
||||||
# Send response headers
|
|
||||||
self.send_response(200)
|
|
||||||
self.send_header('Content-type', 'application/json')
|
|
||||||
self.end_headers()
|
|
||||||
|
|
||||||
# Send the response body (the JSON data)
|
|
||||||
self.wfile.write(send_funct().encode('utf-8'))
|
|
||||||
|
|
||||||
# Graceful shutdown handler
|
|
||||||
def signal_handler(sig, frame):
|
|
||||||
print("\nShutting down server gracefully...")
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
# Set up and start the server
|
|
||||||
if __name__ == "__main__":
|
|
||||||
# Register signal handler for graceful shutdown (e.g., Ctrl+C)
|
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
|
||||||
|
|
||||||
# Set the server address (localhost) and port (8080)
|
|
||||||
server_address = ('', 8080)
|
|
||||||
httpd = HTTPServer(server_address, RequestHandler)
|
|
||||||
|
|
||||||
print("Server started on port 8080")
|
|
||||||
try:
|
|
||||||
# Start the server and listen for requests
|
|
||||||
httpd.serve_forever()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
# Server shutdown is handled in signal_handler
|
|
||||||
pass
|
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
# Interview-Backend
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
@ -1,8 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
FROM python:3.10-slim
|
|
||||||
WORKDIR /code
|
|
||||||
COPY requirements.txt requirements.txt
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
EXPOSE 5000
|
|
||||||
COPY . .
|
|
||||||
CMD ["python", "app.py"]
|
|
@ -1,32 +0,0 @@
|
|||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
||||||
|
|
||||||
hit_count = 0 # In-memory counter
|
|
||||||
|
|
||||||
def get_hit_count():
|
|
||||||
global hit_count
|
|
||||||
hit_count += 1
|
|
||||||
return hit_count
|
|
||||||
|
|
||||||
class RequestHandler(BaseHTTPRequestHandler):
|
|
||||||
def do_GET(self):
|
|
||||||
if self.path == '/':
|
|
||||||
count = get_hit_count()
|
|
||||||
response = f'Hello World! I have been seen {count} times.\n'
|
|
||||||
self.send_response(200)
|
|
||||||
self.send_header('Content-type', 'text/plain')
|
|
||||||
self.end_headers()
|
|
||||||
self.wfile.write(response.encode('utf-8'))
|
|
||||||
else:
|
|
||||||
self.send_response(404)
|
|
||||||
self.send_header('Content-type', 'text/plain')
|
|
||||||
self.end_headers()
|
|
||||||
self.wfile.write(b'Not Found\n')
|
|
||||||
|
|
||||||
def run(server_class=HTTPServer, handler_class=RequestHandler, port=8000):
|
|
||||||
server_address = ('', port)
|
|
||||||
httpd = server_class(server_address, handler_class)
|
|
||||||
print(f'Starting server on port {port}...')
|
|
||||||
httpd.serve_forever()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
run()
|
|
@ -1,8 +0,0 @@
|
|||||||
services:
|
|
||||||
web:
|
|
||||||
container_name: test
|
|
||||||
build: .
|
|
||||||
ports:
|
|
||||||
- "8000:8000"
|
|
||||||
volumes:
|
|
||||||
- ./:/code
|
|
@ -1,12 +1,11 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import json
|
import json
|
||||||
from openpyxl import load_workbook
|
from openpyxl import load_workbook
|
||||||
from send_email import send_email
|
from .send_email import send_email
|
||||||
from filelock import FileLock
|
from filelock import FileLock
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
TODO make it work with the new template
|
|
||||||
TODO update names to be more clear
|
TODO update names to be more clear
|
||||||
TODO try to remove pandas
|
TODO try to remove pandas
|
||||||
"""
|
"""
|
@ -1,4 +1,4 @@
|
|||||||
from ReadDB import ReadDatabase
|
from .ReadDB import ReadDatabase
|
||||||
|
|
||||||
|
|
||||||
def getSchedulePackager(file_name):
|
def getSchedulePackager(file_name):
|
||||||
@ -18,7 +18,7 @@ def getSchedulePackager(file_name):
|
|||||||
"interviewDates": ReadDatabase(file_path=file_name)
|
"interviewDates": ReadDatabase(file_path=file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
from WriteDB import AppendAppointment
|
from .WriteDB import AppendAppointment
|
||||||
from email_validator import validate_email, EmailNotValidError
|
from email_validator import validate_email, EmailNotValidError
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@ from fastapi import FastAPI
|
|||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from NoSheet import NoSheet
|
from .InterviewBooking.NoSheet import NoSheet
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ def get_root():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
from interviewPackagers import getSchedulePackager
|
from .InterviewBooking.interviewPackagers import getSchedulePackager
|
||||||
|
|
||||||
@app.get("/getAppointments")
|
@app.get("/getAppointments")
|
||||||
async def getAppointments():
|
async def getAppointments():
|
||||||
@ -76,7 +76,7 @@ async def getAppointments():
|
|||||||
# 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
|
||||||
)
|
)
|
||||||
|
|
||||||
from interviewPackagers import SelectAppointment
|
from .InterviewBooking.interviewPackagers import SelectAppointment
|
||||||
|
|
||||||
class Appointment(BaseModel):
|
class Appointment(BaseModel):
|
||||||
"""
|
"""
|
Loading…
x
Reference in New Issue
Block a user