Restore Person::read

This commit is contained in:
dull b 2023-07-24 03:32:16 +00:00
parent f77b0d758f
commit 32ad580239

View file

@ -19,6 +19,14 @@ impl Crud for Person {
type InsertForm = PersonInsertForm; type InsertForm = PersonInsertForm;
type UpdateForm = PersonUpdateForm; type UpdateForm = PersonUpdateForm;
type IdType = PersonId; type IdType = PersonId;
async fn read(pool: &mut DbPool<'_>, person_id: PersonId) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
person::table
.filter(person::deleted.eq(false))
.find(person_id)
.first::<Self>(conn)
.await
}
async fn delete(pool: &mut DbPool<'_>, person_id: PersonId) -> Result<usize, Error> { async fn delete(pool: &mut DbPool<'_>, person_id: PersonId) -> Result<usize, Error> {
let conn = &mut get_conn(pool).await?; let conn = &mut get_conn(pool).await?;