🔗 Free Modern URL Shortener. https://kutt.it/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
2.9 KiB

1 year ago
1 year ago
1 year ago
1 year ago
  1. type Raw = import("knex").Raw;
  2. type Match<T> = {
  3. [K in keyof T]?: T[K] | [">" | ">=" | "<=" | "<", T[K]];
  4. };
  5. interface User {
  6. apikey?: string;
  7. banned_by_id?: number;
  8. banned: boolean;
  9. change_email_address?: string;
  10. change_email_expires?: string;
  11. change_email_token?: string;
  12. cooldowns?: string[];
  13. created_at: string;
  14. email: string;
  15. id: number;
  16. password: string;
  17. reset_password_expires?: string;
  18. reset_password_token?: string;
  19. updated_at: string;
  20. verification_expires?: string;
  21. verification_token?: string;
  22. verified?: boolean;
  23. }
  24. interface UserJoined extends User {
  25. admin?: boolean;
  26. homepage?: string;
  27. domain?: string;
  28. domain_id?: number;
  29. }
  30. interface Domain {
  31. id: number;
  32. uuid: string;
  33. address: string;
  34. banned: boolean;
  35. banned_by_id?: number;
  36. created_at: string;
  37. homepage?: string;
  38. updated_at: string;
  39. user_id?: number;
  40. }
  41. interface DomainSanitized {
  42. id: string;
  43. uuid: undefined;
  44. address: string;
  45. banned: boolean;
  46. banned_by_id?: undefined;
  47. created_at: string;
  48. homepage?: string;
  49. updated_at: string;
  50. user_id?: undefined;
  51. }
  52. interface Host {
  53. id: number;
  54. address: string;
  55. banned: boolean;
  56. banned_by_id?: number;
  57. created_at: string;
  58. updated_at: string;
  59. }
  60. interface IP {
  61. id: number;
  62. created_at: string;
  63. updated_at: string;
  64. ip: string;
  65. }
  66. interface Link {
  67. address: string;
  68. banned_by_id?: number;
  69. banned: boolean;
  70. created_at: string;
  71. description?: string;
  72. domain_id?: number;
  73. expire_in: string;
  74. id: number;
  75. password?: string;
  76. target: string;
  77. updated_at: string;
  78. user_id?: number;
  79. uuid: string;
  80. visit_count: number;
  81. }
  82. interface LinkSanitized {
  83. address: string;
  84. banned_by_id?: undefined;
  85. banned: boolean;
  86. created_at: string;
  87. domain_id?: undefined;
  88. id: string;
  89. link: string;
  90. password: boolean;
  91. target: string;
  92. updated_at: string;
  93. user_id?: undefined;
  94. uuid?: undefined;
  95. visit_count: number;
  96. }
  97. interface LinkJoinedDomain extends Link {
  98. domain?: string;
  99. }
  100. interface Visit {
  101. id: number;
  102. countries: Record<string, number>;
  103. created_at: string;
  104. link_id: number;
  105. referrers: Record<string, number>;
  106. total: number;
  107. br_chrome: number;
  108. br_edge: number;
  109. br_firefox: number;
  110. br_ie: number;
  111. br_opera: number;
  112. br_other: number;
  113. br_safari: number;
  114. os_android: number;
  115. os_ios: number;
  116. os_linux: number;
  117. os_macos: number;
  118. os_other: number;
  119. os_windows: number;
  120. }
  121. interface Stats {
  122. browser: Record<
  123. "chrome" | "edge" | "firefox" | "ie" | "opera" | "other" | "safari",
  124. number
  125. >;
  126. os: Record<
  127. "android" | "ios" | "linux" | "macos" | "other" | "windows",
  128. number
  129. >;
  130. country: Record<string, number>;
  131. referrer: Record<string, number>;
  132. }
  133. declare namespace Express {
  134. export interface Request {
  135. realIP?: string;
  136. pageType?: string;
  137. linkTarget?: string;
  138. protectedLink?: string;
  139. token?: string;
  140. user: UserJoined;
  141. }
  142. }