Skip to content

Commit 4bba5cb

Browse files
feat: faculty fullstack implementation
1 parent 0b56c71 commit 4bba5cb

File tree

8 files changed

+320
-328
lines changed

8 files changed

+320
-328
lines changed

app/[locale]/faculty-and-staff/utils.tsx

Lines changed: 194 additions & 267 deletions
Large diffs are not rendered by default.

app/[locale]/profile/client-utils.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ export const Tabs = ({
9191
qualifications: MdSchool,
9292
experience: MdWork,
9393
projects: FaFlask,
94-
educationCurrent: FaBook,
94+
continuingEducation: FaBook,
9595
publications: MdApproval,
96-
scholars: MdGroups,
97-
awards: MdEmojiEvents,
96+
researchScholars: MdGroups,
97+
awardsAndHonors: MdEmojiEvents,
9898
};
9999

100100
return select ? (

i18n/en.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,18 @@ const text: Translations = {
108108
scopusId: 'Scopus',
109109
},
110110
intellectualContributions: {
111-
patents: 'PATENTS',
112111
publications: 'PUBLICATIONS',
113-
books: 'BOOKS',
112+
continuingEducation: 'CONTINUING EDUCATION',
113+
doctoralStudents: 'DOCTORAL STUDENTS',
114114
},
115115
tabs: {
116116
qualifications: 'Education Qualifications',
117117
experience: 'Experience',
118118
projects: 'Projects',
119-
educationCurrent: 'Continuing Education',
119+
continuingEducation: 'Continuing Education',
120120
publications: 'Publications',
121-
scholars: 'Research Scholars',
122-
awards: 'Awards and Honors',
121+
//researchScholars: 'Research Scholars',
122+
awardsAndHonors: 'Awards and Honors',
123123
},
124124
},
125125
FAQ: { title: 'Frequently Asked Questions' },

i18n/hi.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ const text: Translations = {
114114
scopusId: 'स्कोपस',
115115
},
116116
intellectualContributions: {
117-
patents: 'पेटेंट',
118117
publications: 'प्रकाशन',
119-
books: 'पुस्तकें',
118+
continuingEducation: 'निरंतर शिक्षा',
119+
doctoralStudents: 'डॉक्टरेट छात्र',
120120
},
121121
tabs: {
122122
qualifications: 'शैक्षिक योग्यता',
123123
experience: 'अनुभव',
124124
projects: 'प्रोजेक्ट्स',
125-
educationCurrent: 'निरंतर शिक्षा',
125+
continuingEducation: 'निरंतर शिक्षा',
126126
publications: 'प्रकाशन',
127-
scholars: 'अनुसंधान विद्वान',
128-
awards: 'पुरस्कार और सम्मान',
127+
//researchScholars: 'अनुसंधान विद्वान',
128+
awardsAndHonors: 'पुरस्कार और सम्मान',
129129
},
130130
},
131131
FAQ: { title: 'अक्सर पूछे जाने वाले प्रश्न' },

i18n/translations.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,18 @@ export interface Translations {
7878
scopusId: string;
7979
};
8080
intellectualContributions: {
81-
patents: string;
8281
publications: string;
83-
books: string;
82+
continuingEducation: string;
83+
doctoralStudents: string;
8484
};
8585
tabs: {
8686
qualifications: string;
8787
experience: string;
8888
projects: string;
89-
educationCurrent: string;
89+
continuingEducation: string;
9090
publications: string;
91-
scholars: string;
92-
awards: string;
91+
//researchScholars: string;
92+
awardsAndHonors: string;
9393
};
9494
};
9595
FAQ: { title: string };

