[ADD] Allocation, CourseのModelを追加しました。
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
package com.example.demo.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AllocationModel {
|
||||||
|
|
||||||
|
private Long categoryId;
|
||||||
|
private Long courseId;
|
||||||
|
private Integer allocationRatio;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.example.demo.app.domain.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.demo.app.infra.entity.CourseEntity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CourseModel {
|
||||||
|
|
||||||
|
private Long courseId;
|
||||||
|
private String courseName;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public static CourseModel convertFrom(CourseEntity courseEntity) {
|
||||||
|
return new CourseModel(
|
||||||
|
courseEntity.getCourseId(),
|
||||||
|
courseEntity.getCourseName(),
|
||||||
|
courseEntity.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<CourseModel> convertFrom(List<CourseEntity> courseEntityList) {
|
||||||
|
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user