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

Identification of Post Attachment (Priority for test.talawa.io) #3314

Open
JaiPannu-IITI opened this issue Feb 27, 2025 · 7 comments
Open

Identification of Post Attachment (Priority for test.talawa.io) #3314

JaiPannu-IITI opened this issue Feb 27, 2025 · 7 comments
Labels
bug Something isn't working no-issue-activity No issue activity unapproved Unapproved for Pull Request

Comments

@JaiPannu-IITI
Copy link

Describe the bug

Post Attachments does not have id to distinguish a particular post.

Note: postId refers to ID of the actual post it is attachment to, it can be same for multiple attachments

To Reproduce

Steps to reproduce the behavior: Analyze postAttachments schema

Image

Expected behavior

Each post_attachment should have a unique ID assigned to it.

Approach

Add unique identifier of the post_attachment and adjust related sections (except sample data script and sample data) to avoid code breakage.

Potential internship candidates

Please read this if you are planning to apply for a Palisadoes Foundation internship

@JaiPannu-IITI JaiPannu-IITI added the bug Something isn't working label Feb 27, 2025
@github-actions github-actions bot added the unapproved Unapproved for Pull Request label Feb 27, 2025
@PratapRathi
Copy link

PratapRathi commented Feb 28, 2025

@palisadoes Please assign this issue to me.

I was assigned 2 issues but I completed the task and raised PR, please review and close them.
#3300
#3310

@prayanshchh
Copy link
Contributor

why do we need unique ids for attachement

  1. post attachements are only needed when posts are viewed
  2. for this use case querying all attachements based on postId is enough
  3. for every post attachement the name of the post is stored as ulid() in mutation (if i am not wrong)
  4. in sample data we only have 6 posts having images, why do I see more

@JaiPannu-IITI
Copy link
Author

JaiPannu-IITI commented Mar 1, 2025

  1. There must be any unique field.
  2. How would you delete any particular attachment if you want?
  3. One cannot remove sample data duplication without unique id without ignoring business logic since we are directly interacting with database.

@prayanshchh
Copy link
Contributor

prayanshchh commented Mar 1, 2025

  1. if someone deletes a post all the attachements related to post can be deleted using postId, do we need a feature to delete a specific attachement from a post, we may not need it
  2. in develop loadSampledata would delete all records in related collections in db and import them again, making sure no matter how many times the import command is run, it doesn't throw a duplicate key error

@JaiPannu-IITI
Copy link
Author

Please once check how sample data script works

@palisadoes
Copy link
Contributor

@prayanshchh

  1. We need to consider deduplication.
    1. https://en.wikipedia.org/wiki/Data_deduplication
  2. One approach is to create a hash of the object that is being uploaded. If there is a match with a file already stored, then the post is updated with the pointer to the original object. The uploaded object is discarded as unnecessary.
  3. The object is not deleted until all pointers to it are removed.
  4. This also helps when people are forwarding posts. There is no need to recreate the object for everyone who receives the message

Copy link

github-actions bot commented Mar 9, 2025

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

@github-actions github-actions bot added the no-issue-activity No issue activity label Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity No issue activity unapproved Unapproved for Pull Request
Projects
None yet
Development

No branches or pull requests

4 participants