diff --git a/.github/workflows/Actions.yaml b/.github/workflows/Actions.yaml index b7b550d..7a3aaa0 100644 --- a/.github/workflows/Actions.yaml +++ b/.github/workflows/Actions.yaml @@ -12,7 +12,7 @@ on: push: branches: - - main + - master # each workflow must have at least one job. # jobs run in parallel by default (we can change that). @@ -47,7 +47,7 @@ jobs: Dockerhub: runs-on: ubuntu-latest 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: - name: checkout uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile index 12f5ae0..14935d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,14 @@ FROM python:3.10-slim WORKDIR /BajaCloudBackend # 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 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 # Command to run the Python server when the container starts diff --git a/InterviewBooking/ContainerContents/NoSheet.py b/InterviewBooking/NoSheet.py similarity index 100% rename from InterviewBooking/ContainerContents/NoSheet.py rename to InterviewBooking/NoSheet.py diff --git a/InterviewBooking/Other Items/AfterMergeCodeapceTestResults.png b/InterviewBooking/Other Items/AfterMergeCodeapceTestResults.png deleted file mode 100644 index b4c5a58..0000000 Binary files a/InterviewBooking/Other Items/AfterMergeCodeapceTestResults.png and /dev/null differ diff --git a/InterviewBooking/Other Items/Docker Test/Dockerfile b/InterviewBooking/Other Items/Docker Test/Dockerfile deleted file mode 100644 index d924b8a..0000000 --- a/InterviewBooking/Other Items/Docker Test/Dockerfile +++ /dev/null @@ -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"] diff --git a/InterviewBooking/Other Items/Docker Test/docker-compose.yaml b/InterviewBooking/Other Items/Docker Test/docker-compose.yaml deleted file mode 100644 index a24300e..0000000 --- a/InterviewBooking/Other Items/Docker Test/docker-compose.yaml +++ /dev/null @@ -1,10 +0,0 @@ -services: - test-http-container: - container_name: test-http-container - ports: - - 8080:8080 - volumes: - - ./mock:/app - build: . - # networks: - # - testnet diff --git a/InterviewBooking/Other Items/Docker Test/dockertest-test-http-container_latest.tar.gz b/InterviewBooking/Other Items/Docker Test/dockertest-test-http-container_latest.tar.gz deleted file mode 100644 index 292086d..0000000 Binary files a/InterviewBooking/Other Items/Docker Test/dockertest-test-http-container_latest.tar.gz and /dev/null differ diff --git a/InterviewBooking/Other Items/Docker Test/mock/requirements.txt b/InterviewBooking/Other Items/Docker Test/mock/requirements.txt deleted file mode 100644 index e69de29..0000000 diff --git a/InterviewBooking/Other Items/Docker Test/mock/server.py b/InterviewBooking/Other Items/Docker Test/mock/server.py deleted file mode 100644 index 024f1fb..0000000 --- a/InterviewBooking/Other Items/Docker Test/mock/server.py +++ /dev/null @@ -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 diff --git a/InterviewBooking/Other Items/FastAPI test 1000 requests.png b/InterviewBooking/Other Items/FastAPI test 1000 requests.png deleted file mode 100644 index a86b656..0000000 Binary files a/InterviewBooking/Other Items/FastAPI test 1000 requests.png and /dev/null differ diff --git a/InterviewBooking/Other Items/OR-L-Interview Data.xlsx b/InterviewBooking/Other Items/OR-L-Interview Data.xlsx deleted file mode 100644 index d44d9a8..0000000 Binary files a/InterviewBooking/Other Items/OR-L-Interview Data.xlsx and /dev/null differ diff --git a/InterviewBooking/Other Items/README.md b/InterviewBooking/Other Items/README.md deleted file mode 100644 index c40a406..0000000 --- a/InterviewBooking/Other Items/README.md +++ /dev/null @@ -1 +0,0 @@ -# Interview-Backend \ No newline at end of file diff --git a/InterviewBooking/Other Items/TestResultsCodeSpace.png b/InterviewBooking/Other Items/TestResultsCodeSpace.png deleted file mode 100644 index 070d1bc..0000000 Binary files a/InterviewBooking/Other Items/TestResultsCodeSpace.png and /dev/null differ diff --git a/InterviewBooking/Other Items/composetest/Dockerfile b/InterviewBooking/Other Items/composetest/Dockerfile deleted file mode 100644 index 8505363..0000000 --- a/InterviewBooking/Other Items/composetest/Dockerfile +++ /dev/null @@ -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"] \ No newline at end of file diff --git a/InterviewBooking/Other Items/composetest/app.py b/InterviewBooking/Other Items/composetest/app.py deleted file mode 100644 index 7383f11..0000000 --- a/InterviewBooking/Other Items/composetest/app.py +++ /dev/null @@ -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() diff --git a/InterviewBooking/Other Items/composetest/docker-compose.yaml b/InterviewBooking/Other Items/composetest/docker-compose.yaml deleted file mode 100644 index c24417b..0000000 --- a/InterviewBooking/Other Items/composetest/docker-compose.yaml +++ /dev/null @@ -1,8 +0,0 @@ -services: - web: - container_name: test - build: . - ports: - - "8000:8000" - volumes: - - ./:/code diff --git a/InterviewBooking/Other Items/composetest/requirements.txt b/InterviewBooking/Other Items/composetest/requirements.txt deleted file mode 100644 index e69de29..0000000 diff --git a/InterviewBooking/Other Items/mock/OR25-L-Interview Data.xlsx.lock b/InterviewBooking/Other Items/mock/OR25-L-Interview Data.xlsx.lock deleted file mode 100644 index e69de29..0000000 diff --git a/InterviewBooking/ContainerContents/ReadDB.py b/InterviewBooking/ReadDB.py similarity index 100% rename from InterviewBooking/ContainerContents/ReadDB.py rename to InterviewBooking/ReadDB.py diff --git a/InterviewBooking/ContainerContents/WriteDB.py b/InterviewBooking/WriteDB.py similarity index 98% rename from InterviewBooking/ContainerContents/WriteDB.py rename to InterviewBooking/WriteDB.py index e9329a8..ec4e50c 100644 --- a/InterviewBooking/ContainerContents/WriteDB.py +++ b/InterviewBooking/WriteDB.py @@ -1,12 +1,11 @@ import pandas as pd import json from openpyxl import load_workbook -from send_email import send_email +from .send_email import send_email from filelock import FileLock """ -TODO make it work with the new template TODO update names to be more clear TODO try to remove pandas """ diff --git a/InterviewBooking/ContainerContents/interviewPackagers.py b/InterviewBooking/interviewPackagers.py similarity index 95% rename from InterviewBooking/ContainerContents/interviewPackagers.py rename to InterviewBooking/interviewPackagers.py index a2bb7df..88e0431 100644 --- a/InterviewBooking/ContainerContents/interviewPackagers.py +++ b/InterviewBooking/interviewPackagers.py @@ -1,4 +1,4 @@ -from ReadDB import ReadDatabase +from .ReadDB import ReadDatabase def getSchedulePackager(file_name): @@ -18,7 +18,7 @@ def getSchedulePackager(file_name): "interviewDates": ReadDatabase(file_path=file_name) } -from WriteDB import AppendAppointment +from .WriteDB import AppendAppointment from email_validator import validate_email, EmailNotValidError diff --git a/InterviewBooking/ContainerContents/send_email.py b/InterviewBooking/send_email.py similarity index 100% rename from InterviewBooking/ContainerContents/send_email.py rename to InterviewBooking/send_email.py diff --git a/InterviewBooking/Other Items/ConversionToExcel.py b/Other Items/ConversionToExcel.py similarity index 100% rename from InterviewBooking/Other Items/ConversionToExcel.py rename to Other Items/ConversionToExcel.py diff --git a/InterviewBooking/Other Items/TestBookAppointment.py b/Other Items/TestBookAppointment.py similarity index 100% rename from InterviewBooking/Other Items/TestBookAppointment.py rename to Other Items/TestBookAppointment.py diff --git a/InterviewBooking/Other Items/interview_database.yaml b/Other Items/interview_database.yaml similarity index 100% rename from InterviewBooking/Other Items/interview_database.yaml rename to Other Items/interview_database.yaml diff --git a/InterviewBooking/Other Items/mock/OR25-L-Interview Data.xlsx b/Other Items/mock/OR25-L-Interview Data.xlsx similarity index 100% rename from InterviewBooking/Other Items/mock/OR25-L-Interview Data.xlsx rename to Other Items/mock/OR25-L-Interview Data.xlsx diff --git a/InterviewBooking/Other Items/testcontainer.py b/Other Items/testcontainer.py similarity index 100% rename from InterviewBooking/Other Items/testcontainer.py rename to Other Items/testcontainer.py diff --git a/InterviewBooking/Other Items/testhttp.py b/Other Items/testhttp.py similarity index 100% rename from InterviewBooking/Other Items/testhttp.py rename to Other Items/testhttp.py diff --git a/InterviewBooking/Other Items/web1.html b/Other Items/web1.html similarity index 100% rename from InterviewBooking/Other Items/web1.html rename to Other Items/web1.html diff --git a/InterviewBooking/ContainerContents/main.py b/main.py similarity index 94% rename from InterviewBooking/ContainerContents/main.py rename to main.py index dcd8ad6..0f74631 100644 --- a/InterviewBooking/ContainerContents/main.py +++ b/main.py @@ -2,7 +2,7 @@ from fastapi import FastAPI from fastapi.responses import JSONResponse from pydantic import BaseModel -from NoSheet import NoSheet +from .InterviewBooking.NoSheet import NoSheet import datetime import os @@ -46,7 +46,7 @@ def get_root(): ) -from interviewPackagers import getSchedulePackager +from .InterviewBooking.interviewPackagers import getSchedulePackager @app.get("/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 ) -from interviewPackagers import SelectAppointment +from .InterviewBooking.interviewPackagers import SelectAppointment class Appointment(BaseModel): """ diff --git a/InterviewBooking/ContainerContents/requirements.txt b/requirements.txt similarity index 100% rename from InterviewBooking/ContainerContents/requirements.txt rename to requirements.txt