Skip to content

Commit 0191cc9

Browse files
authored
Merge pull request #212 from devfoma/fix-issues-163-179-169
Fix Soroban contract initialization, pure reads, and string bounds
2 parents ccd61eb + 11259e4 commit 0191cc9

10 files changed

Lines changed: 899 additions & 2009 deletions

File tree

actions/user.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,12 @@ export async function updateUserKycStatus(
364364
user.isKycVerified = false
365365
user.kycVerified = false
366366
} else if (physicalMeetingStatus === "approved") {
367-
if (oldPhysicalMeetingStatus !== "scheduled") {
368-
return { success: false, message: "Only scheduled meetings can be approved." }
367+
if (
368+
oldPhysicalMeetingStatus !== "scheduled" &&
369+
oldPhysicalMeetingStatus !== "none" &&
370+
oldPhysicalMeetingStatus !== "rescheduled"
371+
) {
372+
return { success: false, message: "Only scheduled, none, or rescheduled meetings can be approved." }
369373
}
370374

371375
if (!user.physicalMeetingDate && !normalizedMeetingDate) {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { NextResponse } from "next/server"
2+
3+
import { finalizeAuthenticatedResponse, requireAuthenticatedUser } from "@/lib/api/route-guard"
4+
import dbConnect from "@/lib/dbConnect"
5+
import AuditLog from "@/models/AuditLog"
6+
7+
interface RouteContext {
8+
params: Promise<{ id: string }>
9+
}
10+
11+
export async function GET(request: Request, context: RouteContext) {
12+
try {
13+
await dbConnect()
14+
15+
const authContext = await requireAuthenticatedUser(request, ["admin"], {
16+
forbiddenMessage: "Admin access required",
17+
})
18+
if ("response" in authContext) return authContext.response
19+
20+
const { id } = await context.params
21+
if (!id) {
22+
return NextResponse.json({ error: "User ID is required" }, { status: 400 })
23+
}
24+
25+
// Retrieve all audit logs related to this user target ID
26+
const auditLogs = await AuditLog.find({ targetId: id })
27+
.sort({ createdAt: -1 })
28+
.limit(100)
29+
.lean()
30+
31+
const response = NextResponse.json(auditLogs, { status: 200 })
32+
return finalizeAuthenticatedResponse(response, authContext)
33+
} catch (error) {
34+
console.error("KYC_USER_AUDIT_LOG_GET_ERROR", error)
35+
return NextResponse.json({ error: "Internal server error" }, { status: 500 })
36+
}
37+
}

0 commit comments

Comments
 (0)