Skip to content

Commit 5e94bb3

Browse files
authored
Merge pull request #139 from bbarni2020/t2-logs
Add T2 review logs to review pages
2 parents 718c277 + 32188d9 commit 5e94bb3

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

src/routes/dashboard/admin/ReviewHistory.svelte

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,24 @@
3434
</p>
3535
</div>
3636
{/each}
37+
<h1 class="text-2xl font-bold">T2 reviews</h1>
38+
{#each reviews.t2Reviews as review}
39+
<div class="themed-box flex flex-col p-3 shadow-lg">
40+
{#if review.notes}
41+
<p class="text-sm"><span class="font-bold">Notes:</span> {review.notes}</p>
42+
{/if}
43+
{#if review.feedback}
44+
<p class="text-sm"><span class="font-bold">Feedback:</span> {review.feedback}</p>
45+
{/if}
46+
{#if review.image}
47+
<p class="text-sm"><span class="font-bold">Image:</span> {review.image}</p>
48+
{/if}
49+
<p class="text-sm">
50+
<span class="font-bold">Market score per hour:</span> {review.shopScoreMultiplier}
51+
</p>
52+
<p class="text-xs">
53+
by <a href={`../../users/${review.user.id}`} class="underline">{review.user.name}</a>
54+
</p>
55+
</div>
56+
{/each}
3757
</div>

src/routes/dashboard/admin/getReviewHistory.server.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { db } from '$lib/server/db';
2-
import { legionReview, t1Review, user } from '$lib/server/db/schema';
2+
import { legionReview, t1Review, t2Review, user } from '$lib/server/db/schema';
33
import { eq, asc } from 'drizzle-orm';
44

55
export async function getReviewHistory(id: number) {
@@ -36,8 +36,26 @@ export async function getReviewHistory(id: number) {
3636
.where(eq(legionReview.projectId, id))
3737
.orderBy(asc(legionReview.timestamp));
3838

39+
const t2Reviews = await db
40+
.select({
41+
user: {
42+
id: user.id,
43+
name: user.name
44+
},
45+
notes: t2Review.notes,
46+
feedback: t2Review.feedback,
47+
image: t2Review.image,
48+
shopScoreMultiplier: t2Review.shopScoreMultiplier,
49+
timestamp: t2Review.timestamp
50+
})
51+
.from(t2Review)
52+
.innerJoin(user, eq(user.id, t2Review.userId))
53+
.where(eq(t2Review.projectId, id))
54+
.orderBy(asc(t2Review.timestamp));
55+
3956
return {
4057
t1Reviews,
41-
legionReviews
58+
legionReviews,
59+
t2Reviews
4260
};
4361
}

0 commit comments

Comments
 (0)