'use server'

import {CategoryLocale, Lang} from '@prisma/client'

import {db} from '@/lib/db/prisma/client'

export const getCategoryBySlug = async (data: {
	slug: string
	lang: string
}): Promise<CategoryLocale | null> => {
	return db.categoryLocale.findFirst({
		where: {
			slug: data.slug,
			lang: data.lang as Lang
		}
	})
}

export const getCategoryLocalesById = async (id: number) => {
	return db.categoryLocale.findMany({
		where: {categoryId: id}
	})
}
