Skip to content

Commit

Permalink
add :: RecConverter 추상화 및 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
ta2ye0n committed Apr 23, 2024
1 parent 87fc65c commit ed59e38
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.mindway.server.v2.domain.rec.util;

import com.mindway.server.v2.domain.rec.entity.Rec;
import com.mindway.server.v2.domain.rec.entity.Type;
import com.mindway.server.v2.domain.rec.presentation.dto.reqest.WriteRecRequest;

public interface RecConverter {
Rec toEntity (WriteRecRequest writeRecRequest, Type type);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.mindway.server.v2.domain.rec.util.impl;

import com.mindway.server.v2.domain.rec.entity.Rec;
import com.mindway.server.v2.domain.rec.entity.Type;
import com.mindway.server.v2.domain.rec.presentation.dto.reqest.WriteRecRequest;
import com.mindway.server.v2.domain.rec.util.RecConverter;
import org.springframework.stereotype.Component;

@Component
public class RecConverterImpl implements RecConverter {

public Rec toEntity(WriteRecRequest writeRecRequest, Type type) {
return Rec.builder()
.title(writeRecRequest.getTitle())
.content(writeRecRequest.getContent())
.author(writeRecRequest.getAuthor())
.type(type)
.build();
}
}

0 comments on commit ed59e38

Please sign in to comment.