Closed Rotorsoft closed 6 months ago
@kurtisassad let's start refining the engineering requirements and provide a rough estimate
Looks like Kurtis estimated at a 3. Tossing back to @Rotorsoft since Kurtis is out next week (and then when he is back, Ryan is out until 4/16.)
Needless to say, we would prefer not to have to wait for Kurtis to be back for this work to be done.
Roger will reach out to Protocol team today to confirm model/schema is correct.
Looks like this can work. As discussed in the worker policy PR, maybe we can add chainNodeUrl
to the ContentAdded
/ContentUpvoted
events so that we don't need to query across Thread->Community->ChainNode in the worker policy.
Should be fine unless for some reason the policy will fire months/years after the event was emitted at a time when the RPC url is no longer validβ edge case.
Looks like this can work. As discussed in the worker policy PR, maybe we can add
chainNodeUrl
to theContentAdded
/ContentUpvoted
events so that we don't need to query across Thread->Community->ChainNode in the worker policy.Should be fine unless for some reason the policy will fire months/years after the event was emitted at a time when the RPC url is no longer validβ edge case.
I think we can solve this in the projection/query... we can include chain node attributes in the general (getAll) query, or create a getById query with more details
Description
Create a new projection for contest-related events, aimed at capturing all pertinent details at the contest level. This projection will facilitate the presentation of contest information across various UI views, encompassing started contests, new threads and votes within contests, as well as winners. The implementation should include a query endpoint with filters to efficiently retrieve contest records from this projection.
Stakeholders
Details
ContestStarted
(in contest manager)ThreadCreated
(in platform - associated to contest)ThreadUpvoted
(in platform - associated to contest)ContentAdded
(to contest manager)VoteAdded
(to contest manager)WinnerRecorded
(in contest manager)Integration Patterns Consideration:
In the context of integration patterns, the following approaches are being considered:
Platform Event Relay via RabbitMQ:
ContestWorkerPolicy
will be implemented. This policy's role will be to incorporate the new content and votes into the on-chain contest manager.On-Chain Event Integration:
By adopting these integration patterns, we aim to establish seamless communication channels between the platform and external systems, facilitating a more efficient and robust data exchange and synchronization.
Acceptance Criteria
Model
Contest Lifecycle
Engineering Requirements
Projection
[x] Path -
/libs/model/src/contest/Contests.projection.ts
[x] Events - Schemas defined by event producers
/libs/core/src/schemas/events.schemas.ts
namespace, contest address, interval
namespace, contest address, length
contest address, new instance id when recurring, start and end times
contest address and id when recurring, content id and url, creator address
contest address and id when recurring, content id, voter address and voting power
contest address and id when recurrig, winners as ranked array of creator addresses
=> ends contest![x] Schema -
/libs/core/src/schemas/projections/contests.schemas.ts
[x] Repository/ORM
/libs/model/src/models/contest_manager.ts
/libs/model/src/models/contest.ts
/libs/model/src/models/contest_action.ts
[x] Rules
Queries
π© GetAllContests
[x] Path -
/libs/model/src/contest/GetAllContests.query.ts
[ ] Authorization
[ ] Schema (in/out) -
/libs/core/src/schemas/queries/contests.schemas.ts
[x] Routing -
GET /api/v1/contests.getAll
Unit Testing
[x] Path -
/libs/model/test/contests-projection-lifecycle.spec.ts
Happy Path
Sad Path