From f89c4f8d1cbcb6aac2bcb53d422045469fea414a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 12 Jul 2026 23:26:27 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20docs:=20user=20search=20in=20end?= =?UTF-8?q?point=20table,=20users=20tag,=20curl=20tour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ++++++- src/lib.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d1e92e0..d48bde5 100644 --- a/README.md +++ b/README.md @@ -217,6 +217,7 @@ logged-in user. | POST | `/auth/logout` | no | Clear session (no-op if none) | | GET | `/auth/me` | student | Current user (incl. `role` and personal info) | | PATCH | `/users/me` | student | Update own personal info (see below) | +| GET | `/users/search` | teacher | `?q=&role=` — find users by username/name fragment (pickers); ≤10 refs, no contact info | | GET | `/users` | admin | List all users | | GET | `/users/{id}` | admin | Get one user | | PATCH | `/users/{id}/role` | admin | `{role}` — set a user's role | @@ -537,7 +538,11 @@ curl -s -b $JAR $BASE/events/$EV/attendance -H 'content-type: application/json' -d '{"status":"present"}' curl -s -b $JAR $BASE/events/$EV/attendance -# courses + weighted marks (as a teacher; $SID is a student's user id) +# courses + weighted marks (as a teacher) +# find the student to enroll (here: a registered user "veli"): fragment +# search over username/name, role-narrowed (teacher+) +SID=$(curl -s -b $JAR "$BASE/users/search?q=vel&role=student" \ + | grep -o '"id":"[^"]*"' | head -1 | cut -d'"' -f4) CO=$(curl -s -b $JAR $BASE/courses -H 'content-type: application/json' \ -d '{"title":"algebra"}' | grep -o '"id":"[^"]*"' | head -1 | cut -d'"' -f4) curl -s -b $JAR $BASE/courses/$CO/enrollments -H 'content-type: application/json' \ diff --git a/src/lib.rs b/src/lib.rs index 032d9ca..e81e874 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,7 @@ use crate::state::AppState; tags( (name = "meta", description = "Liveness and service metadata"), (name = "auth", description = "Registration, login, session lifecycle"), - (name = "users", description = "User info: self-service profile, plus listing, lookup, and role/profile administration (admin only)"), + (name = "users", description = "User info: self-service profile, name search for the pickers (teacher+, optionally role-filtered), plus listing, lookup, and role/profile administration (admin only)"), (name = "notes", description = "Per-user notes CRUD"), (name = "events", description = "Events and attendance"), (name = "courses", description = "Courses, enrollment, course exams, and course sessions"),