Skip to content

Commit

Permalink
feat(server): Implement 15-item limit for skills and links
Browse files Browse the repository at this point in the history
  • Loading branch information
tawaks committed Oct 20, 2024
1 parent 237a232 commit 721e98d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/routes/profile/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export const actions: Actions = {

if (user) {
try {
const linkCount = await prisma.link.count({where: { userId: user.githubId }});
if (linkCount >= 15) {
return fail(400, {form, message: 'You have reached the maximum limit of 15 links.'});
}
await prisma.link.create({
data: {
title,
Expand Down Expand Up @@ -144,6 +148,10 @@ export const actions: Actions = {

if (user) {
try {
const skillCount = await prisma.skill.count({where :{userId:user.githubId}});
if (skillCount >= 15) {
return fail(400, {form,message:'You have reached the maximum limit of 15 skills'})
}
await prisma.skill.create({
data: {
title,
Expand Down

0 comments on commit 721e98d

Please sign in to comment.