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
@@ -289,6 +289,7 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;b
.face-stage img{max-width:100%;max-height:74vh;display:block}
.face-stage .face-box{pointer-events:auto}
.face-empty{color:var(--muted);font-size:.78rem}
.face-ref-profile-btn[hidden]{display:none}
.btn-primary.ghost.spinning svg{animation:spin 1s linear infinite}
.p-faces{position:absolute;right:8px;top:8px;background:rgba(15,23,42,.72);color:#e2e8f0;font-size:.68rem;font-weight:700;padding:2px 7px;border-radius:999px;pointer-events:none;display:inline-flex;align-items:center;gap:4px}
.p-faces svg{width:12px;height:12px}