Skip to content

Commit

Permalink
Merge pull request #72 from Kusitms-29th-ASAP/hotfix/isAssinged
Browse files Browse the repository at this point in the history
 isAssigned 할당
  • Loading branch information
sominyun authored May 18, 2024
2 parents b077460 + 3b41ad9 commit 7034f3f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class ClassroomService(
child = student,
description = it.description,
type = it.todoType,
deadline = it.deadline
deadline = it.deadline,
isAssigned = true
)
}
}.toSet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class TodoService(
type = request.todoType,
description = request.description,
child = child,
deadline = request.deadline
deadline = request.deadline,
isAssigned = false
)
todoAppender.appendTodo(todo)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class GetTodo {
val description: String,
val todoType: TodoType,
val deadline: LocalDate,
val status: Status
val status: Status,
val isAssigned:Boolean
)

fun toTodoInfo(todos: List<Todo>): List<TodoInfo> {
Expand All @@ -25,7 +26,8 @@ class GetTodo {
description = it.description,
todoType = it.type,
deadline = it.deadline,
status = it.status
status = it.status,
isAssigned = it.isAssigned
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Todo (
type: TodoType,
description: String,
child: Child,
deadline: LocalDate
deadline: LocalDate,
isAssigned: Boolean
):BaseDateEntity(){

init {
Expand All @@ -32,6 +33,8 @@ class Todo (

val deadline : LocalDate = deadline

val isAssigned : Boolean = isAssigned

@Enumerated(EnumType.STRING)
@Column(
nullable = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ class TodoJdbcRepository(
) {
fun insertBatch(todos: Set<Todo>) {
val sql = """
insert into todo (created_at, updated_at, deadline, description, status, type, child_id)
values (now(), now(), ?, ?, ?, ?, ?)
insert into todo (created_at, updated_at, deadline, description, status, type, child_id,is_assigned)
values (now(), now(), ?, ?, ?, ?, ?,?)
""".trimIndent()
jdbcTemplate.batchUpdate(sql, todos, todos.size){ ps : PreparedStatement, todo: Todo ->
ps.setObject(1, todo.deadline)
ps.setObject(2, todo.description)
ps.setObject(3, todo.status.name)
ps.setObject(4, todo.type.name)
ps.setLong(5, todo.child.id)
ps.setObject(6,todo.isAssigned)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class TodoControllerTest : AbstractRestDocsConfigurer() {
val deadline = LocalDate.parse("2024-05-23")
val getTodo: GetTodo.Response = generateFixture {
it.setExp(GetTodo.Response::todoList, listOf(
GetTodo.TodoInfo(1,"체육복 챙기기",TodoType.SUPPLY,LocalDate.parse("2024-05-28"),Status.COMPLETE),
GetTodo.TodoInfo(2,"수학학원 숙제",TodoType.HOMEWORK,LocalDate.parse("2024-05-31"),Status.INCOMPLETE)
GetTodo.TodoInfo(1,"체육복 챙기기",TodoType.SUPPLY,LocalDate.parse("2024-05-28"),Status.COMPLETE, true),
GetTodo.TodoInfo(2,"수학학원 숙제",TodoType.HOMEWORK,LocalDate.parse("2024-05-31"),Status.INCOMPLETE,false)
))
}

Expand All @@ -98,7 +98,8 @@ class TodoControllerTest : AbstractRestDocsConfigurer() {
fieldWithPath("todoList[].description").description("할 일"),
fieldWithPath("todoList[].todoType").description("유형"),
fieldWithPath("todoList[].deadline").description("마감일"),
fieldWithPath("todoList[].status").description("상태")
fieldWithPath("todoList[].status").description("상태"),
fieldWithPath("todoList[].isAssigned").description("할당 여부(선생님:true,학부모:false)")
)
)
)
Expand Down

0 comments on commit 7034f3f

Please sign in to comment.