added post key route

This commit is contained in:
daniel31x13
2024-01-13 01:20:06 -05:00
parent 834d25a99e
commit d91ebb3fa2
13 changed files with 417 additions and 83 deletions
@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[name]` on the table `ApiKey` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "ApiKey_name_key" ON "ApiKey"("name");
@@ -0,0 +1,14 @@
/*
Warnings:
- A unique constraint covering the columns `[name,userId]` on the table `ApiKey` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "ApiKey_name_key";
-- DropIndex
DROP INDEX "ApiKey_token_userId_key";
-- CreateIndex
CREATE UNIQUE INDEX "ApiKey_name_userId_key" ON "ApiKey"("name", "userId");
+2 -2
View File
@@ -144,7 +144,7 @@ model Subscription {
model ApiKey {
id Int @id @default(autoincrement())
name String
name String
user User @relation(fields: [userId], references: [id])
userId Int
token String @unique
@@ -153,5 +153,5 @@ model ApiKey {
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@unique([token, userId])
@@unique([name, userId])
}