mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
Album edit endpoint
This commit is contained in:
parent
d3581eaeef
commit
6cef84a358
24 changed files with 936 additions and 76 deletions
21
src/pages/api/platform/find.ts
Normal file
21
src/pages/api/platform/find.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import type { APIRoute } from 'astro'
|
||||
import prismaClient from 'utils/prisma-client'
|
||||
|
||||
export const GET: APIRoute = async (context) => {
|
||||
const { url } = context
|
||||
const titleParam = url.searchParams.get('q')
|
||||
|
||||
const anims = await prismaClient.platform.findMany({
|
||||
where: titleParam ? { name: { contains: titleParam } } : undefined,
|
||||
select: { id: true, name: true },
|
||||
take: 10,
|
||||
orderBy: { createdAt: 'desc' }
|
||||
})
|
||||
|
||||
return new Response(JSON.stringify(anims), {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue