fix: resolve typescript build errors in page and admin actions
This commit is contained in:
@@ -13,7 +13,7 @@ export async function authenticate(formData: FormData) {
|
||||
const username = formData.get('username') as string;
|
||||
const password = formData.get('password') as string;
|
||||
|
||||
const user = await (prisma as any).user.findUnique({ where: { username } });
|
||||
const user = await prisma.user.findUnique({ where: { username } });
|
||||
|
||||
if (!user || !(await bcrypt.compare(password, user.password))) {
|
||||
return { error: 'Geçersiz kullanıcı adı veya şifre' };
|
||||
@@ -41,7 +41,7 @@ export async function createAdmin(formData: FormData) {
|
||||
|
||||
const hashedPassword = await bcrypt.hash(password, 10);
|
||||
|
||||
await (prisma as any).user.create({
|
||||
await prisma.user.create({
|
||||
data: {
|
||||
username,
|
||||
password: hashedPassword,
|
||||
@@ -55,7 +55,7 @@ export async function updateAdminPassword(id: string, formData: FormData) {
|
||||
const password = formData.get('password') as string;
|
||||
const hashedPassword = await bcrypt.hash(password, 10);
|
||||
|
||||
await (prisma as any).user.update({
|
||||
await prisma.user.update({
|
||||
where: { id },
|
||||
data: {
|
||||
password: hashedPassword,
|
||||
@@ -69,7 +69,7 @@ export async function deleteAdmin(id: string) {
|
||||
const session = await encrypt({ expires: new Date(0) }); // placeholder check
|
||||
// Don't allow deleting self if we had current user id here,
|
||||
// but for now simple delete
|
||||
await (prisma as any).user.delete({ where: { id } });
|
||||
await prisma.user.delete({ where: { id } });
|
||||
|
||||
revalidatePath('/admin/users');
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function Page() {
|
||||
try {
|
||||
const restaurant = await (prisma as any).restaurant.findFirst({
|
||||
const restaurant = await prisma.restaurant.findFirst({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
include: {
|
||||
categories: {
|
||||
@@ -44,7 +44,7 @@ export default async function Page() {
|
||||
ingredients: item.ingredients,
|
||||
tasteProfile: item.tasteProfile,
|
||||
grapeVariety: item.grapeVariety,
|
||||
price: item.price,
|
||||
price: item.price as any,
|
||||
})),
|
||||
})),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user