Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hackathon Request] Support requests for hackathons anywhere in the w… #102

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion api/messages/messages_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,28 @@ def update_hackathon_volunteers(event_id, volunteer_type, json, propel_id):
return Message(
"Updated Hackathon Volunteers"
)


def create_hackathon(json):
db = get_db() # this connects to our Firestore database
logger.debug("Hackathon Create")
send_slack_audit(action="create_hackathon", message="Creating", payload=json)

# Save payload for potential hackathon in the database under the hackathon_requests collection
doc_id = uuid.uuid1().hex
collection = db.collection('hackathon_requests')
insert_res = collection.document(doc_id).set(json)

if "contactEmail" in json and "contactName" in json:
send_welcome_email(json["contactName"], json["contactEmail"])

send_slack(
message=":rocket: New Hackathon Request :rocket: with json: " + str(json), channel="log-hackathon-requests", icon_emoji=":rocket:")
logger.debug(f"Insert Result: {insert_res}")

return Message(
"Created Hackathon"
)


@limits(calls=50, period=ONE_MINUTE)
def save_hackathon(json):
Expand Down Expand Up @@ -1583,6 +1604,7 @@ def send_welcome_email(name, email):
params = {
"from": "Opportunity Hack <[email protected]>",
"to": f"{name} <{email}>",
"bcc": "[email protected]",
"subject": subject,
"html": html_content,
}
Expand Down
6 changes: 6 additions & 0 deletions api/messages/messages_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
single_add_volunteer,
get_single_hackathon_id,
save_hackathon,
create_hackathon,
update_hackathon_volunteers,
get_teams_list,
get_team,
Expand Down Expand Up @@ -467,4 +468,9 @@ def get_giveaway():
@auth.require_org_member_with_permission("volunteer.admin", req_to_org_id=getOrgId)
def admin_get_all_giveaways():
return get_all_giveaways()


@bp.route("/create-hackathon", methods=["POST"])
def submit_create_hackathon():
return vars(create_hackathon(request.get_json()))

Loading