diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 5115826..f1dbd3d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,17 +5,9 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -30,7 +22,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -43,9 +57,9 @@
-
+ {
+ "associatedIndex": 8
+}
@@ -62,10 +76,12 @@
"RunOnceActivity.ShowReadmeOnStart": "true",
"Spring Boot.TampopotestApplication.executor": "Run",
"com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
- "git-widget-placeholder": "master",
+ "git-widget-placeholder": "swclaude3",
"junie.onboarding.icon.badge.shown": "true",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "C:/Users/student/IdeaProjects/tampopo-server",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "settings.editor.selected.configurable": "junie.application.models",
"to.speed.mode.migration.done": "true",
"vue.rearranger.settings.migration": "true"
}
diff --git a/build.gradle b/build.gradle
index ceb8f35..be39a67 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,8 +19,10 @@
}
dependencies {
- implementation 'org.springframework.boot:spring-boot-starter-jersey'
- testImplementation 'org.springframework.boot:spring-boot-starter-jersey-test'
+ implementation 'org.springframework.boot:spring-boot-starter-web'
+ implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
+ runtimeOnly 'com.h2database:h2'
+ testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
diff --git a/src/main/java/com/example/tampopotest/controller/ActivityController.java b/src/main/java/com/example/tampopotest/controller/ActivityController.java
new file mode 100644
index 0000000..cb46b76
--- /dev/null
+++ b/src/main/java/com/example/tampopotest/controller/ActivityController.java
@@ -0,0 +1,246 @@
+package com.example.tampopotest.controller;
+
+import com.example.tampopotest.entity.Activity;
+import com.example.tampopotest.entity.User;
+import com.example.tampopotest.repository.ActivityRepository;
+import com.example.tampopotest.repository.UserRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/users/{user-id}/activities")
+public class ActivityController {
+
+ @Autowired
+ private ActivityRepository activityRepository;
+
+ @Autowired
+ private UserRepository userRepository;
+
+ // GET /users/{user-id}/activities - アクティビティ一覧を返す
+ @GetMapping
+ public ResponseEntity> getActivities(@PathVariable("user-id") String userId) {
+ try {
+ Optional userOpt = userRepository.findByUserId(userId);
+ if (userOpt.isEmpty()) {
+ return ResponseEntity.status(HttpStatus.NOT_FOUND).body("データが存在しません");
+ }
+
+ List activities = activityRepository.findByUserId(userId);
+ List