Skip to content

Commit

Permalink
feat: creating external listing "stub" for doorway usage (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
YazeedLoonat authored Feb 22, 2024
1 parent 10490d7 commit ce9752b
Show file tree
Hide file tree
Showing 2 changed files with 1,260 additions and 1,186 deletions.
23 changes: 23 additions & 0 deletions backend/core/src/listings/listings.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,29 @@ export class ListingsController {
return { listingCsv, unitCsv }
}

@Get(`external/:id`)
@ApiOperation({
summary: "Get listing for external consumption by id",
operationId: "externalRetrieve",
})
@UseInterceptors(ClassSerializerInterceptor)
@UsePipes(new ValidationPipe(defaultValidationPipeOptions))
async retrieveForExternalConsumption(
@Headers("language") language: Language,
@Param("id", new ParseUUIDPipe({ version: "4" })) listingId: string,
@Query() queryParams: ListingsRetrieveQueryParams
) {
if (listingId === undefined || listingId === "undefined") {
return mapTo(ListingDto, {})
}
const listing = mapTo(
ListingDto,
await this.listingsService.findOne(listingId, language, queryParams.view)
)

return JSON.stringify(listing)
}

@Get(`:id`)
@ApiOperation({ summary: "Get listing by id", operationId: "retrieve" })
@UseInterceptors(ClassSerializerInterceptor)
Expand Down
Loading

0 comments on commit ce9752b

Please sign in to comment.