-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] menu api 구현 및 테스트 작성 (#31)
- Loading branch information
Showing
8 changed files
with
278 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/main/kotlin/com/mjucow/eatda/domain/store/service/command/dto/MenuCreateCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/main/kotlin/com/mjucow/eatda/domain/store/service/command/dto/MenuUpdateCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/kotlin/com/mjucow/eatda/presentation/store/menu/MenuController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.mjucow.eatda.presentation.store.menu | ||
|
||
import com.mjucow.eatda.domain.store.service.command.MenuCommandService | ||
import com.mjucow.eatda.domain.store.service.command.dto.MenuUpdateCommand | ||
import com.mjucow.eatda.domain.store.service.query.MenuDto | ||
import com.mjucow.eatda.domain.store.service.query.MenuQueryService | ||
import com.mjucow.eatda.presentation.common.ApiResponse | ||
import org.springframework.http.HttpStatus | ||
import org.springframework.web.bind.annotation.DeleteMapping | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PatchMapping | ||
import org.springframework.web.bind.annotation.PathVariable | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.ResponseStatus | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/menu") | ||
class MenuController( | ||
private val queryService: MenuQueryService, | ||
private val commandService: MenuCommandService, | ||
) { | ||
@GetMapping("/{menuId}") | ||
@ResponseStatus(HttpStatus.OK) | ||
fun findById(@PathVariable("menuId") id: Long): ApiResponse<MenuDto> { | ||
return ApiResponse.success(queryService.findById(id)) | ||
} | ||
|
||
@PatchMapping("/{menuId}") | ||
@ResponseStatus(HttpStatus.OK) | ||
fun updateById(@PathVariable("menuId") id: Long, @RequestBody command: MenuUpdateCommand) { | ||
commandService.update(id, command) | ||
} | ||
|
||
@DeleteMapping("/{menuId}") | ||
@ResponseStatus(HttpStatus.NO_CONTENT) | ||
fun deleteById(@PathVariable("menuId") id: Long) { | ||
commandService.delete(id) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.