Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature onboard developer form b2 #744

Conversation

John-Paul-Larkin
Copy link
Member

@John-Paul-Larkin John-Paul-Larkin commented Feb 20, 2024

Pull Request details

I was experimenting with prisma migrations on the old branch, so I created a new branch for this PR.

I removed the DeveloperDetails model and added all fields to the User model instead.
npx prisma migrate dev && npx prisma migrate reset

I removed the splash page so the route is now:
/alpha/additional-details

I left the summary page in for now.

Any Breaking changes

NB
I removed @unique from the Membership and RSVP tables. Otherwise, I could not migrate.
I have to go out now, but will try my best to figure this issue later.

Summary by CodeRabbit

  • New Features
    • Introduced a comprehensive sign-up process for additional user details, including profile, demographic, work, and education information.
    • Added form validation and submission handling for updating user details.
    • New page component for fetching and displaying user details with authentication support.
    • Implemented predefined options for form fields such as gender, professional status, and level of study.

@John-Paul-Larkin John-Paul-Larkin requested a review from a team as a code owner February 20, 2024 10:43
Copy link

vercel bot commented Feb 20, 2024

@John-Paul-Larkin is attempting to deploy a commit to the Codú Team on Vercel.

A member of the Team first needs to authorize it.

@John-Paul-Larkin
Copy link
Member Author

This was my first time to reconcile a branch divergence. It was only the prisma file, so I think it should be fine.

@John-Paul-Larkin
Copy link
Member Author

It was only the prisma file, so I think it should be fine.

Actually, I am really starting to doubt myself, so please check this to be sure :)

@NiallJoeMaher
Copy link
Contributor

It was only the prisma file, so I think it should be fine.

Actually, I am really starting to doubt myself, so please check this to be sure :)

Don't panic! Let me pull this and make sure it's all good. Might be later before I get it tested.

Copy link

github-actions bot commented Feb 24, 2024

Image description CodeRabbit


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between e9a4edf and 290023391a2c57f058141325573c869de04f6c09 commits.
Files selected (7)
  • app/alpha/additional-details/_client.tsx (1)
  • app/alpha/additional-details/actions.ts (1)
  • app/alpha/additional-details/page.tsx (1)
  • app/alpha/additional-details/selectOptions.ts (1)
  • prisma/migrations/20240218201356_additional_user_details/migration.sql (1)
  • prisma/schema.prisma (1)
  • schema/additionalUserDetails.ts (1)
Files not summarized due to errors (7)
  • app/alpha/additional-details/_client.tsx (diff tokens exceeds limit)
  • prisma/migrations/20240218201356_additional_user_details/migration.sql (nothing obtained from openai)
  • app/alpha/additional-details/page.tsx (nothing obtained from openai)
  • schema/additionalUserDetails.ts (nothing obtained from openai)
  • prisma/schema.prisma (nothing obtained from openai)
  • app/alpha/additional-details/actions.ts (nothing obtained from openai)
  • app/alpha/additional-details/selectOptions.ts (nothing obtained from openai)
Files not reviewed due to errors (6)
  • app/alpha/additional-details/actions.ts (no response)
  • prisma/schema.prisma (no response)
  • app/alpha/additional-details/page.tsx (no response)
  • schema/additionalUserDetails.ts (no response)
  • prisma/migrations/20240218201356_additional_user_details/migration.sql (no response)
  • app/alpha/additional-details/selectOptions.ts (no response)
Files skipped from review due to trivial changes (1)
  • app/alpha/additional-details/_client.tsx (diff too large)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link
Contributor

coderabbitai bot commented Feb 24, 2024

Warning

CodeRabbit GitHub Action Detected

The repository is using both CodeRabbit Pro and CodeRabbit Open Source (via GitHub Actions), which is not recommended as it may lead to duplicate comments and extra noise. Please remove the CodeRabbit GitHub Action.

Walkthrough

