}
impl LocalUser {
- pub fn register(conn: &PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
+ pub fn register(conn: &mut PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
let mut edited_user = form.clone();
let password_hash = form
.password_encrypted
}
pub fn update_password(
- conn: &PgConnection,
+ conn: &mut PgConnection,
local_user_id: LocalUserId,
new_password: &str,
) -> Result<Self, Error> {
.get_result::<Self>(conn)
}
- pub fn set_all_users_email_verified(conn: &PgConnection) -> Result<Vec<Self>, Error> {
+ pub fn set_all_users_email_verified(conn: &mut PgConnection) -> Result<Vec<Self>, Error> {
diesel::update(local_user)
.set(email_verified.eq(true))
.get_results::<Self>(conn)
}
pub fn set_all_users_registration_applications_accepted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
) -> Result<Vec<Self>, Error> {
diesel::update(local_user)
.set(accepted_application.eq(true))
impl Crud for LocalUser {
type Form = LocalUserForm;
type IdType = LocalUserId;
- fn read(conn: &PgConnection, local_user_id: LocalUserId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, local_user_id: LocalUserId) -> Result<Self, Error> {
local_user.find(local_user_id).first::<Self>(conn)
}
- fn delete(conn: &PgConnection, local_user_id: LocalUserId) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, local_user_id: LocalUserId) -> Result<usize, Error> {
diesel::delete(local_user.find(local_user_id)).execute(conn)
}
- fn create(conn: &PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
let local_user_ = insert_into(local_user)
.values(form)
.get_result::<Self>(conn)?;
Ok(local_user_)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
local_user_id: LocalUserId,
form: &LocalUserForm,
) -> Result<Self, Error> {