-
Notifications
You must be signed in to change notification settings - Fork 7
Add dashboard summary, and improve test coverage and linting #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 9 commits
f36e186
8232e08
5975bf4
26fb209
8b08b56
62edb45
9085df7
fb1c3bc
e69d451
e7a0932
18befc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| PORT=3000 | ||
| DB_FILE='investec.db' | ||
| AUTH=false | ||
| CLIENT_ID= | ||
| CLIENT_SECRET= | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,7 @@ | |
| **/dist | ||
| .env | ||
| **.db-shm | ||
| **.db-wal | ||
| **.db-wal | ||
| **.db-journal | ||
| CLAUDE.md | ||
| .idea | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| -- CreateTable | ||
| CREATE TABLE "Profile" ( | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like the migrations could be compressed, given that the DB is shipped with the simulator. |
||
| "profileId" TEXT NOT NULL PRIMARY KEY, | ||
| "profileName" TEXT NOT NULL | ||
| ); | ||
|
|
||
| -- Insert default profile | ||
| INSERT INTO "Profile" ("profileId", "profileName") VALUES ('10001234567890', 'Joe Soap'); | ||
|
|
||
| -- RedefineTables | ||
| PRAGMA defer_foreign_keys=ON; | ||
| PRAGMA foreign_keys=OFF; | ||
| CREATE TABLE "new_Account" ( | ||
| "accountId" TEXT NOT NULL PRIMARY KEY, | ||
| "accountNumber" TEXT NOT NULL, | ||
| "accountName" TEXT NOT NULL, | ||
| "referenceName" TEXT NOT NULL, | ||
| "productName" TEXT NOT NULL, | ||
| "kycCompliant" BOOLEAN NOT NULL DEFAULT true, | ||
| "profileId" TEXT NOT NULL, | ||
| "profileName" TEXT NOT NULL | ||
| ); | ||
| INSERT INTO "new_Account" ("accountId", "accountName", "accountNumber", "productName", "referenceName", "kycCompliant", "profileId", "profileName") | ||
| SELECT "accountId", "accountName", "accountNumber", "productName", "referenceName", true, '10001234567890', 'Joe Soap' FROM "Account"; | ||
| DROP TABLE "Account"; | ||
| ALTER TABLE "new_Account" RENAME TO "Account"; | ||
| PRAGMA foreign_keys=ON; | ||
| PRAGMA defer_foreign_keys=OFF; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { PrismaClient, Prisma } from '@prisma/client' | ||
|
|
||
| const prisma = new PrismaClient() | ||
|
|
||
| const profileData: Prisma.ProfileCreateInput[] = [ | ||
| { | ||
| profileId: '10001234567890', | ||
| profileName: 'Joe Soap', | ||
| }, | ||
| ] | ||
|
|
||
| export async function seedProfiles() { | ||
| for (const p of profileData) { | ||
| const profile = await prisma.profile.create({ | ||
| data: p, | ||
| }) | ||
| console.log(`Created profile with id: ${profile.profileId}`) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,12 +7,20 @@ datasource db { | |||||||||||||
| url = "file:./dev.db" | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| model Profile { | ||||||||||||||
| profileId String @id | ||||||||||||||
| profileName String | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| model Account { | ||||||||||||||
| accountId String @id | ||||||||||||||
| accountNumber String | ||||||||||||||
| accountName String | ||||||||||||||
| referenceName String | ||||||||||||||
| productName String | ||||||||||||||
| kycCompliant Boolean @default(true) | ||||||||||||||
| profileId String | ||||||||||||||
| profileName String | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add foreign key relationship and consider normalization. The Account model extensions introduce profile functionality but lack proper relational constraints:
Consider this improved schema design: kycCompliant Boolean @default(true)
profileId String
- profileName String
+ profile Profile @relation(fields: [profileId], references: [profileId])This approach:
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| model Transaction { | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider normalization and data consistency improvements.
All accounts are using the same profile data, which may be appropriate for testing but raises some concerns:
profileIdandprofileNamein the Account model duplicates data from the Profile table, violating normalization principles.profileIdexists in the Profile table.Consider removing
profileNamefrom the Account model and using joins to retrieve profile information when needed, or adding proper foreign key relationships.Also applies to: 22-24, 32-34, 42-44, 52-54
🤖 Prompt for AI Agents