Skip to content

Commit

Permalink
Merge branch 'catenax-ng-feat/DCMFOSS-53' into feat/DCMFOSS-53
Browse files Browse the repository at this point in the history
  • Loading branch information
Bailonis committed Sep 25, 2023
2 parents 992887b + b6bc4a2 commit 30ba007
Show file tree
Hide file tree
Showing 62 changed files with 5,658 additions and 1,202 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/kics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "KICS"

on:
push:
branches:
- main
- rc/**
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- uses: actions/checkout@v3

- name: KICS scan
uses: checkmarx/kics-github-action@master
with:
path: "."
# Exclude paths from scan by providing the paths as comma separated list
# exclude_paths: "postgres-init.yaml,templates/sharedidp.yaml"
# Exclude queries by providing the query / rule ID as comma separated list
# exclude_queries: "b9c83569-459b-4110-8f79-6305aa33cb37"
# Fail on HIGH severity results
fail_on: high
# Disable secrets detection - we use GitGuardian
disable_secrets: true
# When provided with a directory on output_path
# it will generate the specified reports file named 'results.{extension}'
# in this example it will generate:
# - results-dir/results.json and results-dir/results.sarif
output_path: kicsResults/
output_formats: "json,sarif"

# Upload findings to GitHub Advanced Security Dashboard
- name: Upload SARIF file for GitHub Advanced Security Dashboard
if: always()
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: kicsResults/results.sarif
39 changes: 29 additions & 10 deletions .github/workflows/veracode-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,22 @@ name: Veracode Static Analysis Pipeline Scan
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '27 12 * * 6'

permissions:
contents: read
# Once a day
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
build-and-pipeline-scan:
build-and-pipeline-scan-backend:
permissions:
contents: read
security-events: write
actions: read
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
repository: ''
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v2
Expand All @@ -64,3 +60,26 @@ jobs:
filepath: "./veracode-scan-target.zip"
vid: "${{ secrets.VERACODE_API_ID }}"
vkey: "${{ secrets.VERACODE_API_KEY }}"

build-and-pipeline-scan-frontend:
permissions:
contents: read
security-events: write
actions: read
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Zip frontend
run: zip -r veracode-scan-target-frontend.zip ./demand-capacity-mgmt-frontend

- name: Run Veracode Upload And Scan
uses: veracode/[email protected]
with:
appname: "demand-capacity-mgmt-frontend"
createprofile: false
filepath: "./veracode-scan-target-frontend.zip"
vid: "${{ secrets.VERACODE_API_ID }}"
vkey: "${{ secrets.VERACODE_API_KEY }}"
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ metadata:
name: config-backend
data:
{{- toYaml .Values.backend.configmap.data | nindent 2 }}
{{ end }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import eclipse.tractusx.demand_capacity_mgmt_specification.model.CompanyDto;
import java.util.List;
import lombok.AllArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.CompanyEntity;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.CompanyService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* ******************************************************************************
* Copyright (c) 2023 BMW AG
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
* *******************************************************************************
*/

package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.controllers;

import eclipse.tractusx.demand_capacity_mgmt_specification.api.FavoriteApi;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.FavoriteRequest;
import eclipse.tractusx.demand_capacity_mgmt_specification.model.FavoriteResponse;
import lombok.AllArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums.FavoriteType;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.FavoriteService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.UUID;

@RestController
@AllArgsConstructor
public class FavoriteController implements FavoriteApi {

private final FavoriteService favoriteService;

@Override
public ResponseEntity<FavoriteResponse> createFavorite(FavoriteRequest favoriteRequest) throws Exception {
FavoriteResponse response = favoriteService.createFavorite(favoriteRequest);
return ResponseEntity.status(200).body(response);
}

@Override
public ResponseEntity<Void> deleteFavoriteById(String id) throws Exception {
favoriteService.deleteFavorite(UUID.fromString(id));
return ResponseEntity.status(200).build();
}

@Override
public ResponseEntity<List<FavoriteResponse>> getFavorite() throws Exception {
List<FavoriteResponse> responseList = favoriteService.getAllFavorites();
return ResponseEntity.status(200).body(responseList);
}

@Override
public ResponseEntity<List<FavoriteResponse>> getFavoriteByType(String type) throws Exception {
List<FavoriteResponse> responseList = favoriteService.getAllFavoritesByType(type);
return ResponseEntity.status(200).body(responseList);
}

@Override
public ResponseEntity<FavoriteResponse> updateFavorite(String id,String type, FavoriteRequest favoriteRequest) throws Exception {
FavoriteResponse response = favoriteService.updateFavorite(UUID.fromString(id), FavoriteType.valueOf(type),favoriteRequest);
return ResponseEntity.status(200).body(response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import eclipse.tractusx.demand_capacity_mgmt_specification.model.UnitMeasure;
import java.util.List;
import lombok.AllArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.UnitMeasureEntity;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.services.UnityOfMeasureService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* ******************************************************************************
* Copyright (c) 2023 BMW AG
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
* *******************************************************************************
*/

package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities.enums.FavoriteType;

import javax.persistence.*;
import java.util.UUID;

@Entity
@Table(name = "favorites")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FavoriteEntity {

@Id
@GeneratedValue
@Column(columnDefinition = "uuid", updatable = false, name = "user_id")
private UUID id;

@Column(columnDefinition = "uuid",name = "favorite_id")
private UUID favoriteId;

@Column(name = "f_type", columnDefinition = "varchar")
@Enumerated(EnumType.STRING)
private FavoriteType type;
}
Loading

0 comments on commit 30ba007

Please sign in to comment.