Skip to content

Commit f8f949b

Browse files
feat: flexible faculty details
1 parent 37052b2 commit f8f949b

File tree

1 file changed

+133
-72
lines changed

1 file changed

+133
-72
lines changed

server/db/schema/faculty.schema.ts

Lines changed: 133 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { relations, sql } from 'drizzle-orm';
1+
import { relations } from 'drizzle-orm';
22
import {
3+
date,
34
integer,
45
pgTable,
6+
serial,
57
smallint,
68
text,
79
uniqueIndex,
@@ -26,8 +28,6 @@ export const faculty = pgTable(
2628
.references(() => persons.id),
2729
employeeId: varchar('employee_id', { length: 8 }).notNull(),
2830
officeAddress: varchar('college_address', { length: 16 }).notNull(),
29-
30-
// Meta
3131
designation: varchar('designation', {
3232
enum: [
3333
'Assistant Professor Grade-I',
@@ -39,78 +39,10 @@ export const faculty = pgTable(
3939
departmentId: smallint('department_id')
4040
.references(() => departments.id)
4141
.notNull(),
42-
43-
// Socials
4442
googleScholarId: text('google_scholar_id'),
45-
orcidId: text('orcid_id'),
43+
linkedInId: text('linked_in_id'),
4644
researchGateId: text('research_gate_id'),
4745
scopusId: text('scopus_id'),
48-
49-
// Miscellaneous
50-
qualifications: text('qualifications')
51-
.array()
52-
.default(sql`'{}'`)
53-
.notNull(),
54-
areasOfInterest: text('areas_of_interest')
55-
.array()
56-
.default(sql`'{}'`)
57-
.notNull(),
58-
teachingInterests: text('teaching_interests')
59-
.array()
60-
.default(sql`'{}'`)
61-
.notNull(),
62-
researchInterests: text('research_interests')
63-
.array()
64-
.default(sql`'{}'`)
65-
.notNull(),
66-
patents: text('patents')
67-
.array()
68-
.default(sql`'{}'`)
69-
.notNull(),
70-
copyrights: text('copyrights')
71-
.array()
72-
.default(sql`'{}'`)
73-
.notNull(),
74-
publications: text('publications')
75-
.array()
76-
.default(sql`'{}'`)
77-
.notNull(),
78-
journals: text('journals')
79-
.array()
80-
.default(sql`'{}'`)
81-
.notNull(),
82-
conferences: text('conferences')
83-
.array()
84-
.default(sql`'{}'`)
85-
.notNull(),
86-
books: text('books')
87-
.array()
88-
.default(sql`'{}'`)
89-
.notNull(),
90-
workshops: text('workshops')
91-
.array()
92-
.default(sql`'{}'`)
93-
.notNull(),
94-
expertLectures: text('expert_lectures')
95-
.array()
96-
.default(sql`'{}'`)
97-
.notNull(),
98-
awards: text('awards')
99-
.array()
100-
.default(sql`'{}'`)
101-
.notNull(),
102-
outreach: text('outreach')
103-
.array()
104-
.default(sql`'{}'`)
105-
.notNull(),
106-
eContent: text('e_content')
107-
.array()
108-
.default(sql`'{}'`)
109-
.notNull(),
110-
researchProjects: text('research_projects')
111-
.array()
112-
.default(sql`'{}'`)
113-
.notNull(),
11446
},
11547
(faculty) => {
11648
return {
@@ -121,6 +53,123 @@ export const faculty = pgTable(
12153
}
12254
);
12355

56+
// Qualifications Table
57+
export const qualifications = pgTable('qualifications', {
58+
id: integer('id').primaryKey(),
59+
facultyId: integer('faculty_id')
60+
.references(() => faculty.id)
61+
.notNull(),
62+
title: text('title').notNull(),
63+
about: text('about').notNull(),
64+
location: text('location').notNull(),
65+
startDate: date('start_date').notNull(),
66+
endDate: date('end_date'),
67+
});
68+
69+
// Experience Table
70+
export const experience = pgTable('experience', {
71+
id: serial('id').primaryKey(),
72+
facultyId: integer('faculty_id')
73+
.references(() => faculty.id)
74+
.notNull(),
75+
title: text('title').notNull(),
76+
description: text('description').notNull(),
77+
place: text('place').notNull(),
78+
startDate: date('start_date').notNull(),
79+
endDate: date('end_date').notNull(),
80+
});
81+
82+
// Projects Table
83+
export const projects = pgTable('projects', {
84+
id: serial('id').primaryKey(),
85+
facultyId: integer('faculty_id')
86+
.references(() => faculty.id)
87+
.notNull(),
88+
title: text('title').notNull(),
89+
field: text('field').notNull(),
90+
role: text('role').notNull(),
91+
startDate: date('start_date').notNull(),
92+
endDate: date('end_date').notNull(),
93+
tag: varchar('tag', {
94+
enum: ['sponsored', 'unsponsored'],
95+
}).notNull(),
96+
});
97+
98+
// Continuing Education Table
99+
export const continuingEducation = pgTable('continuing_education', {
100+
id: serial('id').primaryKey(),
101+
facultyId: integer('faculty_id')
102+
.references(() => faculty.id)
103+
.notNull(),
104+
title: text('title').notNull(),
105+
field: text('field').notNull(),
106+
role: text('role').notNull(),
107+
startDate: date('start_date').notNull(),
108+
endDate: date('end_date').notNull(),
109+
});
110+
111+
// Publications Table
112+
export const publications = pgTable('publications', {
113+
id: integer('id').primaryKey(),
114+
facultyId: integer('faculty_id')
115+
.references(() => faculty.id)
116+
.notNull(),
117+
title: text('title').notNull(),
118+
field: text('field').notNull(),
119+
people: text('people').notNull(),
120+
date: date('date').notNull(),
121+
tag: varchar('tag', {
122+
enum: ['book', 'journal', 'conference'],
123+
}).notNull(),
124+
});
125+
126+
// // Research Scholars Table
127+
// export const researchScholars = pgTable('research_scholars', {
128+
// id: integer('id').primaryKey(),
129+
// facultyId: integer('faculty_id')
130+
// .references(() => faculty.id)
131+
// .notNull(),
132+
// title: text('title').notNull(),
133+
// role: text('role').notNull(),
134+
// person: text('person').notNull(),
135+
// date: date('date').notNull(),
136+
// tag: text('tag'),
137+
// });
138+
139+
// Awards and Honors Table
140+
export const awardsAndHonors = pgTable('awards_and_honors', {
141+
id: integer('id').primaryKey(),
142+
facultyId: integer('faculty_id')
143+
.references(() => faculty.id)
144+
.notNull(),
145+
title: text('title').notNull(),
146+
field: text('field').notNull(),
147+
date: date('date').notNull(),
148+
place: text('place').notNull(),
149+
});
150+
151+
// Custom Topics Table
152+
export const customTopics = pgTable('custom_topics', {
153+
id: serial('id').primaryKey(),
154+
facultyId: integer('faculty_id')
155+
.references(() => faculty.id)
156+
.notNull(),
157+
name: text('name').notNull(),
158+
});
159+
160+
// Custom Information Table
161+
export const customInformation = pgTable('custom_information', {
162+
id: serial('id').primaryKey(),
163+
topicId: integer('topic_id')
164+
.references(() => customTopics.id, { onDelete: 'cascade' })
165+
.notNull(),
166+
title: text('title').notNull(),
167+
description: text('description'),
168+
caption: text('caption'),
169+
startDate: date('start_date'),
170+
endDate: date('end_date'),
171+
});
172+
124173
export const facultyRelations = relations(faculty, ({ many, one }) => ({
125174
courseLogs: many(courseLogs),
126175
courses: many(courses),
@@ -135,4 +184,16 @@ export const facultyRelations = relations(faculty, ({ many, one }) => ({
135184
fields: [faculty.id],
136185
references: [persons.id],
137186
}),
187+
qualifications: many(qualifications),
188+
experience: many(experience),
189+
projects: many(projects),
190+
continuingEducation: many(continuingEducation),
191+
publications: many(publications),
192+
// researchScholars: many(researchScholars),
193+
awardsAndHonors: many(awardsAndHonors),
194+
customTopics: many(customTopics),
195+
}));
196+
197+
export const customTopicsRelations = relations(customTopics, ({ many }) => ({
198+
customInformation: many(customInformation),
138199
}));

0 commit comments

Comments
 (0)