codu icon indicating copy to clipboard operation
codu copied to clipboard

Feature/ Add "series" to link related articles

Open RangerCreaky opened this issue 1 year ago • 15 comments

✨ Codu Pull Request 💻

Fixes #(issue) Fixes #1081

Pull Request details

  • Added an extra input field in the more options section (While creating a new post) under the Canonical Url and Draft link
  • Added a new table in the database called "series"
  • Added a new field in the post table called seriesId referencing the id of the series table.

Cases considered

  • CREATE When the user creates a new record will be created in the series table

  • EDIT

  1. If the user adds a series name to a post which didn't have a series then a new record will be created
  2. If the user changes the series name to a new series name (which is not present in the db), then a new record will be created in the series table. (The previous series will be removed from the series table, if no other post has that series name to maintain consistency).
  3. If the user removes the series name then the seriesId in the post table will be set to null. (The previous series will be removed from the series table, if no other post has that series name to maintain consistency)
  • DELETE If the user deletes the post which had a series name then the series will be removed from the series table, if no other post has that series.

Any Breaking changes

None

Associated Screenshots

series-image

WORKING GIF: series codu

RangerCreaky avatar Oct 31 '24 07:10 RangerCreaky

@RangerCreaky is attempting to deploy a commit to the Codú Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 31 '24 07:10 vercel[bot]

[!IMPORTANT]

Review skipped

Review was skipped due to path filters

:no_entry: Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !**/*.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes in this pull request implement a new feature that allows users to link articles into a series. This includes adding a seriesName input field to the article creation form, updating the database schema to accommodate a new series table, and modifying the post management logic to handle the association between posts and series. The updates also ensure that the necessary validations are in place for the seriesName field and that existing functionalities remain intact.

Changes

File Path Change Summary
app/(editor)/create/[[...paramsArr]]/_client.tsx Added a new input field for seriesName in the article creation form and updated getFormData and savePost functions to handle this new field.
schema/post.ts Introduced a new optional field seriesName to SavePostSchema with validation rules.
server/api/router/post.ts Enhanced postRouter to accept seriesName in the update mutation, modified delete mutation to handle series logic, and updated editDraft query to include series relationship.
server/db/schema.ts Added a new series table with relevant fields and established a relationship with the post table through a new seriesId field.
drizzle/0000_initial_schema.sql Updated SQL migration script to create the new Series table and add seriesId to the Post table with appropriate foreign key constraints.
drizzle/0011_add_series.sql Introduced a new SQL script to create the Series table and modify the Post table, adding a foreign key constraint for seriesId.
server/api/router/index.ts Minor modification in appRouter configuration related to tagRouter.

Assessment against linked issues

Objective Addressed Explanation
Allow users to group related articles into a series (#[1081])
Add a series field to the article creation form and database (#[1081])
Automatic Navigation for articles in a series (#[1081]) Navigation links are not implemented in this PR.
Indication of the article’s place within the series (#[1081]) No indication of article placement is included.

Possibly related PRs

  • #1109: This PR updates the Settings component and includes enhancements to the email verification process, which may relate to user input handling and form management, similar to the changes made in the main PR regarding the Create component's form enhancements.
  • #1153: This PR focuses on rendering articles accurately, which involves managing content and user input, paralleling the main PR's updates to the Create component that includes a new input field for seriesName.
  • #1163: This PR introduces a new navigation system for the editor, which may interact with the Create component's functionality, especially in terms of user experience and form submission processes.

Suggested labels

hacktoberfest-accepted, hacktoberfest

Suggested reviewers

  • NiallJoeMaher

Poem

In a garden of stories, we weave and we share,
A series of tales, with love and with care.
Each post a new chapter, linked hand in hand,
Together they flourish, a beautiful band.
So hop on this journey, let the stories flow,
With series to guide us, together we grow! 🐇✨


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>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Oct 31 '24 07:10 coderabbitai[bot]

@NiallJoeMaher can you please review, I have worked on the changes you mentioned previously.

RangerCreaky avatar Oct 31 '24 08:10 RangerCreaky

@NiallJoeMaher Can you please check the reply and Please let me know if this approach works, or if there’s another way you'd like it handled!

RangerCreaky avatar Nov 01 '24 14:11 RangerCreaky

@NiallJoeMaher Any update on this?

RangerCreaky avatar Nov 04 '24 01:11 RangerCreaky

@NiallJoeMaher I have made the mentioned changes

RangerCreaky avatar Nov 04 '24 15:11 RangerCreaky

@NiallJoeMaher any update on this?

RangerCreaky avatar Nov 07 '24 04:11 RangerCreaky

@NiallJoeMaher any update on this?

RangerCreaky avatar Nov 11 '24 06:11 RangerCreaky

hey @RangerCreaky sorry we've been busy, I'm taking a look at this

CarolinaCobo avatar Nov 11 '24 20:11 CarolinaCobo

Hey @CarolinaCobo no problem.

RangerCreaky avatar Nov 12 '24 07:11 RangerCreaky

@NiallJoeMaher, I will work on these changes Let me know if there are any more changes needed to be done

RangerCreaky avatar Nov 16 '24 11:11 RangerCreaky

@NiallJoeMaher I have made the changes, please review

RangerCreaky avatar Nov 18 '24 03:11 RangerCreaky

@NiallJoeMaher any update on this?

RangerCreaky avatar Nov 22 '24 14:11 RangerCreaky

@RangerCreaky Hi Ranger Niall is actually on holidays at the moment.

John-Paul-Larkin avatar Nov 22 '24 14:11 John-Paul-Larkin

@John-Paul-Larkin Oh okay,

RangerCreaky avatar Nov 22 '24 14:11 RangerCreaky