16 lines
1.0 KiB
TypeScript
16 lines
1.0 KiB
TypeScript
import { loadEnvConfig } from '@next/env'
|
|
loadEnvConfig(process.cwd())
|
|
async function main() {
|
|
const url = new URL(process.env.DATABASE_URL || '')
|
|
if (!['localhost', '127.0.0.1'].includes(url.hostname) || !url.pathname.startsWith('/salary_isolated_')) throw new Error('仅允许隔离本地薪资数据库')
|
|
const { prisma } = await import('../lib/prisma')
|
|
const { connectCreativeMarketIntent } = await import('../lib/connect-salary-market-intent')
|
|
try {
|
|
const actor = await prisma.user.findFirst({ where: { isSuperAdmin: true, isActive: true, status: 'active', archivedAt: null }, select: { id: true } })
|
|
if (!actor) throw new Error('缺少本地超管')
|
|
if (!process.argv.includes('--apply')) { console.log('只读检查通过;使用 --apply 显式修改隔离本地岗位来源。'); return }
|
|
console.log(JSON.stringify(await connectCreativeMarketIntent(actor.id)))
|
|
} finally { await prisma.$disconnect() }
|
|
}
|
|
main().catch(error => { console.error(error instanceof Error ? error.message : '配置调整失败'); process.exitCode = 1 })
|