students: add face reference from the profile photo

POST /api/students/:id/face-refs/from-profile inserts a student_face_refs
row straight from students.photo_path, with no new upload. The file is copied
under a fresh name via storage.copyObject: deleting a ref unlinks its
photo_path, so reusing the original would destroy the profile photo. Path must
start with /uploads/, otherwise 400.

The faces modal gets a "Взять из фото профиля" button, hidden unless the
student has an /uploads/ profile photo (state from GET /api/students/:id/profile).
.face-ref-profile-btn[hidden]{display:none} is required — .btn-primary sets
inline-flex, which overrides the UA [hidden] rule.
This commit is contained in:
dev
2026-10-10 13:31:39 +03:00
parent 60e701d1d3
commit 8847028b7e
5 changed files with 93 additions and 1 deletions
+1
View File
@@ -235,6 +235,7 @@
<div style="display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:6px">
<input type="file" id="faceRefFile" accept="image/*" hidden>
<button type="button" class="btn-primary ghost" id="faceRefAddBtn">Добавить эталон</button>
<button type="button" class="btn-primary ghost face-ref-profile-btn" id="faceRefProfileBtn" hidden>Взять из фото профиля</button>
<span class="hint">1–2 фото анфас при хорошем свете. После добавления система пересчитает лица на всех фото.</span>
</div>
</div>