GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
yhornisse
/
bremer
Browse code
fix controller
master
1 parent
62024e4
commit
31922bab6719371e5707d7cd3aa314d285afa576
yhornisse
authored
on 23 Aug 2023
Patch
Showing
1 changed file
src/main/kotlin/controller/api/TagApiController.kt
Ignore Space
Show notes
View
src/main/kotlin/controller/api/TagApiController.kt
/* * Copyright (c) 2023. yo-saito. All Rights Reserved. */ package net.piedpiper.bremer.controller.api import jakarta.validation.Valid import net.piedpiper.bremer.model.api.TagAudioRequest import net.piedpiper.bremer.model.api.TagAudioResponse import net.piedpiper.bremer.model.api.TagRequest import net.piedpiper.bremer.model.api.AllTagsResponse import net.piedpiper.bremer.service.TagService import org.springframework.beans.factory.annotation.Qualifier import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.* @RestController("bremer.controller.TagApiController") @RequestMapping("bremer/api/tag") class TagApiController( @Qualifier("bremer.service.TagService") private val tagService: TagService ) { @GetMapping fun getAllTags(): ResponseEntity<AllTagsResponse> = ResponseEntity.ok(tagService.getAllTags()) @PostMapping fun createTag(@Valid @RequestBody request: TagRequest): ResponseEntity<Void> { tagService.createTag(request) return ResponseEntity.ok(null) } @GetMapping("{slug}") fun getAudioList(@PathVariable("slug") slug: String): ResponseEntity<TagAudioResponse> = ResponseEntity.ok(tagService.getAudioListByTagSlug(slug)) @PutMapping("{slug}") fun updateTag( @PathVariable("slug") slug: String, @Valid @RequestBody request: TagRequest ): ResponseEntity<Void> { tagService.updateTag(slug, request) return ResponseEntity.ok(null) } @PostMapping("audio/{slug}") fun addAudioList( @PathVariable("slug") slug: String, @Valid @RequestBody request: TagAudioRequest ): ResponseEntity<Void> { tagService.addTagToAudioList(slug, request) return ResponseEntity.ok(null) } @DeleteMapping("audio/{slug}") fun deleteAudioList( @PathVariable("slug") slug: String, @Valid @RequestBody request: TagAudioRequest ): ResponseEntity<Void> { tagService.deleteTagFromAudioList(slug, request) return ResponseEntity.ok(null) } }
/* * Copyright (c) 2023. yo-saito. All Rights Reserved. */ package net.piedpiper.bremer.controller.api import jakarta.validation.Valid import net.piedpiper.bremer.model.api.TagAudioRequest import net.piedpiper.bremer.model.api.TagAudioResponse import net.piedpiper.bremer.model.api.TagRequest import net.piedpiper.bremer.model.api.AllTagsResponse import net.piedpiper.bremer.service.TagService import org.springframework.beans.factory.annotation.Qualifier import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.* @RestController("bremer.controller.TagApiController") @RequestMapping("bremer/api/tag") class TagApiController( @Qualifier("bremer.service.TagService") private val tagService: TagService ) { @GetMapping fun getAllTags(): ResponseEntity<AllTagsResponse> = ResponseEntity.ok(tagService.getAllTags()) @PostMapping fun createTag(@Valid @RequestBody request: TagRequest): ResponseEntity<Void> { tagService.createTag(request) return ResponseEntity.ok(null) } @GetMapping("{slug}") fun getAudioList(@PathVariable("slug") slug: String): ResponseEntity<TagAudioResponse> = ResponseEntity.ok(tagService.getAudioListByTagSlug(slug)) @PostMapping("{slug}") fun updateTag( @PathVariable("slug") slug: String, @Valid @RequestBody request: TagRequest ): ResponseEntity<Void> { tagService.updateTag(slug, request) return ResponseEntity.ok(null) } @PutMapping("audio/{slug}") fun addAudioList( @PathVariable("slug") slug: String, @Valid @RequestBody request: TagAudioRequest ): ResponseEntity<Void> { tagService.addTagToAudioList(slug, request) return ResponseEntity.ok(null) } @DeleteMapping("audio/{slug}") fun deleteAudioList( @PathVariable("slug") slug: String, @Valid @RequestBody request: TagAudioRequest ): ResponseEntity<Void> { tagService.deleteTagFromAudioList(slug, request) return ResponseEntity.ok(null) } }
Show line notes below