Skip to content

Commit

Permalink
add :: GoalConverter 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Umjiseung committed Apr 13, 2024
1 parent 1d02bcf commit 23498d3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.mindway.server.v2.domain.goal.util;

import com.mindway.server.v2.domain.goal.entity.Goal;
import com.mindway.server.v2.domain.user.entity.User;

import java.time.LocalDate;

public interface GoalConverter {
Goal toEntity(User user, String created_at, String ended_at, Long goal_count);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mindway.server.v2.domain.goal.util.impl;

import com.mindway.server.v2.domain.goal.entity.Goal;
import com.mindway.server.v2.domain.goal.util.GoalConverter;
import com.mindway.server.v2.domain.user.entity.User;
import org.springframework.stereotype.Component;

import java.time.LocalDate;

@Component
public class GoalConverterImpl implements GoalConverter {

public Goal toEntity(User user, String created_at, String ended_at, Long goal_count) {
return Goal.builder()
.started_at(LocalDate.parse(created_at))
.ended_at(LocalDate.parse(ended_at))
.goal_count(goal_count)
.user(user)
.build();
}
}

0 comments on commit 23498d3

Please sign in to comment.