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

feat(blog): expose unique identifier #983

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

luanargolodev
Copy link
Contributor

@luanargolodev luanargolodev commented Dec 26, 2024

What is this Contribution About?

This PR aims to add the unique id of the blog post.

As the post can be 100% edited (including the slug), we added this id to have a unique identifier.

Aiming at a scenario in which we save comments using the post_slug in the comments table, if there were any changes to the slug due to an error or anything else, we would lose all data registered in the system due to this change.
{07EE2404-F2E0-4185-B50A-EB3C6DE31511}

Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.64.12 update
  • 🎉 for Minor 0.65.0 update
  • 🚀 for Major 1.0.0 update

Comment on lines +14 to +20
return (current as Record<string, T>[]).map((item) => {
const id = (item.name as string).split(path)[1]?.replace("/", "");
return {
...item[accessor],
id,
};
});
Copy link
Contributor

Choose a reason for hiding this comment

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

why add it manually? I think this should be in the table, maybe by a workflow that runs it when this changes comes to production

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why add it manually? I think this should be in the table, maybe by a workflow that runs it when this changes comes to production

@IncognitaDev, by default it already returns, but in a different format.

ex: collections/blog/categories/05430797e2d1 or collections/blog/posts/1d76260ef8a8

the objective is to do the split and return only the unique identifier to use later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

example of how I'm using

{A6300D91-C6DA-4B99-BFC2-5B4070847CD3}

@matheusgr matheusgr merged commit 6a28504 into deco-cx:main Jan 6, 2025
1 check passed
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.

3 participants