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

[FEAT] 최초 접근 기능 구현 #248

Merged
merged 5 commits into from
Apr 16, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ ResponseEntity<Void> setLink(@PathVariable("id") Long postId, @Valid @RequestBod
@Operation(summary = "신청 관리 정보 조회 API")
ResponseEntity<GetApplicantInfoResponseDto> getApplyInfo(@PathVariable("id") Long postId, @AuthUser User user);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "방문 처리 성"),
}
)
@Operation(summary = "최초 접근 후 호출 API")
ResponseEntity<Void> processFirstAccess(@PathVariable("id") Long postId, @AuthUser User user);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "신청자 승인 성공"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import synk.meeteam.domain.recruitment.recruitment_role.entity.RecruitmentRole;
import synk.meeteam.domain.recruitment.recruitment_role.service.RecruitmentRoleService;
import synk.meeteam.domain.user.user.entity.User;
import synk.meeteam.domain.user.user.service.UserService;
import synk.meeteam.security.AuthUser;

@RestController
Expand All @@ -39,6 +40,8 @@ public class RecruitmentApplicantController implements RecruitmentApplicantApi {
private final RecruitmentPostService recruitmentPostService;
private final RecruitmentRoleService recruitmentRoleService;

private final UserService userService;

@PutMapping("/{id}/link")
@Override
public ResponseEntity<Void> setLink(@PathVariable("id") Long postId,
Expand Down Expand Up @@ -68,7 +71,16 @@ public ResponseEntity<GetApplicantInfoResponseDto> getApplyInfo(@PathVariable("i

return ResponseEntity.ok()
.body(new GetApplicantInfoResponseDto(recruitmentPost.getTitle(), recruitmentPost.getKakaoLink(),
roleStatusResponseDtos, roleDtos));
user.isFirstApplicantAccess(),roleStatusResponseDtos,
roleDtos));
}

@PatchMapping("/{id}/access")
@Override
public ResponseEntity<Void> processFirstAccess(@PathVariable("id") Long postId, @AuthUser User user) {
userService.processFirstAccess(user);

return ResponseEntity.ok().build();
}

@PatchMapping("/{id}/approve")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public record GetApplicantInfoResponseDto(
String title,
@Schema(description = "오픈카톡방 링크", example = "https://open.kakao.com/o/gLmqdijg")
String link,
@Schema(description = "처음 접속 여부", example = "true")
boolean isFirstAccess,
List<GetRecruitmentRoleStatusResponseDto> recruitmentStatus,
List<GetRoleDto> roles
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ public class RecruitmentPost extends BaseEntity {
public RecruitmentPost(String title, String content, Scope scope, Category category, Field field,
ProceedType proceedType, LocalDate proceedingStart, LocalDate proceedingEnd,
LocalDate deadline,
long bookmarkCount, String kakaoLink, boolean isClosed, Meeteam meeteam) {
long bookmarkCount, String kakaoLink, boolean isClosed, Meeteam meeteam,
Course course, Professor professor) {
mikekks marked this conversation as resolved.
Show resolved Hide resolved
this.title = title;
this.content = content;
this.scope = scope;
Expand All @@ -139,6 +140,8 @@ public RecruitmentPost(String title, String content, Scope scope, Category categ
this.kakaoLink = kakaoLink;
this.isClosed = isClosed;
this.meeteam = meeteam;
this.course = course;
this.professor = professor;
}

public double getResponseRate() {
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/synk/meeteam/domain/user/user/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ public class User extends BaseTimeEntity {
@ColumnDefault("0")
private long scoreProfessionalism = 0;

@ColumnDefault("0")
private boolean isFirstProfileAccess = false;
@ColumnDefault("1")
private boolean isFirstProfileAccess = true;

@ColumnDefault("0")
private boolean isFirstApplicantAccess = false;
@ColumnDefault("1")
private boolean isFirstApplicantAccess = true;

public User(String platformId) {
this.platformId = platformId;
Expand Down Expand Up @@ -253,4 +253,8 @@ public void updateNickname(String nickname) {
public boolean isNotEqualNickname(String nickname) {
return !this.nickname.equals(nickname);
}

public void processFirstAccess(){
this.isFirstApplicantAccess = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ public interface UserService {
User findById(Long userId);

User findByEncryptedId(String encryptedId);

void processFirstAccess(User user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@ public User findByEncryptedId(String encryptedId) {
}
return userRepository.findByIdFetchRole(userId);
}

@Transactional
public void processFirstAccess(User user) {
user.processFirstAccess();
userRepository.save(user);
}
}
Loading