diff --git a/server/domain/src/form/models.rs b/server/domain/src/form/models.rs index 9012c498..38ae8d2d 100644 --- a/server/domain/src/form/models.rs +++ b/server/domain/src/form/models.rs @@ -274,6 +274,7 @@ pub struct PostedAnswersUpdateSchema { #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct Answer { + pub answer_id: AnswerId, pub question_id: QuestionId, pub answer: String, } diff --git a/server/infra/resource/src/database/form.rs b/server/infra/resource/src/database/form.rs index d717c25b..a5d39bf7 100644 --- a/server/infra/resource/src/database/form.rs +++ b/server/infra/resource/src/database/form.rs @@ -592,6 +592,7 @@ impl FormDatabase for ConnectionPool { .iter() .map(|rs| { Ok::(AnswerDto { + answer_id: rs.try_get("", "answer_id")?, question_id: rs.try_get("", "question_id")?, answer: rs.try_get("", "answer")?, }) @@ -697,6 +698,7 @@ impl FormDatabase for ConnectionPool { }) .map(|rs| { Ok::(AnswerDto { + answer_id: rs.try_get("", "answer_id")?, question_id: rs.try_get("", "question_id")?, answer: rs.try_get("", "answer")?, }) @@ -796,6 +798,7 @@ impl FormDatabase for ConnectionPool { }) .map(|rs| { Ok::(AnswerDto { + answer_id: rs.try_get("", "answer_id")?, question_id: rs.try_get("", "question_id")?, answer: rs.try_get("", "answer")?, }) diff --git a/server/infra/resource/src/dto.rs b/server/infra/resource/src/dto.rs index fea0ae30..fd24b9e3 100644 --- a/server/infra/resource/src/dto.rs +++ b/server/infra/resource/src/dto.rs @@ -136,6 +136,7 @@ impl TryFrom for domain::form::models::SimpleForm { } pub struct AnswerDto { + pub answer_id: i32, pub question_id: i32, pub answer: String, } @@ -145,11 +146,13 @@ impl TryFrom for domain::form::models::Answer { fn try_from( AnswerDto { + answer_id, question_id, answer, }: AnswerDto, ) -> Result { Ok(domain::form::models::Answer { + answer_id: answer_id.into(), question_id: question_id.into(), answer, })