Conversation
|
mofe-back上でseed作ってdumpを初期データとして投入してみました。 |
|
ありがとうございます!遅くなって申し訳ないです。 |
There was a problem hiding this comment.
Pull request overview
This PR sets up a development environment using devcontainer to enable local development without authentication dependencies. The changes include devcontainer configuration files, temporary stub implementations to resolve build errors, and a development-specific security configuration that bypasses authentication.
Changes:
- Added devcontainer configuration (Dockerfile, devcontainer.json, docker-compose.yml) with MariaDB and RabbitMQ services
- Created stub implementations for missing classes (TaskSlug, SubmissionFactory methods) to resolve compilation errors
- Added DevSecurityConfig to disable authentication in development environment
- Commented out Google Cloud Storage dependency that required authentication
Reviewed changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| .devcontainer/Dockerfile | Base Java 21 development container with Docker CLI and common tools |
| .devcontainer/devcontainer.json | Devcontainer configuration with VS Code extensions and port forwarding |
| .devcontainer/docker-compose.yml | Development services configuration for MariaDB and RabbitMQ |
| .devcontainer/dump.sql | SQL dump with sample database schema and test data |
| src/main/resources/application-dev.properties | Development-specific Spring Boot configuration |
| src/main/kotlin/com/mofecoder/api/shared/config/SecurityConfig.kt | Development security configuration bypassing authentication |
| src/main/kotlin/com/mofecoder/api/submission/presentation/HealthCheckController.kt | Custom health check endpoint |
| src/main/kotlin/com/mofecoder/api/problem/TaskSlug.kt | Value object for task slugs |
| src/main/kotlin/com/mofecoder/api/submission/usecase/CreateSubmissionUseCase.kt | Stub implementation added to resolve compilation error |
| src/main/kotlin/com/mofecoder/api/submission/factory/SubmissionFactory.kt | Stub implementation added to resolve compilation error |
| build.gradle.kts | Commented out GCP storage dependency |
| settings.gradle.kts | Root project configuration |
| .gitignore | Added .env file exclusion |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
|
|
||
| "postCreateCommand": "chmod +x gradlew", | ||
| "postStartCommand": "sudo service docker start", |
There was a problem hiding this comment.
The postStartCommand attempts to start Docker with "sudo service docker start", but this command is unlikely to work in a devcontainer environment. Devcontainers typically use Docker-outside-of-Docker pattern where the Docker socket is mounted from the host. This command may fail or be unnecessary. Consider removing this command or using a different approach if Docker-in-Docker is truly needed.
| "postStartCommand": "sudo service docker start", |
|
|
||
| /** | ||
| * タスクのスラッグを表すvalue object | ||
| * 仮実装 - 後で詳細実装予定 | ||
| */ |
There was a problem hiding this comment.
The TaskSlug value class is missing the @valueobject annotation that is used consistently on other value objects in the codebase (see ProblemId and UserId). This annotation is part of the jMolecules DDD framework being used in this project and should be added for consistency and to properly mark this as a DDD value object.
| /** | |
| * タスクのスラッグを表すvalue object | |
| * 仮実装 - 後で詳細実装予定 | |
| */ | |
| import org.jmolecules.ddd.annotation.ValueObject | |
| /** | |
| * タスクのスラッグを表すvalue object | |
| * 仮実装 - 後で詳細実装予定 | |
| */ | |
| @ValueObject |
| import io.swagger.v3.oas.annotations.Operation | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse | ||
| import io.swagger.v3.oas.annotations.tags.Tag | ||
| import org.springframework.http.HttpStatus | ||
| 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 | ||
|
|
||
| @RestController | ||
| @RequestMapping("/health") | ||
| @Tag(name = "Health Check", description = "アプリケーションのヘルスチェック") | ||
| class HealthCheckController { | ||
|
|
||
| @GetMapping | ||
| @Operation( | ||
| summary = "ヘルスチェック", | ||
| description = "アプリケーションの稼働状況を確認します。", | ||
| responses = [ | ||
| ApiResponse( | ||
| responseCode = "200", | ||
| description = "アプリケーションが正常に稼働している場合" | ||
| ) | ||
| ] | ||
| ) | ||
| fun healthCheck(): ResponseEntity<Map<String, Any>> { | ||
| val response = mapOf( | ||
| "status" to "UP", | ||
| "timestamp" to System.currentTimeMillis(), | ||
| "service" to "mofe-submission-api" | ||
| ) | ||
| return ResponseEntity.ok(response) | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
The HealthCheckController duplicates functionality already provided by Spring Boot Actuator. The application-dev.properties file already enables actuator endpoints including health checks at line 28. This custom health check endpoint creates redundancy and may confuse API consumers about which health endpoint to use. Consider removing this controller and relying on the standard actuator health endpoint at /actuator/health instead.
| import io.swagger.v3.oas.annotations.Operation | |
| import io.swagger.v3.oas.annotations.responses.ApiResponse | |
| import io.swagger.v3.oas.annotations.tags.Tag | |
| import org.springframework.http.HttpStatus | |
| 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 | |
| @RestController | |
| @RequestMapping("/health") | |
| @Tag(name = "Health Check", description = "アプリケーションのヘルスチェック") | |
| class HealthCheckController { | |
| @GetMapping | |
| @Operation( | |
| summary = "ヘルスチェック", | |
| description = "アプリケーションの稼働状況を確認します。", | |
| responses = [ | |
| ApiResponse( | |
| responseCode = "200", | |
| description = "アプリケーションが正常に稼働している場合" | |
| ) | |
| ] | |
| ) | |
| fun healthCheck(): ResponseEntity<Map<String, Any>> { | |
| val response = mapOf( | |
| "status" to "UP", | |
| "timestamp" to System.currentTimeMillis(), | |
| "service" to "mofe-submission-api" | |
| ) | |
| return ResponseEntity.ok(response) | |
| } | |
| } | |
| // The custom /health endpoint has been removed in favor of the standard | |
| // Spring Boot Actuator health endpoint exposed at /actuator/health. | |
| // This avoids duplication and potential confusion for API consumers. |
| management.endpoints.web.exposure.include=health,info,metrics,prometheus | ||
| management.endpoint.health.show-details=always | ||
|
|
||
| # セキュリティ設定(開発用) |
There was a problem hiding this comment.
The application-dev.properties uses a placeholder JWT issuer URI 'https://dev-auth.example.com' that is not a real endpoint. Since this is a development configuration with security disabled via DevSecurityConfig, this JWT configuration will never be used but may cause confusion. Consider either commenting out these JWT settings in dev profile or using a comment to clarify that they are placeholders not currently used.
| # セキュリティ設定(開発用) | |
| # セキュリティ設定(開発用) | |
| # 下記のJWT設定はプレースホルダーであり、DevSecurityConfigにより現在は使用されていません。 | |
| # 開発環境でセキュリティを有効化する場合は、実際のIssuer URIとaudienceに置き換えてください。 |
|
|
||
| LOCK TABLES `users` WRITE; | ||
| /*!40000 ALTER TABLE `users` DISABLE KEYS */; | ||
| INSERT INTO `users` VALUES (1,'email','[email protected]','$2a$11$GvBKPQon3ltxl5BAMBywRePvLV6HfWfqfe4cxZIIdAuiejchdt8wS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'admin','admin',NULL,NULL,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.425381','2025-10-13 05:25:15.425381',NULL),(2,'email','[email protected]','$2a$11$WwagUYWw38sYuyVme0QqUuQNvRbseKrKEuvoTay.dDfZqmEp19QeS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user1','user1',2296,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.509505','2025-10-13 05:25:15.509505',NULL),(3,'email','[email protected]','$2a$11$9hREPQL5zLNJ6oAponNwae5/3Oof/nU5.w48KmBT2n7dj9rMifqTO',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user2','user2',2099,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.593187','2025-10-13 05:25:15.593187',NULL),(4,'email','[email protected]','$2a$11$uPeT015KNyzybhXhjVl6Y.9vvTj.BRvxRi9r7UDtY9dO7xhUWPNSW',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user3','user3',1803,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.677599','2025-10-13 05:25:15.677599',NULL),(5,'email','[email protected]','$2a$11$yWH9b0zLd3CmnswwTyVvtubR2UE6RpFnZSpsuqouWG.syhy0nW5cG',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user4','user4',1684,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.761877','2025-10-13 05:25:15.761877',NULL),(6,'email','[email protected]','$2a$11$bvOcFffS6ZJTvLFkIbqBj.3AfwgmZQwp/D7D.WzpzXwuAqFq0L.Sm',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user5','user5',1387,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.848405','2025-10-13 05:25:15.848405',NULL),(7,'email','[email protected]','$2a$11$DV35zI.qBDmws9EiLpD82eSnVaOuN.X3RRkd8C76rmePzgZ/EQ/9C',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'writer','writer',NULL,NULL,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.932604','2025-10-13 05:25:15.932604',NULL),(8,'email','[email protected]','$2a$11$BB30R8h9sw7YnzULcEL3o.d/.C7fO17D2fK9xQ8gGc8AlKAF2hbgS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'member','manabeai',NULL,NULL,NULL,'[email protected]','{\"Na8SDwxNq45HebU-yJ0k2w\":{\"token\":\"$2a$10$Rt6EgBfW1tBNvwRva85PteY8awXiIwpe4Bzs.Y7sZv6FJ4wKBU8qK\",\"expiry\":1762752670}}','2025-10-13 05:31:10.392772','2025-10-13 05:31:10.437329',NULL); |
There was a problem hiding this comment.
The dump.sql contains a personal email address '[email protected]' in the test data. Including real personal information (even if it's a development email) in version control is not recommended as it may violate privacy best practices and could be indexed by search engines. Consider using clearly fake email addresses like '[email protected]' to maintain consistency with the other test users.
| INSERT INTO `users` VALUES (1,'email','[email protected]','$2a$11$GvBKPQon3ltxl5BAMBywRePvLV6HfWfqfe4cxZIIdAuiejchdt8wS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'admin','admin',NULL,NULL,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.425381','2025-10-13 05:25:15.425381',NULL),(2,'email','[email protected]','$2a$11$WwagUYWw38sYuyVme0QqUuQNvRbseKrKEuvoTay.dDfZqmEp19QeS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user1','user1',2296,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.509505','2025-10-13 05:25:15.509505',NULL),(3,'email','[email protected]','$2a$11$9hREPQL5zLNJ6oAponNwae5/3Oof/nU5.w48KmBT2n7dj9rMifqTO',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user2','user2',2099,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.593187','2025-10-13 05:25:15.593187',NULL),(4,'email','[email protected]','$2a$11$uPeT015KNyzybhXhjVl6Y.9vvTj.BRvxRi9r7UDtY9dO7xhUWPNSW',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user3','user3',1803,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.677599','2025-10-13 05:25:15.677599',NULL),(5,'email','[email protected]','$2a$11$yWH9b0zLd3CmnswwTyVvtubR2UE6RpFnZSpsuqouWG.syhy0nW5cG',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user4','user4',1684,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.761877','2025-10-13 05:25:15.761877',NULL),(6,'email','[email protected]','$2a$11$bvOcFffS6ZJTvLFkIbqBj.3AfwgmZQwp/D7D.WzpzXwuAqFq0L.Sm',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user5','user5',1387,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.848405','2025-10-13 05:25:15.848405',NULL),(7,'email','[email protected]','$2a$11$DV35zI.qBDmws9EiLpD82eSnVaOuN.X3RRkd8C76rmePzgZ/EQ/9C',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'writer','writer',NULL,NULL,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.932604','2025-10-13 05:25:15.932604',NULL),(8,'email','[email protected]','$2a$11$BB30R8h9sw7YnzULcEL3o.d/.C7fO17D2fK9xQ8gGc8AlKAF2hbgS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'member','manabeai',NULL,NULL,NULL,'[email protected]','{\"Na8SDwxNq45HebU-yJ0k2w\":{\"token\":\"$2a$10$Rt6EgBfW1tBNvwRva85PteY8awXiIwpe4Bzs.Y7sZv6FJ4wKBU8qK\",\"expiry\":1762752670}}','2025-10-13 05:31:10.392772','2025-10-13 05:31:10.437329',NULL); | |
| INSERT INTO `users` VALUES (1,'email','[email protected]','$2a$11$GvBKPQon3ltxl5BAMBywRePvLV6HfWfqfe4cxZIIdAuiejchdt8wS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'admin','admin',NULL,NULL,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.425381','2025-10-13 05:25:15.425381',NULL),(2,'email','[email protected]','$2a$11$WwagUYWw38sYuyVme0QqUuQNvRbseKrKEuvoTay.dDfZqmEp19QeS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user1','user1',2296,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.509505','2025-10-13 05:25:15.509505',NULL),(3,'email','[email protected]','$2a$11$9hREPQL5zLNJ6oAponNwae5/3Oof/nU5.w48KmBT2n7dj9rMifqTO',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user2','user2',2099,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.593187','2025-10-13 05:25:15.593187',NULL),(4,'email','[email protected]','$2a$11$uPeT015KNyzybhXhjVl6Y.9vvTj.BRvxRi9r7UDtY9dO7xhUWPNSW',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user3','user3',1803,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.677599','2025-10-13 05:25:15.677599',NULL),(5,'email','[email protected]','$2a$11$yWH9b0zLd3CmnswwTyVvtubR2UE6RpFnZSpsuqouWG.syhy0nW5cG',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user4','user4',1684,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.761877','2025-10-13 05:25:15.761877',NULL),(6,'email','[email protected]','$2a$11$bvOcFffS6ZJTvLFkIbqBj.3AfwgmZQwp/D7D.WzpzXwuAqFq0L.Sm',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'member','user5','user5',1387,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.848405','2025-10-13 05:25:15.848405',NULL),(7,'email','[email protected]','$2a$11$DV35zI.qBDmws9EiLpD82eSnVaOuN.X3RRkd8C76rmePzgZ/EQ/9C',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,'2025-10-13 05:25:15',NULL,NULL,'writer','writer',NULL,NULL,NULL,'[email protected]',NULL,'2025-10-13 05:25:15.932604','2025-10-13 05:25:15.932604',NULL),(8,'email','[email protected]','$2a$11$BB30R8h9sw7YnzULcEL3o.d/.C7fO17D2fK9xQ8gGc8AlKAF2hbgS',NULL,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'member','manabeai',NULL,NULL,NULL,'[email protected]','{\"Na8SDwxNq45HebU-yJ0k2w\":{\"token\":\"$2a$10$Rt6EgBfW1tBNvwRva85PteY8awXiIwpe4Bzs.Y7sZv6FJ4wKBU8qK\",\"expiry\":1762752670}}','2025-10-13 05:31:10.392772','2025-10-13 05:31:10.437329',NULL); |
| @@ -0,0 +1,73 @@ | |||
| { | |||
| "name": "Mofe API Dev Container", | |||
| "dockerComposeFile": ["../compose.yaml", "docker-compose.yml"], | |||
There was a problem hiding this comment.
The devcontainer.json references '../compose.yaml' in the dockerComposeFile array, but the compose.yaml file in the repository root defines different service configurations (mysql, mariadb, rabbitmq) with different environment variables than those used in docker-compose.yml. This could lead to confusion or conflicts. The devcontainer should either use only docker-compose.yml or the compose files should be harmonized to avoid configuration mismatches.
| "dockerComposeFile": ["../compose.yaml", "docker-compose.yml"], | |
| "dockerComposeFile": ["docker-compose.yml"], |
| "name": "Mofe API Dev Container", | ||
| "dockerComposeFile": ["../compose.yaml", "docker-compose.yml"], | ||
| "service": "app", | ||
| "workspaceFolder": "/workspace", |
There was a problem hiding this comment.
The workspaceFolder is set to "/workspace" but the volume mount maps to "/workspaces/mofe-api" (note the plural "workspaces"). This path mismatch will cause the devcontainer to not find the project files in the expected location, breaking the development environment setup.
| "workspaceFolder": "/workspace", | |
| "workspaceFolder": "/workspaces/mofe-api", |
概要