Skip to content

Commit

Permalink
Merge pull request #69 from odeta939/reviewRegistersUserToWine
Browse files Browse the repository at this point in the history
Reviews now register the user to the wine as intended
  • Loading branch information
odeta939 authored Nov 14, 2023
2 parents 00c2d16 + 1b8671c commit f3af9b7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vinoa-web/sanity/sanity-utils/review-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export async function createReview(review: ReviewDTO) {
wine: { _ref: review.wineId, _type: 'reference' },
user: { _ref: review.userId, _type: 'reference' },
});

await client.patch(review.wineId).setIfMissing({users: []}).append('users', [{_type: 'reference', _ref: review.userId}]).commit({autoGenerateArrayKeys: true});
}

export async function getReviewsForWine(slug: string): Promise<Array<Review>> {
Expand Down

0 comments on commit f3af9b7

Please sign in to comment.