diff --git a/src/lib/server/api/infrastructure/database/seed.ts b/src/lib/server/api/infrastructure/database/seed.ts index 016f5b9..7a7495e 100644 --- a/src/lib/server/api/infrastructure/database/seed.ts +++ b/src/lib/server/api/infrastructure/database/seed.ts @@ -14,7 +14,7 @@ async function resetTable(db: db, table: Table) { for (const table of [ schema.categories, - schema.categoriesToExternalIds, + schema.categoriesToExternalIdsTable, schema.categories_to_games, schema.collection_items, schema.collections, diff --git a/src/lib/server/api/infrastructure/database/tables/categories.table.ts b/src/lib/server/api/infrastructure/database/tables/categories.table.ts new file mode 100644 index 0000000..b22cfc7 --- /dev/null +++ b/src/lib/server/api/infrastructure/database/tables/categories.table.ts @@ -0,0 +1,23 @@ +import { pgTable, text, uuid } from 'drizzle-orm/pg-core'; +import { createId as cuid2 } from '@paralleldrive/cuid2'; +import { type InferSelectModel, relations } from 'drizzle-orm'; +import {categoriesToExternalIdsTable} from './categoriesToExternalIdsTable'; +import { categories_to_games_table } from './categoriesToGames'; +import { timestamps } from '../utils'; + +export const categoriesTable = pgTable('categories', { + id: uuid('id').primaryKey().defaultRandom(), + cuid: text('cuid') + .unique() + .$defaultFn(() => cuid2()), + name: text('name'), + slug: text('slug'), + ...timestamps, +}); + +export type Categories = InferSelectModel; + +export const categories_relations = relations(categoriesTable, ({ many }) => ({ + categories_to_games: many(categories_to_games_table), + categoriesToExternalIds: many(categoriesToExternalIdsTable), +})); diff --git a/src/lib/server/api/infrastructure/database/tables/categories.ts b/src/lib/server/api/infrastructure/database/tables/categories.ts deleted file mode 100644 index 5936858..0000000 --- a/src/lib/server/api/infrastructure/database/tables/categories.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { pgTable, text, uuid } from 'drizzle-orm/pg-core'; -import { createId as cuid2 } from '@paralleldrive/cuid2'; -import { type InferSelectModel, relations } from 'drizzle-orm'; -import categoriesToExternalIds from './categoriesToExternalIds'; -import categories_to_games from './categoriesToGames'; -import { timestamps } from '../utils'; - -const categories = pgTable('categories', { - id: uuid('id').primaryKey().defaultRandom(), - cuid: text('cuid') - .unique() - .$defaultFn(() => cuid2()), - name: text('name'), - slug: text('slug'), - ...timestamps, -}); - -export type Categories = InferSelectModel; - -export const categories_relations = relations(categories, ({ many }) => ({ - categories_to_games: many(categories_to_games), - categoriesToExternalIds: many(categoriesToExternalIds), -})); - -export default categories; diff --git a/src/lib/server/api/infrastructure/database/tables/categoriesToExternalIds.ts b/src/lib/server/api/infrastructure/database/tables/categoriesToExternalIdsTable.ts similarity index 62% rename from src/lib/server/api/infrastructure/database/tables/categoriesToExternalIds.ts rename to src/lib/server/api/infrastructure/database/tables/categoriesToExternalIdsTable.ts index 352b732..b06a267 100644 --- a/src/lib/server/api/infrastructure/database/tables/categoriesToExternalIds.ts +++ b/src/lib/server/api/infrastructure/database/tables/categoriesToExternalIdsTable.ts @@ -1,14 +1,14 @@ import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; -import categories from './categories'; +import { categoriesTable } from './categories.table'; import externalIds from './externalIds'; import { relations } from 'drizzle-orm'; -const categoriesToExternalIds = pgTable( +export const categoriesToExternalIdsTable = pgTable( 'categories_to_external_ids', { categoryId: uuid('category_id') .notNull() - .references(() => categories.id, { onDelete: 'restrict', onUpdate: 'cascade' }), + .references(() => categoriesTable.id, { onDelete: 'restrict', onUpdate: 'cascade' }), externalId: uuid('external_id') .notNull() .references(() => externalIds.id, { onDelete: 'restrict', onUpdate: 'cascade' }), @@ -23,17 +23,15 @@ const categoriesToExternalIds = pgTable( ); export const categoriesToExternalIdsRelations = relations( - categoriesToExternalIds, + categoriesToExternalIdsTable, ({ one }) => ({ - category: one(categories, { - fields: [categoriesToExternalIds.categoryId], - references: [categories.id], + category: one(categoriesTable, { + fields: [categoriesToExternalIdsTable.categoryId], + references: [categoriesTable.id], }), externalId: one(externalIds, { - fields: [categoriesToExternalIds.externalId], + fields: [categoriesToExternalIdsTable.externalId], references: [externalIds.id], }), }), ); - -export default categoriesToExternalIds; diff --git a/src/lib/server/api/infrastructure/database/tables/categoriesToGames.ts b/src/lib/server/api/infrastructure/database/tables/categoriesToGames.ts index 7afb8e2..4343a7c 100644 --- a/src/lib/server/api/infrastructure/database/tables/categoriesToGames.ts +++ b/src/lib/server/api/infrastructure/database/tables/categoriesToGames.ts @@ -1,14 +1,14 @@ import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { relations } from 'drizzle-orm'; -import categories from './categories'; +import { categoriesTable } from './categories.table'; import games from './games'; -const categories_to_games = pgTable( +export const categories_to_games_table = pgTable( 'categories_to_games', { category_id: uuid('category_id') .notNull() - .references(() => categories.id, { onDelete: 'restrict', onUpdate: 'cascade' }), + .references(() => categoriesTable.id, { onDelete: 'restrict', onUpdate: 'cascade' }), game_id: uuid('game_id') .notNull() .references(() => games.id, { onDelete: 'restrict', onUpdate: 'cascade' }), @@ -22,15 +22,14 @@ const categories_to_games = pgTable( }, ); -export const categories_to_games_relations = relations(categories_to_games, ({ one }) => ({ - category: one(categories, { - fields: [categories_to_games.category_id], - references: [categories.id], +export const categories_to_games_relations = relations(categories_to_games_table, ({ one }) => ({ + category: one(categoriesTable, { + fields: [categories_to_games_table.category_id], + references: [categoriesTable.id], }), game: one(games, { - fields: [categories_to_games.game_id], + fields: [categories_to_games_table.game_id], references: [games.id], }), })); -export default categories_to_games; diff --git a/src/lib/server/api/infrastructure/database/tables/collectionItems.ts b/src/lib/server/api/infrastructure/database/tables/collectionItems.ts index cf1805c..131ac2f 100644 --- a/src/lib/server/api/infrastructure/database/tables/collectionItems.ts +++ b/src/lib/server/api/infrastructure/database/tables/collectionItems.ts @@ -1,11 +1,11 @@ import { integer, pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { createId as cuid2 } from '@paralleldrive/cuid2'; import { type InferSelectModel, relations } from 'drizzle-orm'; -import collections from './collections'; +import { collections } from './collections'; import games from './games'; import { timestamps } from '../utils'; -const collection_items = pgTable('collection_items', { +export const collection_items = pgTable('collection_items', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -32,5 +32,3 @@ export const collection_item_relations = relations(collection_items, ({ one }) = references: [games.id], }), })); - -export default collection_items; diff --git a/src/lib/server/api/infrastructure/database/tables/collections.ts b/src/lib/server/api/infrastructure/database/tables/collections.ts index 58b8297..9f881ba 100644 --- a/src/lib/server/api/infrastructure/database/tables/collections.ts +++ b/src/lib/server/api/infrastructure/database/tables/collections.ts @@ -1,10 +1,10 @@ -import { pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'; +import { pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { createId as cuid2 } from '@paralleldrive/cuid2'; import { type InferSelectModel, relations } from 'drizzle-orm'; import { usersTable } from './users.table'; import { timestamps } from '../utils'; -const collections = pgTable('collections', { +export const collections = pgTable('collections', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -25,4 +25,3 @@ export const collection_relations = relations(collections, ({ one }) => ({ export type Collections = InferSelectModel; -export default collections; diff --git a/src/lib/server/api/infrastructure/database/tables/expansions.ts b/src/lib/server/api/infrastructure/database/tables/expansions.ts index ff56e4d..200bfff 100644 --- a/src/lib/server/api/infrastructure/database/tables/expansions.ts +++ b/src/lib/server/api/infrastructure/database/tables/expansions.ts @@ -30,5 +30,3 @@ export const expansion_relations = relations(expansions, ({ one }) => ({ references: [games.id], }), })); - -export default expansions; diff --git a/src/lib/server/api/infrastructure/database/tables/externalIds.ts b/src/lib/server/api/infrastructure/database/tables/externalIds.ts index 5d0a481..80c1033 100644 --- a/src/lib/server/api/infrastructure/database/tables/externalIds.ts +++ b/src/lib/server/api/infrastructure/database/tables/externalIds.ts @@ -11,7 +11,7 @@ export const externalIdType = pgEnum('external_id_type', [ 'artist', ]); -const externalIds = pgTable('external_ids', { +export const externalIds = pgTable('external_ids', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -21,5 +21,3 @@ const externalIds = pgTable('external_ids', { }); export type ExternalIds = InferSelectModel; - -export default externalIds; diff --git a/src/lib/server/api/infrastructure/database/tables/federatedIdentity.table.ts b/src/lib/server/api/infrastructure/database/tables/federatedIdentity.table.ts index c47f817..63d9313 100644 --- a/src/lib/server/api/infrastructure/database/tables/federatedIdentity.table.ts +++ b/src/lib/server/api/infrastructure/database/tables/federatedIdentity.table.ts @@ -1,4 +1,5 @@ import { pgTable, text, uuid } from "drizzle-orm/pg-core"; +import { type InferSelectModel } from 'drizzle-orm'; import { usersTable } from "./users.table"; import { timestamps } from '../utils'; @@ -11,4 +12,6 @@ export const federatedIdentityTable = pgTable('federated_identity', { federated_user_id: text('federated_user_id').notNull(), federated_username: text('federated_username').notNull(), ...timestamps -}); \ No newline at end of file +}); + +export type FederatedIdentity = InferSelectModel; diff --git a/src/lib/server/api/infrastructure/database/tables/games.ts b/src/lib/server/api/infrastructure/database/tables/games.ts index 91d5cfa..99ec01a 100644 --- a/src/lib/server/api/infrastructure/database/tables/games.ts +++ b/src/lib/server/api/infrastructure/database/tables/games.ts @@ -1,13 +1,13 @@ import { index, integer, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'; import { createId as cuid2 } from '@paralleldrive/cuid2'; import { type InferSelectModel, relations, sql } from 'drizzle-orm'; -import categoriesToGames from './categoriesToGames'; -import gamesToExternalIds from './gamesToExternalIds'; -import mechanicsToGames from './mechanicsToGames'; -import publishersToGames from './publishersToGames'; +import {categories_to_games_table} from './categoriesToGames'; +import {gamesToExternalIds} from './gamesToExternalIds'; +import {mechanics_to_games} from './mechanicsToGames'; +import {publishers_to_games} from './publishersToGames'; import { timestamps } from '../utils'; -const games = pgTable( +export const games = pgTable( 'games', { id: uuid('id').primaryKey().defaultRandom(), @@ -42,12 +42,10 @@ const games = pgTable( ); export const gameRelations = relations(games, ({ many }) => ({ - categories_to_games: many(categoriesToGames), - mechanics_to_games: many(mechanicsToGames), - publishers_to_games: many(publishersToGames), + categories_to_games: many(categories_to_games_table), + mechanics_to_games: many(mechanics_to_games), + publishers_to_games: many(publishers_to_games), gamesToExternalIds: many(gamesToExternalIds), })); export type Games = InferSelectModel; - -export default games; diff --git a/src/lib/server/api/infrastructure/database/tables/gamesToExternalIds.ts b/src/lib/server/api/infrastructure/database/tables/gamesToExternalIds.ts index 66edec9..b625924 100644 --- a/src/lib/server/api/infrastructure/database/tables/gamesToExternalIds.ts +++ b/src/lib/server/api/infrastructure/database/tables/gamesToExternalIds.ts @@ -1,8 +1,8 @@ import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; -import games from './games'; -import externalIds from './externalIds'; +import {games} from './games'; +import {externalIds} from './externalIds'; -const gamesToExternalIds = pgTable( +export const gamesToExternalIds = pgTable( 'games_to_external_ids', { gameId: uuid('game_id') @@ -20,5 +20,3 @@ const gamesToExternalIds = pgTable( }; }, ); - -export default gamesToExternalIds; diff --git a/src/lib/server/api/infrastructure/database/tables/index.ts b/src/lib/server/api/infrastructure/database/tables/index.ts index 9b59c1e..e706804 100644 --- a/src/lib/server/api/infrastructure/database/tables/index.ts +++ b/src/lib/server/api/infrastructure/database/tables/index.ts @@ -1,36 +1,26 @@ -export { usersTable, userRelations as user_relations, type Users } from './users.table'; -export { default as recoveryCodes, type RecoveryCodes } from './recoveryCodes'; -export { - default as password_reset_tokens, - password_reset_token_relations, - type PasswordResetTokens, -} from './passwordResetTokens'; -export { default as sessionsTable, type Sessions } from './sessions.table'; -export { default as roles, role_relations, type Roles } from './roles'; -export { default as userRoles, user_role_relations, type UserRoles } from './userRoles'; -export { default as collections, collection_relations, type Collections } from './collections'; -export { - default as collection_items, - collection_item_relations, - type CollectionItems, -} from './collectionItems'; -export { default as wishlists, wishlists_relations, type Wishlists } from './wishlists'; -export { - default as wishlist_items, - wishlist_item_relations, - type WishlistItems, -} from './wishlistItems'; -export { default as externalIds, type ExternalIds, externalIdType } from './externalIds'; -export { default as games, gameRelations, type Games } from './games'; -export { default as gamesToExternalIds } from './gamesToExternalIds'; -export { default as expansions, expansion_relations, type Expansions } from './expansions'; -export { default as publishers, publishers_relations, type Publishers } from './publishers'; -export { default as publishers_to_games, publishers_to_games_relations } from './publishersToGames'; -export { default as publishersToExternalIds } from './publishersToExternalIds'; -export { default as categories, categories_relations, type Categories } from './categories'; -export { default as categoriesToExternalIds } from './categoriesToExternalIds'; -export { default as categories_to_games, categories_to_games_relations } from './categoriesToGames'; -export { default as mechanics, mechanics_relations, type Mechanics } from './mechanics'; -export { default as mechanicsToExternalIds } from './mechanicsToExternalIds'; -export { default as mechanics_to_games, mechanics_to_games_relations } from './mechanicsToGames'; -export { default as twoFactor } from './two-factor.table'; +export * from './categories.table'; +export * from './categoriesToExternalIdsTable'; +export * from './categoriesToGames'; +export * from './collectionItems'; +export * from './collections'; +export * from './credentials.table'; +export * from './expansions'; +export * from './externalIds'; +export * from './federatedIdentity.table'; +export * from './games'; +export * from './gamesToExternalIds'; +export * from './mechanics'; +export * from './mechanicsToExternalIds'; +export * from './mechanicsToGames' +export * from './passwordResetTokens'; +export * from './publishers'; +export * from './publishersToExternalIds'; +export * from './publishersToGames'; +export * from './recoveryCodes'; +export * from './roles'; +export * from './sessions.table'; +export * from './two-factor.table'; +export * from './userRoles'; +export * from './users.table'; +export * from './wishlistItems'; +export * from './wishlists'; \ No newline at end of file diff --git a/src/lib/server/api/infrastructure/database/tables/mechanics.ts b/src/lib/server/api/infrastructure/database/tables/mechanics.ts index 3a80fb0..72f5902 100644 --- a/src/lib/server/api/infrastructure/database/tables/mechanics.ts +++ b/src/lib/server/api/infrastructure/database/tables/mechanics.ts @@ -5,7 +5,7 @@ import mechanicsToGames from './mechanicsToGames'; import mechanicsToExternalIds from './mechanicsToExternalIds'; import { timestamps } from '../utils'; -const mechanics = pgTable('mechanics', { +export const mechanics = pgTable('mechanics', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -21,5 +21,3 @@ export const mechanics_relations = relations(mechanics, ({ many }) => ({ mechanics_to_games: many(mechanicsToGames), mechanicsToExternalIds: many(mechanicsToExternalIds), })); - -export default mechanics; diff --git a/src/lib/server/api/infrastructure/database/tables/mechanicsToExternalIds.ts b/src/lib/server/api/infrastructure/database/tables/mechanicsToExternalIds.ts index 8fab637..b755eab 100644 --- a/src/lib/server/api/infrastructure/database/tables/mechanicsToExternalIds.ts +++ b/src/lib/server/api/infrastructure/database/tables/mechanicsToExternalIds.ts @@ -1,8 +1,8 @@ import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; -import mechanics from './mechanics'; -import externalIds from './externalIds'; +import {mechanics} from './mechanics'; +import {externalIds} from './externalIds'; -const mechanicsToExternalIds = pgTable( +export const mechanicsToExternalIds = pgTable( 'mechanics_to_external_ids', { mechanicId: uuid('mechanic_id') @@ -20,5 +20,3 @@ const mechanicsToExternalIds = pgTable( }; }, ); - -export default mechanicsToExternalIds; diff --git a/src/lib/server/api/infrastructure/database/tables/mechanicsToGames.ts b/src/lib/server/api/infrastructure/database/tables/mechanicsToGames.ts index aa549c4..6faf721 100644 --- a/src/lib/server/api/infrastructure/database/tables/mechanicsToGames.ts +++ b/src/lib/server/api/infrastructure/database/tables/mechanicsToGames.ts @@ -1,9 +1,9 @@ import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { relations } from 'drizzle-orm'; -import mechanics from './mechanics'; -import games from './games'; +import {mechanics} from './mechanics'; +import {games} from './games'; -const mechanics_to_games = pgTable( +export const mechanics_to_games = pgTable( 'mechanics_to_games', { mechanic_id: uuid('mechanic_id') diff --git a/src/lib/server/api/infrastructure/database/tables/passwordResetTokens.ts b/src/lib/server/api/infrastructure/database/tables/passwordResetTokens.ts index 143ee28..3fa94bf 100644 --- a/src/lib/server/api/infrastructure/database/tables/passwordResetTokens.ts +++ b/src/lib/server/api/infrastructure/database/tables/passwordResetTokens.ts @@ -4,7 +4,7 @@ import { type InferSelectModel, relations } from 'drizzle-orm'; import { usersTable } from './users.table'; import { timestamps } from '../utils'; -const password_reset_tokens = pgTable('password_reset_tokens', { +export const password_reset_tokens = pgTable('password_reset_tokens', { id: text('id') .primaryKey() .$defaultFn(() => cuid2()), @@ -23,5 +23,3 @@ export const password_reset_token_relations = relations(password_reset_tokens, ( references: [usersTable.id], }), })); - -export default password_reset_tokens; diff --git a/src/lib/server/api/infrastructure/database/tables/publishers.ts b/src/lib/server/api/infrastructure/database/tables/publishers.ts index b83a3ef..65a0c2d 100644 --- a/src/lib/server/api/infrastructure/database/tables/publishers.ts +++ b/src/lib/server/api/infrastructure/database/tables/publishers.ts @@ -1,11 +1,11 @@ import { pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { createId as cuid2 } from '@paralleldrive/cuid2'; import { type InferSelectModel, relations } from 'drizzle-orm'; -import publishers_to_games from './publishersToGames'; +import {publishers_to_games} from './publishersToGames'; import publishersToExternalIds from './publishersToExternalIds'; import { timestamps } from '../utils'; -const publishers = pgTable('publishers', { +export const publishers = pgTable('publishers', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -21,5 +21,3 @@ export const publishers_relations = relations(publishers, ({ many }) => ({ publishers_to_games: many(publishers_to_games), publishersToExternalIds: many(publishersToExternalIds), })); - -export default publishers; diff --git a/src/lib/server/api/infrastructure/database/tables/publishersToExternalIds.ts b/src/lib/server/api/infrastructure/database/tables/publishersToExternalIds.ts index 898e6da..1f630d8 100644 --- a/src/lib/server/api/infrastructure/database/tables/publishersToExternalIds.ts +++ b/src/lib/server/api/infrastructure/database/tables/publishersToExternalIds.ts @@ -1,8 +1,8 @@ import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; -import publishers from './publishers'; -import externalIds from './externalIds'; +import {publishers} from './publishers'; +import {externalIds} from './externalIds'; -const publishersToExternalIds = pgTable( +export const publishersToExternalIds = pgTable( 'publishers_to_external_ids', { publisherId: uuid('publisher_id') @@ -20,5 +20,3 @@ const publishersToExternalIds = pgTable( }; }, ); - -export default publishersToExternalIds; diff --git a/src/lib/server/api/infrastructure/database/tables/publishersToGames.ts b/src/lib/server/api/infrastructure/database/tables/publishersToGames.ts index 86de77d..f2c2d24 100644 --- a/src/lib/server/api/infrastructure/database/tables/publishersToGames.ts +++ b/src/lib/server/api/infrastructure/database/tables/publishersToGames.ts @@ -1,9 +1,9 @@ import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { relations } from 'drizzle-orm'; -import publishers from './publishers'; -import games from './games'; +import {publishers} from './publishers'; +import {games} from './games'; -const publishers_to_games = pgTable( +export const publishers_to_games = pgTable( 'publishers_to_games', { publisher_id: uuid('publisher_id') @@ -32,5 +32,3 @@ export const publishers_to_games_relations = relations(publishers_to_games, ({ o references: [games.id], }), })); - -export default publishers_to_games; diff --git a/src/lib/server/api/infrastructure/database/tables/recoveryCodes.ts b/src/lib/server/api/infrastructure/database/tables/recoveryCodes.ts index 9a7ee8e..936ae79 100644 --- a/src/lib/server/api/infrastructure/database/tables/recoveryCodes.ts +++ b/src/lib/server/api/infrastructure/database/tables/recoveryCodes.ts @@ -3,7 +3,7 @@ import type { InferSelectModel } from 'drizzle-orm'; import { usersTable } from './users.table'; import { timestamps } from '../utils'; -const recovery_codes = pgTable('recovery_codes', { +export const recovery_codes = pgTable('recovery_codes', { id: uuid('id').primaryKey().defaultRandom(), userId: uuid('user_id') .notNull() @@ -14,5 +14,3 @@ const recovery_codes = pgTable('recovery_codes', { }); export type RecoveryCodes = InferSelectModel; - -export default recovery_codes; diff --git a/src/lib/server/api/infrastructure/database/tables/roles.ts b/src/lib/server/api/infrastructure/database/tables/roles.ts index 43768b0..4e701ac 100644 --- a/src/lib/server/api/infrastructure/database/tables/roles.ts +++ b/src/lib/server/api/infrastructure/database/tables/roles.ts @@ -1,10 +1,10 @@ import { pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { createId as cuid2 } from '@paralleldrive/cuid2'; import { type InferSelectModel, relations } from 'drizzle-orm'; -import user_roles from './userRoles'; +import {user_roles} from './userRoles'; import { timestamps } from '../utils'; -const roles = pgTable('roles', { +export const roles = pgTable('roles', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -19,5 +19,3 @@ export type Roles = InferSelectModel; export const role_relations = relations(roles, ({ many }) => ({ user_roles: many(user_roles), })); - -export default roles; diff --git a/src/lib/server/api/infrastructure/database/tables/sessions.table.ts b/src/lib/server/api/infrastructure/database/tables/sessions.table.ts index 823eb19..2985393 100644 --- a/src/lib/server/api/infrastructure/database/tables/sessions.table.ts +++ b/src/lib/server/api/infrastructure/database/tables/sessions.table.ts @@ -2,7 +2,7 @@ import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'; import { relations, type InferSelectModel } from 'drizzle-orm'; import { usersTable } from './users.table'; -const sessionsTable = pgTable('sessions', { +export const sessionsTable = pgTable('sessions', { id: text('id').primaryKey(), userId: uuid('user_id') .notNull() @@ -25,5 +25,3 @@ export const sessionsRelations = relations(sessionsTable, ({ one }) => ({ })); export type Sessions = InferSelectModel; - -export default sessionsTable; diff --git a/src/lib/server/api/infrastructure/database/tables/two-factor.table.ts b/src/lib/server/api/infrastructure/database/tables/two-factor.table.ts index b523a16..f4cd9a2 100644 --- a/src/lib/server/api/infrastructure/database/tables/two-factor.table.ts +++ b/src/lib/server/api/infrastructure/database/tables/two-factor.table.ts @@ -4,7 +4,7 @@ import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'; import { timestamps } from '../utils'; import { usersTable } from './users.table'; -const twoFactorTable = pgTable('two_factor', { +export const twoFactorTable = pgTable('two_factor', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -30,5 +30,3 @@ export const emailVerificationsRelations = relations(twoFactorTable, ({ one }) = })); export type TwoFactor = InferSelectModel; - -export default twoFactorTable; diff --git a/src/lib/server/api/infrastructure/database/tables/userRoles.ts b/src/lib/server/api/infrastructure/database/tables/userRoles.ts index 46489a0..6d3d833 100644 --- a/src/lib/server/api/infrastructure/database/tables/userRoles.ts +++ b/src/lib/server/api/infrastructure/database/tables/userRoles.ts @@ -2,10 +2,10 @@ import { boolean, pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { createId as cuid2 } from '@paralleldrive/cuid2'; import { type InferSelectModel, relations } from 'drizzle-orm'; import { usersTable } from './users.table'; -import roles from './roles'; +import {roles} from './roles'; import { timestamps } from '../utils'; -const user_roles = pgTable('user_roles', { +export const user_roles = pgTable('user_roles', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -32,5 +32,3 @@ export const user_role_relations = relations(user_roles, ({ one }) => ({ })); export type UserRoles = InferSelectModel; - -export default user_roles; diff --git a/src/lib/server/api/infrastructure/database/tables/users.table.ts b/src/lib/server/api/infrastructure/database/tables/users.table.ts index 0e90b66..77224f4 100644 --- a/src/lib/server/api/infrastructure/database/tables/users.table.ts +++ b/src/lib/server/api/infrastructure/database/tables/users.table.ts @@ -2,7 +2,7 @@ import { boolean, pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { createId as cuid2 } from '@paralleldrive/cuid2'; import { type InferSelectModel, relations } from 'drizzle-orm'; import { timestamps } from '../utils'; -import user_roles from './userRoles'; +import {user_roles} from './userRoles'; export const usersTable = pgTable('users', { id: uuid('id').primaryKey().defaultRandom(), diff --git a/src/lib/server/api/infrastructure/database/tables/wishlistItems.ts b/src/lib/server/api/infrastructure/database/tables/wishlistItems.ts index ac4bc61..1aaecac 100644 --- a/src/lib/server/api/infrastructure/database/tables/wishlistItems.ts +++ b/src/lib/server/api/infrastructure/database/tables/wishlistItems.ts @@ -2,10 +2,10 @@ import { pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { createId as cuid2 } from '@paralleldrive/cuid2'; import { type InferSelectModel, relations } from 'drizzle-orm'; import wishlists from './wishlists'; -import games from './games'; +import {games} from './games'; import { timestamps } from '../utils'; -const wishlist_items = pgTable('wishlist_items', { +export const wishlist_items = pgTable('wishlist_items', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -31,5 +31,3 @@ export const wishlist_item_relations = relations(wishlist_items, ({ one }) => ({ references: [games.id], }), })); - -export default wishlist_items; diff --git a/src/lib/server/api/infrastructure/database/tables/wishlists.ts b/src/lib/server/api/infrastructure/database/tables/wishlists.ts index 83cd754..8e0ab5e 100644 --- a/src/lib/server/api/infrastructure/database/tables/wishlists.ts +++ b/src/lib/server/api/infrastructure/database/tables/wishlists.ts @@ -4,7 +4,7 @@ import { type InferSelectModel, relations } from 'drizzle-orm'; import { usersTable } from './users.table'; import { timestamps } from '../utils'; -const wishlists = pgTable('wishlists', { +export const wishlists = pgTable('wishlists', { id: uuid('id').primaryKey().defaultRandom(), cuid: text('cuid') .unique() @@ -24,5 +24,3 @@ export const wishlists_relations = relations(wishlists, ({ one }) => ({ references: [usersTable.id], }), })); - -export default wishlists;