The recent update introduces a comprehensive system for handling additional user sign-up details. It encompasses a new React component for collecting extensive user information during registration, a backend function for form submission and database updates, schema changes for additional user details, and predefined select options for form fields. This enhancement aims to enrich user profiles by capturing detailed demographic, work, and education information.

Changes

Files Summary
app/alpha/additional-details/.../_client.tsx, .../page.tsx Introduced components for handling additional sign-up details and rendering user details page.
app/alpha/additional-details/actions.ts Added a form submission handler for updating user details in the database.
prisma/migrations/.../migration.sql, schema.prisma Updated database schema with new user details fields and adjustments in existing models.
schema/additionalUserDetails.ts Defined a schema for additional user details with validation rules.

🐰✨
A hop, skip, a jump so light,
We've added details, oh what a sight!
From name to course, in fields so bright,
Our forms now gleam, in the soft moonlight.
🌟📝💫

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 12

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e4fd410 and ccc52b45a4409fd278b3d5f1ab7e99600dc13fa0.
Files selected for processing (7)
  • app/alpha/additional-details/_client.tsx (1 hunks)
  • app/alpha/additional-details/actions.ts (1 hunks)
  • app/alpha/additional-details/page.tsx (1 hunks)
  • app/alpha/additional-details/selectOptions.ts (1 hunks)
  • prisma/migrations/20240218201356_additional_user_details/migration.sql (1 hunks)
  • prisma/schema.prisma (1 hunks)
  • schema/additionalUserDetails.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/alpha/additional-details/selectOptions.ts
Additional comments: 7
prisma/migrations/20240218201356_additional_user_details/migration.sql (1)
  • 11-11: Dropping the default value for isEventOrganiser in the Membership table could impact the application's behavior if the codebase assumes a default value for this column. Ensure that all insertions into the Membership table explicitly set a value for isEventOrganiser.
app/alpha/additional-details/page.tsx (1)
  • 1-5: Ensure that all imported modules are used within the file. Unused imports can lead to unnecessary code bloat and potential confusion about the file's dependencies.
app/alpha/additional-details/actions.ts (1)
  • 1-9: Verify that all imported modules and functions are utilized within the file. Unused imports can clutter the code and potentially introduce confusion about the file's dependencies.
prisma/schema.prisma (1)
  • 78-114: The addition of new fields to the User model aligns with the PR's objectives to consolidate user details. Ensure that these fields are appropriately used throughout the application and that any necessary validations or constraints are applied at the database level or within the application logic. Additionally, consider the impact of these changes on existing data and whether any data migration or transformation is required.
app/alpha/additional-details/_client.tsx (3)
  • 1-20: The use of "use client"; at the top of the file is a good practice for Next.js 13, ensuring that the file is treated as a client component. This is crucial for optimal performance and correct behavior in Next.js applications.
  • 46-49: The setup for useForm with zodResolver is correctly implemented, ensuring that form validation is based on the schema defined for additional user details. This is a good practice for maintaining consistency and reliability in form data handling.
  • 717-755: The SlideButtons component is well-designed, offering flexibility with optional handleClickNextSlide, handleClickPreviousSlide, and isSubmitButton props. This design allows for reuse across different slides with varying requirements for navigation and submission. Good job on designing a reusable component.

