Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

define api endpoints and contract #15

Merged
merged 4 commits into from
Aug 25, 2023
Merged

define api endpoints and contract #15

merged 4 commits into from
Aug 25, 2023

Conversation

aramikm
Copy link
Collaborator

@aramikm aramikm commented Aug 24, 2023

Description

We need to define the endpoints and dtos related to content publishing api.

close #4

Details

  • implemented endpoints for content publishing
  • implemented dtos for requests and responses
  • added support to generate openapi metadata for swagger

Verification evidence

Screenshot 2023-08-24 at 2 01 10 PM

Screenshot 2023-08-24 at 2 00 57 PM

Screenshot 2023-08-24 at 2 00 40 PM

Copy link
Collaborator

@wilwade wilwade left a comment

Choose a reason for hiding this comment

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

Looks really good. A few thoughts that are less about changes and more about next pieces.

apps/api/src/api.controller.ts Outdated Show resolved Hide resolved
libs/common/src/dtos/activity.dto.ts Show resolved Hide resolved
libs/common/src/dtos/announcement.dto.ts Outdated Show resolved Hide resolved

@Post('content/:userDsnpId/broadcast')
@HttpCode(202)
async broadcast(@Param('userDsnpId') userDsnpId: string, @Body() broadcastDto: BroadcastDto): Promise<AnnouncementResponseDto> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not this PR, but I wonder how we will reuse the announcement structure while still waiting to upload the files.

I guess the upload endpoint could return the ipfs.io CID url (as it knows the upload parameters, we can generate the correct CID) and so while not uploaded yet, the incoming broadcastDto That way it is just matching the CID from the ifps url to trigger the release to IPFS from the upload queue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if I follow the reuse scenario that you are mentioning. Would you please elaborate on that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Mostly how the assetIds strings are used. If those assetIds were urls of the form https://ipfs.io/ipfs/[CID], then we could just insert them into the Broadcast/ReplyDto from the calling service. Then in here, it would just be a matter of parsing, validating, and triggering off the actual ipfs pins of those files inside the BroadcastDto.

Copy link
Collaborator Author

@aramikm aramikm Aug 25, 2023

Choose a reason for hiding this comment

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

I think there are some confusion about how we are imagining this might work. I'll create a diagram before starting to implement that part to make sure we are on the same page.

Copy link
Collaborator

@saraswatpuneet saraswatpuneet left a comment

Choose a reason for hiding this comment

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

lgtm! some of comments can be translated into stories

@aramikm aramikm merged commit 73099bd into main Aug 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initial api contract design
3 participants