Skip to content

Commit

Permalink
search both dbs
Browse files Browse the repository at this point in the history
  • Loading branch information
makinbacon21 committed Apr 29, 2024
1 parent d263a15 commit dc1b3ef
Show file tree
Hide file tree
Showing 6 changed files with 259 additions and 142 deletions.
7 changes: 7 additions & 0 deletions app/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ export async function submitData(prevState: {
showProfile: formData.get("showProfile"),
};

//@ts-ignore
const itsRecord: any[] = await queryDb(`SELECT GRAD_YEAR, DORM, DORM_ROOM \
FROM student_data WHERE USER_ID='${id}' `);

await prisma.studentOverlay.upsert({
where: {
uid: id,
Expand All @@ -146,6 +150,9 @@ export async function submitData(prevState: {
lastName: rawFormData.lastName,
pronouns: rawFormData.pronouns,
photoPath: photo_path,
dorm: itsRecord[0]["DORM"],
dormRoom: itsRecord[0]["DORM_ROOM"],
gradYear: itsRecord[0]["GRAD_YEAR"],
showProfile: rawFormData.showProfile === "on" ? true : false,
showDorm: rawFormData.showDorm === "on" ? true : false,
showPhoto: rawFormData.showPicture === "on" ? true : false,
Expand Down
6 changes: 3 additions & 3 deletions app/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export default async function Settings() {
pronouns: user_data_prisma.pronouns,
id: user_data_prisma.uid,
photo_path: user_data_prisma.photoPath,
year: user_data_prisma.gradYear,
dorm: user_data_prisma.dorm,
room: user_data_prisma.dormRoom,
showDorm: user_data_prisma.showDorm,
showPicture: user_data_prisma.showPhoto,
showProfile: user_data_prisma.showProfile,
year: cygnet_user_data.year,
dorm: cygnet_user_data.dorm,
room: cygnet_user_data.room,
};
} else {
user_data = {
Expand Down
Loading

0 comments on commit dc1b3ef

Please sign in to comment.