mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-13 08:12:40 +10:00
feat(library admin): client side search
This commit is contained in:
20
server/api/v1/store/developers.ts
Normal file
20
server/api/v1/store/developers.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const userId = await h3.context.session.getUserId(h3);
|
||||
if (!userId) throw createError({ statusCode: 403 });
|
||||
|
||||
const developers = await prisma.developer.findMany({
|
||||
include: {
|
||||
games: true,
|
||||
},
|
||||
orderBy: {
|
||||
games: {
|
||||
_count: "desc",
|
||||
},
|
||||
},
|
||||
take: 3,
|
||||
});
|
||||
|
||||
return developers;
|
||||
});
|
||||
20
server/api/v1/store/publishers.ts
Normal file
20
server/api/v1/store/publishers.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import prisma from "~/server/internal/db/database";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const userId = await h3.context.session.getUserId(h3);
|
||||
if (!userId) throw createError({ statusCode: 403 });
|
||||
|
||||
const publishers = await prisma.publisher.findMany({
|
||||
include: {
|
||||
games: true,
|
||||
},
|
||||
orderBy: {
|
||||
games: {
|
||||
_count: "desc",
|
||||
},
|
||||
},
|
||||
take: 4,
|
||||
});
|
||||
|
||||
return publishers;
|
||||
});
|
||||
Reference in New Issue
Block a user