From 0466c1a83f00f22dbb41afeca0174ec5d397e976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 12 Sep 2026 18:05:57 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20rename=20app=5Fuser=20in?= =?UTF-8?q?=20the=20six=20FromRow=20entities=20the=20port=20missed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PagedList reads with SELECT * + FromRow need field names to match columns; Attendance, Enrollment, ExamAttempt, ExamResult, ExamAnswer and AnswerImage carried a bare `user` field, so any paged read 500'd with a database error (found live by e2e's full_user_journey via GET /events/{id}/attendance). Attribute-only: query_as! sites are unaffected, no .sqlx refresh needed. --- src/domain/answer_image.rs | 7 ++++++- src/domain/attendance.rs | 1 + src/domain/enrollment.rs | 1 + src/domain/exam_answer.rs | 7 ++++++- src/domain/exam_attempt.rs | 1 + src/domain/exam_result.rs | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/domain/answer_image.rs b/src/domain/answer_image.rs index 19fad3c..18dbddd 100644 --- a/src/domain/answer_image.rs +++ b/src/domain/answer_image.rs @@ -44,7 +44,11 @@ impl AnswerImageId { /// The underscore-joined wire form (`{question}_{user}[_{seq}]`). pub fn key(&self) -> String { - key::sitting(self.question.key().as_str(), self.user.key().as_str(), self.seq) + key::sitting( + self.question.key().as_str(), + self.user.key().as_str(), + self.seq, + ) } } @@ -56,6 +60,7 @@ impl AnswerImageId { pub struct AnswerImage { pub(crate) exam: ExamId, pub(crate) question: ExamQuestionId, + #[sqlx(rename = "app_user")] pub(crate) user: UserId, /// Which sitting this drawing belongs to — 1 for the first attempt, /// counting up, so retakes accumulate instead of overwriting. diff --git a/src/domain/attendance.rs b/src/domain/attendance.rs index 1306f2f..8ed3e84 100644 --- a/src/domain/attendance.rs +++ b/src/domain/attendance.rs @@ -54,6 +54,7 @@ impl AttendanceStatus { #[derive(Debug, Clone, sqlx::FromRow)] pub struct Attendance { pub(crate) event: EventId, + #[sqlx(rename = "app_user")] pub(crate) user: UserId, pub(crate) status: AttendanceStatus, pub(crate) marked_by: UserId, diff --git a/src/domain/enrollment.rs b/src/domain/enrollment.rs index 2528194..cc1c0dc 100644 --- a/src/domain/enrollment.rs +++ b/src/domain/enrollment.rs @@ -37,6 +37,7 @@ impl EnrollmentId { #[derive(Debug, Clone, sqlx::FromRow)] pub struct Enrollment { pub(crate) course: CourseId, + #[sqlx(rename = "app_user")] pub(crate) user: UserId, pub(crate) enrolled_by: UserId, pub(crate) source: Option, diff --git a/src/domain/exam_answer.rs b/src/domain/exam_answer.rs index c603726..c8388e0 100644 --- a/src/domain/exam_answer.rs +++ b/src/domain/exam_answer.rs @@ -31,7 +31,11 @@ impl ExamAnswerId { /// The underscore-joined wire form (`{question}_{user}[_{seq}]`). pub fn key(&self) -> String { - key::sitting(self.question.key().as_str(), self.user.key().as_str(), self.seq) + key::sitting( + self.question.key().as_str(), + self.user.key().as_str(), + self.seq, + ) } } @@ -59,6 +63,7 @@ impl AnswerText { pub struct ExamAnswer { pub(crate) exam: ExamId, pub(crate) question: ExamQuestionId, + #[sqlx(rename = "app_user")] pub(crate) user: UserId, pub(crate) seq: i64, pub(crate) selected: Option, diff --git a/src/domain/exam_attempt.rs b/src/domain/exam_attempt.rs index bc4b5de..56b6bae 100644 --- a/src/domain/exam_attempt.rs +++ b/src/domain/exam_attempt.rs @@ -64,6 +64,7 @@ impl AttemptStatus { #[derive(Debug, Clone, sqlx::FromRow)] pub struct ExamAttempt { pub(crate) exam: ExamId, + #[sqlx(rename = "app_user")] pub(crate) user: UserId, pub(crate) seq: i64, pub(crate) started_at: Timestamp, diff --git a/src/domain/exam_result.rs b/src/domain/exam_result.rs index 8ea2764..4c13b18 100644 --- a/src/domain/exam_result.rs +++ b/src/domain/exam_result.rs @@ -72,6 +72,7 @@ impl Mark { #[derive(Debug, Clone, sqlx::FromRow)] pub struct ExamResult { pub(crate) exam: ExamId, + #[sqlx(rename = "app_user")] pub(crate) user: UserId, pub(crate) seq: i64, pub(crate) mark: Mark,