mirror of
https://github.com/corazoncp/zoom-sched-poc.git
synced 2026-12-01 04:50:31 +00:00
fix(CR-17): omit zoom_start_url from unauthenticated GET appointment lookup
- Set zoom_start_url to None in GET /api/appointments/<lookup_id> while keeping it in POST /pay - Update index.html Screen 3 to show host link only when present and explain host-auth requirement on GET - Add TDD test verifying GET omits zoom_start_url while POST /pay returns it
This commit is contained in:
1 parent
ebe21ecf15
commit
cb96461073
3 files changed
+37
-4
No files matched your search
+3
-1
@@ -122,7 +122,9 @@ def create_app(test_config: dict | None = None) -> Flask:
|
||||
row, err = _resolve_appointment(lookup_id, db_path)
|
||||
if err:
|
||||
return err
|
||||
return jsonify(AppointmentResponse.model_validate(row).model_dump()), 200
|
||||
payload = AppointmentResponse.model_validate(row).model_dump()
|
||||
payload["zoom_start_url"] = None
|
||||
return jsonify(payload), 200
|
||||
|
||||
@app.post("/api/appointments/<lookup_id>/pay")
|
||||
@limiter.limit("10 per minute")
|
||||
|
||||
@@ -283,9 +283,11 @@
|
||||
const joinLinkHtml = safeJoinUrl
|
||||
? `<a href="${escapeHtml(safeJoinUrl)}" target="_blank" rel="noopener noreferrer">${escapeHtml(safeJoinUrl)}</a>`
|
||||
: `<span>${escapeHtml(appt.zoom_join_url || "No disponible")}</span>`;
|
||||
const startLinkHtml = safeStartUrl
|
||||
? `<a href="${escapeHtml(safeStartUrl)}" target="_blank" rel="noopener noreferrer">Abrir como anfitriona (privado)</a>`
|
||||
: `<span>Enlace no válido</span>`;
|
||||
const startLinkHtml = !appt.zoom_start_url
|
||||
? `<span>Disponible solo al confirmar el pago (requiere credenciales de anfitriona)</span>`
|
||||
: safeStartUrl
|
||||
? `<a href="${escapeHtml(safeStartUrl)}" target="_blank" rel="noopener noreferrer">Abrir como anfitriona (privado)</a>`
|
||||
: `<span>Enlace no válido</span>`;
|
||||
extraHtml = `
|
||||
<ul class="meta-list">
|
||||
<li><strong>Zoom Meeting ID:</strong> <code>${escapeHtml(appt.zoom_meeting_id)}</code></li>
|
||||
|
||||
@@ -843,3 +843,32 @@ def test_get_appointment_lookup_id_length_boundaries(client, lookup_id, expected
|
||||
test_client, _ = client
|
||||
resp = test_client.get(f"/api/appointments/{lookup_id}")
|
||||
assert resp.status_code == expected_status
|
||||
|
||||
|
||||
def test_get_appointment_omits_zoom_start_url_while_pay_returns_it(client, monkeypatch):
|
||||
test_client, _ = client
|
||||
_mock_zoom_happy_path(monkeypatch)
|
||||
|
||||
c_resp = test_client.post(
|
||||
"/api/appointments",
|
||||
json={
|
||||
"credentials": SAMPLE_CREDS,
|
||||
"client_name": "María Perez",
|
||||
"start_time_local": "2026-11-25T15:00",
|
||||
},
|
||||
)
|
||||
assert c_resp.status_code == 201
|
||||
sid = c_resp.get_json()["session_id"]
|
||||
|
||||
p_resp = test_client.post(
|
||||
f"/api/appointments/{sid}/pay",
|
||||
json={"credentials": SAMPLE_CREDS},
|
||||
)
|
||||
assert p_resp.status_code == 200
|
||||
assert p_resp.get_json()["zoom_start_url"] == "https://zoom.us/s/987654321?zak=abc"
|
||||
|
||||
g_resp = test_client.get(f"/api/appointments/{sid}")
|
||||
assert g_resp.status_code == 200
|
||||
fetched = g_resp.get_json()
|
||||
assert fetched["zoom_start_url"] is None
|
||||
assert fetched["zoom_join_url"] == "https://zoom.us/j/987654321"
|
||||
Reference in new issue
Block a user