revert: 撤销 admin-service seed 脚本

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-21 22:41:24 -08:00
parent a1a9a087c5
commit 45fcae5ef5
2 changed files with 1 additions and 81 deletions

View File

@ -6,8 +6,7 @@
"private": true,
"license": "UNLICENSED",
"prisma": {
"schema": "prisma/schema.prisma",
"seed": "ts-node prisma/seed.ts"
"schema": "prisma/schema.prisma"
},
"scripts": {
"build": "nest build",

View File

@ -1,79 +0,0 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
// ============================================
// 系统账户定义 (与 identity-service/prisma/seed.ts 保持同步)
// ============================================
const SYSTEM_ACCOUNTS = [
{
userId: BigInt(1),
accountSequence: 'S0000000001',
nickname: '总部社区',
status: 'SYSTEM',
},
{
userId: BigInt(2),
accountSequence: 'S0000000002',
nickname: '成本费账户',
status: 'SYSTEM',
},
{
userId: BigInt(3),
accountSequence: 'S0000000003',
nickname: '运营费账户',
status: 'SYSTEM',
},
{
userId: BigInt(4),
accountSequence: 'S0000000004',
nickname: 'RWAD底池账户',
status: 'SYSTEM',
},
{
userId: BigInt(5),
accountSequence: 'D25122100000',
nickname: '种子用户',
status: 'ACTIVE',
},
];
async function main() {
console.log('Seeding admin-service database...');
// 同步系统账户到 user_query_view
console.log('Syncing system accounts to user_query_view...');
for (const account of SYSTEM_ACCOUNTS) {
await prisma.userQueryView.upsert({
where: { userId: account.userId },
update: {
accountSequence: account.accountSequence,
nickname: account.nickname,
status: account.status,
syncedAt: new Date(),
},
create: {
userId: account.userId,
accountSequence: account.accountSequence,
nickname: account.nickname,
status: account.status,
kycStatus: 'NOT_VERIFIED',
registeredAt: new Date(),
syncedAt: new Date(),
},
});
console.log(` - Synced: ${account.nickname} (${account.accountSequence})`);
}
console.log('Admin-service database seeded successfully!');
console.log(`- Synced ${SYSTEM_ACCOUNTS.length} system accounts to user_query_view`);
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});