diff --git a/server/controllers/authController.ts b/server/controllers/authController.ts index 84f2b36..7a713ee 100644 --- a/server/controllers/authController.ts +++ b/server/controllers/authController.ts @@ -22,7 +22,7 @@ export const authController = { // Hash password const saltRounds = 12; - const hashedPassword = await bcrypt.hash(validatedData.password, saltRounds); + const hashedPassword = await bcrypt.hash(validatedData.password as string, saltRounds); // Determine role - special handling for admin user let userRole = "standard"; diff --git a/shared/schema.ts b/shared/schema.ts index 6b7c4f7..423ab73 100644 --- a/shared/schema.ts +++ b/shared/schema.ts @@ -1,4 +1,4 @@ -import { pgTable, text, serial, integer, boolean, timestamp, numeric, varchar, uuid, json } from "drizzle-orm/pg-core"; +import { pgTable, text, serial, integer, boolean, timestamp, numeric, varchar, uuid, json, pgEnum, time, decimal } from "drizzle-orm/pg-core"; import { relations } from "drizzle-orm"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; import { z } from "zod"; @@ -167,6 +167,26 @@ export const userPreferencesRelations = relations(userPreferences, ({ one }) => user: one(users, { fields: [userPreferences.userId], references: [users.id] }), })); +export const availabilityRelations = relations(availability, ({ one }) => ({ + professional: one(users, { fields: [availability.professionalId], references: [users.id] }), +})); + +export const appointmentsRelations = relations(appointments, ({ one }) => ({ + professional: one(users, { fields: [appointments.professionalId], references: [users.id] }), + client: one(users, { fields: [appointments.clientId], references: [users.id] }), +})); + +export const connectionsRelations = relations(connections, ({ one }) => ({ + requester: one(users, { fields: [connections.requesterId], references: [users.id] }), + receiver: one(users, { fields: [connections.receiverId], references: [users.id] }), +})); + +export const reviewsRelations = relations(reviews, ({ one }) => ({ + professional: one(users, { fields: [reviews.professionalId], references: [users.id] }), + client: one(users, { fields: [reviews.clientId], references: [users.id] }), + appointment: one(appointments, { fields: [reviews.appointmentId], references: [appointments.id] }), +})); + // Zod schemas for validation export const insertUserSchema = createInsertSchema(users).omit({ id: true,