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

feat(rest): Update Component with attachment #2063

Conversation

tuannn2
Copy link
Contributor

@tuannn2 tuannn2 commented Jul 25, 2023

Please provide a summary of your changes here.

  • Which issue is this pull request belonging to and how is it solving it? (Refer to issue here)
  • Did you add or update any new dependencies that are required for your change?

Issue: #2062

How To Test?

  • Run command line:
curl 'https://sw360.org/api/components/17653524' -i -X PATCH \
    -H 'Content-Type: application/hal+json' \
    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic3czNjAtUkVTVC1BUEkiXSwidXNlcl9uYW1lIjoiYWRtaW5Ac3czNjAub3JnIiwic2NvcGUiOlsiYWxsIl0sImV4cCI6MTY5MDI1ODUyNywiYXV0aG9yaXRpZXMiOlsiUkVBRCIsIldSSVRFIl0sImp0aSI6IldFU1V6RVQ1Y09aTGVXQTA4cDVxQ3lEdUVoRSIsImNsaWVudF9pZCI6InRydXN0ZWQtc3czNjAtY2xpZW50In0.GtSuxr_Av75PD3qvqXaoF8TkSnWUrNGTHXKpUvJS6VUGodyzgU9y-GSgc-ofsZkhhsnbRm3xrB-3uK6-__qPU6ibIS6cIznRYMvsd8KXFLJR56ZRkzlBDA5f7VocEzq_3WVjNZ0uQVrfdHvoPWeFzNziG_IxhXv6go8N4Ai4PV5PbQ19t3AOpH5eW900E2AkoI0TLxhGuQ6GyQBu0Ll_2nc7I68yFJb2J2F4jjlYR0wMTKNKJorg5UG_2vUzPo0DcoKu2HaNS-4c0u9XNHuYJmBiXwnR7PWx3jxhyp_lsst4V_BjD7y5siO9LpFR41GZmbA8qv00VO6zJ_vaO6JpNQ' \
    -H 'Accept: application/hal+json' \
    -d '{
  "name" : "Updated Component",
  "attachmentDTOs" : [ {
    "attachmentContentId" : "1231231255",
    "filename" : "spring-mvc-4.3.4.RELEASE.jar"
  } ]
}'


  • Expected Output
{
  "id" : "17653524",
  "name" : "Updated Component",
  "description" : "Angular is a development platform for building mobile and desktop web applications.",
  "createdOn" : "2016-12-15",
  "componentType" : "OSS",
  "subscribers" : [ "Mari" ],
  "moderators" : [ "[email protected]", "[email protected]" ],
  "componentOwner" : "John",
  "ownerAccountingUnit" : "4822",
  "ownerGroup" : "AA BB 123 GHV2-DE",
  "ownerCountry" : "DE",
  "visbility" : "EVERYONE",
  "externalIds" : {
    "component-id-key" : "1831A4",
    "ws-component-id" : "[\"123\",\"598753\"]"
  },
  "additionalData" : {
    "Key" : "Value"
  },
  "mainLicenseIds" : [ "Apache-2.0", "MIT" ],
  "defaultVendorId" : "vendorId",
  "categories" : [ "java", "javascript", "sql" ],
  "languages" : [ "EN", "DE" ],
  "softwarePlatforms" : [ "Linux" ],
  "operatingSystems" : [ "Windows", "Linux" ],
  "homepage" : "https://angular.io",
  "mailinglist" : "[email protected]",
  "wiki" : "http://wiki.ubuntu.com/",
  "blog" : "http://www.javaworld.com/",
  "modifiedOn" : "2016-12-30",
  "setBusinessUnit" : false,
  "setVisbility" : true,
  "_links" : {
    "self" : {
      "href" : "https://sw360.org/api/components/17653524"
    }
  },
  "_embedded" : {
    "createdBy" : {
      "email" : "[email protected]",
      "deactivated" : false,
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/users/byid/123456789"
        }
      }
    },
    "sw360:moderators" : [ {
      "email" : "[email protected]",
      "deactivated" : false,
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/users/byid/74427996"
        }
      }
    }, {
      "email" : "[email protected]",
      "deactivated" : false,
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/users/byid/123456789"
        }
      }
    } ],
    "sw360:vendors" : [ {
      "fullName" : "Google"
    } ],
    "sw360:releases" : [ {
      "name" : "Angular 2.3.0",
      "version" : "2.3.0",
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/releases/3765276512"
        }
      }
    }, {
      "name" : "Angular 2.3.1",
      "version" : "2.3.1",
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/releases/3765276512"
        }
      }
    } ],
    "defaultVendor" : {
      "url" : "https://vendor.com",
      "shortName" : "vendorShortName",
      "fullName" : "vendorFullName",
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/vendors/vendorId"
        }
      }
    },
    "sw360:attachments" : [ {
      "filename" : "spring-mvc-4.3.4.RELEASE.jar",
      "_links" : {
        "self" : {
          "href" : "https://sw360.org/api/attachments/1231231255"
        }
      }
    } ]
  }
}

@tienlee tienlee added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for REST New-UI Level for the API and UI level changes for the new-ui labels Jul 25, 2023
@nikkuma7
Copy link
Contributor

Test successful.
image

@ag4ums ag4ums removed the needs general test This is general testing, meaning that there is no org specific issue to check for label Jul 26, 2023
@tuannn2 tuannn2 force-pushed the release/feature_edit_component_include_attachments branch from ebeed93 to eb22f1d Compare July 27, 2023 02:04
@tuannn2 tuannn2 force-pushed the release/feature_edit_component_include_attachments branch from eb22f1d to 42f4410 Compare July 31, 2023 08:29
@eldrin30
Copy link
Contributor

eldrin30 commented Aug 1, 2023

Code looks good :)

@ag4ums ag4ums added the ready ready to merge label Aug 1, 2023
@ag4ums ag4ums merged commit d9e9276 into eclipse-sw360:main Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New-UI Level for the API and UI level changes for the new-ui ready ready to merge REST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants