forge
Explore
Log in

Don't you dare go Hollow

Rename app_user in the six FromRow entities the port missed

Browse files at this commit

0466c1a83f00f22dbb41afeca0174ec5d397e976Ahmet Kaan GümüşParent: 18e1b7b
  • fix
    • rename app_user in the six FromRow entities the port missed
Show full message
🐛 fix: rename app_user in the six FromRow entities the port missed

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.rsmodified+6 -1
@@ -44,7 +44,11 @@ impl AnswerImageId {
44 44
45 /// The underscore-joined wire form (`{question}_{user}[_{seq}]`).45 /// The underscore-joined wire form (`{question}_{user}[_{seq}]`).
46 pub fn key(&self) -> String {46 pub fn key(&self) -> String {
47- key::sitting(self.question.key().as_str(), self.user.key().as_str(), self.seq)47+ key::sitting(
48+ self.question.key().as_str(),
49+ self.user.key().as_str(),
50+ self.seq,
51+ )
48 }52 }
49 }53 }
50 54
@@ -56,6 +60,7 @@ impl AnswerImageId {
56 pub struct AnswerImage {60 pub struct AnswerImage {
57 pub(crate) exam: ExamId,61 pub(crate) exam: ExamId,
58 pub(crate) question: ExamQuestionId,62 pub(crate) question: ExamQuestionId,
63+ #[sqlx(rename = "app_user")]
59 pub(crate) user: UserId,64 pub(crate) user: UserId,
60 /// Which sitting this drawing belongs to — 1 for the first attempt,65 /// Which sitting this drawing belongs to — 1 for the first attempt,
61 /// counting up, so retakes accumulate instead of overwriting.66 /// counting up, so retakes accumulate instead of overwriting.
src/domain/attendance.rsmodified+1 -0
@@ -54,6 +54,7 @@ impl AttendanceStatus {
54 #[derive(Debug, Clone, sqlx::FromRow)]54 #[derive(Debug, Clone, sqlx::FromRow)]
55 pub struct Attendance {55 pub struct Attendance {
56 pub(crate) event: EventId,56 pub(crate) event: EventId,
57+ #[sqlx(rename = "app_user")]
57 pub(crate) user: UserId,58 pub(crate) user: UserId,
58 pub(crate) status: AttendanceStatus,59 pub(crate) status: AttendanceStatus,
59 pub(crate) marked_by: UserId,60 pub(crate) marked_by: UserId,
src/domain/enrollment.rsmodified+1 -0
@@ -37,6 +37,7 @@ impl EnrollmentId {
37 #[derive(Debug, Clone, sqlx::FromRow)]37 #[derive(Debug, Clone, sqlx::FromRow)]
38 pub struct Enrollment {38 pub struct Enrollment {
39 pub(crate) course: CourseId,39 pub(crate) course: CourseId,
40+ #[sqlx(rename = "app_user")]
40 pub(crate) user: UserId,41 pub(crate) user: UserId,
41 pub(crate) enrolled_by: UserId,42 pub(crate) enrolled_by: UserId,
42 pub(crate) source: Option<ClassGroupId>,43 pub(crate) source: Option<ClassGroupId>,
src/domain/exam_answer.rsmodified+6 -1
@@ -31,7 +31,11 @@ impl ExamAnswerId {
31 31
32 /// The underscore-joined wire form (`{question}_{user}[_{seq}]`).32 /// The underscore-joined wire form (`{question}_{user}[_{seq}]`).
33 pub fn key(&self) -> String {33 pub fn key(&self) -> String {
34- key::sitting(self.question.key().as_str(), self.user.key().as_str(), self.seq)34+ key::sitting(
35+ self.question.key().as_str(),
36+ self.user.key().as_str(),
37+ self.seq,
38+ )
35 }39 }
36 }40 }
37 41
@@ -59,6 +63,7 @@ impl AnswerText {
59 pub struct ExamAnswer {63 pub struct ExamAnswer {
60 pub(crate) exam: ExamId,64 pub(crate) exam: ExamId,
61 pub(crate) question: ExamQuestionId,65 pub(crate) question: ExamQuestionId,
66+ #[sqlx(rename = "app_user")]
62 pub(crate) user: UserId,67 pub(crate) user: UserId,
63 pub(crate) seq: i64,68 pub(crate) seq: i64,
64 pub(crate) selected: Option<ChoiceId>,69 pub(crate) selected: Option<ChoiceId>,
src/domain/exam_attempt.rsmodified+1 -0
@@ -64,6 +64,7 @@ impl AttemptStatus {
64 #[derive(Debug, Clone, sqlx::FromRow)]64 #[derive(Debug, Clone, sqlx::FromRow)]
65 pub struct ExamAttempt {65 pub struct ExamAttempt {
66 pub(crate) exam: ExamId,66 pub(crate) exam: ExamId,
67+ #[sqlx(rename = "app_user")]
67 pub(crate) user: UserId,68 pub(crate) user: UserId,
68 pub(crate) seq: i64,69 pub(crate) seq: i64,
69 pub(crate) started_at: Timestamp,70 pub(crate) started_at: Timestamp,
src/domain/exam_result.rsmodified+1 -0
@@ -72,6 +72,7 @@ impl Mark {
72 #[derive(Debug, Clone, sqlx::FromRow)]72 #[derive(Debug, Clone, sqlx::FromRow)]
73 pub struct ExamResult {73 pub struct ExamResult {
74 pub(crate) exam: ExamId,74 pub(crate) exam: ExamId,
75+ #[sqlx(rename = "app_user")]
75 pub(crate) user: UserId,76 pub(crate) user: UserId,
76 pub(crate) seq: i64,77 pub(crate) seq: i64,
77 pub(crate) mark: Mark,78 pub(crate) mark: Mark,