reformat with prettier with semicolons and tabs

This commit is contained in:
m5r
2021-07-31 23:57:43 +08:00
parent fc4278ca7b
commit 079241ddb0
80 changed files with 1187 additions and 1270 deletions

View File

@ -1,24 +1,24 @@
import { NotFoundError, SecurePassword, resolver } from "blitz"
import { NotFoundError, SecurePassword, resolver } from "blitz";
import db from "../../../db"
import { authenticateUser } from "./login"
import { ChangePassword } from "../validations"
import db from "../../../db";
import { authenticateUser } from "./login";
import { ChangePassword } from "../validations";
export default resolver.pipe(
resolver.zod(ChangePassword),
resolver.authorize(),
async ({ currentPassword, newPassword }, ctx) => {
const user = await db.user.findFirst({ where: { id: ctx.session.userId! } })
if (!user) throw new NotFoundError()
const user = await db.user.findFirst({ where: { id: ctx.session.userId! } });
if (!user) throw new NotFoundError();
await authenticateUser(user.email, currentPassword)
await authenticateUser(user.email, currentPassword);
const hashedPassword = await SecurePassword.hash(newPassword.trim())
const hashedPassword = await SecurePassword.hash(newPassword.trim());
await db.user.update({
where: { id: user.id },
data: { hashedPassword },
})
});
return true
return true;
}
)
);