Skip to content

Commit

Permalink
Update AnnotationController.kt (cors v2)
Browse files Browse the repository at this point in the history
  • Loading branch information
otaliptus authored Dec 25, 2023
1 parent 6c840d5 commit 0b65cdf
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class AnnotationController(
private val annotationService: AnnotationService
) {
@PostMapping("parse-selector")
@CrossOrigin(origins = ["*"])
@CrossOrigin(origins = ["*", "http://localhost:3000", "http://game-lounge.com"])
fun parseSelector(@RequestBody selector: SelectorDto): ResponseEntity<String> {

return ResponseEntity.ok("test")
}
@PostMapping("/create")
@CrossOrigin(origins = ["*"])
@CrossOrigin(origins = ["*", "http://localhost:3000", "http://game-lounge.com"])
fun createAnnotation(@RequestBody annotationDto: AnnotationDto): ResponseEntity<AnnotationDto> {

val responseAnnotation = DtoConverter
Expand All @@ -30,7 +30,7 @@ class AnnotationController(
}

@GetMapping("/{id}")
@CrossOrigin(origins = ["*"])
@CrossOrigin(origins = ["*", "http://localhost:3000", "http://game-lounge.com"])
fun getAnnotation(@PathVariable id: String): ResponseEntity<AnnotationDto> {
val annotation = annotationService.getAnnotation(id) ?: return ResponseEntity(HttpStatus.NOT_FOUND)

Expand All @@ -40,15 +40,15 @@ class AnnotationController(
}

@PostMapping("/get-annotations-by-target")
@CrossOrigin(origins = ["*"])
@CrossOrigin(origins = ["*", "http://localhost:3000", "http://game-lounge.com"])
fun getAnnotationsByTarget(@RequestBody request: GetAnnotationsByTargetIdRequest): ResponseEntity<List<AnnotationDto>> {
val annotations = annotationService.getAnnotationsByTarget(request.targetId)
val responseAnnotationList = annotations.map { DtoConverter.convertAnnotationToAnnotationDto(it) }
return ResponseEntity.ok(responseAnnotationList)
}

@DeleteMapping("/{id}")
@CrossOrigin(origins = ["*"])
@CrossOrigin(origins = ["*", "http://localhost:3000", "http://game-lounge.com"])
fun deleteAnnotation(@PathVariable id: String): ResponseEntity<Void> {
return if (annotationService.deleteAnnotation(id)) {
ResponseEntity<Void>(HttpStatus.NO_CONTENT)
Expand Down

0 comments on commit 0b65cdf

Please sign in to comment.