Add update_person route

This commit is contained in:
Ben Grant 2023-05-13 17:13:04 +10:00
parent d2a94b078c
commit cd18427d1b
8 changed files with 106 additions and 26 deletions

View file

@ -80,7 +80,7 @@ impl Adaptor for SqlAdaptor {
};
Ok(
match person::Entity::find_by_id((event_id, person.name))
match person::Entity::find_by_id((person.name, event_id))
.one(&self.db)
.await?
{
@ -156,7 +156,16 @@ impl SqlAdaptor {
// Connect to the database
let db = Database::connect(&connection_string).await.unwrap();
println!("Connected to database at {}", connection_string);
println!(
"{} Connected to database at {}",
match db {
DatabaseConnection::SqlxMySqlPoolConnection(_) => "🐬",
DatabaseConnection::SqlxPostgresPoolConnection(_) => "🐘",
DatabaseConnection::SqlxSqlitePoolConnection(_) => "🪶",
DatabaseConnection::Disconnected => panic!("Failed to connect"),
},
connection_string
);
// Setup tables
Migrator::up(&db, None).await.unwrap();