05/08 Phase 4
This commit is contained in:
@@ -115,6 +115,22 @@ def create():
|
||||
log_tenant_action("appointment.create", "appointment", appt.id,
|
||||
{"customer": customer_id, "staff": staff_id,
|
||||
"start": start_raw})
|
||||
|
||||
# Schedule 24h and 2h email reminders
|
||||
from app.models.salon import AppointmentReminder as AR
|
||||
for hours, rtype in [(24, "24h"), (2, "2h")]:
|
||||
remind_at = start_time - timedelta(hours=hours)
|
||||
if remind_at > datetime.now(timezone.utc):
|
||||
db.session.add(AR(
|
||||
tenant_id=g.tenant.id,
|
||||
location_id=g.location.id,
|
||||
appointment_id=appt.id,
|
||||
reminder_type=rtype,
|
||||
scheduled_for=remind_at,
|
||||
channel="email",
|
||||
status="pending",
|
||||
))
|
||||
|
||||
db.session.commit()
|
||||
flash("Appointment created.", "success")
|
||||
return redirect(url_for("appointments.index",
|
||||
|
||||
Reference in New Issue
Block a user