Add lastValidatedAt to license keys

This commit is contained in:
NeilClack
2026-09-10 13:18:15 -05:00
parent 1aecc51bbd
commit 0175cab0b4
7 changed files with 54 additions and 13 deletions
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "LicenseKey" ADD COLUMN "lastValidatedAt" TIMESTAMP(3);
+1
View File
@@ -199,6 +199,7 @@ model LicenseKey {
key String @unique
active Boolean
createdAt DateTime @default(now())
lastValidatedAt DateTime?
userId String?
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
email String?
File diff suppressed because one or more lines are too long
@@ -1718,6 +1718,7 @@ export const LicenseKeyScalarFieldEnum = {
key: 'key',
active: 'active',
createdAt: 'createdAt',
lastValidatedAt: 'lastValidatedAt',
userId: 'userId',
email: 'email'
} as const
@@ -235,6 +235,7 @@ export const LicenseKeyScalarFieldEnum = {
key: 'key',
active: 'active',
createdAt: 'createdAt',
lastValidatedAt: 'lastValidatedAt',
userId: 'userId',
email: 'email'
} as const
+36 -1
View File
@@ -29,6 +29,7 @@ export type LicenseKeyMinAggregateOutputType = {
key: string | null
active: boolean | null
createdAt: Date | null
lastValidatedAt: Date | null
userId: string | null
email: string | null
}
@@ -38,6 +39,7 @@ export type LicenseKeyMaxAggregateOutputType = {
key: string | null
active: boolean | null
createdAt: Date | null
lastValidatedAt: Date | null
userId: string | null
email: string | null
}
@@ -47,6 +49,7 @@ export type LicenseKeyCountAggregateOutputType = {
key: number
active: number
createdAt: number
lastValidatedAt: number
userId: number
email: number
_all: number
@@ -58,6 +61,7 @@ export type LicenseKeyMinAggregateInputType = {
key?: true
active?: true
createdAt?: true
lastValidatedAt?: true
userId?: true
email?: true
}
@@ -67,6 +71,7 @@ export type LicenseKeyMaxAggregateInputType = {
key?: true
active?: true
createdAt?: true
lastValidatedAt?: true
userId?: true
email?: true
}
@@ -76,6 +81,7 @@ export type LicenseKeyCountAggregateInputType = {
key?: true
active?: true
createdAt?: true
lastValidatedAt?: true
userId?: true
email?: true
_all?: true
@@ -158,6 +164,7 @@ export type LicenseKeyGroupByOutputType = {
key: string
active: boolean
createdAt: Date
lastValidatedAt: Date | null
userId: string | null
email: string | null
_count: LicenseKeyCountAggregateOutputType | null
@@ -188,6 +195,7 @@ export type LicenseKeyWhereInput = {
key?: Prisma.StringFilter<"LicenseKey"> | string
active?: Prisma.BoolFilter<"LicenseKey"> | boolean
createdAt?: Prisma.DateTimeFilter<"LicenseKey"> | Date | string
lastValidatedAt?: Prisma.DateTimeNullableFilter<"LicenseKey"> | Date | string | null
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
@@ -198,6 +206,7 @@ export type LicenseKeyOrderByWithRelationInput = {
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
lastValidatedAt?: Prisma.SortOrderInput | Prisma.SortOrder
userId?: Prisma.SortOrderInput | Prisma.SortOrder
email?: Prisma.SortOrderInput | Prisma.SortOrder
user?: Prisma.UserOrderByWithRelationInput
@@ -211,6 +220,7 @@ export type LicenseKeyWhereUniqueInput = Prisma.AtLeast<{
NOT?: Prisma.LicenseKeyWhereInput | Prisma.LicenseKeyWhereInput[]
active?: Prisma.BoolFilter<"LicenseKey"> | boolean
createdAt?: Prisma.DateTimeFilter<"LicenseKey"> | Date | string
lastValidatedAt?: Prisma.DateTimeNullableFilter<"LicenseKey"> | Date | string | null
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
@@ -221,6 +231,7 @@ export type LicenseKeyOrderByWithAggregationInput = {
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
lastValidatedAt?: Prisma.SortOrderInput | Prisma.SortOrder
userId?: Prisma.SortOrderInput | Prisma.SortOrder
email?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.LicenseKeyCountOrderByAggregateInput
@@ -236,6 +247,7 @@ export type LicenseKeyScalarWhereWithAggregatesInput = {
key?: Prisma.StringWithAggregatesFilter<"LicenseKey"> | string
active?: Prisma.BoolWithAggregatesFilter<"LicenseKey"> | boolean
createdAt?: Prisma.DateTimeWithAggregatesFilter<"LicenseKey"> | Date | string
lastValidatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"LicenseKey"> | Date | string | null
userId?: Prisma.StringNullableWithAggregatesFilter<"LicenseKey"> | string | null
email?: Prisma.StringNullableWithAggregatesFilter<"LicenseKey"> | string | null
}
@@ -245,6 +257,7 @@ export type LicenseKeyCreateInput = {
key: string
active: boolean
createdAt?: Date | string
lastValidatedAt?: Date | string | null
email?: string | null
user?: Prisma.UserCreateNestedOneWithoutLicenseKeysInput
}
@@ -254,6 +267,7 @@ export type LicenseKeyUncheckedCreateInput = {
key: string
active: boolean
createdAt?: Date | string
lastValidatedAt?: Date | string | null
userId?: string | null
email?: string | null
}
@@ -263,6 +277,7 @@ export type LicenseKeyUpdateInput = {
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
user?: Prisma.UserUpdateOneWithoutLicenseKeysNestedInput
}
@@ -272,6 +287,7 @@ export type LicenseKeyUncheckedUpdateInput = {
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -281,6 +297,7 @@ export type LicenseKeyCreateManyInput = {
key: string
active: boolean
createdAt?: Date | string
lastValidatedAt?: Date | string | null
userId?: string | null
email?: string | null
}
@@ -290,6 +307,7 @@ export type LicenseKeyUpdateManyMutationInput = {
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -298,6 +316,7 @@ export type LicenseKeyUncheckedUpdateManyInput = {
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -317,6 +336,7 @@ export type LicenseKeyCountOrderByAggregateInput = {
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
lastValidatedAt?: Prisma.SortOrder
userId?: Prisma.SortOrder
email?: Prisma.SortOrder
}
@@ -326,6 +346,7 @@ export type LicenseKeyMaxOrderByAggregateInput = {
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
lastValidatedAt?: Prisma.SortOrder
userId?: Prisma.SortOrder
email?: Prisma.SortOrder
}
@@ -335,6 +356,7 @@ export type LicenseKeyMinOrderByAggregateInput = {
key?: Prisma.SortOrder
active?: Prisma.SortOrder
createdAt?: Prisma.SortOrder
lastValidatedAt?: Prisma.SortOrder
userId?: Prisma.SortOrder
email?: Prisma.SortOrder
}
@@ -386,6 +408,7 @@ export type LicenseKeyCreateWithoutUserInput = {
key: string
active: boolean
createdAt?: Date | string
lastValidatedAt?: Date | string | null
email?: string | null
}
@@ -394,6 +417,7 @@ export type LicenseKeyUncheckedCreateWithoutUserInput = {
key: string
active: boolean
createdAt?: Date | string
lastValidatedAt?: Date | string | null
email?: string | null
}
@@ -431,6 +455,7 @@ export type LicenseKeyScalarWhereInput = {
key?: Prisma.StringFilter<"LicenseKey"> | string
active?: Prisma.BoolFilter<"LicenseKey"> | boolean
createdAt?: Prisma.DateTimeFilter<"LicenseKey"> | Date | string
lastValidatedAt?: Prisma.DateTimeNullableFilter<"LicenseKey"> | Date | string | null
userId?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
email?: Prisma.StringNullableFilter<"LicenseKey"> | string | null
}
@@ -440,6 +465,7 @@ export type LicenseKeyCreateManyUserInput = {
key: string
active: boolean
createdAt?: Date | string
lastValidatedAt?: Date | string | null
email?: string | null
}
@@ -448,6 +474,7 @@ export type LicenseKeyUpdateWithoutUserInput = {
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -456,6 +483,7 @@ export type LicenseKeyUncheckedUpdateWithoutUserInput = {
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -464,6 +492,7 @@ export type LicenseKeyUncheckedUpdateManyWithoutUserInput = {
key?: Prisma.StringFieldUpdateOperationsInput | string
active?: Prisma.BoolFieldUpdateOperationsInput | boolean
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
lastValidatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -474,6 +503,7 @@ export type LicenseKeySelect<ExtArgs extends runtime.Types.Extensions.InternalAr
key?: boolean
active?: boolean
createdAt?: boolean
lastValidatedAt?: boolean
userId?: boolean
email?: boolean
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
@@ -484,6 +514,7 @@ export type LicenseKeySelectCreateManyAndReturn<ExtArgs extends runtime.Types.Ex
key?: boolean
active?: boolean
createdAt?: boolean
lastValidatedAt?: boolean
userId?: boolean
email?: boolean
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
@@ -494,6 +525,7 @@ export type LicenseKeySelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Ex
key?: boolean
active?: boolean
createdAt?: boolean
lastValidatedAt?: boolean
userId?: boolean
email?: boolean
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
@@ -504,11 +536,12 @@ export type LicenseKeySelectScalar = {
key?: boolean
active?: boolean
createdAt?: boolean
lastValidatedAt?: boolean
userId?: boolean
email?: boolean
}
export type LicenseKeyOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "key" | "active" | "createdAt" | "userId" | "email", ExtArgs["result"]["licenseKey"]>
export type LicenseKeyOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "key" | "active" | "createdAt" | "lastValidatedAt" | "userId" | "email", ExtArgs["result"]["licenseKey"]>
export type LicenseKeyInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
user?: boolean | Prisma.LicenseKey$userArgs<ExtArgs>
}
@@ -529,6 +562,7 @@ export type $LicenseKeyPayload<ExtArgs extends runtime.Types.Extensions.Internal
key: string
active: boolean
createdAt: Date
lastValidatedAt: Date | null
userId: string | null
email: string | null
}, ExtArgs["result"]["licenseKey"]>
@@ -959,6 +993,7 @@ export interface LicenseKeyFieldRefs {
readonly key: Prisma.FieldRef<"LicenseKey", 'String'>
readonly active: Prisma.FieldRef<"LicenseKey", 'Boolean'>
readonly createdAt: Prisma.FieldRef<"LicenseKey", 'DateTime'>
readonly lastValidatedAt: Prisma.FieldRef<"LicenseKey", 'DateTime'>
readonly userId: Prisma.FieldRef<"LicenseKey", 'String'>
readonly email: Prisma.FieldRef<"LicenseKey", 'String'>
}
+1
View File
@@ -89,6 +89,7 @@ export function mockLicenseKey(overrides?: Record<string, unknown>) {
key: 'AAAA-BBBB-CCCC-DDDD',
active: true,
createdAt: new Date('2026-01-01T00:00:00.000Z'),
lastValidatedAt: null,
level: 'standard',
userId: 'user-1',
...overrides