export DB, Event creation, broker with city/state

This commit is contained in:
2024-09-12 15:13:56 +02:00
parent 60866473f7
commit 68d2615f0f
21 changed files with 242 additions and 40 deletions

View File

@@ -134,10 +134,10 @@ export const commercials = pgTable(
// });
export const listingEvents = pgTable('listing_events', {
id: uuid('id').primaryKey().defaultRandom().notNull(),
listingId: uuid('listing_id').notNull(), // Assuming listings are referenced by UUID, adjust as necessary
listingId: uuid('listing_id'), // Assuming listings are referenced by UUID, adjust as necessary
userId: uuid('user_id'), // Nullable, if user is logged in, otherwise null
eventType: varchar('event_type', { length: 50 }).notNull(), // 'view', 'print', 'email', 'facebook', 'x', 'linkedin', 'contact'
eventTimestamp: timestamp('event_timestamp').defaultNow().notNull(),
eventType: varchar('event_type', { length: 50 }), // 'view', 'print', 'email', 'facebook', 'x', 'linkedin', 'contact'
eventTimestamp: timestamp('event_timestamp').defaultNow(),
userIp: varchar('user_ip', { length: 45 }), // Optional if you choose to track IP in frontend or backend
userAgent: varchar('user_agent', { length: 255 }), // Store User-Agent as string
locationCountry: varchar('location_country', { length: 100 }), // Country from IP