Skip to content

Commit cb84fbb

Browse files
committed
refactor: Repository 인터페이스를 Domain 모듈로 이동
Clean Architecture 원칙에 따라 Repository 패턴을 개선: - Repository 인터페이스를 Infrastructure에서 Domain으로 이동 - Infrastructure는 Domain 인터페이스를 구현하도록 수정 - Application 레이어가 Domain 인터페이스에만 의존하도록 개선 - ConversationHistory 폴더명을 Conversation으로 변경하여 일관성 확보 - 모든 테스트 코드의 참조 경로 업데이트 변경사항: - Domain/Repositories/ 인터페이스 생성 - Infrastructure 구현체들이 Domain 인터페이스 참조 - Application 서비스들의 의존성을 Domain으로 변경 - DI 컨테이너 등록 수정 - 테스트 프로젝트 참조 경로 업데이트
1 parent f48c908 commit cb84fbb

25 files changed

+533
-154
lines changed

ProjectVG.Application/Services/Character/CharacterService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ProjectVG.Infrastructure.Persistence.Repositories.Characters;
1+
using ProjectVG.Domain.Repositories;
22
using Microsoft.Extensions.Logging;
33
using ProjectVG.Application.Models.Character;
44
using ProjectVG.Common.Exceptions;

ProjectVG.Application/Services/Conversation/ConversationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using ProjectVG.Domain.Entities.ConversationHistorys;
2-
using ProjectVG.Infrastructure.Persistence.Repositories.Conversation;
2+
using ProjectVG.Domain.Repositories;
33
using Microsoft.Extensions.Logging;
44
using ProjectVG.Common.Exceptions;
55
using ProjectVG.Common.Constants;

ProjectVG.Application/Services/Credit/CreditManagementService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using Microsoft.EntityFrameworkCore;
22
using ProjectVG.Domain.Entities.Credits;
33
using ProjectVG.Infrastructure.Persistence.EfCore;
4-
using ProjectVG.Infrastructure.Persistence.Repositories.Credit;
5-
using ProjectVG.Infrastructure.Persistence.Repositories.Users;
4+
using ProjectVG.Domain.Repositories;
65

76
namespace ProjectVG.Application.Services.Credit
87
{

ProjectVG.Application/Services/User/UserService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ProjectVG.Application.Models.User;
22
using ProjectVG.Common.Utils;
33
using ProjectVG.Domain.Entities.Users;
4-
using ProjectVG.Infrastructure.Persistence.Repositories.Users;
4+
using ProjectVG.Domain.Repositories;
55

66
namespace ProjectVG.Application.Services.Users
77
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ProjectVG.Domain.Entities.Characters;
22

3-
namespace ProjectVG.Infrastructure.Persistence.Repositories.Characters
3+
namespace ProjectVG.Domain.Repositories
44
{
55
public interface ICharacterRepository
66
{
@@ -12,4 +12,4 @@ public interface ICharacterRepository
1212
Task<IEnumerable<Character>> GetByUserIdAsync(Guid userId);
1313
Task<IEnumerable<Character>> GetPublicCharactersAsync();
1414
}
15-
}
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using ProjectVG.Domain.Entities.ConversationHistorys;
2+
3+
namespace ProjectVG.Domain.Repositories
4+
{
5+
public interface IConversationRepository
6+
{
7+
Task<IEnumerable<ConversationHistory>> GetConversationHistoryAsync(Guid userId, Guid characterId, int page = 1, int pageSize = 10);
8+
Task<ConversationHistory> AddAsync(ConversationHistory conversationHistory);
9+
Task DeleteConversationAsync(Guid userId, Guid characterId);
10+
Task<int> GetMessageCountAsync(Guid userId, Guid characterId);
11+
Task<IEnumerable<ConversationHistory>> GetByConversationIdAsync(string conversationId);
12+
Task DeleteMessageAsync(Guid messageId);
13+
}
14+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using ProjectVG.Domain.Entities.Credits;
2+
3+
namespace ProjectVG.Domain.Repositories
4+
{
5+
public interface ICreditTransactionRepository
6+
{
7+
Task<CreditTransaction> CreateAsync(CreditTransaction transaction);
8+
Task<CreditTransaction?> GetByTransactionIdAsync(string transactionId);
9+
Task<(List<CreditTransaction> Transactions, int TotalCount)> GetUserTransactionsAsync(
10+
Guid userId,
11+
int pageNumber,
12+
int pageSize,
13+
CreditTransactionType? transactionType = null);
14+
Task<decimal> GetUserTransactionSumAsync(
15+
Guid userId,
16+
DateTime startDate,
17+
DateTime endDate,
18+
CreditTransactionType? transactionType = null);
19+
Task<List<CreditTransaction>> GetByRelatedEntityAsync(string relatedEntityType, string relatedEntityId);
20+
Task<List<CreditTransaction>> GetBySourceAsync(Guid userId, string source, int? limit = null);
21+
Task<bool> TransactionExistsAsync(string transactionId);
22+
Task<List<CreditTransaction>> GetRecentTransactionsAsync(Guid userId, int count = 10);
23+
}
24+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ProjectVG.Domain.Entities.Users;
22

3-
namespace ProjectVG.Infrastructure.Persistence.Repositories.Users
3+
namespace ProjectVG.Domain.Repositories
44
{
55
public interface IUserRepository
66
{
@@ -15,4 +15,4 @@ public interface IUserRepository
1515
Task<User> UpdateAsync(User user);
1616
Task DeleteAsync(Guid id);
1717
}
18-
}
18+
}

0 commit comments

Comments
 (0)