def notify_shift_candidate_update(user, shift, talents_to_notify=[]): for talent in talents_to_notify['accepted']: payload = api.utils.jwt.jwt_payload_handler({ "user_id": talent.user.id, "shift_id": shift.id }) send_email_message( 'applicant_accepted', talent.user.email, { "COMPANY": shift.employer.title, "POSITION": shift.position.title, "TOKEN": jwt_encode_handler(payload), "DATE": shift.starting_at, "DATA": { "type": "shift", "id": shift.id } }) send_fcm_notification( 'applicant_accepted', talent.user.id, { "COMPANY": shift.employer.title, "POSITION": shift.position.title, "TOKEN": jwt_encode_handler(payload), "DATE": shift.starting_at, "DATA": { "type": "shift", "id": shift.id } }) for talent in talents_to_notify['rejected']: payload = api.utils.jwt.jwt_payload_handler({ "user_id": talent.user.id, "shift_id": shift.id }) send_email_message( 'applicant_rejected', talent.user.email, { "COMPANY": shift.employer.title, "POSITION": shift.position.title, "TOKEN": jwt_encode_handler(payload), "DATE": shift.starting_at, "DATA": { "type": "invite", "id": invite.id } }) send_fcm_notification( 'applicant_rejected', talent.user.id, { "COMPANY": shift.employer.title, "POSITION": shift.position.title, "TOKEN": jwt_encode_handler(payload), "DATE": shift.starting_at, "DATA": { "type": "invite", "id": invite.id } })
def notify_email_validation(user): payload = api.utils.jwt.jwt_payload_handler({"user_id": user.id}) token = jwt_encode_handler(payload) send_email_message( "registration", user.email, { "SUBJECT": "Please validate your email in JobCore", "LINK": API_URL + '/api/user/email/validate?token=' + token, "FIRST_NAME": user.first_name })
def notify_new_rating(rating): if rating.employee != None: send_email_message( "new_rating", rating.employee.user.email, { "SENDER": rating.sender.employer.title, "VENUE": rating.shift.venue.title, "DATE": rating.shift.starting_at.strftime('%m/%d/%Y'), "LINK": EMPLOYEE_URL + '/rating/' + str(rating.id), "DATA": { "type": "rating", "id": rating.id } }) send_fcm_notification( "new_rating", to.profile.user.id, { "SENDER": rating.sender.employer.title, "VENUE": rating.shift.venue.title, "DATE": rating.shift.starting_at.strftime('%m/%d/%Y'), "LINK": EMPLOYEE_URL + '/rating/' + str(rating.id), "DATA": { "type": "rating", "id": rating.id } }) elif rating.employer != None: employer_users = Profile.objects.filter( employer__id=rating.employer.id) for profile in employer_users: send_email_message( "new_rating", profile.user.email, { "SENDER": rating.sender.user.first_name + ' ' + rating.sender.user.last_name, "VENUE": rating.shift.venue.title, "DATE": rating.shift.starting_at.strftime('%m/%d/%Y'), "LINK": EMPLOYEE_URL + '/rating/' + str(rating.id), "DATA": { "type": "rating", "id": rating.id } })
def notify_invite_accepted(invite): return send_email_message( "invite_accepted", invite.sender.user.email, { "TALENT": invite.first_name + ' ' + invite.last_name, "LINK": EMPLOYER_URL, "DATA": { "type": "registration" } })
def notify_jobcore_invite(invite): payload = api.utils.jwt.jwt_payload_handler({ "sender_id": invite.sender.id, "invite_id": invite.id }) token = jwt_encode_handler(payload) send_email_message( "invite_to_jobcore", invite.email, { "SENDER": invite.sender.user.first_name + ' ' + invite.sender.user.last_name, "EMAIL": invite.email, "COMPANY": invite.sender.user.profile.employer.title, "LINK": EMPLOYER_URL + "/invite?token=" + token, "DATA": { "type": "invite", "id": invite.id } })
def notify_single_shift_invite(invite): payload = api.utils.jwt.jwt_payload_handler({ "sender_id": invite.sender.id, "invite_id": invite.id }) token = jwt_encode_handler(payload) # invite.employee.user.email send_email_message( "invite_to_shift", invite.sender.user.email, { "SENDER": invite.sender.user.first_name + ' ' + invite.sender.user.last_name, "COMPANY": invite.sender.user.profile.employer.title, "POSITION": invite.shift.position.title, "DATE": invite.shift.starting_at.strftime('%m/%d/%Y'), "LINK": EMPLOYEE_URL + '/invite?token=' + token, "DATA": { "type": "invite", "id": invite.id } }) send_fcm_notification( "invite_to_shift", invite.employee.user.id, { "SENDER": invite.sender.user.first_name + ' ' + invite.sender.user.last_name, "COMPANY": invite.sender.user.profile.employer.title, "POSITION": invite.shift.position.title, "DATE": invite.shift.starting_at.strftime('%m/%d/%Y'), "LINK": EMPLOYEE_URL + '/invite?token=' + token, "DATA": { "type": "invite", "id": invite.id } })
def notify_password_reset_code(user): payload = api.utils.jwt.jwt_payload_handler({"user_id": user.id}) token = jwt_encode_handler(payload) send_email_message( "password_reset_link", user.email, {"link": API_URL + '/api/user/password/reset?token=' + token})