first working state

This commit is contained in:
jane 2022-04-23 22:58:54 -04:00
parent 0a9b76f9c7
commit 4a0db151d4
23 changed files with 512 additions and 74 deletions

View file

@ -9,10 +9,21 @@ export const getBorderById = async (id) => {
});
};
export const countAllBorders = async () => {
return await prisma.borderImage.count();
};
export const getAllBorders = async (limit = undefined, cursor = undefined) => {
const sanitizedLimit = parseInt(limit) || undefined;
const sanitizedCursor = parseInt(cursor) || 0;
return await prisma.borderImage.findMany({
take: limit,
cursor: cursor,
take: sanitizedLimit,
cursor: {
id: sanitizedCursor,
},
orderBy: {
id: "asc",
},
});
};
@ -63,10 +74,10 @@ export const setUserBorder = async (req, borderId) => {
create: {
userId: session.user.id,
discordId: accountData.providerAccountId,
borderId,
borderId: parseInt(borderId),
},
data: {
borderId,
update: {
borderId: parseInt(borderId),
},
where: {
userId: session.user.id,