Cleanup some more.
Get rid of lib.rs, and move main entry point to main.rs.
This commit is contained in:
parent
ce1e9c6190
commit
16a1b75643
@ -8,10 +8,6 @@ build = "src/build.rs"
|
||||
[build-dependencies]
|
||||
ructe = { version = "^0.3.2", features = ["sass", "mime02"] }
|
||||
|
||||
[[bin]]
|
||||
name = "rphotosadm"
|
||||
path = "src/rphotosadm.rs"
|
||||
|
||||
[dependencies]
|
||||
nickel = "~0.10.0"
|
||||
nickel-jwt-session = "~0.10.0"
|
||||
|
@ -5,7 +5,7 @@ use diesel::pg::PgConnection;
|
||||
use diesel::prelude::*;
|
||||
use photosdir::PhotosDir;
|
||||
use rexif::{ExifData, ExifEntry, ExifTag, TagValue};
|
||||
use rphotos::models::{Modification, Photo, Camera};
|
||||
use models::{Modification, Photo, Camera};
|
||||
use std::path::Path;
|
||||
|
||||
pub fn crawl(db: &PgConnection, photos: &PhotosDir, only_in: &Path)
|
||||
@ -44,7 +44,7 @@ fn save_photo(db: &PgConnection,
|
||||
};
|
||||
if let Some((lat, long)) = find_position(&exif)? {
|
||||
debug!("Position for {} is {} {}", file_path, lat, long);
|
||||
use rphotos::schema::positions::dsl::*;
|
||||
use schema::positions::dsl::*;
|
||||
if let Ok((pos, clat, clong)) =
|
||||
positions.filter(photo_id.eq(photo.id))
|
||||
.select((id, latitude, longitude))
|
||||
@ -59,7 +59,7 @@ fn save_photo(db: &PgConnection,
|
||||
}
|
||||
} else {
|
||||
info!("Position for {} is {} {}", file_path, lat, long);
|
||||
use rphotos::models::NewPosition;
|
||||
use models::NewPosition;
|
||||
insert(&NewPosition {
|
||||
photo_id: photo.id,
|
||||
latitude: (lat * 1e6) as i32,
|
||||
|
@ -4,14 +4,14 @@ use diesel::prelude::*;
|
||||
use diesel::result::Error as DieselError;
|
||||
use diesel::update;
|
||||
use photosdir::PhotosDir;
|
||||
use rphotos::models::{Modification, Photo};
|
||||
use models::{Modification, Photo};
|
||||
use std::io::prelude::*;
|
||||
|
||||
pub fn one(db: &PgConnection,
|
||||
photodir: &PhotosDir,
|
||||
tpath: &str)
|
||||
-> Result<(), Error> {
|
||||
use rphotos::schema::photos::dsl::*;
|
||||
use schema::photos::dsl::*;
|
||||
match update(photos.filter(path.eq(&tpath)))
|
||||
.set(is_public.eq(true))
|
||||
.get_result::<Photo>(db) {
|
||||
@ -45,7 +45,7 @@ pub fn by_file_list<In: BufRead + Sized>(db: &PgConnection,
|
||||
fn register_photo(db: &PgConnection,
|
||||
tpath: &str)
|
||||
-> Result<Photo, DieselError> {
|
||||
use rphotos::schema::photos::dsl::{photos, is_public};
|
||||
use schema::photos::dsl::{photos, is_public};
|
||||
let photo =
|
||||
match Photo::create_or_set_basics(&db, &tpath, None, 0, None)? {
|
||||
Modification::Created(photo) => photo,
|
||||
|
@ -3,7 +3,7 @@ use chrono::naive::NaiveDateTime;
|
||||
use diesel;
|
||||
use diesel::pg::PgConnection;
|
||||
use diesel::prelude::*;
|
||||
use rphotos::models::{Modification, Person, Photo, Place, Tag};
|
||||
use models::{Modification, Person, Photo, Place, Tag};
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::result;
|
||||
@ -123,9 +123,9 @@ pub fn photo_by_path(db: &PgConnection,
|
||||
}
|
||||
|
||||
fn tag_photo(db: &PgConnection, thephoto: &Photo, tagname: &str) -> Result<()> {
|
||||
use rphotos::models::{NewPhotoTag, NewTag, PhotoTag};
|
||||
use models::{NewPhotoTag, NewTag, PhotoTag};
|
||||
let tag = {
|
||||
use rphotos::schema::tags::dsl::*;
|
||||
use schema::tags::dsl::*;
|
||||
tags.filter(tag_name.eq(tagname))
|
||||
.first::<Tag>(db)
|
||||
.or_else(|_| {
|
||||
@ -138,7 +138,7 @@ fn tag_photo(db: &PgConnection, thephoto: &Photo, tagname: &str) -> Result<()> {
|
||||
})
|
||||
}?;
|
||||
debug!(" tag {:?}", tag);
|
||||
use rphotos::schema::photo_tags::dsl::*;
|
||||
use schema::photo_tags::dsl::*;
|
||||
let q = photo_tags.filter(photo_id.eq(thephoto.id))
|
||||
.filter(tag_id.eq(tag.id));
|
||||
if let Ok(result) = q.first::<PhotoTag>(db) {
|
||||
@ -157,9 +157,9 @@ fn tag_photo(db: &PgConnection, thephoto: &Photo, tagname: &str) -> Result<()> {
|
||||
}
|
||||
|
||||
fn person_photo(db: &PgConnection, photo: &Photo, name: &str) -> Result<()> {
|
||||
use rphotos::models::{NewPerson, NewPhotoPerson, PhotoPerson};
|
||||
use models::{NewPerson, NewPhotoPerson, PhotoPerson};
|
||||
let person = {
|
||||
use rphotos::schema::people::dsl::*;
|
||||
use schema::people::dsl::*;
|
||||
people.filter(person_name.eq(name))
|
||||
.first::<Person>(db)
|
||||
.or_else(|_| {
|
||||
@ -172,7 +172,7 @@ fn person_photo(db: &PgConnection, photo: &Photo, name: &str) -> Result<()> {
|
||||
})
|
||||
}?;
|
||||
debug!(" person {:?}", person);
|
||||
use rphotos::schema::photo_people::dsl::*;
|
||||
use schema::photo_people::dsl::*;
|
||||
let q = photo_people.filter(photo_id.eq(photo.id))
|
||||
.filter(person_id.eq(person.id));
|
||||
if let Ok(result) = q.first::<PhotoPerson>(db) {
|
||||
@ -193,9 +193,9 @@ fn person_photo(db: &PgConnection, photo: &Photo, name: &str) -> Result<()> {
|
||||
}
|
||||
|
||||
fn place_photo(db: &PgConnection, photo: &Photo, name: &str) -> Result<()> {
|
||||
use rphotos::models::{NewPhotoPlace, NewPlace, PhotoPlace};
|
||||
use models::{NewPhotoPlace, NewPlace, PhotoPlace};
|
||||
let place = {
|
||||
use rphotos::schema::places::dsl::*;
|
||||
use schema::places::dsl::*;
|
||||
places.filter(place_name.eq(name))
|
||||
.first::<Place>(db)
|
||||
.or_else(|_| {
|
||||
@ -208,7 +208,7 @@ fn place_photo(db: &PgConnection, photo: &Photo, name: &str) -> Result<()> {
|
||||
})
|
||||
}?;
|
||||
debug!(" place {:?}", place);
|
||||
use rphotos::schema::photo_places::dsl::*;
|
||||
use schema::photo_places::dsl::*;
|
||||
photo_places.filter(photo_id.eq(photo.id))
|
||||
.filter(place_id.eq(place.id))
|
||||
.first::<PhotoPlace>(db)
|
||||
@ -238,7 +238,7 @@ fn grade_photo(db: &PgConnection, photo: &mut Photo, name: &str) -> Result<()> {
|
||||
photo)))
|
||||
}
|
||||
});
|
||||
use rphotos::schema::photos::dsl::*;
|
||||
use schema::photos::dsl::*;
|
||||
let n = diesel::update(photos.find(photo.id))
|
||||
.set(grade.eq(photo.grade))
|
||||
.execute(db)
|
||||
|
@ -4,10 +4,10 @@ use diesel::expression::dsl::{count_star, sql};
|
||||
use diesel::pg::PgConnection;
|
||||
use diesel::prelude::*;
|
||||
use diesel::types::{BigInt, Double, Nullable, Text, Timestamp};
|
||||
use rphotos::schema::people::dsl::people;
|
||||
use rphotos::schema::photos::dsl::photos;
|
||||
use rphotos::schema::places::dsl::places;
|
||||
use rphotos::schema::tags::dsl::tags;
|
||||
use schema::people::dsl::people;
|
||||
use schema::photos::dsl::photos;
|
||||
use schema::places::dsl::places;
|
||||
use schema::tags::dsl::tags;
|
||||
|
||||
sql_function!(date_part,
|
||||
date_part_t,
|
||||
@ -25,7 +25,7 @@ pub fn show_stats(db: &PgConnection) -> Result<(), Error> {
|
||||
|
||||
// Something like this should be possible, I guess?
|
||||
//
|
||||
// use rphotos::schema::photos::dsl::date;
|
||||
// use schema::photos::dsl::date;
|
||||
// let year = date_part("year", date).aliased("y");
|
||||
// println!("Count per year: {:?}",
|
||||
// photos.select((year, count_star()))
|
||||
|
@ -9,7 +9,7 @@ use rand::os::OsRng;
|
||||
use std::iter::Iterator;
|
||||
|
||||
pub fn list(db: &PgConnection) -> Result<(), Error> {
|
||||
use rphotos::schema::users::dsl::*;
|
||||
use schema::users::dsl::*;
|
||||
println!("Existing users: {:?}.",
|
||||
users.select(username).load::<String>(db)?);
|
||||
Ok(())
|
||||
@ -18,7 +18,7 @@ pub fn list(db: &PgConnection) -> Result<(), Error> {
|
||||
pub fn passwd(db: &PgConnection, uname: &str) -> Result<(), Error> {
|
||||
let pword = random_password(14);
|
||||
let hashword = make_password(&pword);
|
||||
use rphotos::schema::users::dsl::*;
|
||||
use schema::users::dsl::*;
|
||||
match update(users.filter(username.eq(&uname)))
|
||||
.set(password.eq(&hashword))
|
||||
.execute(db)? {
|
||||
@ -26,7 +26,7 @@ pub fn passwd(db: &PgConnection, uname: &str) -> Result<(), Error> {
|
||||
println!("Updated password for {:?} to {:?}", uname, pword);
|
||||
}
|
||||
0 => {
|
||||
use rphotos::models::NewUser;
|
||||
use models::NewUser;
|
||||
insert(&NewUser {
|
||||
username: &uname,
|
||||
password: &hashword,
|
||||
|
@ -1,9 +0,0 @@
|
||||
#![recursion_limit="128"]
|
||||
extern crate chrono;
|
||||
#[macro_use]
|
||||
extern crate diesel;
|
||||
#[macro_use]
|
||||
extern crate diesel_codegen;
|
||||
|
||||
pub mod schema;
|
||||
pub mod models;
|
@ -1,9 +1,11 @@
|
||||
extern crate rphotos;
|
||||
#![recursion_limit="128"]
|
||||
extern crate brotli2;
|
||||
extern crate clap;
|
||||
extern crate chrono;
|
||||
#[macro_use]
|
||||
extern crate diesel;
|
||||
#[macro_use]
|
||||
extern crate diesel_codegen;
|
||||
extern crate djangohashers;
|
||||
extern crate dotenv;
|
||||
extern crate env_logger;
|
||||
@ -30,11 +32,13 @@ extern crate xml;
|
||||
mod adm;
|
||||
mod env;
|
||||
mod memcachemiddleware;
|
||||
mod models;
|
||||
mod nickel_diesel;
|
||||
mod photosdir;
|
||||
mod photosdirmiddleware;
|
||||
mod pidfiles;
|
||||
mod requestloggermiddleware;
|
||||
mod schema;
|
||||
mod server;
|
||||
|
||||
use adm::{findphotos, makepublic, readkpa, users, storestatics};
|
@ -1,6 +1,6 @@
|
||||
use image::{self, FilterType, GenericImage, ImageError, ImageFormat};
|
||||
use rexif::{self, ExifData};
|
||||
use rphotos::models::Photo;
|
||||
use models::Photo;
|
||||
use std::{fs, io};
|
||||
use std::ffi::OsStr;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
@ -21,7 +21,7 @@ use nickel_diesel::{DieselMiddleware, DieselRequestExtensions};
|
||||
use nickel_jwt_session::{SessionMiddleware, SessionRequestExtensions,
|
||||
SessionResponseExtensions};
|
||||
use r2d2::NopErrorHandler;
|
||||
use rphotos::models::{Person, Photo, Place, Tag};
|
||||
use models::{Person, Photo, Place, Tag};
|
||||
|
||||
use env::{dburl, env_or, jwt_key, photos_dir};
|
||||
|
||||
@ -126,7 +126,7 @@ fn do_login<'mw>(req: &mut Request,
|
||||
let next = sanitize_next(form_data.get("next")).map(String::from);
|
||||
if let (Some(user), Some(pw)) = (form_data.get("user"),
|
||||
form_data.get("password")) {
|
||||
use rphotos::schema::users::dsl::*;
|
||||
use schema::users::dsl::*;
|
||||
if let Ok(hash) = users.filter(username.eq(user))
|
||||
.select(password)
|
||||
.first::<String>(c) {
|
||||
@ -223,7 +223,7 @@ fn show_image<'mw>(req: &Request,
|
||||
the_id: i32,
|
||||
size: SizeTag)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::photos::dsl::photos;
|
||||
use schema::photos::dsl::photos;
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
if let Ok(tphoto) = photos.find(the_id).first::<Photo>(c) {
|
||||
if req.authorized_user().is_some() || tphoto.is_public() {
|
||||
@ -258,14 +258,14 @@ fn get_image_data(req: &Request,
|
||||
fn tag_all<'mw>(req: &mut Request,
|
||||
res: Response<'mw>)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::tags::dsl::{id, tag_name, tags};
|
||||
use schema::tags::dsl::{id, tag_name, tags};
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
let query = tags.into_boxed();
|
||||
let query = if req.authorized_user().is_some() {
|
||||
query
|
||||
} else {
|
||||
use rphotos::schema::photo_tags::dsl as tp;
|
||||
use rphotos::schema::photos::dsl as p;
|
||||
use schema::photo_tags::dsl as tp;
|
||||
use schema::photos::dsl as p;
|
||||
query.filter(id.eq_any(tp::photo_tags
|
||||
.select(tp::tag_id)
|
||||
.filter(tp::photo_id
|
||||
@ -284,11 +284,11 @@ fn tag_one<'mw>(req: &mut Request,
|
||||
res: Response<'mw>,
|
||||
tslug: String)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::tags::dsl::{slug, tags};
|
||||
use schema::tags::dsl::{slug, tags};
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
if let Ok(tag) = tags.filter(slug.eq(tslug)).first::<Tag>(c) {
|
||||
use rphotos::schema::photos::dsl::{date, grade, id};
|
||||
use rphotos::schema::photo_tags::dsl::{photo_id, photo_tags, tag_id};
|
||||
use schema::photos::dsl::{date, grade, id};
|
||||
use schema::photo_tags::dsl::{photo_id, photo_tags, tag_id};
|
||||
return res.ok(|o| {
|
||||
templates::tag(o,
|
||||
req,
|
||||
@ -307,13 +307,13 @@ fn tag_one<'mw>(req: &mut Request,
|
||||
fn place_all<'mw>(req: &mut Request,
|
||||
res: Response<'mw>)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::places::dsl::{id, place_name, places};
|
||||
use schema::places::dsl::{id, place_name, places};
|
||||
let query = places.into_boxed();
|
||||
let query = if req.authorized_user().is_some() {
|
||||
query
|
||||
} else {
|
||||
use rphotos::schema::photo_places::dsl as pp;
|
||||
use rphotos::schema::photos::dsl as p;
|
||||
use schema::photo_places::dsl as pp;
|
||||
use schema::photos::dsl as p;
|
||||
query.filter(id.eq_any(pp::photo_places
|
||||
.select(pp::place_id)
|
||||
.filter(pp::photo_id
|
||||
@ -345,11 +345,11 @@ fn place_one<'mw>(req: &mut Request,
|
||||
res: Response<'mw>,
|
||||
tslug: String)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::places::dsl::{places, slug};
|
||||
use schema::places::dsl::{places, slug};
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
if let Ok(place) = places.filter(slug.eq(tslug)).first::<Place>(c) {
|
||||
use rphotos::schema::photos::dsl::{date, grade, id};
|
||||
use rphotos::schema::photo_places::dsl::{photo_id, photo_places,
|
||||
use schema::photos::dsl::{date, grade, id};
|
||||
use schema::photo_places::dsl::{photo_id, photo_places,
|
||||
place_id};
|
||||
return res.ok(|o| templates::place(
|
||||
o,
|
||||
@ -367,13 +367,13 @@ fn place_one<'mw>(req: &mut Request,
|
||||
fn person_all<'mw>(req: &mut Request,
|
||||
res: Response<'mw>)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::people::dsl::{id, people, person_name};
|
||||
use schema::people::dsl::{id, people, person_name};
|
||||
let query = people.into_boxed();
|
||||
let query = if req.authorized_user().is_some() {
|
||||
query
|
||||
} else {
|
||||
use rphotos::schema::photo_people::dsl as pp;
|
||||
use rphotos::schema::photos::dsl as p;
|
||||
use schema::photo_people::dsl as pp;
|
||||
use schema::photos::dsl as p;
|
||||
query.filter(id.eq_any(pp::photo_people
|
||||
.select(pp::person_id)
|
||||
.filter(pp::photo_id
|
||||
@ -392,11 +392,11 @@ fn person_one<'mw>(req: &mut Request,
|
||||
res: Response<'mw>,
|
||||
tslug: String)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::people::dsl::{people, slug};
|
||||
use schema::people::dsl::{people, slug};
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
if let Ok(person) = people.filter(slug.eq(tslug)).first::<Person>(c) {
|
||||
use rphotos::schema::photos::dsl::{date, grade, id};
|
||||
use rphotos::schema::photo_people::dsl::{person_id, photo_id,
|
||||
use schema::photos::dsl::{date, grade, id};
|
||||
use schema::photo_people::dsl::{person_id, photo_id,
|
||||
photo_people};
|
||||
return res.ok(|o| templates::person(
|
||||
o,
|
||||
@ -415,7 +415,7 @@ fn photo_details<'mw>(req: &mut Request,
|
||||
res: Response<'mw>,
|
||||
id: i32)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::photos::dsl::photos;
|
||||
use schema::photos::dsl::photos;
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
if let Ok(tphoto) = photos.find(id).first::<Photo>(c) {
|
||||
if req.authorized_user().is_some() || tphoto.is_public() {
|
||||
@ -428,28 +428,28 @@ fn photo_details<'mw>(req: &mut Request,
|
||||
Link::day(d.year(), d.month(), d.day())])
|
||||
.unwrap_or_else(|| vec![]),
|
||||
&{
|
||||
use rphotos::schema::people::dsl::{people, id};
|
||||
use rphotos::schema::photo_people::dsl::{photo_people, photo_id, person_id};
|
||||
use schema::people::dsl::{people, id};
|
||||
use schema::photo_people::dsl::{photo_people, photo_id, person_id};
|
||||
people.filter(id.eq_any(photo_people.select(person_id)
|
||||
.filter(photo_id.eq(tphoto.id))))
|
||||
.load(c).unwrap()
|
||||
},
|
||||
&{
|
||||
use rphotos::schema::places::dsl::{places, id};
|
||||
use rphotos::schema::photo_places::dsl::{photo_places, photo_id, place_id};
|
||||
use schema::places::dsl::{places, id};
|
||||
use schema::photo_places::dsl::{photo_places, photo_id, place_id};
|
||||
places.filter(id.eq_any(photo_places.select(place_id)
|
||||
.filter(photo_id.eq(tphoto.id))))
|
||||
.load(c).unwrap()
|
||||
},
|
||||
&{
|
||||
use rphotos::schema::tags::dsl::{tags, id};
|
||||
use rphotos::schema::photo_tags::dsl::{photo_tags, photo_id, tag_id};
|
||||
use schema::tags::dsl::{tags, id};
|
||||
use schema::photo_tags::dsl::{photo_tags, photo_id, tag_id};
|
||||
tags.filter(id.eq_any(photo_tags.select(tag_id)
|
||||
.filter(photo_id.eq(tphoto.id))))
|
||||
.load(c).unwrap()
|
||||
},
|
||||
{
|
||||
use rphotos::schema::positions::dsl::*;
|
||||
use schema::positions::dsl::*;
|
||||
match positions.filter(photo_id.eq(tphoto.id))
|
||||
.select((latitude, longitude))
|
||||
.first::<(i32, i32)>(c) {
|
||||
@ -465,13 +465,13 @@ fn photo_details<'mw>(req: &mut Request,
|
||||
}
|
||||
},
|
||||
{
|
||||
use rphotos::schema::attributions::dsl::*;
|
||||
use schema::attributions::dsl::*;
|
||||
tphoto.attribution_id.map(|i| {
|
||||
attributions.find(i).select(name).first(c).unwrap()
|
||||
})
|
||||
},
|
||||
{
|
||||
use rphotos::schema::cameras::dsl::*;
|
||||
use schema::cameras::dsl::*;
|
||||
tphoto.camera_id.map(|i| {
|
||||
cameras.find(i).first(c).unwrap()
|
||||
})
|
||||
|
@ -4,11 +4,11 @@ use chrono::naive::NaiveDate;
|
||||
use diesel::expression::sql_literal::SqlLiteral;
|
||||
use diesel::pg::PgConnection;
|
||||
use diesel::prelude::*;
|
||||
use models::Photo;
|
||||
use nickel::{MiddlewareResult, Request, Response};
|
||||
use nickel_diesel::DieselRequestExtensions;
|
||||
use nickel_jwt_session::SessionRequestExtensions;
|
||||
use server::nickelext::MyResponse;
|
||||
use rphotos::models::Photo;
|
||||
use templates;
|
||||
use time;
|
||||
|
||||
@ -17,7 +17,7 @@ pub fn all_years<'mw>(req: &mut Request,
|
||||
res: Response<'mw>)
|
||||
-> MiddlewareResult<'mw> {
|
||||
|
||||
use rphotos::schema::photos::dsl::{date, grade};
|
||||
use schema::photos::dsl::{date, grade};
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
|
||||
let groups: Vec<Group> =
|
||||
@ -59,7 +59,7 @@ pub fn months_in_year<'mw>(req: &mut Request,
|
||||
res: Response<'mw>,
|
||||
year: i32)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::photos::dsl::{date, grade};
|
||||
use schema::photos::dsl::{date, grade};
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
|
||||
let title: String = format!("Photos from {}", year);
|
||||
@ -109,7 +109,7 @@ pub fn days_in_month<'mw>(req: &mut Request,
|
||||
year: i32,
|
||||
month: u32)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::photos::dsl::{date, grade};
|
||||
use schema::photos::dsl::{date, grade};
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
|
||||
let lpath: Vec<Link> = vec![Link::year(year)];
|
||||
@ -155,7 +155,7 @@ pub fn days_in_month<'mw>(req: &mut Request,
|
||||
pub fn all_null_date<'mw>(req: &mut Request,
|
||||
res: Response<'mw>)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::photos::dsl::{date, path};
|
||||
use schema::photos::dsl::{date, path};
|
||||
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
res.ok(|o| templates::index(
|
||||
@ -177,7 +177,7 @@ pub fn all_for_day<'mw>(req: &mut Request,
|
||||
day: u32)
|
||||
-> MiddlewareResult<'mw> {
|
||||
let thedate = NaiveDate::from_ymd(year, month, day).and_hms(0, 0, 0);
|
||||
use rphotos::schema::photos::dsl::date;
|
||||
use schema::photos::dsl::date;
|
||||
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
|
||||
@ -247,7 +247,7 @@ pub fn part_for_day<'mw>(
|
||||
part: usize,
|
||||
) -> MiddlewareResult<'mw> {
|
||||
let thedate = NaiveDate::from_ymd(year, month, day).and_hms(0, 0, 0);
|
||||
use rphotos::schema::photos::dsl::date;
|
||||
use schema::photos::dsl::date;
|
||||
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
|
||||
@ -293,7 +293,7 @@ pub fn part_for_day<'mw>(
|
||||
pub fn on_this_day<'mw>(req: &mut Request,
|
||||
res: Response<'mw>)
|
||||
-> MiddlewareResult<'mw> {
|
||||
use rphotos::schema::photos::dsl::{date, grade};
|
||||
use schema::photos::dsl::{date, grade};
|
||||
let c: &PgConnection = &req.db_conn();
|
||||
|
||||
let (month, day) = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
@use ::{Coord, Link};
|
||||
@use nickel::Request;
|
||||
@use nickel_jwt_session::SessionRequestExtensions;
|
||||
@use rphotos::models::{Photo, Person, Place, Tag, Camera};
|
||||
@use models::{Photo, Person, Place, Tag, Camera};
|
||||
@use templates::page_base;
|
||||
|
||||
@(req: &Request, lpath: &[Link], people: &[Person], places: &[Place], tags: &[Tag], position: Option<Coord>, attribution: Option<String>, camera: Option<Camera>, photo: Photo)
|
||||
|
@ -1,4 +1,4 @@
|
||||
@use rphotos::models::Photo;
|
||||
@use models::Photo;
|
||||
|
||||
@(photo: &Photo)
|
||||
<p class="item"><a href="/img/@photo.id"><img src="/img/@photo.id-s.jpg"></a></p>
|
||||
|
@ -1,6 +1,6 @@
|
||||
@use ::Link;
|
||||
@use nickel::Request;
|
||||
@use rphotos::models::Photo;
|
||||
@use models::Photo;
|
||||
@use templates::{page_base, img_link};
|
||||
|
||||
@(req: &Request, title: &str, lpath: &[Link], photos: &[Photo])
|
||||
|
@ -1,5 +1,5 @@
|
||||
@use nickel::Request;
|
||||
@use rphotos::models::Person;
|
||||
@use models::Person;
|
||||
@use templates::page_base;
|
||||
|
||||
@(req: &Request, people: &[Person])
|
||||
|
@ -1,5 +1,5 @@
|
||||
@use nickel::Request;
|
||||
@use rphotos::models::{Photo, Person};
|
||||
@use models::{Photo, Person};
|
||||
@use templates::{page_base, img_link};
|
||||
|
||||
@(req: &Request, photos: &[Photo], person: Person)
|
||||
|
@ -1,5 +1,5 @@
|
||||
@use nickel::Request;
|
||||
@use rphotos::models::{Photo, Place};
|
||||
@use models::{Photo, Place};
|
||||
@use templates::{page_base, img_link};
|
||||
|
||||
@(req: &Request, photos: &[Photo], place: Place)
|
||||
|
@ -1,5 +1,5 @@
|
||||
@use nickel::Request;
|
||||
@use rphotos::models::Place;
|
||||
@use models::Place;
|
||||
@use templates::page_base;
|
||||
|
||||
@(req: &Request, places: &[Place])
|
||||
|
@ -1,5 +1,5 @@
|
||||
@use nickel::Request;
|
||||
@use rphotos::models::{Photo, Tag};
|
||||
@use models::{Photo, Tag};
|
||||
@use templates::{page_base, img_link};
|
||||
|
||||
@(req: &Request, photos: &[Photo], tag: Tag)
|
||||
|
@ -1,5 +1,5 @@
|
||||
@use nickel::Request;
|
||||
@use rphotos::models::Tag;
|
||||
@use models::Tag;
|
||||
@use templates::page_base;
|
||||
|
||||
@(req: &Request, tags: &[Tag])
|
||||
|
Loading…
Reference in New Issue
Block a user