-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge pull request #10 from FusionTech-2430/release
🚀 Release v1.0
- Loading branch information
Showing
38 changed files
with
1,227 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Build Project | ||
on: | ||
pull_request: | ||
branches: [ "main", "develop", "release" ] | ||
|
||
jobs: | ||
Build: | ||
runs-on: self-hosted | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
- name: Build with Maven | ||
env: | ||
CONFIG_IP: ${{ secrets.DEV_INTEG_HOST }} | ||
run: mvn clean install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deploy PROD | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
jobs: | ||
Deploy: | ||
name: Deploy on PROD | ||
runs-on: self-hosted | ||
steps: | ||
- name: executing remote ssh commands using ssh key | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.PROD_G2_HOST }} | ||
username: ${{ secrets.HOSTS_USERNAME }} | ||
key: ${{ secrets.PROD_G2_SSH_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script: | | ||
cd AllConnected/${{ github.event.repository.name }} | ||
echo "Fetching latest code..." | ||
git fetch | ||
git checkout main | ||
git pull | ||
echo "Building Docker image..." | ||
docker build -t ${{ github.event.repository.name }} . | ||
echo "Creating .env file..." | ||
echo "PROFILE=prod2" >> .env | ||
echo "CONFIG_IP=10.43.101.72" >> .env | ||
docker rm -f ${{ github.event.repository.name }} | ||
docker run --name ${{ github.event.repository.name }} --network all_connected -d -p ${{ secrets.SERVICE_PORT }}:8080 --env-file .env ${{ github.event.repository.name }} | ||
echo "Docker container running..." | ||
rm .env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
src/main/java/co/allconnected/fussiontech/productsservice/config/WebConfig.java
This file was deleted.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
src/main/java/co/allconnected/fussiontech/productsservice/controllers/LabelsController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package co.allconnected.fussiontech.productsservice.controllers; | ||
|
||
import co.allconnected.fussiontech.productsservice.dtos.LabelDTO; | ||
import co.allconnected.fussiontech.productsservice.dtos.Response; | ||
import co.allconnected.fussiontech.productsservice.services.LabelService; | ||
import co.allconnected.fussiontech.productsservice.utils.OperationException; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/labels") | ||
public class LabelsController { | ||
private final LabelService labelService; | ||
|
||
@Autowired | ||
public LabelsController(LabelService labelService) { | ||
this.labelService = labelService; | ||
} | ||
|
||
@PostMapping | ||
public ResponseEntity<LabelDTO> createLabel(@RequestParam String name) { | ||
try { | ||
if (name == null || name.trim().isEmpty()) { | ||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); // Manejo del error si 'name' es nulo o vacÃo | ||
} | ||
LabelDTO labelDTO = labelService.createLabel(name); | ||
return ResponseEntity.status(HttpStatus.CREATED).body(labelDTO); | ||
} catch (Exception e) { | ||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); | ||
} | ||
} | ||
@PutMapping("/{id}") | ||
public ResponseEntity<?> updateLabel(@PathVariable String id, @RequestParam String name) { | ||
try { | ||
return ResponseEntity.status(HttpStatus.OK).body(labelService.updateLabel(id, name)); | ||
} catch (OperationException e) { | ||
return ResponseEntity.status(e.getCode()).body(new Response(e.getCode(), e.getMessage())); | ||
} catch (Exception e) { | ||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new Response(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Unexpected error occurred: " + e.getMessage())); | ||
} | ||
} | ||
@GetMapping("/{id}") | ||
public ResponseEntity<?> getLabel(@PathVariable String id) { | ||
try { | ||
return ResponseEntity.status(HttpStatus.OK).body(labelService.getLabel(id)); | ||
} catch (OperationException e) { | ||
return ResponseEntity.status(e.getCode()).body(new Response(e.getCode(), e.getMessage())); | ||
} catch (Exception e) { | ||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new Response(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Unexpected error occurred: " + e.getMessage())); | ||
} | ||
} | ||
|
||
@GetMapping() | ||
public ResponseEntity<?> getLabels() { | ||
try { | ||
LabelDTO[] listLabelsDTO = labelService.getLabels(); | ||
return ResponseEntity.status(HttpStatus.OK).body(listLabelsDTO); | ||
} catch (OperationException e) { | ||
return ResponseEntity.status(e.getCode()).body(new Response(e.getCode(), e.getMessage())); | ||
} catch (RuntimeException e) { | ||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new Response(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage())); | ||
} | ||
} | ||
|
||
@DeleteMapping("/{id}") | ||
public ResponseEntity<?> deleteLabel(@PathVariable String id) { | ||
try { | ||
labelService.deleteLabel(id); | ||
return ResponseEntity.status(HttpStatus.OK).body(new Response(HttpStatus.OK.value(), "Label deleted")); | ||
} catch (OperationException e) { | ||
return ResponseEntity.status(e.getCode()).body(new Response(e.getCode(), e.getMessage())); | ||
} catch (Exception e) { | ||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new Response(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Unexpected error occurred: " + e.getMessage())); | ||
} | ||
} | ||
} |
Oops, something went wrong.