diff --git a/AfterMergeCodeapceTestResults.png b/AfterMergeCodeapceTestResults.png new file mode 100644 index 0000000..b4c5a58 Binary files /dev/null and b/AfterMergeCodeapceTestResults.png differ diff --git a/__pycache__/GetSchedulePackager.cpython-312.pyc b/__pycache__/GetSchedulePackager.cpython-312.pyc new file mode 100644 index 0000000..cedba80 Binary files /dev/null and b/__pycache__/GetSchedulePackager.cpython-312.pyc differ diff --git a/__pycache__/postSelectAppointment.cpython-312.pyc b/__pycache__/postSelectAppointment.cpython-312.pyc new file mode 100644 index 0000000..da2fced Binary files /dev/null and b/__pycache__/postSelectAppointment.cpython-312.pyc differ diff --git a/djangotutorial/mysite/__pycache__/__init__.cpython-312.pyc b/djangotutorial/mysite/__pycache__/__init__.cpython-312.pyc index bef271a..86745d5 100644 Binary files a/djangotutorial/mysite/__pycache__/__init__.cpython-312.pyc and b/djangotutorial/mysite/__pycache__/__init__.cpython-312.pyc differ diff --git a/djangotutorial/mysite/__pycache__/getAppointments.cpython-312.pyc b/djangotutorial/mysite/__pycache__/getAppointments.cpython-312.pyc new file mode 100644 index 0000000..277ab79 Binary files /dev/null and b/djangotutorial/mysite/__pycache__/getAppointments.cpython-312.pyc differ diff --git a/djangotutorial/mysite/__pycache__/newtest.cpython-312.pyc b/djangotutorial/mysite/__pycache__/newtest.cpython-312.pyc new file mode 100644 index 0000000..9a423ca Binary files /dev/null and b/djangotutorial/mysite/__pycache__/newtest.cpython-312.pyc differ diff --git a/djangotutorial/mysite/__pycache__/selectAppointment.cpython-312.pyc b/djangotutorial/mysite/__pycache__/selectAppointment.cpython-312.pyc new file mode 100644 index 0000000..037aa84 Binary files /dev/null and b/djangotutorial/mysite/__pycache__/selectAppointment.cpython-312.pyc differ diff --git a/djangotutorial/mysite/__pycache__/settings.cpython-312.pyc b/djangotutorial/mysite/__pycache__/settings.cpython-312.pyc index ebaaf01..ca666c9 100644 Binary files a/djangotutorial/mysite/__pycache__/settings.cpython-312.pyc and b/djangotutorial/mysite/__pycache__/settings.cpython-312.pyc differ diff --git a/djangotutorial/mysite/__pycache__/urls.cpython-312.pyc b/djangotutorial/mysite/__pycache__/urls.cpython-312.pyc index 324cc8b..263b748 100644 Binary files a/djangotutorial/mysite/__pycache__/urls.cpython-312.pyc and b/djangotutorial/mysite/__pycache__/urls.cpython-312.pyc differ diff --git a/djangotutorial/mysite/__pycache__/wsgi.cpython-312.pyc b/djangotutorial/mysite/__pycache__/wsgi.cpython-312.pyc index 3b9d9fc..1e0c9af 100644 Binary files a/djangotutorial/mysite/__pycache__/wsgi.cpython-312.pyc and b/djangotutorial/mysite/__pycache__/wsgi.cpython-312.pyc differ diff --git a/djangotutorial/mysite/getAppointments.py b/djangotutorial/mysite/getAppointments.py new file mode 100644 index 0000000..98e215b --- /dev/null +++ b/djangotutorial/mysite/getAppointments.py @@ -0,0 +1,8 @@ +import json +from django.http import HttpResponse +from .methods.GetSchedulePackager import getSchedulePackager + + +def index(request): + res = getSchedulePackager() + return HttpResponse(json.dumps(res)) \ No newline at end of file diff --git a/djangotutorial/mysite/methods/GetSchedulePackager.py b/djangotutorial/mysite/methods/GetSchedulePackager.py new file mode 100644 index 0000000..be00728 --- /dev/null +++ b/djangotutorial/mysite/methods/GetSchedulePackager.py @@ -0,0 +1,26 @@ +import yaml +import json + +with open("./mysite/methods/MockDB/schedule.yaml", "r") as scheduleyml: + ymlschedule = yaml.safe_load(scheduleyml) + +def getSchedulePackager(): + """ + Formats and allows for the + + ``REQUIRES``: None + + ``PROMISES``: ``JSON`` http response ready + + ``Develop in part by``: Brock T + + ``Contact``: darkicewolf50@gmail.ocm + + """ + + return { + "statusCode": 200, + "isBase64ENcoded": "false", + "body": json.dumps(ymlschedule) + } + diff --git a/djangotutorial/mysite/methods/MockDB/schedule.yaml b/djangotutorial/mysite/methods/MockDB/schedule.yaml new file mode 100644 index 0000000..2a85139 --- /dev/null +++ b/djangotutorial/mysite/methods/MockDB/schedule.yaml @@ -0,0 +1,11 @@ +Date: + Sept 16: + Meeting Duration: 30 min + Meeting Start Times: + - 10:00 am + - 10:30 am + - 11:00 am + - 11:30 am + - 1:00 pm + - 1:30 pm + - 2:00 pm diff --git a/djangotutorial/mysite/methods/__pycache__/GetSchedulePackager.cpython-312.pyc b/djangotutorial/mysite/methods/__pycache__/GetSchedulePackager.cpython-312.pyc new file mode 100644 index 0000000..ad1658d Binary files /dev/null and b/djangotutorial/mysite/methods/__pycache__/GetSchedulePackager.cpython-312.pyc differ diff --git a/djangotutorial/mysite/methods/__pycache__/postSelectAppointment.cpython-312.pyc b/djangotutorial/mysite/methods/__pycache__/postSelectAppointment.cpython-312.pyc new file mode 100644 index 0000000..ec9dfb2 Binary files /dev/null and b/djangotutorial/mysite/methods/__pycache__/postSelectAppointment.cpython-312.pyc differ diff --git a/djangotutorial/mysite/methods/postSelectAppointment.py b/djangotutorial/mysite/methods/postSelectAppointment.py new file mode 100644 index 0000000..5a5688a --- /dev/null +++ b/djangotutorial/mysite/methods/postSelectAppointment.py @@ -0,0 +1,36 @@ +import json +import datetime + +def SelectAppointment (appointmentJson): + """ + packages up a response for a http request + + ``appointmentJSON``: ``JSON`` + The appointment date and time details + + ``returns``: ``json`` + Returns the status of the booking confirmation + + ``Develop in part by``: Brock T + + ``Contact``: darkicewolf50@gmail.com + """ + + status = mockWriteFunction(appointmentJson) + + if status: + resBody = {"Success": True} + else: + resBody = {"Success": False} + + return { + "statusCode": 200, + "isBase64ENcoded": "false", + "body": json.dumps(resBody) + } + +def mockWriteFunction(appTime): + return 0 + +if __name__ == "__main__": + print(SelectAppointment("10:00 AM")) \ No newline at end of file diff --git a/djangotutorial/mysite/methods/schedule.yaml b/djangotutorial/mysite/methods/schedule.yaml new file mode 100644 index 0000000..2a85139 --- /dev/null +++ b/djangotutorial/mysite/methods/schedule.yaml @@ -0,0 +1,11 @@ +Date: + Sept 16: + Meeting Duration: 30 min + Meeting Start Times: + - 10:00 am + - 10:30 am + - 11:00 am + - 11:30 am + - 1:00 pm + - 1:30 pm + - 2:00 pm diff --git a/djangotutorial/polls/newtest.py b/djangotutorial/mysite/newtest.py similarity index 100% rename from djangotutorial/polls/newtest.py rename to djangotutorial/mysite/newtest.py diff --git a/djangotutorial/mysite/selectAppointment.py b/djangotutorial/mysite/selectAppointment.py new file mode 100644 index 0000000..15f2ec7 --- /dev/null +++ b/djangotutorial/mysite/selectAppointment.py @@ -0,0 +1,8 @@ +import json +from django.http import HttpResponse +from .methods.postSelectAppointment import SelectAppointment + + +def index(request): + res = SelectAppointment(request) + return HttpResponse(json.dumps(res)) \ No newline at end of file diff --git a/djangotutorial/mysite/urls.py b/djangotutorial/mysite/urls.py index de5fc10..da52cf6 100644 --- a/djangotutorial/mysite/urls.py +++ b/djangotutorial/mysite/urls.py @@ -17,8 +17,12 @@ Including another URLconf from django.contrib import admin from django.urls import include, path +from . import newtest, getAppointments, selectAppointment urlpatterns = [ path("polls/", include("polls.urls")), path("admin/", admin.site.urls), + path("test", newtest.index, name="index"), + path("getSchedule", getAppointments.index, name="index"), + path("postSelectAppointment", selectAppointment.index, name="index"), ] \ No newline at end of file diff --git a/djangotutorial/polls/__pycache__/__init__.cpython-312.pyc b/djangotutorial/polls/__pycache__/__init__.cpython-312.pyc index ae55520..bf20d19 100644 Binary files a/djangotutorial/polls/__pycache__/__init__.cpython-312.pyc and b/djangotutorial/polls/__pycache__/__init__.cpython-312.pyc differ diff --git a/djangotutorial/polls/__pycache__/getAppointments.cpython-312.pyc b/djangotutorial/polls/__pycache__/getAppointments.cpython-312.pyc new file mode 100644 index 0000000..85a3af5 Binary files /dev/null and b/djangotutorial/polls/__pycache__/getAppointments.cpython-312.pyc differ diff --git a/djangotutorial/polls/__pycache__/newtest.cpython-312.pyc b/djangotutorial/polls/__pycache__/newtest.cpython-312.pyc index 3c9acf6..437ea5d 100644 Binary files a/djangotutorial/polls/__pycache__/newtest.cpython-312.pyc and b/djangotutorial/polls/__pycache__/newtest.cpython-312.pyc differ diff --git a/djangotutorial/polls/__pycache__/selectAppointment.cpython-312.pyc b/djangotutorial/polls/__pycache__/selectAppointment.cpython-312.pyc new file mode 100644 index 0000000..b66a5a6 Binary files /dev/null and b/djangotutorial/polls/__pycache__/selectAppointment.cpython-312.pyc differ diff --git a/djangotutorial/polls/__pycache__/urls.cpython-312.pyc b/djangotutorial/polls/__pycache__/urls.cpython-312.pyc index d02f913..e8793e8 100644 Binary files a/djangotutorial/polls/__pycache__/urls.cpython-312.pyc and b/djangotutorial/polls/__pycache__/urls.cpython-312.pyc differ diff --git a/djangotutorial/polls/__pycache__/views.cpython-312.pyc b/djangotutorial/polls/__pycache__/views.cpython-312.pyc index db702bd..9647f44 100644 Binary files a/djangotutorial/polls/__pycache__/views.cpython-312.pyc and b/djangotutorial/polls/__pycache__/views.cpython-312.pyc differ diff --git a/djangotutorial/polls/urls.py b/djangotutorial/polls/urls.py index 1b5cdb2..0cc22df 100644 --- a/djangotutorial/polls/urls.py +++ b/djangotutorial/polls/urls.py @@ -1,9 +1,12 @@ from django.urls import path from . import views -from . import newtest +# , newtest, getAppointments, selectAppointment + urlpatterns = [ path("", views.index, name="index"), - path("test", newtest.index, name="index") + # path("test", newtest.index, name="index"), + # path("getSchedule", getAppointments.index, name="index"), + # path("postSelectAppointment", selectAppointment.index, name="index"), ] diff --git a/testhttp.py b/testhttp.py index fed39b5..a37ca2d 100644 --- a/testhttp.py +++ b/testhttp.py @@ -3,14 +3,14 @@ import requests import timeit def BenchMarkServer(): - rawRes = requests.get("http://localhost:8080") + rawRes = requests.get("http://localhost:8080/getAppointments") res = json.loads(rawRes.text) #print(json.dumps(res, indent=1)) def BenchMarkDjango(): - rawRes = requests.get("http://localhost:8000/polls/test") + rawRes = requests.get("http://localhost:8000/getSchedule") res = json.loads(rawRes.text) - #print(json.dumps(res, indent=1)) + # print(json.dumps(res, indent=1)) if __name__ == "__main__": djangoTime = timeit.timeit(stmt=BenchMarkDjango, number=10)