Skip to content

Commit

Permalink
Update prisma seed to use EuPlatesc test account
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-M22 committed May 19, 2024
1 parent c6fafdc commit 9856e1f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 35 deletions.
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
"format": "npx prettier --write .",
"format:check": "npx prettier --check .",
"types:check": "npx tsc --noEmit --incremental",
"prisma": "npx dotenv -c development -- npx prisma",
"prisma:generate": "npx dotenv -c development -- npx prisma generate",
"prisma:push": "npx dotenv -c development -- npx prisma db push",
"prisma:migrate": "npx dotenv -c development -- npx prisma migrate dev",
"prisma:generate": "npx dotenv -c development -- npx prisma generate",
"seed:dev": "npx dotenv -c development -- npx ts-node --project tsconfig.seed.json prisma/seed-dev.ts"
"prisma:seed": "npx dotenv -c development -- npx ts-node --project tsconfig.seed.json prisma/seed-dev.ts"
},
"dependencies": {
"@azure/identity": "^4.0.1",
Expand Down Expand Up @@ -50,7 +49,7 @@
"eslint-config-next": "14.0.4",
"postcss": "^8",
"prettier": "^3.1.1",
"prisma": "^5.8.0",
"prisma": "^5.12.1",
"tailwindcss": "^3.3.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
Expand Down
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ model EuPlatescAccount {
id Int @id @default(autoincrement())
name String
description String?
merchantId Int @unique @map("merchant_id")
merchantId String @map("merchant_id")
secretKey String @map("secret_key")
didacticPremiumCardOnly Boolean @map("didactic_premium_card_only")
faculties Faculty[]
Expand Down
6 changes: 4 additions & 2 deletions prisma/seed-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { PrismaClient, Role, StudyCycle, FacultyTaxType } from "@prisma/client";
const prisma = new PrismaClient();

async function main() {
if (!process.env.EUPLATESC_KEY) throw Error("Missing EUPLATESC_KEY env variable");

const euPlatescAccounts = [];
for (let i = 1; i <= 25; i++) {
const account = await prisma.euPlatescAccount.create({
data: {
name: `Account ${i}`,
description: `Description ${i}`,
merchantId: 44841002813,
secretKey: `Key ${i}`,
merchantId: "44841002813",
secretKey: process.env.EUPLATESC_KEY,
didacticPremiumCardOnly: i % 2 === 0, // Alternate between true and false
},
});
Expand Down

0 comments on commit 9856e1f

Please sign in to comment.