Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

닉네임 특수문자 해결 #85

Merged
merged 4 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import com.toyProject7.karrot.manner.service.MannerService
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController

@RestController
class MannerController(
private val mannerService: MannerService,
) {
@PutMapping("/api/profile/{nickname}/praise/{mannerType}")
@PutMapping("/api/profile/praise/{mannerType}")
fun increaseMannerCount(
@PathVariable nickname: String,
@RequestParam nickname: String,
@PathVariable mannerType: MannerType,
): ResponseEntity<String> {
mannerService.increaseMannerCount(nickname, mannerType)
return ResponseEntity.noContent().build()
}
// PUT /api/profile/praise/{mannerType}?nickname=hello%2Fworld
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.toyProject7.karrot.user.AuthUser
import com.toyProject7.karrot.user.controller.User
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestParam
Expand All @@ -33,22 +32,24 @@ class ProfileController(
return ResponseEntity.ok(profile)
}

@GetMapping("/api/profile/{nickname}")
@GetMapping("/api/profile")
fun getProfile(
@PathVariable nickname: String,
@RequestParam nickname: String,
): ResponseEntity<ProfileResponse> {
val profile = profileService.getProfile(nickname)
return ResponseEntity.ok(profile)
}
// GET /api/profile?nickname=hello%2Fworld

@GetMapping("/api/profile/{nickname}/sells")
@GetMapping("/api/profile/sells")
fun getProfileSells(
@PathVariable nickname: String,
@RequestParam nickname: String,
@RequestParam articleId: Long,
): ResponseEntity<List<Item>> {
val itemList: List<Item> = profileService.getProfileSells(nickname, articleId)
return ResponseEntity.ok(itemList)
}
// GET /api/profile/sells?nickname=hello%2Fworld&articleId=123

@PutMapping("/api/mypage/profile/edit")
fun editProfile(
Expand All @@ -59,23 +60,25 @@ class ProfileController(
return ResponseEntity.ok(profile)
}

@GetMapping("/api/profile/{nickname}/manners")
@GetMapping("/api/profile/manners")
fun getManners(
@PathVariable nickname: String,
@RequestParam nickname: String,
@AuthUser user: User,
): ResponseEntity<MannersResponse> {
val manners = profileService.getManner(user, nickname)
return ResponseEntity.ok(manners)
}
// GET /api/profile/manners?nickname=hello%2Fworld

@GetMapping("/api/profile/{nickname}/reviews")
@GetMapping("/api/profile/reviews")
fun getReviews(
@PathVariable nickname: String,
@RequestParam("reviewId") reviewId: Long,
@RequestParam nickname: String,
@RequestParam reviewId: Long,
): ResponseEntity<ReviewsResponse> {
val reviews = profileService.getPreviousReviews(nickname, reviewId)
return ResponseEntity.ok(reviews)
}
// GET /api/profile/reviews?nickname=hello%2Fworld&reviewId=123
}

typealias ProfileResponse = Profile
Expand Down