import { prisma } from '@/lib/prisma'
import { NextResponse } from 'next/server'

export async function POST(request: Request) {
  try {
    const { userId } = await request.json()
    
    await prisma.user.update({
      where: { id: userId },
      data: { lastLoginAt: new Date() }
    })
    
    return NextResponse.json({ success: true })
  } catch (error) {
    console.error('Error updating last login:', error)
    return NextResponse.json({ error: 'Failed to update last login' }, { status: 500 })
  }
}