Skip to content

Commit

Permalink
fix : develop 충돌 수정 후 다시 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dayon-Hong committed Nov 24, 2023
1 parent e887dad commit 596feb5
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.class
.env
.idea/
.gradle/

# Log file
*.log
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'org.springframework.boot' version '2.7.9'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
id 'net.ltgt.apt' version '0.21'
// id 'net.ltgt.apt' version '0.21'
}

group = 'com.teamjo'
Expand Down
45 changes: 23 additions & 22 deletions github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@ name: techeer-market

on:
push:
-develop
workflow_dispath:
branches:
- develop
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
-name: Checkout
uses: actions/checkout@c2
- name: Checkout
uses: actions/checkout@v2

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

-name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash

-name: Build with Gradle
run: ./gradlew clean build
shell: bash
- name: Build with Gradle
run: ./gradlew clean build
shell: bash

-name: Get build time
usees: 1466587594/get-current-time@v2
- name: Get build time
id: current-time
uses: 1466587594/get-current-time@v2
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00"
format: 'YYYY-MM-DDTHH-mm-ss'
utcOffset: '+09:00'

-name: Show Current Time
run: echo "CurrentTime = ${{steps.current-time.outputs.formattedTime}}"
shell: bash
- name: Show Current Time
run: echo "CurrentTime = ${{ steps.current-time.outputs.formattedTime }}"
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-11-01T22:09:42+0900",
date = "2023-11-24T18:06:05+0900",
comments = "version: 1.5.3.Final, compiler: javac, environment: Java 11.0.15 (Oracle Corporation)"
)
@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ public interface UserLikeRepository extends JpaRepository<UserLike, Long> {
boolean existsByUsersAndProducts(Users users, Products products);

Optional<UserLike> findByUsersAndProducts(Users users, Products products);

// int countByProduct(Products products);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
package com.teamjo.techeermarket.domain.mypage.service;

import com.teamjo.techeermarket.domain.mypage.repository.UserLikeRepository;
import com.teamjo.techeermarket.domain.products.entity.Products;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

//@Service
//@RequiredArgsConstructor
@Service
@RequiredArgsConstructor
public class MyPageService {

private final UserLikeRepository userLikeRepository;

/*
// 게시물 좋아요 수 계산하기
*/
// @Transactional(readOnly = true)
// 상품에 대한 좋아요 개수 조회
// public int getLikesCountByProduct(Products product) {
// return userLikeRepository.countByProduct(product);
// }



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.teamjo.techeermarket.domain.products.mapper.ProductMapper;
import com.teamjo.techeermarket.domain.products.service.CategoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.teamjo.techeermarket.domain.products.dto.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.*;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Setter
// 게시물 목차로 보여지는 리스트
public class ProductPreViewDto {

Expand All @@ -24,10 +22,8 @@ public class ProductPreViewDto {

private String createdAt ;

// private int likes ; // 좋아요수
private int likes ; // 좋아요수

private int views; // 뷰 수



}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ public ProductPreViewDto fromListEntity(Products product){
.build();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class CategoryService {
public List<ProductPreViewDto> getCategoryList (Long categoryId, int pageNo, int pageSize) {
Categorys category = categoryRepository.findCategorysById(categoryId);
if (category == null) {
throw new CategoryNotFoundException();
throw new CategoryNotFoundException(); // 카테고리 확인
}
Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("id").descending()); // 1페이지부터 시작하도록
Page<Products> productPage = productRepository.findByCategorys(category,pageable);
Expand All @@ -47,6 +47,15 @@ public List<ProductPreViewDto> getCategoryList (Long categoryId, int pageNo, int
.collect(Collectors.toList());
}


/*
return productPage.stream()
.map(product -> {
ProductPreViewDto productPreViewDto = productMapper.fromListEntity(product);
productPreViewDto.setLikes(userLikeService.getLikesCountByProduct(product));
return productPreViewDto;
})
.collect(Collectors.toList());
}
*/

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.teamjo.techeermarket.domain.images.entity.ProductImage;
import com.teamjo.techeermarket.domain.images.repository.ProductImageRepository;
import com.teamjo.techeermarket.domain.images.service.ProductImageService;
import com.teamjo.techeermarket.domain.products.dto.request.ProductRequestDto;
import com.teamjo.techeermarket.domain.products.entity.Categorys;
import com.teamjo.techeermarket.domain.products.entity.ProductState;
Expand Down Expand Up @@ -30,7 +29,6 @@
public class ProductService {

private final ProductRepository productRepository;
private final ProductImageService productImageService;
@Autowired
private final UserRepository userRepository;
@Autowired
Expand Down Expand Up @@ -97,7 +95,9 @@ public Long saveProduct(ProductRequestDto request, String email) throws IOExcept



// 게시물 전체 조회
/*
// 상품 게시물 전체 조회
*/



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ public void likeProduct(String email, Long productId) {
Products products = productRepository.findById(productId)
.orElseThrow(ProductNotFoundException::new);

/*
아래 조건 추가 하도록 수정
//addGoodPoint는 좋아요를 추가하는 메소드로써 이미 좋아요가 되어있는 글이라면 예외처리된다.
//deleteGoodPoint는 좋아요를 철회하는 메소드로써 좋아요된 이력이 없다면 예외처리된다.
// 커스텀 익셉션은 추후에 추가하기로하고 임시방편으로 런타임 익셉션을 사용하도록 하였다.
*/

// 사용자가 해당 상품에 이미 좋아요를 누른 적이 없으면
if (!userLikeRepository.existsByUsersAndProducts(users, products)) {
// 좋아요 정보를 생성하여 저장
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ public ErrorResponse(ErrorCode code){
this.code = code.getCode();
}


}
4 changes: 0 additions & 4 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@
hibernate:
format_sql: true



servlet:
multipart:
max-file-size: 1000MB
max-request-size: 1000MB



jwt.secret : kJlkhRU-b-p3nwYgbeNpgVii1rssccUKOP4yaUjeHbM

logging:
Expand Down

0 comments on commit 596feb5

Please sign in to comment.