Skip to content

Commit

Permalink
Merge pull request #89 from whyphi/dev/v1.0
Browse files Browse the repository at this point in the history
merge: `v2.0`
  • Loading branch information
wderocco8 authored Aug 16, 2024
2 parents a1f27fa + 0217dbe commit f295656
Show file tree
Hide file tree
Showing 32 changed files with 1,714 additions and 1,029 deletions.
6 changes: 4 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from chalicelib.api.announcements import announcements_api
from chalicelib.api.insights import insights_api
from chalicelib.api.members import members_api
from chalicelib.api.events import events_api
from chalicelib.api.events_member import events_member_api
from chalicelib.api.events_rush import events_rush_api
from chalicelib.api.accountability import accountability_api
from chalicelib.api.monitoring import monitoring_api

Expand All @@ -37,7 +38,8 @@
app.register_blueprint(applicants_api)
app.register_blueprint(insights_api)
app.register_blueprint(members_api)
app.register_blueprint(events_api)
app.register_blueprint(events_member_api)
app.register_blueprint(events_rush_api)
app.register_blueprint(accountability_api)
app.register_blueprint(monitoring_api)

Expand Down
3 changes: 2 additions & 1 deletion chalicelib/api/accountability.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from chalice import Blueprint
from chalicelib.decorators import auth
from chalicelib.services.AccountabilityService import accountability_service
from chalicelib.models.roles import Roles

accountability_api = Blueprint(__name__)


@accountability_api.route("/accountability", methods=["GET"], cors=True)
@auth(accountability_api, roles=["admin"])
@auth(accountability_api, roles=[Roles.ADMIN, Roles.MEMBER])
def get_accountability():
if accountability_api.current_request.query_params:
page = int(accountability_api.current_request.query_params.get("page", 0))
Expand Down
2 changes: 0 additions & 2 deletions chalicelib/api/applicants.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from chalice import Blueprint
from chalicelib.services.ApplicantService import applicant_service
from chalicelib.handlers.error_handler import handle_exceptions
from chalicelib.decorators import auth
from chalicelib.models.roles import Roles

from pydantic import ValidationError

applicants_api = Blueprint(__name__)

Expand Down
117 changes: 0 additions & 117 deletions chalicelib/api/events.py

This file was deleted.

69 changes: 69 additions & 0 deletions chalicelib/api/events_member.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from chalice import Blueprint
from chalicelib.decorators import auth
from chalicelib.services.EventsMemberService import events_member_service
from chalicelib.models.roles import Roles

events_member_api = Blueprint(__name__)


@events_member_api.route("/timeframes", methods=["POST"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN])
def create_timeframe():
data = events_member_api.current_request.json_body
return events_member_service.create_timeframe(data)


@events_member_api.route("/timeframes", methods=["GET"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN, Roles.MEMBER])
def get_all_timeframes():
return events_member_service.get_all_timeframes()


@events_member_api.route("/timeframes/{timeframe_id}", methods=["GET"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN, Roles.MEMBER])
def get_timeframe(timeframe_id: str):
return events_member_service.get_timeframe(timeframe_id)


@events_member_api.route("/timeframes/{timeframe_id}", methods=["DELETE"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN])
def delete_timeframe(timeframe_id: str):
return events_member_service.delete_timeframe(timeframe_id)


@events_member_api.route("/timeframes/{timeframe_id}/events", methods=["POST"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN])
def create_event(timeframe_id: str):
data = events_member_api.current_request.json_body
return events_member_service.create_event(timeframe_id, data)


@events_member_api.route("/events/{event_id}", methods=["GET"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN, Roles.MEMBER])
def get_event(event_id: str):
return events_member_service.get_event(event_id)


@events_member_api.route("/timeframes/{timeframe_id}/sheets", methods=["GET"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN, Roles.MEMBER])
def get_timeframe_sheets(timeframe_id: str):
return events_member_service.get_timeframe_sheets(timeframe_id)


@events_member_api.route("/events/{event_id}/checkin", methods=["POST"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN, Roles.MEMBER])
def checkin(event_id: str):
data = events_member_api.current_request.json_body
return events_member_service.checkin(event_id, data)


