This commit is contained in:
Oscar
2026-06-02 16:22:53 +03:00
parent dc44cdd639
commit bc3e48bcad
37 changed files with 973 additions and 1894 deletions

View File

@@ -1,14 +1,14 @@
import { date, doublePrecision, pgEnum, pgTable, text, uuid, varchar } from 'drizzle-orm/pg-core';
import { date, doublePrecision, integer, pgEnum, pgTable, text, uuid, varchar } from 'drizzle-orm/pg-core';
import { user } from './user.schema';
import { city, cityDistrict } from './city.schema';
export const genderEnum = pgEnum('gender', ['male', 'female']);
export const profileMediaTypeEnum = pgEnum('profile_media_type', ['photo', 'video', 'audio']);
export const profile = pgTable('profile', {
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('user_id')
.notNull()
.unique()
.references(() => user.id, { onDelete: 'cascade' }),
name: varchar('name', { length: 100 }).notNull(),
birthDate: date('birth_date').notNull(),
@@ -19,6 +19,18 @@ export const profile = pgTable('profile', {
nation: varchar('nation', { length: 100 }),
height: doublePrecision('height'),
weight: doublePrecision('weight'),
activeChatId: uuid('active_chat_id'),
});
// Media attachments for a profile (photos, videos, audio)
export const profileMedia = pgTable('profile_media', {
id: uuid('id').primaryKey().defaultRandom(),
profileId: uuid('profile_id')
.notNull()
.references(() => profile.id, { onDelete: 'cascade' }),
path: text('path').notNull(),
type: profileMediaTypeEnum('type').notNull(),
sortOrder: integer('sort_order').notNull().default(0),
});
export const tag = pgTable('tag', {
@@ -34,12 +46,3 @@ export const profileTag = pgTable('profile_tag', {
.notNull()
.references(() => tag.id, { onDelete: 'cascade' }),
});
export const media = pgTable('media', {
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('user_id')
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),
path: text('path').notNull(),
type: varchar('type', { length: 10 }).notNull(),
});