2023-04-19 02:14:25 +03:00
|
|
|
import userA from '@affine-test/fixtures/userA.json' assert { type: 'json' };
|
2023-08-29 13:07:05 +03:00
|
|
|
import { hash } from '@node-rs/argon2';
|
2023-04-19 02:14:25 +03:00
|
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
|
|
|
|
async function main() {
|
2023-04-28 02:02:05 +03:00
|
|
|
await prisma.user.create({
|
2023-08-29 13:07:05 +03:00
|
|
|
data: {
|
|
|
|
...userA,
|
|
|
|
password: await hash(userA.password),
|
|
|
|
},
|
2023-04-19 02:14:25 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
.then(async () => {
|
|
|
|
await prisma.$disconnect();
|
|
|
|
})
|
|
|
|
.catch(async e => {
|
|
|
|
console.error(e);
|
|
|
|
await prisma.$disconnect();
|
|
|
|
process.exit(1);
|
|
|
|
});
|