Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COT-72] Feature: 프로필 링크 관련 테이블 추가 #209

Merged
merged 9 commits into from
Nov 28, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.cotato.csquiz.api.mypage.dto.HallOfFameResponse;
import org.cotato.csquiz.common.config.jwt.JwtTokenProvider;
import org.cotato.csquiz.domain.education.service.MyPageService;
import org.cotato.csquiz.domain.education.service.HallOfFameService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
Expand All @@ -18,14 +18,14 @@
@RequestMapping("/v1/api/mypage")
public class MyPageController {

private final MyPageService myPageService;
private final HallOfFameService hallOfFameService;
private final JwtTokenProvider jwtTokenProvider;

@GetMapping("/hall-of-fame")
public ResponseEntity<HallOfFameResponse> findHallOfFame(@RequestParam("generationId") Long generationId,
@RequestHeader("Authorization") String authorizationHeader) {
String accessToken = jwtTokenProvider.getBearer(authorizationHeader);

return ResponseEntity.ok(myPageService.findHallOfFame(generationId, jwtTokenProvider.getMemberId(accessToken)));
return ResponseEntity.ok(hallOfFameService.findHallOfFame(generationId, jwtTokenProvider.getMemberId(accessToken)));
Youthhing marked this conversation as resolved.
Show resolved Hide resolved
}
}
14 changes: 14 additions & 0 deletions src/main/java/org/cotato/csquiz/domain/auth/entity/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public class Member extends BaseTimeEntity {
@Column(name = "member_profile_image")
private S3Info profileImage;

@Column(name = "introduction")
private String introduction;
Youthhing marked this conversation as resolved.
Show resolved Hide resolved

@Column(name = "university")
private String university;

@Builder
public Member(String email, String password, String name, String phoneNumber) {
this.email = email;
Expand Down Expand Up @@ -90,4 +96,12 @@ public void updatePosition(MemberPosition position) {
public void updateProfileImage(S3Info s3Info) {
this.profileImage = s3Info;
}

public void updateIntroduction(String introduction) {
this.introduction = introduction;
}

public void updateUniversity(String university) {
this.university = university;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.cotato.csquiz.domain.auth.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.cotato.csquiz.common.entity.BaseTimeEntity;
import org.cotato.csquiz.domain.auth.enums.LinkType;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class ProfileLink extends BaseTimeEntity {

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

@Column(name = "type", nullable = false)
@Enumerated(EnumType.STRING)
private LinkType role;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id", nullable = false)
private Member member;

@Builder
public ProfileLink(LinkType role, Member member) {
this.role = role;
this.member = member;
}
Youthhing marked this conversation as resolved.
Show resolved Hide resolved
}
16 changes: 16 additions & 0 deletions src/main/java/org/cotato/csquiz/domain/auth/enums/LinkType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.cotato.csquiz.domain.auth.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum LinkType {
GITHUB("깃허브"),
BEHANCE("비핸스"),
BLOG("블로그"),
OTHER("기타"),
;

private final String description;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.cotato.csquiz.domain.auth.repository;

import org.cotato.csquiz.domain.auth.entity.ProfileLink;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ProfileLinkRepository extends JpaRepository<ProfileLink, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.cotato.csquiz.domain.auth.service;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class MemberProfileService {
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@RequiredArgsConstructor
@Transactional(readOnly = true)
@Slf4j
public class MyPageService {
public class HallOfFameService {

private static final int SHOW_PEOPLE_COUNT = 5;
private final MemberService memberService;
Expand Down
Loading