export default defineEventHandler(async (event) => {
  const query = getQuery(event)
  const parent = JSON.parse(query.parent)

  try {
    const districts = await prisma.addressDistricts.findUnique({
      where: {
        Code: parent.Code,
      },
    })
    return districts.Postal
  } catch (error) {
    // Return error if fetching users fails
    return {
      status: 500,
      body: { message: 'Failed to fetch districts' },
    }
  }
})
