(
pool: &mysql::Pool,
teller_name: String,
branch_name: String,
)
| 92 | } |
| 93 | |
| 94 | pub fn create_teller( |
| 95 | pool: &mysql::Pool, |
| 96 | teller_name: String, |
| 97 | branch_name: String, |
| 98 | ) -> Result<(), PersistenceError> { |
| 99 | if teller_name.replace(' ', "").trim().is_empty() { |
| 100 | return Err(PersistenceError::EmptyTellerName); |
| 101 | } |
| 102 | |
| 103 | if branch_name.replace(' ', "").trim().is_empty() { |
| 104 | return Err(PersistenceError::EmptyBranch); |
| 105 | } |
| 106 | |
| 107 | let mut conn = pool.get_conn()?; |
| 108 | |
| 109 | let last_insert_id = insert_teller_data( |
| 110 | &mut conn, |
| 111 | teller_name.to_lowercase(), |
| 112 | branch_name.to_lowercase(), |
| 113 | )?; |
| 114 | |
| 115 | if last_insert_id > 0 { |
| 116 | Ok(()) |
| 117 | } else { |
| 118 | Err(PersistenceError::Unknown) |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | pub fn create_customer( |
| 123 | pool: &mysql::Pool, |
no test coverage detected