@valentine-efagene/qshelter-common 2.0.11 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[tokenHash]` on the table `refresh_tokens` will be added. If there are existing duplicate values, this will fail.
5
+ - Added the required column `tokenHash` to the `refresh_tokens` table without a default value. This is not possible if the table is not empty.
6
+
7
+ */
8
+ -- DropIndex
9
+ DROP INDEX `refresh_tokens_token_key` ON `refresh_tokens`;
10
+
11
+ -- AlterTable
12
+ ALTER TABLE `refresh_tokens` ADD COLUMN `tokenHash` VARCHAR(64) NOT NULL,
13
+ MODIFY `token` LONGTEXT NULL;
14
+
15
+ -- CreateIndex
16
+ CREATE UNIQUE INDEX `refresh_tokens_tokenHash_key` ON `refresh_tokens`(`tokenHash`);
@@ -0,0 +1,3 @@
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "mysql"
@@ -124,7 +124,9 @@ model Tenant {
124
124
 
125
125
  model RefreshToken {
126
126
  id String @id @default(cuid())
127
- token String @unique
127
+ // Store a fixed-length hash for lookup/indexing and keep the raw JWT (optional)
128
+ tokenHash String @unique @db.VarChar(64)
129
+ token String? @db.LongText
128
130
  userId String
129
131
  user User @relation(fields: [userId], references: [id], onDelete: Cascade)
130
132
  expiresAt DateTime
@@ -205,6 +207,17 @@ model Social {
205
207
  @@map("socials")
206
208
  }
207
209
 
210
+ model OAuthState {
211
+ id String @id @default(cuid())
212
+ state String @unique
213
+ expiresAt DateTime
214
+ createdAt DateTime @default(now())
215
+
216
+ @@index([state])
217
+ @@index([expiresAt])
218
+ @@map("oauth_states")
219
+ }
220
+
208
221
  model Wallet {
209
222
  id String @id @default(cuid())
210
223
  balance Float @default(0)