Added account member API.
This commit is contained in:
@@ -106,6 +106,14 @@ where
|
||||
|
||||
fn classify_delete_error(error: DatabaseError) -> RepositoryError {
|
||||
match &error {
|
||||
DatabaseError::ForeignKeyViolation {
|
||||
constraint: Constraint::AccountMemberAccount,
|
||||
..
|
||||
} => RepositoryError::ReferenceViolation {
|
||||
relation: ReferenceRelation::AccountMember,
|
||||
kind: ReferenceViolationKind::StillReferenced,
|
||||
source: error,
|
||||
},
|
||||
DatabaseError::ForeignKeyViolation {
|
||||
constraint: Constraint::TransactionAccount,
|
||||
..
|
||||
@@ -153,6 +161,19 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn classifies_account_member_account_delete_foreign_key_constraint() {
|
||||
let error = classify_delete_error(foreign_key_violation(Constraint::AccountMemberAccount));
|
||||
assert!(matches!(
|
||||
error,
|
||||
RepositoryError::ReferenceViolation {
|
||||
relation: ReferenceRelation::AccountMember,
|
||||
kind: ReferenceViolationKind::StillReferenced,
|
||||
..
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn classifies_account_delete_foreign_key_constraint() {
|
||||
let error = classify_delete_error(foreign_key_violation(
|
||||
|
||||
Reference in New Issue
Block a user