Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/org/atdev/artrip/domain/Enum/CurationType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.atdev.artrip.domain.Enum;

public enum CurationType {
ALL,
COUNTRY,
REGION
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public JwtToken generateToken(User user, Role roles) {
.compact();

String refreshToken = Jwts.builder()
.setExpiration(new Date(now + refreshTokenExpirationMillis))//7일 만료
// .setExpiration(new Date(now + refreshTokenExpirationMillis))//7일 만료
.setExpiration(new Date(now + 1000 * 60 * 30))
.setIssuedAt(Calendar.getInstance().getTime())
.signWith(key, SignatureAlgorithm.HS256)
.compact();
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/org/atdev/artrip/domain/auth/jwt/JwtProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.extern.slf4j.Slf4j;
import org.atdev.artrip.domain.auth.jwt.exception.JwtAuthenticationException;
import org.atdev.artrip.global.apipayload.code.status.UserError;
import org.atdev.artrip.global.apipayload.exception.GeneralException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
Expand Down Expand Up @@ -58,16 +59,16 @@ public boolean validateToken(String token) {
return true;
} catch (SecurityException | MalformedJwtException e) {
log.warn("Invalid JWT Token", e);
throw new JwtAuthenticationException(UserError._JWT_INVALID_SIGNATURE);
throw new GeneralException(UserError._JWT_INVALID_SIGNATURE);
} catch (ExpiredJwtException e) {
log.warn("Expired JWT Token", e);
throw new JwtAuthenticationException(UserError._JWT_EXPIRED_ACCESS_TOKEN);
throw new GeneralException(UserError._JWT_EXPIRED_ACCESS_TOKEN);
} catch (UnsupportedJwtException e) {
log.warn("Unsupported JWT Token", e);
throw new JwtAuthenticationException(UserError._JWT_UNSUPPORTED_TOKEN);
throw new GeneralException(UserError._JWT_UNSUPPORTED_TOKEN);
} catch (IllegalArgumentException e) {
log.warn("JWT claims string is empty.", e);
throw new JwtAuthenticationException(UserError._JWT_INVALID_TOKEN);
throw new GeneralException(UserError._JWT_INVALID_TOKEN);
}
// return false;
}
Expand All @@ -79,10 +80,10 @@ public void validateRefreshToken(String refreshToken) {
.parseClaimsJws(refreshToken);
} catch (ExpiredJwtException e) {
log.warn("Expired Refresh Token", e);
throw new JwtAuthenticationException(UserError._JWT_EXPIRED_REFRESH_TOKEN);
throw new GeneralException(UserError._JWT_EXPIRED_REFRESH_TOKEN);
} catch (JwtException e) {
log.warn("Invalid Refresh Token", e);
throw new JwtAuthenticationException(UserError._INVALID_REFRESH_TOKEN);
throw new GeneralException(UserError._INVALID_REFRESH_TOKEN);
}
}
private Claims parseClaims(String accessToken) {
Expand Down
44 changes: 44 additions & 0 deletions src/main/java/org/atdev/artrip/domain/curation/data/Curation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.atdev.artrip.domain.curation.data;

import jakarta.persistence.*;
import lombok.*;
import org.atdev.artrip.domain.Enum.CurationType;
import org.atdev.artrip.domain.exhibit.data.Exhibit;
import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "curation")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Curation {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "curation_id")
private Long curationId;

@Column(name = "title",nullable = false)
private String title;

@Column(name = "sub_description")
private String subDescription;

@Enumerated(EnumType.STRING)
@Column(name = "curation_type", nullable = false)
private CurationType curationType;

@Column(name = "is_active")
private boolean isActive = true;

@ManyToMany
@JoinTable(
name = "curation_exhibit",
joinColumns = @JoinColumn(name = "curation_id"),
inverseJoinColumns = @JoinColumn(name = "exhibit_id")
)
private List<Exhibit> exhibits = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.atdev.artrip.domain.curation.repository;

import org.atdev.artrip.domain.curation.data.Curation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface CurationRepository extends JpaRepository<Curation, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.atdev.artrip.domain.curation.service;

import org.springframework.stereotype.Service;

@Service
public class CurationService {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.atdev.artrip.domain.curation.web.controller;

import org.springframework.stereotype.Controller;

@Controller
public class CurationController {
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,12 @@ public ResponseEntity<CommonResponse<List<String>>> getOverseas(){
return ResponseEntity.ok(CommonResponse.onSuccess(OverseasList));
}

// @Operation(summary = "국내 지역 목록 조회")
// @ApiErrorResponses(
// common = {CommonError._BAD_REQUEST, CommonError._UNAUTHORIZED}
// )
// @GetMapping("/domestic")
// public ResponseEntity<CommonResponse<List<String>>> getDomestic(){
//
// List<String> domesticList = homeService.getDomestic();
//
// return ResponseEntity.ok(CommonResponse.onSuccess(domesticList));
// }

@Operation(summary = "국내 지역 목록 조회")//하드코딩
@ApiErrorResponses(
common = {CommonError._BAD_REQUEST, CommonError._UNAUTHORIZED}
)
@GetMapping("/domestic")
public ResponseEntity<CommonResponse<List<RegionResponse>>> getDomestic2(){
public ResponseEntity<CommonResponse<List<RegionResponse>>> getDomestic(){

List<RegionResponse> response = homeService.getRegions();

Expand Down
Loading