/*
Warnings:

- Made the column `eventDate` on table `Event` required. This step will fail if there are existing NULL values in that column.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration makes the eventDate column in the Event table required. This change could potentially cause the migration to fail if there are existing NULL values in that column. It's crucial to ensure that all existing data complies with this new constraint before applying the migration.

Comment on lines 14 to 22
ALTER TABLE "User" ADD COLUMN "course" TEXT,
ADD COLUMN "dateOfBirth" TIMESTAMP(3),
ADD COLUMN "firstName" TEXT,
ADD COLUMN "gender" TEXT,
ADD COLUMN "jobTitle" TEXT,
ADD COLUMN "levelOfStudy" TEXT,
ADD COLUMN "professionalOrStudent" TEXT,
ADD COLUMN "surname" TEXT,
ADD COLUMN "workplace" TEXT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding multiple columns to the User table to consolidate user details is a significant change. Ensure that these new fields are properly integrated into the application's logic, especially regarding form submissions and data retrieval. Additionally, consider the impact on performance and storage, as well as the necessity of each field to avoid overloading the User model with too much responsibility.

Comment on lines 20 to 47
export default async function Page() {
const session = await getServerAuthSession();
if (!session || !session.user) {
redirect("/get-started");
}

const details = await prisma.user.findUnique({
where: {
id: session.user.id,
},
select: selectUserDetails,
});

const detailsWithNullsRemoved = {
username: details?.username || "",
firstName: details?.firstName || "",
surname: details?.surname || "",
gender: details?.gender || "",
dateOfBirth: details?.dateOfBirth || undefined,
location: details?.location || "",
professionalOrStudent: details?.professionalOrStudent || "",
course: details?.course || "",
levelOfStudy: details?.levelOfStudy || "",
jobTitle: details?.jobTitle || "",
workplace: details?.workplace || "",
};

return <Content details={detailsWithNullsRemoved} />;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The redirection logic in the absence of a session or user should use return redirect("/get-started"); to ensure that the function execution stops after the redirect. Without the return statement, the function might continue executing, leading to potential errors or unexpected behavior.

-    redirect("/get-started");
+    return redirect("/get-started");

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
export default async function Page() {
const session = await getServerAuthSession();
if (!session || !session.user) {
redirect("/get-started");
}
const details = await prisma.user.findUnique({
where: {
id: session.user.id,
},
select: selectUserDetails,
});
const detailsWithNullsRemoved = {
username: details?.username || "",
firstName: details?.firstName || "",
surname: details?.surname || "",
gender: details?.gender || "",
dateOfBirth: details?.dateOfBirth || undefined,
location: details?.location || "",
professionalOrStudent: details?.professionalOrStudent || "",
course: details?.course || "",
levelOfStudy: details?.levelOfStudy || "",
jobTitle: details?.jobTitle || "",
workplace: details?.workplace || "",
};
return <Content details={detailsWithNullsRemoved} />;
export default async function Page() {
const session = await getServerAuthSession();
if (!session || !session.user) {
return redirect("/get-started");
}
const details = await prisma.user.findUnique({
where: {
id: session.user.id,
},
select: selectUserDetails,
});
const detailsWithNullsRemoved = {
username: details?.username || "",
firstName: details?.firstName || "",
surname: details?.surname || "",
gender: details?.gender || "",
dateOfBirth: details?.dateOfBirth || undefined,
location: details?.location || "",
professionalOrStudent: details?.professionalOrStudent || "",
course: details?.course || "",
levelOfStudy: details?.levelOfStudy || "",
jobTitle: details?.jobTitle || "",
workplace: details?.workplace || "",
};
return <Content details={detailsWithNullsRemoved} />;

Comment on lines +33 to +45
const detailsWithNullsRemoved = {
username: details?.username || "",
firstName: details?.firstName || "",
surname: details?.surname || "",
gender: details?.gender || "",
dateOfBirth: details?.dateOfBirth || undefined,
location: details?.location || "",
professionalOrStudent: details?.professionalOrStudent || "",
course: details?.course || "",
levelOfStudy: details?.levelOfStudy || "",
jobTitle: details?.jobTitle || "",
workplace: details?.workplace || "",
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach to remove nulls from user details is clear and straightforward. However, consider centralizing this logic in a utility function if similar patterns are used elsewhere in the codebase. This would improve maintainability and reduce code duplication.

Comment on lines 11 to 45
export async function handleFormSubmit(dataInput: TypeAdditionalDetailsSchema) {
const session = await getServerAuthSession();
if (!session || !session.user) {
redirect("/get-started");
}

try {
const validatedData = AdditionalDetailsSchema.parse(dataInput);

await prisma.user.update({
where: {
id: session.user.id,
},
data: {
firstName: validatedData.firstName,
surname: validatedData.surname,
username: validatedData.username,
location: validatedData.location,
gender: validatedData.gender,
dateOfBirth: validatedData.dateOfBirth,
professionalOrStudent: validatedData.professionalOrStudent,
workplace: validatedData.workplace,
jobTitle: validatedData.jobTitle,
levelOfStudy: validatedData.levelOfStudy,
course: validatedData.course,
},
});
return true;
} catch (error) {
console.error(
"Error updating the User and DeveloperDetails models:",
error,
);
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The form submission handler correctly validates the input data and updates the user's details in the database. However, the error handling could be improved by providing more specific feedback to the user or logging detailed error information for debugging purposes. Additionally, consider handling potential exceptions from getServerAuthSession and prisma.user.update.

Comment on lines 42 to 44
if (!session) {
redirect("/get-started");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redirecting users who are not in a session directly in the component body can lead to unexpected behavior during server-side rendering (SSR) or static site generation (SSG) in Next.js. Consider moving this logic to a useEffect hook or using middleware for session checks to ensure compatibility with Next.js's rendering strategies.

- if (!session) {
-   redirect("/get-started");
- }
+ useEffect(() => {
+   if (!session) {
+     redirect("/get-started");
+   }
+ }, [session]);

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if (!session) {
redirect("/get-started");
}
useEffect(() => {
if (!session) {
redirect("/get-started");
}
}, [session]);

Comment on lines 54 to 63
const onFormSubmit = async (data: TypeAdditionalDetailsSchema) => {
const isSuccess = await handleFormSubmit(data);

if (isSuccess) {
toast.success("Saved");
}
if (!isSuccess) {
toast.error("Error, saving was unsuccessful.");
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onFormSubmit function correctly handles form submission and displays appropriate toast messages based on the success of the operation. However, consider adding error handling for potential exceptions thrown by handleFormSubmit to improve the robustness of your application.

  const onFormSubmit = async (data: TypeAdditionalDetailsSchema) => {
    try {
      const isSuccess = await handleFormSubmit(data);
      if (isSuccess) {
        toast.success("Saved");
      } else {
        toast.error("Error, saving was unsuccessful.");
      }
    } catch (error) {
      toast.error("An unexpected error occurred.");
    }
  };

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
const onFormSubmit = async (data: TypeAdditionalDetailsSchema) => {
const isSuccess = await handleFormSubmit(data);
if (isSuccess) {
toast.success("Saved");
}
if (!isSuccess) {
toast.error("Error, saving was unsuccessful.");
}
};
const onFormSubmit = async (data: TypeAdditionalDetailsSchema) => {
try {
const isSuccess = await handleFormSubmit(data);
if (isSuccess) {
toast.success("Saved");
} else {
toast.error("Error, saving was unsuccessful.");
}
} catch (error) {
toast.error("An unexpected error occurred.");
}
};

Comment on lines +226 to +250
useEffect(() => {
// If year or month change, recalculate how many days are in the specified month
if (year && month !== undefined) {
// Returns the last day of the month, by creating a date with day 0 of the following month.
const nummberOfDaysInMonth = new Date(year, month + 1, 0).getDate();
const daysArray = Array.from(
{ length: nummberOfDaysInMonth },
(_, index) => index + 1,
);
setListOfDaysInSelectedMonth(daysArray);
}

// Update the date object when year, month or date change
if (year && month !== undefined && day) {
let selectedDate: Date;

if (new Date(year, month, day).getDate() < day) {
// If user switches to a month in which selected day does not exist
// ie from 30/1 to feb(only 28 days), then set day to the 1st
selectedDate = new Date(year, month, 1);
} else {
selectedDate = new Date(year, month, day);
}
setValue("dateOfBirth", selectedDate);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for handling the date of birth selection in SlideTwo is well-implemented, dynamically updating the list of days based on the selected month and year. However, consider abstracting this logic into a custom hook or utility function to improve readability and reusability.

Comment on lines +418 to +438
let isError = await trigger(["professionalOrStudent"]);

if (isError) {
const professionalOrStudent = getValues("professionalOrStudent");

if (professionalOrStudent === "Working professional") {
isError = await trigger(["workplace", "jobTitle"]);

if (isError) {
router.push(`?slide=${4}`, { scroll: false });
}
} else if (professionalOrStudent === "Current student") {
isError = await trigger(["levelOfStudy", "course"]);

if (isError) {
router.push(`?slide=${4}`, { scroll: false });
}
} else if (professionalOrStudent === "None of the above") {
router.push(`?slide=${4}`, { scroll: false });
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In SlideThree, the logic for navigating to the next slide based on the professionalOrStudent selection is clear and functional. However, the repeated calls to trigger for different fields based on the user's selection could be optimized by grouping related fields into a single trigger call to reduce redundancy.

- isError = await trigger(["workplace", "jobTitle"]);
+ isError = await trigger(professionalOrStudent === "Working professional" ? ["workplace", "jobTitle"] : ["levelOfStudy", "course"]);

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
let isError = await trigger(["professionalOrStudent"]);
if (isError) {
const professionalOrStudent = getValues("professionalOrStudent");
if (professionalOrStudent === "Working professional") {
isError = await trigger(["workplace", "jobTitle"]);
if (isError) {
router.push(`?slide=${4}`, { scroll: false });
}
} else if (professionalOrStudent === "Current student") {
isError = await trigger(["levelOfStudy", "course"]);
if (isError) {
router.push(`?slide=${4}`, { scroll: false });
}
} else if (professionalOrStudent === "None of the above") {
router.push(`?slide=${4}`, { scroll: false });
}
}
let isError = await trigger(["professionalOrStudent"]);
if (isError) {
const professionalOrStudent = getValues("professionalOrStudent");
if (professionalOrStudent === "Working professional") {
isError = await trigger(professionalOrStudent === "Working professional" ? ["workplace", "jobTitle"] : ["levelOfStudy", "course"]);
if (isError) {
router.push(`?slide=${4}`, { scroll: false });
}
} else if (professionalOrStudent === "Current student") {
isError = await trigger(["levelOfStudy", "course"]);
if (isError) {
router.push(`?slide=${4}`, { scroll: false });
}
} else if (professionalOrStudent === "None of the above") {
router.push(`?slide=${4}`, { scroll: false });
}
}

Comment on lines +638 to +647
<div className="flex min-w-[20rem]">
<p className="w-1/2">Date of birth: </p>{" "}
<p className="w-1/2">
{" "}
{dateOfBirth.getDate()}
{" / "}
{dateOfBirth.getMonth() + 1} {" / "}
{dateOfBirth.getFullYear()}
</p>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In SlideFour, the logic for displaying the date of birth uses getDate, getMonth, and getFullYear directly. This approach does not account for months being zero-indexed. Consider using a date formatting library like date-fns or moment to format the date correctly and improve code readability.

- {dateOfBirth.getDate()} {" / "}
- {dateOfBirth.getMonth() + 1} {" / "}
- {dateOfBirth.getFullYear()}
+ {format(dateOfBirth, "dd / MM / yyyy")}

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
<div className="flex min-w-[20rem]">
<p className="w-1/2">Date of birth: </p>{" "}
<p className="w-1/2">
{" "}
{dateOfBirth.getDate()}
{" / "}
{dateOfBirth.getMonth() + 1} {" / "}
{dateOfBirth.getFullYear()}
</p>
</div>
<div className="flex min-w-[20rem]">
<p className="w-1/2">Date of birth: </p>{" "}
<p className="w-1/2">
{" "}
{format(dateOfBirth, "dd / MM / yyyy")}
</p>
</div>

@John-Paul-Larkin John-Paul-Larkin force-pushed the Feature-onboard-developer-form-b2 branch from ccc52b4 to 6e652e6 Compare February 24, 2024 15:47
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e4fd410 and 6e652e6.
Files selected for processing (7)
  • app/alpha/additional-details/_client.tsx (1 hunks)
  • app/alpha/additional-details/actions.ts (1 hunks)
  • app/alpha/additional-details/page.tsx (1 hunks)
  • app/alpha/additional-details/selectOptions.ts (1 hunks)
  • prisma/migrations/20240224154056_add_user_data/migration.sql (1 hunks)
  • prisma/schema.prisma (8 hunks)
  • schema/additionalUserDetails.ts (1 hunks)
Files skipped from review as they are similar to previous changes (6)
  • app/alpha/additional-details/_client.tsx
  • app/alpha/additional-details/actions.ts
  • app/alpha/additional-details/page.tsx
  • app/alpha/additional-details/selectOptions.ts
  • prisma/schema.prisma
  • schema/additionalUserDetails.ts

Comment on lines +2 to +10
ALTER TABLE "User" ADD COLUMN "course" TEXT,
ADD COLUMN "dateOfBirth" TIMESTAMP(3),
ADD COLUMN "firstName" TEXT,
ADD COLUMN "gender" TEXT,
ADD COLUMN "jobTitle" TEXT,
ADD COLUMN "levelOfStudy" TEXT,
ADD COLUMN "professionalOrStudent" TEXT,
ADD COLUMN "surname" TEXT,
ADD COLUMN "workplace" TEXT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration adds multiple columns to the "User" table, enhancing the user profile with both personal and professional details. Here are a few considerations:

  1. Data Types: Ensure that the chosen data types align with the expected data. For example, TIMESTAMP(3) for dateOfBirth is appropriate as it includes time down to milliseconds, which might be more precise than necessary for a birth date. Consider if DATE might be a more suitable choice for storing only the date part.

  2. Privacy Considerations: Adding personal information such as dateOfBirth, gender, and surname raises privacy and data protection considerations. Ensure that there are policies and features in place for users to control who can view this information or to opt out of providing it.

  3. Naming Consistency: The naming convention seems consistent, using camelCase for multi-word column names. Ensure this aligns with the rest of the database schema.

  4. Potential Missing Columns: Depending on the application's requirements, consider if any additional columns might be necessary for the User model, such as a column for middleName or nationality. However, only add these if they are genuinely needed to avoid unnecessary data collection.

  5. Indexing and Performance: For columns that will be frequently searched or filtered upon, consider adding indexes to improve query performance. However, this should be balanced against the write performance impact.

Consider reviewing the data types for appropriateness, especially for dateOfBirth. Also, ensure privacy considerations are addressed for personal information.

Copy link

vercel bot commented Feb 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
codu ❌ Failed (Inspect) Feb 24, 2024 5:06pm

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6e652e6 and e291a9e.
Files selected for processing (3)
  • app/alpha/additional-details/_client.tsx (1 hunks)
  • app/alpha/additional-details/actions.ts (1 hunks)
  • app/alpha/additional-details/page.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • app/alpha/additional-details/_client.tsx
  • app/alpha/additional-details/actions.ts
  • app/alpha/additional-details/page.tsx

Copy link
Contributor

@NiallJoeMaher NiallJoeMaher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌮

@NiallJoeMaher NiallJoeMaher merged commit 5614fdc into codu-code:develop Feb 24, 2024
4 of 5 checks passed
@John-Paul-Larkin John-Paul-Larkin deleted the Feature-onboard-developer-form-b2 branch March 27, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants