Skip to content
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 @@ -25,15 +25,18 @@ public void run(String... args) {

List<ChatStyle> styles = Arrays.asList(
new ChatStyle("편한 반말", "일상적이고 거리감 없는 말투"),
new ChatStyle("기본 존댓말", "무난하고 예의 중심의 말투"),
new ChatStyle("부드러운 존댓말", "말끝을 완화해 정중함을 강조한 말투"),
new ChatStyle("존댓말", "무난하고 예의 중심의 말투"),
new ChatStyle("애교 섞인 말투", "감정 표현이 많고 친근함을 강조"),
new ChatStyle("차분한 설명형 말투", "또박또박 설명하듯 말하는 스타일"),
new ChatStyle("걱정·배려 중심 말투", "상대 상태를 먼저 살피는 말투"),
new ChatStyle("보고·전달형 말투", "사실 위주로 간단히 전달하는 스타일"),
new ChatStyle("감사·존중 강조 말투", "고마움과 존중 표현이 자주 들어가는 말투"),
new ChatStyle("농담 섞인 편안한 말투", "가벼운 웃음 포인트가 있는 스타일"),
new ChatStyle("조심스러운 요청형 말투", "부탁이나 제안을 할 때 사용하는 말투")
new ChatStyle("걱정·배려 중심 말투", "상대 상태를 먼저 살피는 말투")
// new ChatStyle("농담 섞인 편안한 말투", "가벼운 웃음 포인트가 있는 스타일"),
// new ChatStyle("부드러운 존댓말", "말끝을 완화해 정중함을 강조한 말투"),
// new ChatStyle("차분한 설명형 말투", "또박또박 설명하듯 말하는 스타일"),
// new ChatStyle("농담 섞인 편안한 말투", "가벼운 웃음 포인트가 있는 스타일"),
// new ChatStyle("부드러운 존댓말", "말끝을 완화해 정중함을 강조한 말투"),
// new ChatStyle("차분한 설명형 말투", "또박또박 설명하듯 말하는 스타일"),
// new ChatStyle("보고·전달형 말투", "사실 위주로 간단히 전달하는 스타일"),
// new ChatStyle("감사·존중 강조 말투", "고마움과 존중 표현이 자주 들어가는 말투"),
// new ChatStyle("조심스러운 요청형 말투", "부탁이나 제안을 할 때 사용하는 말투")
);

chatStyleRepository.saveAll(styles);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.example.team4backend.controller;

import com.example.team4backend.common.response.ApiResult;
import com.example.team4backend.dto.ChatStyleResponse;
import com.example.team4backend.service.ChatStyleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "ChatStyle", description = "채팅 스타일 관리 API")
@RestController
@RequestMapping("/chat-styles")
@RequiredArgsConstructor
public class ChatStyleController {

private final ChatStyleService chatStyleService;

@Operation(summary = "채팅 스타일 목록 조회", description = "시스템에 등록된 모든 채팅 스타일을 조회합니다.")
@GetMapping
public ResponseEntity<ApiResult<List<ChatStyleResponse>>> getAllChatStyles() {
List<ChatStyleResponse> chatStyles = chatStyleService.getAllChatStyles();
return ResponseEntity.ok(ApiResult.ok(chatStyles));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.example.team4backend.controller;

import com.example.team4backend.common.response.ApiResult;
import com.example.team4backend.dto.RelationshipResponse;
import com.example.team4backend.service.RelationshipService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "Relationship", description = "관계 관리 API")
@RestController
@RequestMapping("/relationships")
@RequiredArgsConstructor
public class RelationshipController {

private final RelationshipService relationshipService;

@Operation(summary = "관계 목록 조회", description = "시스템에 등록된 모든 관계 유형을 조회합니다.")
@GetMapping
public ResponseEntity<ApiResult<List<RelationshipResponse>>> getAllRelationships() {
List<RelationshipResponse> relationships = relationshipService.getAllRelationships();
return ResponseEntity.ok(ApiResult.ok(relationships));
}
}
24 changes: 24 additions & 0 deletions src/main/java/com/example/team4backend/dto/ChatStyleResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.team4backend.dto;

import com.example.team4backend.domain.ChatStyle;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "채팅 스타일 정보 응답")
public record ChatStyleResponse(
@Schema(description = "채팅 스타일 ID", example = "1")
Long id,

@Schema(description = "스타일 이름", example = "편한 반말")
String styleName,

@Schema(description = "스타일 설명", example = "친근하고 편안한 반말 스타일")
String description
) {
public static ChatStyleResponse from(ChatStyle chatStyle) {
return new ChatStyleResponse(
chatStyle.getId(),
chatStyle.getStyleName(),
chatStyle.getDescription()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.team4backend.dto;

import com.example.team4backend.domain.Relationship;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "관계 정보 응답")
public record RelationshipResponse(
@Schema(description = "관계 ID", example = "1")
Long id,

@Schema(description = "관계 코드", example = "FRIEND")
String code,

@Schema(description = "관계 설명", example = "친구")
String description
) {
public static RelationshipResponse from(Relationship relationship) {
return new RelationshipResponse(
relationship.getId(),
relationship.getCode(),
relationship.getDescription()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ private SecurityPaths() {}
"/auth/login",
"/auth/kakao/login",
"/auth/refresh",
"/prompts"
"/prompts",
"/relationships",
"/chat-styles"
};

public static final String[] CSRF_IGNORED = {
Expand All @@ -23,7 +25,8 @@ private SecurityPaths() {}
"/swagger-ui.html",
"/prompts",
"/users",
"/targets"
"/targets",
"/relationships"
};

public static final String[] PUBLIC_DOCS = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.team4backend.service;

import com.example.team4backend.dto.ChatStyleResponse;
import com.example.team4backend.repository.ChatStyleRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@RequiredArgsConstructor
public class ChatStyleService {

private final ChatStyleRepository chatStyleRepository;

@Transactional(readOnly = true)
public List<ChatStyleResponse> getAllChatStyles() {
return chatStyleRepository.findAll()
.stream()
.map(ChatStyleResponse::from)
.toList();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.team4backend.service;

import com.example.team4backend.dto.RelationshipResponse;
import com.example.team4backend.repository.RelationshipRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@RequiredArgsConstructor
public class RelationshipService {

private final RelationshipRepository relationshipRepository;

@Transactional(readOnly = true)
public List<RelationshipResponse> getAllRelationships() {
return relationshipRepository.findAll()
.stream()
.map(RelationshipResponse::from)
.toList();
}
}