Skip to content

Commit

Permalink
getTagSummaries API를 컨트롤러에 등록한다
Browse files Browse the repository at this point in the history
  • Loading branch information
anjeongkyun committed Nov 14, 2023
1 parent b134fc5 commit ba85c15
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion api/src/main/kotlin/org/tagwonder/controllers/TagController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ import org.tagwonder.commands.CreateTagsCommand
import org.tagwonder.exceptions.InvalidCommandException
import org.tagwonder.exceptions.toHttpException
import org.tagwonder.jwt.AuthTokenGenerator
import org.tagwonder.queries.GetTagSummariesQuery
import org.tagwonder.queries.GetTagSummariesQueryResponse
import org.tagwonder.queries.GetTagsQuery
import org.tagwonder.queries.GetTagsQueryResponse
import org.tagwonder.usecases.commands.CreateTagsCommandExecutor
import org.tagwonder.usecases.queries.GetTagSummariesQueryProcessor
import org.tagwonder.usecases.queries.GetTagsQueryProcessor

@RestController
class TagController(
private val createTagsCommandExecutor: CreateTagsCommandExecutor,
private val getTagsQueryProcessor: GetTagsQueryProcessor,
private val getTagSummariesQueryProcessor: GetTagSummariesQueryProcessor,
private val authTokenGenerator: AuthTokenGenerator
) {

Expand All @@ -30,7 +34,8 @@ class TagController(
createTagsCommandExecutor.execute(
CreateTagsCommand(
memberId = authTokenGenerator.extractMemberId(authToken),
titles = command.titles
titles = command.titles,
writer = command.writer
)
)
} catch (e: InvalidCommandException) {
Expand All @@ -49,4 +54,16 @@ class TagController(
)
)
}

@Operation(summary = "태그 결과 조회")
@GetMapping("/tag-summaries")
fun getTagSummaries(
@RequestHeader(value = "Authorization", required = true) authToken: String
): GetTagSummariesQueryResponse {
return getTagSummariesQueryProcessor.process(
GetTagSummariesQuery(
memberId = authTokenGenerator.extractMemberId(authToken)
)
)
}
}

0 comments on commit ba85c15

Please sign in to comment.