Skip to content

Commit

Permalink
Merge pull request #396 from softeerbootcamp-2nd/dev
Browse files Browse the repository at this point in the history
MAIN MERGE
  • Loading branch information
tank3a authored Aug 22, 2023
2 parents 5bfab95 + c948217 commit 94d9b93
Show file tree
Hide file tree
Showing 62 changed files with 1,981 additions and 312 deletions.
Binary file added .DS_Store
Binary file not shown.
28 changes: 20 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: test coverage
name: Test Coverage


on:
pull_request:
branches:
branches:
- 'dev'
paths:
- '**.java'
Expand All @@ -12,6 +13,7 @@ permissions:
pull-requests: write

env:
APPLICATION: ${{ secrets.APPLICATION_TEST }}
wd: ./backend

jobs:
Expand All @@ -20,25 +22,35 @@ jobs:
steps:
- uses: actions/checkout@v3


- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Copy application.yml
working-directory: ${{ env.wd }}
run: |
touch ./src/test/resources/application.yml
echo "${{ secrets.APPLICATION_TEST }}" > ./src/test/resources/application.yml
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Test with Gradle
- name: Run Coverage
working-directory: ${{ env.wd }}
run: ./gradlew test

run: |
chmod +x gradlew
./gradlew testCoverage
- name: Add coverage to PR
id: jacoco
uses: madrapps/jacoco-report@v1.2
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
paths: ${{ github.workspace }}/backend/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: 📊 테스트 커버리지 결과
min-coverage-overall: 80
min-coverage-changed-files: 80
update-comment: true
continue-on-error: true
7 changes: 5 additions & 2 deletions backend-recommend/recommend.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def recByApriori(body):
optionList = body['options']

for i in range(len(optionList)):
input.append(optionList[i]['subOptionId'])
input.append(str(optionList[i]))

input = set(input)
dataset = []
Expand Down Expand Up @@ -65,6 +65,9 @@ def recByApriori(body):
response = []
for item in top_items:
consequent = item[0]
response.append({"salesOptions": ",".join(consequent)})
subResponse = []
for option in consequent:
subResponse.append(int(option))
response.append(subResponse)

return jsonify(response)
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ out/
.vscode/

### yml files ###
src/main/resources/application.yml
src/main/resources/application.yml
src/test/resources/application.yml
40 changes: 13 additions & 27 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,26 @@ tasks.named('test') {
}

jacoco {
toolVersion = '0.8.9'
}

test {
useJUnitPlatform()
finalizedBy jacocoTestReport
toolVersion = '0.8.9'
}

jacocoTestReport {
dependsOn test
reports {
xml.required = true
}
finalizedBy 'jacocoTestCoverageVerification'
dependsOn test
reports {
xml.required = true
html.required = true
csv.required = false
}
}

jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.8
}
limit {
counter = 'METHOD'
value = 'COVEREDRATIO'
minimum = 0.8
}
}
}
tasks.register('testCoverage', Test) {
group 'verification'
description 'Runs the tests with covarage (Create JaCoCo report)'

dependsOn test, jacocoTestReport
tasks['jacocoTestReport'].mustRunAfter(tasks['test'])
}

jar {
enabled = false
}

Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package autoever2.cartag.controller;

import autoever2.cartag.domain.car.BoughtCarDto;
import autoever2.cartag.domain.car.CarDefaultDto;
import autoever2.cartag.domain.car.CarDto;
import autoever2.cartag.domain.share.QuoteIdList;
import autoever2.cartag.domain.share.QuoteInfoDto;
import autoever2.cartag.domain.car.CarTypeDto;
import autoever2.cartag.service.CarService;
import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -15,7 +12,6 @@
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
Expand Down Expand Up @@ -56,24 +52,4 @@ public List<CarDto> carTrimInfo(@Parameter(description = "선택한 car_type") @
public CarDefaultDto carDefaultDto(@Parameter(description = "선택한 car_id") @RequestParam("carid") int carId) {
return service.findCarDefaultDtoByCarId(carId);
}

@Operation(summary = "차량 구매 정보 반환 api", description = "차량 구매 정보 조회 method")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공", content = @Content(schema = @Schema(implementation = BoughtCarDto.class))),
})
@GetMapping("bought/infos")
public List<BoughtCarDto> boughtCarDtos() {
return service.findAllBoughInfos();
}

