Update user data handling and password storage mechanisms

Refactor user model and storage implementations to correctly handle password hashing (using `passwordHash` instead of `password`), update field names for profile images to `avatar`, and ensure consistent user data mapping between database and in-memory storage. Includes schema adjustments for `users` table.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 68e1a8f7-084c-4a75-801e-34657bd7a71b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/68e1a8f7-084c-4a75-801e-34657bd7a71b/IiSxX58
This commit is contained in:
sebastjanartic
2025-09-02 12:10:11 +00:00
parent ced02be9dc
commit d283a0d4a5
2 changed files with 23 additions and 20 deletions
+5 -4
View File
@@ -39,14 +39,15 @@ export const videos = pgTable("videos", {
// User table for authentication and video ownership
export const users = pgTable("users", {
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
id: varchar("id").primaryKey(),
username: varchar("username", { length: 50 }).notNull().unique(),
email: varchar("email", { length: 255 }).notNull().unique(),
password: varchar("password", { length: 255 }).notNull(),
passwordHash: varchar("password_hash", { length: 255 }).notNull(),
firstName: varchar("first_name", { length: 100 }),
lastName: varchar("last_name", { length: 100 }),
profileImageUrl: text("profile_image_url"),
isAdmin: boolean("is_admin").default(false).notNull(),
avatar: text("avatar"),
isActive: boolean("is_active").default(true).notNull(),
isAdmin: boolean("is_admin").default(false),
isSuperAdmin: boolean("is_super_admin").default(false).notNull(),
createdAt: timestamp("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`),