kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
05ae5e307e
commit
97e9b9b9c5
|
@ -6,8 +6,6 @@ import type {
|
||||||
} from '@fisch0920/drizzle-orm'
|
} from '@fisch0920/drizzle-orm'
|
||||||
import type { z } from '@hono/zod-openapi'
|
import type { z } from '@hono/zod-openapi'
|
||||||
|
|
||||||
import type { UndefinedToNullDeep } from '@/lib/types'
|
|
||||||
|
|
||||||
import type * as schema from './schema'
|
import type * as schema from './schema'
|
||||||
|
|
||||||
export type Tables = ExtractTablesWithRelations<typeof schema>
|
export type Tables = ExtractTablesWithRelations<typeof schema>
|
||||||
|
@ -55,11 +53,9 @@ export type ConsumerWithProjectAndDeployment = BuildQueryResult<
|
||||||
>
|
>
|
||||||
export type RawConsumer = InferSelectModel<typeof schema.consumers>
|
export type RawConsumer = InferSelectModel<typeof schema.consumers>
|
||||||
export type ConsumerUpdate = Partial<
|
export type ConsumerUpdate = Partial<
|
||||||
UndefinedToNullDeep<
|
Omit<
|
||||||
Omit<
|
InferInsertModel<typeof schema.consumers>,
|
||||||
InferInsertModel<typeof schema.consumers>,
|
'id' | 'projectId' | 'userId' | 'deploymentId'
|
||||||
'id' | 'projectId' | 'userId' | 'deploymentId'
|
|
||||||
>
|
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,7 @@ export async function upsertStripeSubscription({
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO
|
// TODO
|
||||||
consumerUpdate.stripeSubscriptionMetricItems![metricSlug] = null
|
delete consumerUpdate.stripeSubscriptionMetricItems![metricSlug]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ export async function upsertStripeSubscription({
|
||||||
|
|
||||||
const [updatedConsumer] = await db
|
const [updatedConsumer] = await db
|
||||||
.update(schema.consumers)
|
.update(schema.consumers)
|
||||||
.set(consumerUpdate as any) // TODO
|
.set(consumerUpdate)
|
||||||
.where(eq(schema.consumers.id, consumer.id))
|
.where(eq(schema.consumers.id, consumer.id))
|
||||||
.returning()
|
.returning()
|
||||||
assert(updatedConsumer, 500, 'Error updating consumer')
|
assert(updatedConsumer, 500, 'Error updating consumer')
|
||||||
|
|
|
@ -25,12 +25,18 @@ export type AuthenticatedContext = Context<AuthenticatedEnv>
|
||||||
// ? { [K in keyof T]: NullToUndefinedDeep<T[K]> }
|
// ? { [K in keyof T]: NullToUndefinedDeep<T[K]> }
|
||||||
// : T
|
// : T
|
||||||
|
|
||||||
export type UndefinedToNullDeep<T> = T extends undefined
|
// // TODO: currently unused
|
||||||
? T | null
|
// export type UndefinedToNullDeep<T> = T extends undefined
|
||||||
: T extends Date
|
// ? T | null
|
||||||
? T | null
|
// : T extends Date
|
||||||
: T extends readonly (infer U)[]
|
// ? T | null
|
||||||
? UndefinedToNullDeep<U>[]
|
// : T extends readonly (infer U)[]
|
||||||
: T extends object
|
// ? UndefinedToNullDeep<U>[]
|
||||||
? { [K in keyof T]: UndefinedToNullDeep<T[K]> }
|
// : T extends object
|
||||||
: T | null
|
// ? { [K in keyof T]: UndefinedToNullDeep<T[K]> }
|
||||||
|
// : T | null
|
||||||
|
|
||||||
|
// // TODO: currently unused
|
||||||
|
// export type UndefinedValuesToNullableValues<T> = T extends object
|
||||||
|
// ? { [K in keyof T]: T[K] extends undefined ? T[K] | null : T[K] }
|
||||||
|
// : T
|
||||||
|
|
|
@ -5,6 +5,7 @@ export default [
|
||||||
...config,
|
...config,
|
||||||
{
|
{
|
||||||
files: ['**/*.ts', '**/*.tsx'],
|
files: ['**/*.ts', '**/*.tsx'],
|
||||||
|
ignores: ['**/out/**'],
|
||||||
plugins: {
|
plugins: {
|
||||||
drizzle
|
drizzle
|
||||||
},
|
},
|
||||||
|
|
Ładowanie…
Reference in New Issue