kyc user and upload partial update encrypt nik and picture
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user