kyc user and upload partial update encrypt nik and picture

This commit is contained in:
2026-04-27 21:48:24 +07:00
parent b31fe675ae
commit a92b4a8fd9
51 changed files with 5180 additions and 452 deletions
+6 -6
View File
@@ -11,11 +11,7 @@ export type OrganizerTrust = {
export const trustService = {
async getOrganizerTrust(organizerId: string): Promise<OrganizerTrust> {
const [user, tripsCreated, reviewAgg] = await Promise.all([
prisma.user.findUnique({
where: { id: organizerId },
select: { isVerified: true },
}),
const [tripsCreated, reviewAgg, organizerVerification] = await Promise.all([
prisma.trip.count({ where: { organizerId } }),
prisma.tripReview.aggregate({
where: {
@@ -24,11 +20,15 @@ export const trustService = {
_avg: { rating: true },
_count: { _all: true },
}),
prisma.organizerVerification.findUnique({
where: { userId: organizerId },
select: { status: true },
}),
]);
const avg = reviewAgg._avg.rating;
return {
isVerified: user?.isVerified ?? false,
isVerified: organizerVerification?.status === "APPROVED",
tripsCreated,
avgRating:
avg != null ? Math.round(Number(avg) * 10) / 10 : null,