Skip to content

Commit

Permalink
fix: entryId being set to userEntryId instead of entryId in activities
Browse files Browse the repository at this point in the history
  • Loading branch information
dinkelspiel committed May 10, 2024
1 parent 2c510f3 commit 9f4b308
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/api/user/entries/[userEntryId]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const PATCH = async (
(await prisma.userEntry.count({
where: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
},
})) - 1
}`;
Expand All @@ -82,15 +82,15 @@ export const PATCH = async (
(await prisma.userActivity.count({
where: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
additionalData,
},
})) === 0
) {
await prisma.userActivity.create({
data: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
type: 'statusUpdate',
additionalData,
},
Expand All @@ -100,13 +100,13 @@ export const PATCH = async (
await prisma.userActivity.create({
data: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
type: 'statusUpdate',
additionalData: `${data.data.status}|${
(await prisma.userEntry.count({
where: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
},
})) - 1
}`,
Expand Down Expand Up @@ -136,13 +136,13 @@ export const PATCH = async (
await prisma.userActivity.create({
data: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
type: 'completeReview',
additionalData: `${
(await prisma.userEntry.count({
where: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
},
})) - 1
}`,
Expand All @@ -160,13 +160,13 @@ export const PATCH = async (
await prisma.userActivity.create({
data: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
type: 'reviewed',
additionalData: `${
(await prisma.userEntry.count({
where: {
userId: user.id,
entryId: Number(params.userEntryId),
entryId: userEntry.entryId,
},
})) - 1
}`,
Expand Down

0 comments on commit 9f4b308

Please sign in to comment.