grand commit
This commit is contained in:
22
lib/data/models/category.ts
Normal file
22
lib/data/models/category.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
'use server'
|
||||
|
||||
import {CategoryLocale} from '@prisma/client'
|
||||
|
||||
import {STORE_ID} from '@/lib/config/constants'
|
||||
import {db} from '@/lib/db/prisma/client'
|
||||
|
||||
export const getCategoryBySlug = async (slug: string) => {
|
||||
return db.categoryLocale.findFirst({
|
||||
where: {
|
||||
slug
|
||||
},
|
||||
select: {
|
||||
category: {
|
||||
include: {
|
||||
locales: true,
|
||||
categoriesOnProducts: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user