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

[Platform] [User Notifications][TUS]Subscriptions are created when user performs certain actions #176

Open
2 tasks
becevka opened this issue Apr 28, 2024 · 13 comments · Fixed by #181
Open
2 tasks
Assignees
Labels
enhancement New feature or request Platform

Comments

@becevka
Copy link
Contributor

becevka commented Apr 28, 2024

Summary
In order to support User Notifications, we need to subscribe users by default to the Idea of their interest.

Describe the solution you'd like
Subscription Collection should consist of the following fields:

  • entityId, numeric id of the business-level entity (IdeaCard)
  • entityType, enum value of business-level entity type (IdeaCard only for now)
  • user, reference to the user subscribed to Business Entity
  • createdDateTime, date when event was created
  • active, boolean value, true by default, false when user unsubscribed
  • unsubscribeDateTime, date when user deactivated subscription

When user creates idea, subscription for the new idea is automatically created.
When user posts comment to the idea, subscription for that idea is automatically created.
For now, we can disable API endpoints to Subscription.

Acceptance Criteria

Generated by Zenhub AI

  • Scenario: Subscription is created when user creates an idea
    • Given a user creates an idea
    • When the idea is created
    • Then a subscription is automatically created for the user with the entityId of the idea, entityType as 'IdeaCard', and user as the user who created the idea
  • Scenario: Subscription is created when user posts a comment to an idea
    • Given a user posts a comment on an idea
    • When the comment is posted
    • Then a subscription is automatically created for the user with the entityId of the idea, entityType as 'IdeaCard', and user as the user who posted the comment
@becevka becevka added the enhancement New feature or request label Apr 28, 2024
@becevka
Copy link
Contributor Author

becevka commented May 5, 2024

@tiagopazhs Please start with creating a Subscription collection.

@j-peace
Copy link
Contributor

j-peace commented May 6, 2024

@tiagopazhs Please start with creating a Subscription collection.

All rigth!

So, how it works?

If I create the collection in my strapi admin. Then push to my branch.

If you pull this, you will see the collection in your strapi admin? Is it imediatly or do you need to run a migration?

@becevka
Copy link
Contributor Author

becevka commented May 6, 2024

@tiagopazhs
After you add a collection in Admin locally, strapi will generate new files for you. You can commit those files and create PullRequest. We can review them together in github.

@j-peace
Copy link
Contributor

j-peace commented May 11, 2024

Why we have a created time instead of subscribed time?

@j-peace
Copy link
Contributor

j-peace commented May 11, 2024

I didn't understand very weel about this two ones:

  • entityId, numeric id of the business-level entity (IdeaCard)
  • entityType, enum value of business-level entity type (IdeaCard only for now)

@j-peace
Copy link
Contributor

j-peace commented May 11, 2024

I just created the PR here with the other fields: #181

@j-peace
Copy link
Contributor

j-peace commented May 11, 2024

So I have another question:
If I add a field to Subscription. What will happen with the other records in the database that doesn't have this new field.

@becevka
Copy link
Contributor Author

becevka commented May 11, 2024

Why we have a created time instead of subscribed time?

Could be subscribed time, I just thought it would be more consistent to have similar name in all collections

@becevka
Copy link
Contributor Author

becevka commented May 12, 2024

Also difference between createdDateTime and subscribedDateTime is that user can resubscribe, but that will just set active to true and unsubscribeDateTime to null, but createdDateTime will stay the same. I.e. createdDateTime is a time when record was created, just once, while user might resubscribe, we really not care much (at least for now) when they resubscribe.

@becevka
Copy link
Contributor Author

becevka commented May 12, 2024

entityType will be enum type with the name of the type of the data user subscribe to. For now it will have only one option - IdeaCard.
entityId is a numeric Id (not relationship reference) to the entity, user subscribed to. In case of IdeaCard, IdeaCard id.

@j-peace
Copy link
Contributor

j-peace commented May 25, 2024

entityType will be enum type with the name of the type of the data user subscribe to. For now it will have only one option - IdeaCard. entityId is a numeric Id (not relationship reference) to the entity, user subscribed to. In case of IdeaCard, IdeaCard id.

In this case, should I create a field with normal integer type, right?
And before create or update, check if the id exists.

Looks good?

@j-peace
Copy link
Contributor

j-peace commented May 25, 2024

Why we have a created time instead of subscribed time?

Could be subscribed time, I just thought it would be more consistent to have similar name in all collections

Is there a convetion here in the project for that? Something like:
createdAt or createdDateTime or createdTime or TimeCreated
wich one can adapt as well to the project?

Last question wich one looks better, camelCase or PascalCase

@becevka becevka reopened this Jun 23, 2024
@j-peace
Copy link
Contributor

j-peace commented Jul 7, 2024

Hey @becevka is it still open because we have to test the endpoints and pass all tests before to finalize the entire epic ?

@zar92 zar92 added the Platform label Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants