export const companies = pgTable('company', {
id:serial('id' as string).primaryKey(),
name:varchar('name' as string).notNull(),
owner:integer('owner' as string).notNull().references(() => users.id),
manager:integer('manager' as string).notNull().references(() => users.id),
employees:integer('employees' as string).notNull().references(() => users.id),
})
export const users = pgTable('users', {
id:serial('id' as string).primaryKey(),
name:varchar('name' as string).notNull(),
role:varchar('role' as string, {enum:['owner', 'manager', 'employee']}).notNull(),
})
export const userEmails = pgTable('user_emails', {
id:serial('id' as string).primaryKey(),
userId:integer('userId' as string).notNull().references(() => users.id),
email:varchar('email' as string).notNull(),
position:integer('position' as string).notNull(),
profile:integer('profile' as string).notNull().references(() => profiles.id),
})
export const userPhoneNumbers = pgTable('user_emails', {
id:serial('id' as string).primaryKey(),
userId:integer('userId' as string).notNull().references(() => users.id),
email:varchar('email' as string).notNull(),
position:integer('position' as string).notNull(),
profile:integer('profile' as string).notNull().references(() => profiles.id),
})
export const profiles = pgTable('profiles', {
id:serial('id' as string).primaryKey(),
name:varchar('name' as string).notNull(),
})