Skip to content

Commit

Permalink
#87 fix: apply 대체키 수정
Browse files Browse the repository at this point in the history
id -> Long 타입
token -> String 타입
  • Loading branch information
rivkode committed Jun 10, 2024
1 parent 8390ca8 commit e3a0d4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/main/java/com/seoultech/synergybe/domain/apply/Apply.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
public class Apply {
@Id
@Column(name = "apply_id")
private String id;
private Long id;

private String applyToken;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
Expand All @@ -40,8 +42,9 @@ public class Apply {
private IsDeleted isDeleted = new IsDeleted(IS_DELETED_DEFAULT);

@Builder
public Apply(String id, User user, Project project) {
public Apply(Long id, String applyToken, User user, Project project) {
this.id = id;
this.applyToken = applyToken;
this.user = user;
this.project = project;
this.status = ApplyStatus.NEW;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import com.seoultech.synergybe.domain.apply.exception.ApplyBadRequestException;
import com.seoultech.synergybe.domain.apply.exception.ApplyNotFoundException;
import com.seoultech.synergybe.domain.apply.repository.ApplyRepository;
import com.seoultech.synergybe.domain.common.idgenerator.IdGenerator;
import com.seoultech.synergybe.domain.common.idgenerator.IdPrefix;
import com.seoultech.synergybe.domain.notification.NotificationType;
import com.seoultech.synergybe.domain.common.generator.IdGenerator;
import com.seoultech.synergybe.domain.common.generator.IdPrefix;
import com.seoultech.synergybe.domain.common.generator.TokenGenerator;
import com.seoultech.synergybe.domain.notification.service.NotificationService;
import com.seoultech.synergybe.domain.project.Project;
import com.seoultech.synergybe.domain.project.service.ProjectService;
Expand All @@ -33,12 +33,14 @@ public class ApplyService {
private final UserService userService;
private final NotificationService notificationService;
private final IdGenerator idGenerator;
private final TokenGenerator tokenGenerator;

@Transactional
public GetApplyResponse createApply(String userId, String projectId) {
Project project = projectService.findProjectById(projectId);
User user = userService.getUser(userId);
String applyId = idGenerator.generateId(IdPrefix.APPLY);
Long applyId = idGenerator.generateId();
String applyToken = tokenGenerator.generateToken(IdPrefix.APPLY);

Apply apply = Apply.builder()
.id(applyId).user(user).project(project)
Expand Down

0 comments on commit e3a0d4d

Please sign in to comment.