Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
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
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
// https://code.visualstudio.com/docs/java/java-debugging
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic",
"java.dependency.syncWithFolderExplorer": true,
Expand All @@ -8,7 +9,9 @@
},
"java.completion.favoriteStaticMembers": [
"org.hamcrest.Matchers.*",
"org.junit.jupiter.api.*",
"org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*",
"org.springframework.test.web.servlet.result.MockMvcResultMatchers.*"
]
],
"java.debug.settings.hotCodeReplace": "manual" // change to "auto" if you want to enable
}
42 changes: 25 additions & 17 deletions back/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@
- [`ktlint --format`](https://github.com/pinterest/ktlint?tab=readme-ov-file#quick-start)


com.example
├── core
│ ├── domain1
│ │ ├── subcontext1
│ │ ├── subcontext2
│ │ └── common
│ ├── domain2
│ └── shared
│ └── metadata
├── api
│ ├── controller
│ └── service
└── util

TODO: refactor project structure

TODO: add questions
# 2. 표현식 Expression
1. [x] 숫자 연산자 우선순위 오해 OperationPriority
- [x] 이진 시프트 BinaryShift
- [x] 비트 연산자 BitwiseOperator
2. [x] 조건식의 괄호 누락 MissingParentheses
- [x] &&, ||의 우선순위 LogicalOperatorPrecedence
- [x] 조건 연산자와 덧셈 TernaryWithAddition
- [x] 조건 연산자와 null 검사 TernaryWithNullCheck
3. [ ] 덧셈이 아닌 결합으로 작동 StringConcatenation
4. [ ] 멀티라인 문자열 리터럴 MultilineStringLiteral
5. [ ] 단항 덧셈 연산자 UnaryPlusOperator
6. [ ] 조건 표현식의 묵시적 타입 변환 ImplicitTypeConversion
- [ ] 조건 표현식의 박싱된 숫자 BoxedNumberConditional
- [ ] 중첩 조건 표현식 NestedConditional
7. [ ] 비단락 논리 연산자 사용 NonShortCircuitOperator
8. [ ] &&와 || 혼용 MixedLogicalOperators
9. [ ] 잘못된 가변 인수 호출 VarArgsIssues
- [ ] 모호한 가변 인수 호출 AmbiguousVarArgs
- [ ] 배열과 컬렉션 혼용 ArrayCollectionMixup
- [ ] 가변 인수에 원시 배열 전달 PrimitiveArrayToVarArgs
10. [ ] 조건 연산자와 가변 인수 호출 TernaryWithVarArgs
11. [ ] 반환값 무시 IgnoredReturnValue
12. [ ] 새롭게 생성된 객체를 사용하지 않음 UnusedObjects
13. [ ] 잘못된 메서드를 참조하는 바인딩 IncorrectMethodBinding
14. [ ] 메서드 참조 시 잘못된 메서드 지정 WrongMethodReference
5 changes: 2 additions & 3 deletions back/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ dependencies {
testCompileOnly("org.projectlombok:lombok")
testAnnotationProcessor("org.projectlombok:lombok")

// Document RESTful services by combining hand-written with Asciidoctor
// and auto-generated snippets produced with Spring MVC Test
testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")
// SpringDoc OpenAPI UI for REST API documentation
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5")

// Spring Data base dependency without any database-specific functionality
implementation("org.springframework.data:spring-data-commons")
Expand Down
19 changes: 19 additions & 0 deletions back/src/main/java/com/example/mistakes/QuestionEntityBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.example.mistakes;

import com.example.mistakes.api.questions.QuestionEntity;
import java.util.List;
import java.util.stream.Collectors;

public class QuestionEntityBuilder<T> {
public QuestionEntity build(Class<T> cls) {
return new QuestionEntity(cls.getCanonicalName());
}

public static QuestionEntity of(Class<?> cls) {
return new QuestionEntity(cls.getCanonicalName());
}

public static Iterable<QuestionEntity> of(Class<?>... cls) {
return List.of(cls).stream().map(QuestionEntityBuilder::of).collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.mistakes.api.hello;

import com.example.mistakes.base.type.definition.Message;
import com.example.mistakes.base.type.Message;

@Deprecated
public record HelloDTO(String message) implements Message {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.example.mistakes.api.questions;

import com.example.mistakes.base.type.ResponseMany;
import com.example.mistakes.service.QuestionService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class ChaptersController {
@Autowired private final QuestionService service;

public ChaptersController(QuestionService service) {
this.service = service;
}

private ResponseEntity<ResponseMany<QuestionEntity>> _response(Iterable<QuestionEntity> data) {
final var dto = new ResClassQuestion(data);
return ResponseEntity.ok().body(dto);
}

@GetMapping("/{chapterName}")
public ResponseEntity<ResponseMany<QuestionEntity>> getAllMistakesInChapter(
@PathVariable String chapterName) {
final var data = this.service.findAllByChapterName(chapterName);
return _response(data);
}

@GetMapping("/{chapterName}/{mistakeId}")
public ResponseEntity<ResponseMany<QuestionEntity>> getExamplesInMistake(
@PathVariable String chapterName, @PathVariable Integer mistakeId) {
final var data = this.service.findAllByMistakeId(mistakeId);
return _response(data);
}

@GetMapping("/{chapterName}/{mistakeId}/{exampleId}")
public ResponseEntity<ResponseMany<QuestionEntity>> getOneExample(
@PathVariable String chapterName,
@PathVariable Integer mistakeId,
@PathVariable Integer exampleId) {
final var data = this.service.findOne(chapterName, mistakeId, exampleId);
return _response(List.of(data));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.example.mistakes.api.questions;

import com.example.mistakes.base.type.ResponseMany;
import com.example.mistakes.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/examples")
public class ExamplesController {
@Autowired private final QuestionService service;

public ExamplesController(QuestionService service) {
this.service = service;
}

private ResponseEntity<ResponseMany<QuestionEntity>> _response(Iterable<QuestionEntity> data) {
final var dto = new ResClassQuestion(data);
return ResponseEntity.ok().body(dto);
}

@GetMapping("/")
public ResponseEntity<ResponseMany<QuestionEntity>> getAll() {
final var data = this.service.findAll();
return _response(data);
}

@GetMapping("/{id}")
public ResponseEntity<ResponseMany<QuestionEntity>> getOneById(@PathVariable("id") Integer id) {
final var data = this.service.findAllByMistakeId(id);
return _response(data);
}
}

This file was deleted.

Loading