Skip to content
5 changes: 1 addition & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ dependencies {
implementation project(':infrastructure')

implementation 'org.springframework.boot:spring-boot-starter-data-jpa'


testImplementation 'org.springframework:spring-tx'
testImplementation 'org.springframework.boot:spring-boot-starter-security'
testRuntimeOnly 'com.h2database:h2'
runtimeOnly 'com.h2database:h2'


runtimeOnly 'org.postgresql:postgresql'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.btg.core.application.port.in.task;

public interface GetTaskProgressUseCase {

TaskProgressResult getTaskProgress(Long taskId);

record TaskProgressResult(
Long taskId,
Integer totalParticipants,
Integer totalDays,
Double overallCompletionRate,
Double averageCompletionRate
) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.btg.core.application.port.in.task;

public interface JoinTaskUseCase {

TaskMemberResult joinTask(JoinTaskCommand command);

record JoinTaskCommand(
Long taskId,
Long userId
) {
public JoinTaskCommand {
if (taskId == null || taskId <= 0) {
throw new IllegalArgumentException("Task ID is required");
}
if (userId == null || userId <= 0) {
throw new IllegalArgumentException("User ID is required");
}
}
}

record TaskMemberResult(
Long id,
UserInfo user,
Double completionRate,
Integer completedDays,
Integer totalDays,
Long joinedAt
) {}

record UserInfo(Long id, String email, String name) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.btg.core.application.port.in.task;

public interface LeaveTaskUseCase {

void leaveTask(LeaveTaskCommand command);

record LeaveTaskCommand(
Long taskId,
Long userId
) {
public LeaveTaskCommand {
if (taskId == null || taskId <= 0) {
throw new IllegalArgumentException("Task ID is required");
}
if (userId == null || userId <= 0) {
throw new IllegalArgumentException("User ID is required");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.btg.core.application.port.in.task;

import java.util.List;

public interface ListTaskMembersUseCase {

TaskMemberListResult listTaskMembers(ListTaskMembersQuery query);

record ListTaskMembersQuery(Long taskId) {
public ListTaskMembersQuery {
if (taskId == null || taskId <= 0) {
throw new IllegalArgumentException("Task ID is required");
}
}
}

record TaskMemberListResult(
List<TaskMemberInfo> members,
Integer totalCount,
Double averageCompletionRate
) {}

record TaskMemberInfo(
Long id,
UserInfo user,
Double completionRate,
Integer completedDays,
Integer totalDays,
Long joinedAt
) {}

record UserInfo(Long id, String email, String name) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.btg.core.application.port.in.task;

import java.util.List;

public interface UpdateTaskStatusUseCase {

TaskResult updateStatus(UpdateStatusCommand command);

record UpdateStatusCommand(
Long taskId,
Long userId,
String status
) {
private static final List<String> VALID_STATUSES = List.of("IN_PROGRESS", "COMPLETED", "CANCELLED");

public UpdateStatusCommand {
if (taskId == null || taskId <= 0) {
throw new IllegalArgumentException("Task ID is required");
}
if (userId == null || userId <= 0) {
throw new IllegalArgumentException("User ID is required");
}
if (status == null || status.isBlank()) {
throw new IllegalArgumentException("Status is required");
}
if (!VALID_STATUSES.contains(status)) {
throw new IllegalArgumentException("Invalid status: " + status + ". Must be one of: " + VALID_STATUSES);
}
}
}

record TaskResult(
Long id,
Long groupId,
String title,
String description,
String status,
String startDate,
String endDate,
Integer totalDays,
Integer participantCount,
Integer maxParticipants,
Double overallCompletionRate,
UserInfo createdBy,
String createdAt,
String updatedAt
) {}

record UserInfo(Long id, String email, String name) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.btg.core.application.port.out.dailyprogress;

public interface DeleteDailyProgressPort {

void deleteByTaskMemberId(Long taskMemberId);

void deleteAllByTaskId(Long taskId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.btg.core.application.port.out.dailyprogress;

import java.util.List;

public interface LoadDailyProgressPort {

List<DailyProgress> loadByTaskMemberId(Long taskMemberId);

int countCompletedByTaskMemberId(Long taskMemberId);

int countCompletedByTaskId(Long taskId);

int countTotalByTaskId(Long taskId);

record DailyProgress(
Long id,
Long taskMemberId,
String date,
Boolean completed,
String completedAt
) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.btg.core.application.port.out.dailyprogress;

import java.util.List;

public interface SaveDailyProgressPort {

void saveAll(Long taskMemberId, List<DailyProgressEntry> entries);

record DailyProgressEntry(String date, Boolean completed) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.btg.core.application.port.out.task;

public interface DeleteTaskMemberPort {

void deleteByTaskIdAndUserId(Long taskId, Long userId);

void deleteAllByTaskId(Long taskId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.btg.core.application.port.out.task;

public interface DeleteTaskPort {
void deleteById(Long taskId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.btg.core.application.port.out.task;

import java.util.List;
import java.util.Optional;

public interface LoadTaskMemberPort {

Optional<TaskMember> loadByTaskIdAndUserId(Long taskId, Long userId);

List<TaskMember> loadByTaskId(Long taskId);

int countByTaskId(Long taskId);

boolean existsByTaskIdAndUserId(Long taskId, Long userId);

record TaskMember(
Long id,
Long taskId,
Long userId,
Long joinedAt
) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.btg.core.application.port.out.task;

import java.util.List;
import java.util.Optional;

public interface LoadTaskPort {

Optional<Task> loadById(Long taskId);

PagedTask loadByGroupId(Long groupId, String status, int page, int size);

record Task(
Long id,
Long groupId,
Long createdByUserId,
String title,
String description,
String status,
String startDate,
String endDate,
Integer totalDays,
Integer maxParticipants,
Long createdAt,
Long updatedAt
) {}

record PagedTask(
List<Task> content,
int totalElements,
int totalPages,
int page,
int size
) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.btg.core.application.port.out.task;

public interface SaveTaskMemberPort {

TaskMember save(Long taskId, Long userId);

record TaskMember(
Long id,
Long taskId,
Long userId,
Long joinedAt
) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.btg.core.application.port.out.task;

public interface SaveTaskPort {
Task save(
Long groupId,
Long createdByUserId,
String title,
String description,
String status,
String startDate,
String endDate,
Integer totalDays,
Integer maxParticipants
);

record Task(
Long id,
Long groupId,
Long createdByUserId,
String title,
String description,
String status,
String startDate,
String endDate,
Integer totalDays,
Integer maxParticipants,
Long createdAt,
Long updatedAt
) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.btg.core.application.port.out.task;

public interface UpdateTaskPort {

Task updateStatus(Long taskId, String newStatus);

Task update(Long taskId, String title, String description, Integer maxParticipants);

record Task(
Long id,
Long groupId,
Long createdByUserId,
String title,
String description,
String status,
String startDate,
String endDate,
Integer totalDays,
Integer maxParticipants,
Long createdAt,
Long updatedAt
) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.btg.core.application.service.dailyprogress;

import com.btg.core.application.port.in.dailyprogress.GetDailyProgressUseCase;
import org.springframework.stereotype.Service;

/**
* GetDailyProgressUseCase 구현체
*
* TODO: 실제 비즈니스 로직 구현 필요
* - DailyProgress 조회 로직
* - 통계 계산 로직
* - Outbound Port 연결 (LoadDailyProgressPort 등)
*/
@Service
public class GetDailyProgressService implements GetDailyProgressUseCase {

@Override
public DailyProgressSummaryResult getDailyProgressSummary(Long taskId) {
// TODO: Implement actual business logic
// 1. Validate taskId
// 2. Load task and verify it exists
// 3. Load all daily progress records for the task
// 4. Calculate statistics (completion rate, etc.)
// 5. Return summary result
throw new UnsupportedOperationException("getDailyProgressSummary not implemented yet");
}

@Override
public MyDailyProgressResult getMyDailyProgress(Long taskId, Long userId) {
// TODO: Implement actual business logic
// 1. Validate taskId and userId
// 2. Load task and verify it exists
// 3. Verify user is participating in the task
// 4. Load user's daily progress records
// 5. Return user's progress result
throw new UnsupportedOperationException("getMyDailyProgress not implemented yet");
}
}
Loading
Loading