rwadurian/backend/services/reward-service/prisma/seed.ts

71 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
// 初始化权益定义
const rightDefinitions = [
{
rightType: 'SHARE_RIGHT',
usdtPerTree: 500,
hashpowerPercent: 0,
payableTo: 'USER_ACCOUNT',
ruleDescription: '分享权益每棵树500 USDT分配给推荐链',
},
{
rightType: 'PROVINCE_AREA_RIGHT',
usdtPerTree: 15,
hashpowerPercent: 1,
payableTo: 'SYSTEM_ACCOUNT',
ruleDescription: '省区域权益每棵树15 USDT + 1%算力,进系统省公司账户',
},
{
rightType: 'PROVINCE_TEAM_RIGHT',
usdtPerTree: 20,
hashpowerPercent: 0,
payableTo: 'USER_ACCOUNT',
ruleDescription: '省团队权益每棵树20 USDT给最近的授权省公司',
},
{
rightType: 'CITY_AREA_RIGHT',
usdtPerTree: 35,
hashpowerPercent: 2,
payableTo: 'SYSTEM_ACCOUNT',
ruleDescription: '市区域权益每棵树35 USDT + 2%算力,进系统市公司账户',
},
{
rightType: 'CITY_TEAM_RIGHT',
usdtPerTree: 40,
hashpowerPercent: 0,
payableTo: 'USER_ACCOUNT',
ruleDescription: '市团队权益每棵树40 USDT给最近的授权市公司',
},
{
rightType: 'COMMUNITY_RIGHT',
usdtPerTree: 80,
hashpowerPercent: 0,
payableTo: 'USER_ACCOUNT',
ruleDescription: '社区权益每棵树80 USDT给最近的社区',
},
];
for (const def of rightDefinitions) {
await prisma.rightDefinition.upsert({
where: { rightType: def.rightType },
update: def,
create: def,
});
}
console.log('Seed completed: Right definitions initialized');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});