index.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { type Session } from 'next-auth';
  2. import { Prisma } from '@prisma/client'
  3. export type IconType = {
  4. name: string
  5. tags: string[]
  6. svg: string
  7. version: string
  8. category: string
  9. }
  10. export type IconsType = IconType[]
  11. export type DocsItem = {
  12. title: string
  13. items: {
  14. title: string
  15. href: string
  16. label?: string
  17. }[]
  18. }
  19. export type DocsConfigType = DocsItem[]
  20. export type ExtendedSession = Session & { user?: { id?: string} }
  21. const userWithRelations = Prisma.validator<Prisma.UserDefaultArgs>()({
  22. include: { accounts: true, sessions: true, subscription: true },
  23. })
  24. export type User = Prisma.UserGetPayload<typeof userWithRelations>
  25. const planWithRelations = Prisma.validator<Prisma.PlanDefaultArgs>()({
  26. include: { subscriptions: true },
  27. })
  28. export type Plan = Prisma.PlanGetPayload<typeof planWithRelations>
  29. const subscriptionWithRelations = Prisma.validator<Prisma.SubscriptionDefaultArgs>()({
  30. include: { plan: true, user: true },
  31. })
  32. export type Subscription = Prisma.SubscriptionGetPayload<typeof subscriptionWithRelations>
  33. export type SubscriptionState = {
  34. id?: number,
  35. planName?: string,
  36. planInterval?: string,
  37. productId?: number,
  38. variantId?: number,
  39. status?: string,
  40. renewalDate?: Date | null,
  41. trialEndDate?: Date | null,
  42. expiryDate?: Date | null,
  43. unpauseDate?: Date | null,
  44. price?: number,
  45. } | undefined