mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-19 22:41:13 +00:00
refactor: struct name
This commit is contained in:
parent
d8a269edd3
commit
139248dc4c
1 changed files with 3 additions and 3 deletions
|
|
@ -8,7 +8,7 @@ use serde::Serialize;
|
|||
pub const PAGE_SIZE: u64 = 20;
|
||||
|
||||
#[derive(FromQueryResult, Serialize)]
|
||||
pub struct ApplicationResult {
|
||||
pub struct CandidateParentResult {
|
||||
pub application: i32,
|
||||
pub name: Option<String>,
|
||||
pub surname: Option<String>,
|
||||
|
|
@ -30,7 +30,7 @@ impl Query {
|
|||
pub async fn list_candidates(
|
||||
db: &DbConn,
|
||||
field_of_study_opt: Option<String>,
|
||||
) -> Result<Vec<ApplicationResult>, DbErr> {
|
||||
) -> Result<Vec<CandidateParentResult>, DbErr> {
|
||||
let select = Candidate::find();
|
||||
if let Some(study) = field_of_study_opt {
|
||||
select.filter(candidate::Column::Study.eq(study))
|
||||
|
|
@ -40,7 +40,7 @@ impl Query {
|
|||
.join(JoinType::InnerJoin, candidate::Relation::Parent.def())
|
||||
.column_as(parent::Column::Name, "parent_name")
|
||||
.column_as(parent::Column::Surname, "parent_surname")
|
||||
.into_model::<ApplicationResult>()
|
||||
.into_model::<CandidateParentResult>()
|
||||
.paginate(db, PAGE_SIZE)
|
||||
.fetch()
|
||||
.await
|
||||
|
|
|
|||
Loading…
Reference in a new issue