package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"class-variance-authority": "^0.7.0",
3737
"clsx": "^2.1.0",
3838
"cmdk": "^1.0.0",
39-
"drizzle-orm": "^0.33.0",
39+
"drizzle-orm": "^0.34.1",
4040
"embla-carousel-autoplay": "^8.2.1",
4141
"embla-carousel-fade": "^8.2.1",
4242
"embla-carousel-react": "^8.2.1",
@@ -61,7 +61,7 @@
6161
"@types/react-slick": "^0.23.13",
6262
"@typescript-eslint/eslint-plugin": "^6.19.1",
6363
"autoprefixer": "^10.0.1",
64-
"drizzle-kit": "^0.24.0",
64+
"drizzle-kit": "^0.25.0",
6565
"eslint": "^8",
6666
"eslint-config-next": "14.2.4",
6767
"eslint-config-prettier": "^9.1.0",

server/db/schema/faculty.schema.ts

Lines changed: 93 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const faculty = pgTable(
2626
id: integer('id')
2727
.primaryKey()
2828
.references(() => persons.id),
29-
employeeId: varchar('employee_id', { length: 8 }).notNull(),
29+
employeeId: varchar('employee_id', { length: 8 }).unique().notNull(),
3030
officeAddress: varchar('college_address', { length: 16 }).notNull(),
3131
designation: varchar('designation', {
3232
enum: [
@@ -55,12 +55,12 @@ export const faculty = pgTable(
5555

5656
// Qualifications Table
5757
export const qualifications = pgTable('qualifications', {
58-
id: integer('id').primaryKey(),
59-
facultyId: integer('faculty_id')
60-
.references(() => faculty.id)
58+
id: serial('id').primaryKey(),
59+
employeeId: varchar('employee_id', { length: 8 })
60+
.references(() => faculty.employeeId)
6161
.notNull(),
6262
title: text('title').notNull(),
63-
about: text('about').notNull(),
63+
field: text('about').notNull(),
6464
location: text('location').notNull(),
6565
startDate: date('start_date').notNull(),
6666
endDate: date('end_date'),
@@ -69,21 +69,21 @@ export const qualifications = pgTable('qualifications', {
6969
// Experience Table
7070
export const experience = pgTable('experience', {
7171
id: serial('id').primaryKey(),
72-
facultyId: integer('faculty_id')
73-
.references(() => faculty.id)
72+
employeeId: varchar('employee_id', { length: 8 })
73+
.references(() => faculty.employeeId)
7474
.notNull(),
7575
title: text('title').notNull(),
76-
description: text('description').notNull(),
77-
place: text('place').notNull(),
76+
field: text('field').notNull(),
77+
location: text('location').notNull(),
7878
startDate: date('start_date').notNull(),
79-
endDate: date('end_date').notNull(),
79+
endDate: date('end_date'),
8080
});
8181

8282
// Projects Table
8383
export const projects = pgTable('projects', {
8484
id: serial('id').primaryKey(),
85-
facultyId: integer('faculty_id')
86-
.references(() => faculty.id)
85+
employeeId: varchar('employee_id', { length: 8 })
86+
.references(() => faculty.employeeId)
8787
.notNull(),
8888
title: text('title').notNull(),
8989
field: text('field').notNull(),
@@ -98,24 +98,24 @@ export const projects = pgTable('projects', {
9898
// Continuing Education Table
9999
export const continuingEducation = pgTable('continuing_education', {
100100
id: serial('id').primaryKey(),
101-
facultyId: integer('faculty_id')
102-
.references(() => faculty.id)
101+
employeeId: varchar('employee_id', { length: 8 })
102+
.references(() => faculty.employeeId)
103103
.notNull(),
104104
title: text('title').notNull(),
105-
field: text('field').notNull(),
105+
type: text('type').notNull(),
106106
role: text('role').notNull(),
107107
startDate: date('start_date').notNull(),
108108
endDate: date('end_date').notNull(),
109109
});
110110

111111
// Publications Table
112112
export const publications = pgTable('publications', {
113-
id: integer('id').primaryKey(),
114-
facultyId: integer('faculty_id')
115-
.references(() => faculty.id)
113+
id: serial('id').primaryKey(),
114+
employeeId: varchar('employee_id', { length: 8 })
115+
.references(() => faculty.employeeId)
116116
.notNull(),
117117
title: text('title').notNull(),
118-
field: text('field').notNull(),
118+
details: text('details').notNull(),
119119
people: text('people').notNull(),
120120
date: date('date').notNull(),
121121
tag: varchar('tag', {
@@ -125,7 +125,7 @@ export const publications = pgTable('publications', {
125125

126126
// // Research Scholars Table
127127
// export const researchScholars = pgTable('research_scholars', {
128-
// id: integer('id').primaryKey(),
128+
// id: serial('id').primaryKey(),
129129
// facultyId: integer('faculty_id')
130130
// .references(() => faculty.id)
131131
// .notNull(),
@@ -138,21 +138,21 @@ export const publications = pgTable('publications', {
138138

139139
// Awards and Honors Table
140140
export const awardsAndHonors = pgTable('awards_and_honors', {
141-
id: integer('id').primaryKey(),
142-
facultyId: integer('faculty_id')
143-
.references(() => faculty.id)
141+
id: serial('id').primaryKey(),
142+
employeeId: varchar('employee_id', { length: 8 })
143+
.references(() => faculty.employeeId)
144144
.notNull(),
145145
title: text('title').notNull(),
146146
field: text('field').notNull(),
147147
date: date('date').notNull(),
148-
place: text('place').notNull(),
148+
location: text('location').notNull(),
149149
});
150150

151151
// Custom Topics Table
152152
export const customTopics = pgTable('custom_topics', {
153153
id: serial('id').primaryKey(),
154-
facultyId: integer('faculty_id')
155-
.references(() => faculty.id)
154+
employeeId: varchar('employee_id', { length: 8 })
155+
.references(() => faculty.employeeId)
156156
.notNull(),
157157
name: text('name').notNull(),
158158
});
@@ -194,6 +194,71 @@ export const facultyRelations = relations(faculty, ({ many, one }) => ({
194194
customTopics: many(customTopics),
195195
}));
196196

197-
export const customTopicsRelations = relations(customTopics, ({ many }) => ({
198-
customInformation: many(customInformation),
197+
export const qualificationsRelations = relations(qualifications, ({ one }) => ({
198+
faculty: one(faculty, {
199+
fields: [qualifications.employeeId],
200+
references: [faculty.employeeId],
201+
}),
202+
}));
203+
204+
export const experienceRelations = relations(experience, ({ one }) => ({
205+
faculty: one(faculty, {
206+
fields: [experience.employeeId],
207+
references: [faculty.employeeId],
208+
}),
209+
}));
210+
211+
export const projectsRelations = relations(projects, ({ one }) => ({
212+
faculty: one(faculty, {
213+
fields: [projects.employeeId],
214+
references: [faculty.employeeId],
215+
}),
216+
}));
217+
218+
export const continuingEducationRelations = relations(
219+
continuingEducation,
220+
({ one }) => ({
221+
faculty: one(faculty, {
222+
fields: [continuingEducation.employeeId],
223+
references: [faculty.employeeId],
224+
}),
225+
})
226+
);
227+
228+
export const publicationsRelations = relations(publications, ({ one }) => ({
229+
faculty: one(faculty, {
230+
fields: [publications.employeeId],
231+
references: [faculty.employeeId],
232+
}),
199233
}));
234+
235+
export const awardsAndHonorsRelations = relations(
236+
awardsAndHonors,
237+
({ one }) => ({
238+
faculty: one(faculty, {
239+
fields: [awardsAndHonors.employeeId],
240+
references: [faculty.employeeId],
241+
}),
242+
})
243+
);
244+
245+
export const customTopicsRelations = relations(
246+
customTopics,
247+
({ one, many }) => ({
248+
faculty: one(faculty, {
249+
fields: [customTopics.employeeId],
250+
references: [faculty.employeeId],
251+
}),
252+
customInformation: many(customInformation),
253+
})
254+
);
255+
256+
export const customInformationRelations = relations(
257+
customInformation,
258+
({ one }) => ({
259+
customTopic: one(customTopics, {
260+
fields: [customInformation.topicId],
261+
references: [customTopics.id],
262+
}),
263+
})
264+
);

0 commit comments

Comments
 (0)