Browse Source

Feature/setup api keys for Ghostfolio data provider (#4088)

* Setup API keys for Ghostfolio data provider
pull/4089/head
Thomas Kaul 2 months ago
committed by GitHub
parent
commit
9461b32a39
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 19
      prisma/migrations/20241130164335_added_api_keys_to_user copy/migration.sql
  2. 13
      prisma/schema.prisma

19
prisma/migrations/20241130164335_added_api_keys_to_user copy/migration.sql

@ -0,0 +1,19 @@
-- CreateTable
CREATE TABLE "ApiKey" (
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"hashedKey" TEXT NOT NULL,
"id" TEXT NOT NULL,
"updatedAt" TIMESTAMP(3) NOT NULL,
"userId" TEXT NOT NULL,
CONSTRAINT "ApiKey_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "ApiKey_hashedKey_idx" ON "ApiKey"("hashedKey");
-- CreateIndex
CREATE INDEX "ApiKey_userId_idx" ON "ApiKey"("userId");
-- AddForeignKey
ALTER TABLE "ApiKey" ADD CONSTRAINT "ApiKey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

13
prisma/schema.prisma

@ -77,6 +77,18 @@ model Analytics {
@@index([updatedAt])
}
model ApiKey {
createdAt DateTime @default(now())
hashedKey String
id String @id @default(uuid())
updatedAt DateTime @updatedAt
userId String
user User @relation(fields: [userId], onDelete: Cascade, references: [id])
@@index([hashedKey])
@@index([userId])
}
model AuthDevice {
createdAt DateTime @default(now())
credentialId Bytes
@ -238,6 +250,7 @@ model User {
AccessGive Access[] @relation("accessGive")
Account Account[]
Analytics Analytics?
ApiKey ApiKey[]
AuthDevice AuthDevice[]
Order Order[]
Settings Settings?

Loading…
Cancel
Save