-
Notifications
You must be signed in to change notification settings - Fork 0
Feature : 서비스 런칭을 위한 서비스 추가 #11
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
Changes from all commits
e7dc7b1
f2a0326
c1da9dd
b7a683d
055f2e0
5eaaa99
4e83965
327fa2c
f2d8a32
8aa4c24
0cb7930
0986638
105857f
c82bd41
e29a9fb
c280132
d4048d4
e6ea4a2
9ad211b
41cdc92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,6 +3,8 @@ | |||||||||||||||||||||||||||||||||||||||
using ProjectVG.Application.Models.Character; | ||||||||||||||||||||||||||||||||||||||||
using ProjectVG.Api.Models.Character.Request; | ||||||||||||||||||||||||||||||||||||||||
using ProjectVG.Api.Models.Character.Response; | ||||||||||||||||||||||||||||||||||||||||
using ProjectVG.Api.Filters; | ||||||||||||||||||||||||||||||||||||||||
using System.Security.Claims; | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
namespace ProjectVG.Api.Controllers | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
|
@@ -19,6 +21,16 @@ public CharacterController(ICharacterService characterService, ILogger<Character | |||||||||||||||||||||||||||||||||||||||
_logger = logger; | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
private Guid? GetCurrentUserId() | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
var userIdClaim = User.FindFirst("user_id")?.Value; | ||||||||||||||||||||||||||||||||||||||||
if (Guid.TryParse(userIdClaim, out var userId)) | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
return userId; | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
return null; | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
[HttpGet] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<IEnumerable<CharacterResponse>>> GetAllCharacters() | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
|
@@ -35,20 +47,42 @@ public async Task<ActionResult<CharacterResponse>> GetCharacterById(Guid id) | |||||||||||||||||||||||||||||||||||||||
return Ok(response); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
[HttpPost] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<CharacterResponse>> CreateCharacter([FromBody] CreateCharacterRequest request) | ||||||||||||||||||||||||||||||||||||||||
[HttpPost("individual")] | ||||||||||||||||||||||||||||||||||||||||
[JwtAuthentication] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<CharacterResponse>> CreateCharacterWithFields([FromBody] CreateCharacterWithFieldsRequest request) | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
var userId = GetCurrentUserId(); | ||||||||||||||||||||||||||||||||||||||||
var command = request.ToCommand(userId); | ||||||||||||||||||||||||||||||||||||||||
var characterDto = await _characterService.CreateCharacterWithFieldsAsync(command); | ||||||||||||||||||||||||||||||||||||||||
var response = CharacterResponse.ToResponseDto(characterDto); | ||||||||||||||||||||||||||||||||||||||||
return CreatedAtAction(nameof(GetCharacterById), new { id = response.Id }, response); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
[HttpPost("systemprompt")] | ||||||||||||||||||||||||||||||||||||||||
[JwtAuthentication] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<CharacterResponse>> CreateCharacterWithSystemPrompt([FromBody] CreateCharacterWithSystemPromptRequest request) | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
var command = request.ToCreateCharacterCommand(); | ||||||||||||||||||||||||||||||||||||||||
var characterDto = await _characterService.CreateCharacterAsync(command); | ||||||||||||||||||||||||||||||||||||||||
var userId = GetCurrentUserId(); | ||||||||||||||||||||||||||||||||||||||||
var command = request.ToCommand(userId); | ||||||||||||||||||||||||||||||||||||||||
var characterDto = await _characterService.CreateCharacterWithSystemPromptAsync(command); | ||||||||||||||||||||||||||||||||||||||||
var response = CharacterResponse.ToResponseDto(characterDto); | ||||||||||||||||||||||||||||||||||||||||
return CreatedAtAction(nameof(GetCharacterById), new { id = response.Id }, response); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
[HttpPut("{id}")] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<CharacterResponse>> UpdateCharacter(Guid id, [FromBody] UpdateCharacterRequest request) | ||||||||||||||||||||||||||||||||||||||||
[HttpPut("{id}/individual")] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<CharacterResponse>> UpdateCharacterToIndividual(Guid id, [FromBody] UpdateCharacterToIndividualRequest request) | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
var command = request.ToCommand(id); | ||||||||||||||||||||||||||||||||||||||||
var characterDto = await _characterService.UpdateCharacterToIndividualAsync(command); | ||||||||||||||||||||||||||||||||||||||||
var response = CharacterResponse.ToResponseDto(characterDto); | ||||||||||||||||||||||||||||||||||||||||
return Ok(response); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
Comment on lines
+72
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 인증 없는 캐릭터 업데이트 보안 문제
[HttpPut("{id}/individual")]
+ [JwtAuthentication]
public async Task<ActionResult<CharacterResponse>> UpdateCharacterToIndividual(Guid id, [FromBody] UpdateCharacterToIndividualRequest request) 또한 현재 사용자가 해당 캐릭터의 소유자인지 확인하는 로직도 필요할 수 있습니다. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
[HttpPut("{id}/systemprompt")] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<CharacterResponse>> UpdateCharacterToSystemPrompt(Guid id, [FromBody] UpdateCharacterToSystemPromptRequest request) | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
var command = request.ToUpdateCharacterCommand(); | ||||||||||||||||||||||||||||||||||||||||
var characterDto = await _characterService.UpdateCharacterAsync(id, command); | ||||||||||||||||||||||||||||||||||||||||
var command = request.ToCommand(id); | ||||||||||||||||||||||||||||||||||||||||
var characterDto = await _characterService.UpdateCharacterToSystemPromptAsync(command); | ||||||||||||||||||||||||||||||||||||||||
var response = CharacterResponse.ToResponseDto(characterDto); | ||||||||||||||||||||||||||||||||||||||||
return Ok(response); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
Comment on lines
+81
to
88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 인증 없는 캐릭터 업데이트 보안 문제
[HttpPut("{id}/systemprompt")]
+ [JwtAuthentication]
public async Task<ActionResult<CharacterResponse>> UpdateCharacterToSystemPrompt(Guid id, [FromBody] UpdateCharacterToSystemPromptRequest request) 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||
|
@@ -59,5 +93,28 @@ public async Task<ActionResult> DeleteCharacter(Guid id) | |||||||||||||||||||||||||||||||||||||||
await _characterService.DeleteCharacterAsync(id); | ||||||||||||||||||||||||||||||||||||||||
return NoContent(); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
[HttpGet("my")] | ||||||||||||||||||||||||||||||||||||||||
[JwtAuthentication] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<IEnumerable<CharacterResponse>>> GetMyCharacters([FromQuery] string orderBy = "latest") | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
var userId = GetCurrentUserId(); | ||||||||||||||||||||||||||||||||||||||||
if (!userId.HasValue) | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
return Unauthorized(); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
var characterDtos = await _characterService.GetMyCharactersAsync(userId.Value, orderBy); | ||||||||||||||||||||||||||||||||||||||||
var responses = characterDtos.Select(CharacterResponse.ToResponseDto); | ||||||||||||||||||||||||||||||||||||||||
return Ok(responses); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
[HttpGet("public")] | ||||||||||||||||||||||||||||||||||||||||
public async Task<ActionResult<IEnumerable<CharacterResponse>>> GetPublicCharacters([FromQuery] string orderBy = "latest") | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
var characterDtos = await _characterService.GetPublicCharactersAsync(orderBy); | ||||||||||||||||||||||||||||||||||||||||
var responses = characterDtos.Select(CharacterResponse.ToResponseDto); | ||||||||||||||||||||||||||||||||||||||||
return Ok(responses); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
헤더 명 변경 영향 점검: X-Refresh-Credit
클라이언트/게이트웨이 모두
X-Refresh-Credit
로 업데이트되었는지 확인 필요합니다. 미반영 시 새 토큰 발급·로그아웃이 전부 실패합니다.점검 스크립트:
🏁 Script executed:
Length of output: 1618
헤더 명 변경 일괄 반영 필요: X-Access-Credit / X-Refresh-Credit
tokenResponse.headers.get('X-Access-Token')
→X-Access-Credit
tokenResponse.headers.get('X-Refresh-Token')
→X-Refresh-Credit
X-Access-Token
→X-Access-Credit
X-Refresh-Token
→X-Refresh-Credit
미적용 시 토큰 발급 및 로그아웃 기능 전부 실패합니다.
🤖 Prompt for AI Agents