Restore Person::read

pull/3707/head
dull b 2023-07-24 03:32:16 +00:00
parent f77b0d758f
commit 32ad580239
1 changed files with 8 additions and 0 deletions

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?;