'use server'

import {Category} from '@prisma/client'

import AppCatalogRender from '@/components/shared/sidebar/app-catalog-render'
import {db} from '@/lib/db/prisma/client'

const appCatalog = async (): Promise<Category[] | null> => {
	return db.category.findMany({
		include: {
			locales: true
		}
	})
}

export default async function AppCatalog() {
	const categories: Category[] | null = await appCatalog()
	// @ts-ignore
	return <AppCatalogRender items={categories} />
}
