mirror of
https://github.com/beilunyang/moemail.git
synced 2026-07-07 23:31:44 +08:00
feat: implement email sending functionality via Resend service
This commit is contained in:
29
app/api/emails/send-permission/route.ts
Normal file
29
app/api/emails/send-permission/route.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { NextResponse } from "next/server"
|
||||
import { auth } from "@/lib/auth"
|
||||
import { checkSendPermission } from "@/lib/send-permissions"
|
||||
|
||||
export const runtime = "edge"
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const session = await auth()
|
||||
if (!session?.user?.id) {
|
||||
return NextResponse.json({
|
||||
canSend: false,
|
||||
error: "未授权"
|
||||
})
|
||||
}
|
||||
const result = await checkSendPermission(session.user.id)
|
||||
|
||||
return NextResponse.json(result)
|
||||
} catch (error) {
|
||||
console.error('Failed to check send permission:', error)
|
||||
return NextResponse.json(
|
||||
{
|
||||
canSend: false,
|
||||
error: "权限检查失败"
|
||||
},
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user