Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions controllers/asset_version_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ func NewAssetVersionController(
// @Param projectSlug path string true "Project slug"
// @Param assetSlug path string true "Asset slug"
// @Param assetVersionSlug path string true "Asset version slug"
// @Success 200 {object} models.AssetVersion
// @Success 200 {object} dtos.AssetVersionModel
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug} [get]
func (a *AssetVersionController) Read(ctx shared.Context) error {
assetVersion := shared.GetAssetVersion(ctx)
return ctx.JSON(200, assetVersion)
return ctx.JSON(200, transformer.AssetVersionModelToDTO(assetVersion))
Comment thread
Dboy0ZDev marked this conversation as resolved.
Comment thread
Dboy0ZDev marked this conversation as resolved.
}

// @Summary Create asset version
Expand All @@ -78,7 +78,7 @@ func (a *AssetVersionController) Read(ctx shared.Context) error {
// @Param projectSlug path string true "Project slug"
// @Param assetSlug path string true "Asset slug"
// @Param body body object{name=string,tag=bool,defaultBranch=bool} true "Request body"
// @Success 201 {object} models.AssetVersion
// @Success 201 {object} dtos.AssetVersionModel
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs [post]
func (a *AssetVersionController) Create(ctx shared.Context) error {
asset := shared.GetAsset(ctx)
Expand All @@ -103,7 +103,7 @@ func (a *AssetVersionController) Create(ctx shared.Context) error {
if err != nil {
return err
}
return ctx.JSON(201, assetVersion)
return ctx.JSON(201, transformer.AssetVersionModelToDTO(assetVersion))
Comment thread
Dboy0ZDev marked this conversation as resolved.
}

// @Summary Delete asset version
Expand Down Expand Up @@ -133,7 +133,7 @@ func (a *AssetVersionController) Delete(ctx shared.Context) error {
// @Param organization path string true "Organization slug"
// @Param projectSlug path string true "Project slug"
// @Param assetSlug path string true "Asset slug"
// @Success 200 {array} models.AssetVersion
// @Success 200 {array} []dtos.AssetVersionModel
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs [get]
func (a *AssetVersionController) GetAssetVersionsByAssetID(ctx shared.Context) error {
asset := shared.GetAsset(ctx)
Expand All @@ -142,7 +142,8 @@ func (a *AssetVersionController) GetAssetVersionsByAssetID(ctx shared.Context) e
if err != nil {
return err
}
return ctx.JSON(200, assetVersions)
formattedAssetVersions := utils.Map(assetVersions, transformer.AssetVersionModelToDTO)
return ctx.JSON(200, formattedAssetVersions)
}

func (a *AssetVersionController) SBOMJSON(ctx shared.Context) error {
Expand Down
Loading