@events_member_api.route("/events/{event_id}", methods=["PATCH"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN])
def update_event(event_id: str):
pass


@events_member_api.route("/events/{event_id}", methods=["DELETE"], cors=True)
@auth(events_member_api, roles=[Roles.ADMIN])
def delete_event(event_id: str):
return events_member_service.delete(event_id)
70 changes: 70 additions & 0 deletions chalicelib/api/events_rush.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
from chalice import Blueprint
from chalicelib.decorators import auth
from chalicelib.services.EventsRushService import events_rush_service
from chalicelib.models.roles import Roles


events_rush_api = Blueprint(__name__)


@events_rush_api.route("/events/rush", methods=["GET"], cors=True)
@auth(events_rush_api, roles=[Roles.ADMIN, Roles.MEMBER])
def get_rush_events():
return events_rush_service.get_rush_categories_and_events()


@events_rush_api.route("/events/rush/{event_id}", methods=["POST"], cors=True)
def get_rush_event(event_id):
data = events_rush_api.current_request.json_body
return events_rush_service.get_rush_event(event_id=event_id, data=data)


@events_rush_api.route("/events/rush/category", methods=["POST"], cors=True)
@auth(events_rush_api, roles=[Roles.ADMIN])
def create_rush_category():
data = events_rush_api.current_request.json_body
return events_rush_service.create_rush_category(data)


@events_rush_api.route("/events/rush", methods=["POST"], cors=True)
@auth(events_rush_api, roles=[Roles.ADMIN])
def create_rush_event():
data = events_rush_api.current_request.json_body
return events_rush_service.create_rush_event(data)


@events_rush_api.route("/events/rush", methods=["PATCH"], cors=True)
@auth(events_rush_api, roles=[Roles.ADMIN])
def modify_rush_event():
data = events_rush_api.current_request.json_body
return events_rush_service.modify_rush_event(data)

@events_rush_api.route("/events/rush/settings", methods=["PATCH"], cors=True)
@auth(events_rush_api, roles=[Roles.ADMIN])
def modify_rush_settings():
data = events_rush_api.current_request.json_body
return events_rush_service.modify_rush_settings(data)


@events_rush_api.route("/events/rush/checkin/{event_id}", methods=["POST"], cors=True)
def checkin_rush(event_id):
data = events_rush_api.current_request.json_body
return events_rush_service.checkin_rush(event_id, data)


@events_rush_api.route("/events/rush/default", methods=["POST"], cors=True)
def get_rush_events_default_category():
data = events_rush_api.current_request.json_body
return events_rush_service.get_rush_events_default_category(data)


@events_rush_api.route("/events/rush/{event_id}", methods=["DELETE"], cors=True)
@auth(events_rush_api, roles=[Roles.ADMIN])
def delete_rush_event(event_id):
return events_rush_service.delete_rush_event(event_id)


@events_rush_api.route("/events/rush/{category_id}/analytics", methods=["GET"], cors=True)
@auth(events_rush_api, roles=[Roles.ADMIN])
def get_rush_category_analytics(category_id):
return events_rush_service.get_rush_category_analytics(category_id=category_id)
2 changes: 0 additions & 2 deletions chalicelib/api/insights.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# TO BE COMPLETED: create api routes for analytics
from chalice import Blueprint
from chalicelib.services.InsightsService import insights_service
from chalicelib.handlers.error_handler import handle_exceptions
from chalicelib.decorators import auth
from chalicelib.models.roles import Roles

from pydantic import ValidationError

insights_api = Blueprint(__name__)

Expand Down
3 changes: 1 addition & 2 deletions chalicelib/api/listings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from chalicelib.decorators import auth
from chalicelib.models.roles import Roles

from pydantic import ValidationError

listings_api = Blueprint(__name__)

Expand Down Expand Up @@ -56,8 +55,8 @@ def toggle_visibility(id):


@listings_api.route("/listings/{id}/update-field", methods=["PATCH"], cors=True)
@handle_exceptions
@auth(listings_api, roles=[Roles.ADMIN, Roles.MEMBER])
@handle_exceptions
def update_listing_field_route(id):
try:
return listing_service.update_field_route(
Expand Down
Loading

0 comments on commit f295656

Please sign in to comment.