add pre-commit config

This commit is contained in:
Johannes Heuel
2022-08-22 20:07:39 +02:00
parent 1ed0f5f95b
commit b4e9fd499f
13 changed files with 42 additions and 32 deletions

View File

@@ -1,16 +1,16 @@
extern crate diesel;
use backend::models::*;
use diesel::prelude::*;
use backend::*;
use diesel::prelude::*;
type DbError = Box<dyn std::error::Error + Send + Sync>;
pub fn list_pictures(conn: &PgConnection) -> Result<Vec<Picture>, DbError> {
use self::schema::pictures::dsl::*;
Ok(pictures
.limit(50)
.order_by(created_at.desc())
.load::<Picture>(conn)?)
}
}