feat(falahmobile): retheme app to premium dark spatial UI, implement waqf module, and resolve testing suite config

This commit is contained in:
FalahMobile
2026-07-08 18:07:07 +08:00
parent 3eb89a5665
commit 0cacc4fa1a
22 changed files with 693 additions and 355 deletions
+4 -4
View File
@@ -7,10 +7,10 @@ export async function POST() {
const password = await bcrypt.hash('password123', 10)
const userData = [
{ email: 'ghazali@falahos.my', name: 'Abu Hamid Al-Ghazali', password, flhBalance: 5000 },
{ email: 'ibnabbas@falahos.my', name: 'Abdullah Ibn Abbas', password, flhBalance: 3000 },
{ email: 'rabia@falahos.my', name: "Rabi'a Al-Adawiyya", password, flhBalance: 2000 },
{ email: 'demo@falahos.my', name: 'Demo User', password, flhBalance: 500 },
{ email: 'ghazali@falahos.my', name: 'Abu Hamid Al-Ghazali', passwordHash: password, flhBalance: 5000 },
{ email: 'ibnabbas@falahos.my', name: 'Abdullah Ibn Abbas', passwordHash: password, flhBalance: 3000 },
{ email: 'rabia@falahos.my', name: "Rabi'a Al-Adawiyya", passwordHash: password, flhBalance: 2000 },
{ email: 'demo@falahos.my', name: 'Demo User', passwordHash: password, flhBalance: 500 },
]
const users: any[] = []
+46
View File
@@ -0,0 +1,46 @@
import { NextRequest, NextResponse } from 'next/server'
import { prisma } from '@/lib/prisma'
import { verifyJWT } from '@/lib/auth'
export async function POST(req: NextRequest) {
try {
const auth = req.headers.get('authorization')
if (!auth?.startsWith('Bearer ')) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
}
const payload = await verifyJWT(auth.slice(7))
if (!payload) {
return NextResponse.json({ error: 'Invalid token' }, { status: 401 })
}
const { projectId, amountFlh } = await req.json()
if (!projectId || !amountFlh || amountFlh <= 0) {
return NextResponse.json({ error: 'Invalid project or amount' }, { status: 400 })
}
const user = await prisma.user.findUnique({ where: { id: payload.id } })
if (!user) {
return NextResponse.json({ error: 'User not found' }, { status: 404 })
}
if (user.flhBalance < amountFlh) {
return NextResponse.json({ error: 'Insufficient FLH balance' }, { status: 400 })
}
// Decrement the user's balance
const updatedUser = await prisma.user.update({
where: { id: payload.id },
data: { flhBalance: { decrement: amountFlh } },
})
return NextResponse.json({
success: true,
newBalance: updatedUser.flhBalance,
message: `Successfully contributed ${amountFlh} FLH to the project.`
})
} catch (e) {
console.error(e)
return NextResponse.json({ error: 'Internal server error' }, { status: 500 })
}
}