Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sandreae committed Apr 21, 2023
1 parent b66c652 commit 95a73ca
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions aquadoggo/src/db/models/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ pub fn parse_document_view_field_rows(
// document_view_fields
// - if it is a relation list value type:
// - if the row.value is None then this list is empty and we should create a relation list with no items
// - otherwise safely unwrap each item and parse into a DocumentId/DocumentViewId then push to the suitable
// - otherwise safely unwrap each item and parse into a DocumentId/DocumentViewId then push to the suitable
// list vec
//
document_field_rows.iter().for_each(|row| {
Expand All @@ -262,7 +262,9 @@ pub fn parse_document_view_field_rows(
&row.name,
DocumentViewValue::new(
&row.operation_id.parse::<OperationId>().unwrap(),
&OperationValue::Boolean(row.value.as_ref().unwrap().parse::<bool>().unwrap()),
&OperationValue::Boolean(
row.value.as_ref().unwrap().parse::<bool>().unwrap(),
),
),
);
}
Expand All @@ -271,7 +273,9 @@ pub fn parse_document_view_field_rows(
&row.name,
DocumentViewValue::new(
&row.operation_id.parse::<OperationId>().unwrap(),
&OperationValue::Integer(row.value.as_ref().unwrap().parse::<i64>().unwrap()),
&OperationValue::Integer(
row.value.as_ref().unwrap().parse::<i64>().unwrap(),
),
),
);
}
Expand Down Expand Up @@ -308,7 +312,9 @@ pub fn parse_document_view_field_rows(
// to the document_view_fields yet.
"relation_list" => {
match relation_lists.get_mut(&row.name) {
Some((_, list)) => list.push(row.value.as_ref().unwrap().parse::<DocumentId>().unwrap()),
Some((_, list)) => {
list.push(row.value.as_ref().unwrap().parse::<DocumentId>().unwrap())
}
None => {
let list = match row.value.as_ref() {
Some(document_id) => {
Expand All @@ -327,7 +333,11 @@ pub fn parse_document_view_field_rows(
DocumentViewValue::new(
&row.operation_id.parse::<OperationId>().unwrap(),
&OperationValue::PinnedRelation(PinnedRelation::new(
row.value.as_ref().unwrap().parse::<DocumentViewId>().unwrap(),
row.value
.as_ref()
.unwrap()
.parse::<DocumentViewId>()
.unwrap(),
)),
),
);
Expand All @@ -336,9 +346,13 @@ pub fn parse_document_view_field_rows(
// document_view_fields yet.
"pinned_relation_list" => {
match pinned_relation_lists.get_mut(&row.name) {
Some((_, list)) => {
list.push(row.value.as_ref().unwrap().parse::<DocumentViewId>().unwrap())
}
Some((_, list)) => list.push(
row.value
.as_ref()
.unwrap()
.parse::<DocumentViewId>()
.unwrap(),
),
None => {
let list = match row.value.as_ref() {
Some(document_view_id) => {
Expand Down

0 comments on commit 95a73ca

Please sign in to comment.