@Operation(summary = "차량 공유하기를 위한 api", description = "차량 공유를 위한 정보 반환")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공", content = @Content(schema = @Schema(implementation = QuoteInfoDto.class))),
})
@PostMapping("/infos/shares")
public QuoteInfoDto boughtCarDtos(@Parameter(description = "선택한 id 리스트") @RequestBody QuoteIdList idList) {
return service.findShareInfoDto(idList);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import autoever2.cartag.domain.model.ModelDetailMappedDto;
import autoever2.cartag.domain.model.ModelEfficiencyDataDto;
import autoever2.cartag.domain.model.ModelShortDataDto;
import autoever2.cartag.domain.model.PowerTrainMappedDto;
import autoever2.cartag.service.ModelService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand Down Expand Up @@ -37,7 +36,8 @@ public class ModelController {
})
@GetMapping("/list")
public List<ModelShortDataDto> getTrimModelType(@Parameter(description = "선택한 차량 트림ID") @RequestParam("carid") int carId) {
return modelTypeService.getModelTypeData(carId);
List<ModelShortDataDto> result = modelTypeService.getModelTypeData(carId);
return result;
}

@Operation(summary = "모델타입 상세 데이터 조회", description = "모델명과 설명, 이미지 반환하는 api")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package autoever2.cartag.controller;

import autoever2.cartag.domain.car.BoughtCarDto;
import autoever2.cartag.domain.quote.HistoryShortDto;
import autoever2.cartag.domain.quote.QuoteDataDto;
import autoever2.cartag.domain.quote.QuoteInfoDto;
import autoever2.cartag.service.CarService;
import autoever2.cartag.service.QuoteService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/quote")
@RequiredArgsConstructor
public class QuoteController {

private final CarService carService;
private final QuoteService quoteService;

@Operation(summary = "추천 견적 그래프 제공 API", description = "유사견적(최대 4개)와 판매횟수 제공")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공", content = @Content(schema = @Schema(implementation = HistoryShortDto.class)))
})
@PostMapping("/list")
public List<HistoryShortDto> getRecommendedList(@RequestBody QuoteDataDto quoteDataDto) {
List<HistoryShortDto> result = quoteService.findTopHistory(quoteDataDto);
return result;
}

@Operation(summary = "차량 구매 정보 반환 api", description = "차량 구매 정보 조회 method")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공", content = @Content(schema = @Schema(implementation = BoughtCarDto.class))),
})
@GetMapping("bought/infos")
public List<BoughtCarDto> getAllHistorySum() {
return carService.findAllBoughInfos();
}

@Operation(summary = "차량 공유하기를 위한 api", description = "차량 공유를 위한 정보 반환")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공", content = @Content(schema = @Schema(implementation = QuoteInfoDto.class))),
})
@PostMapping("/infos/shares")
public QuoteInfoDto getQuoteDetail(@Parameter(description = "선택한 id 리스트") @RequestBody QuoteDataDto idList) {
QuoteInfoDto data = carService.findShareInfoDto(idList);
return data;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class OuterColorDto {
private String colorCarImage;

@Builder
public OuterColorDto(String colorName, String colorImage, Long colorPrice, Long colorBoughtCount, String colorCarImage) {
public OuterColorDto(int colorId, String colorName, String colorImage, Long colorPrice, Long colorBoughtCount, String colorCarImage) {
this.colorId = colorId;
this.colorName = colorName;
this.colorImage = colorImage;
this.colorPrice = colorPrice;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
package autoever2.cartag.domain.option;

import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter @Setter
@NoArgsConstructor
public class QuoteSubOptionDto {
private int optionId;
private String optionName;
private Long optionPrice;
private String optionTitle;
private String optionImage;

@Builder
public QuoteSubOptionDto(int optionId, String optionName, Long optionPrice, String optionTitle, String optionImage) {
this.optionId = optionId;
this.optionName = optionName;
this.optionPrice = optionPrice;
this.optionTitle = optionTitle;
this.optionImage = optionImage;
}
}
Loading

0 comments on commit 94d9b93

Please sign in to comment.