Skip to content

Conversation

@CMSSKKK
Copy link
Collaborator

@CMSSKKK CMSSKKK commented Apr 6, 2022

처음에 뵙겠습니다 solar🎉

로니&반스입니다!

아직 처음이라 많은 작업을 하지는 못했지만 1차 PR을 보냅니다.
잘부탁드립니다.

구현사항

  • DB 테이블 설계 및 쿼리 작성
    • table 설계(프로토타입)
    • schema.sql 작성
DROP TABLE IF EXISTS column;
DROP TABLE IF EXISTS `user`;
DROP TABLE IF EXISTS card;
DROP TABLE IF EXISTS log;

CREATE TABLE column
(
    id       INTEGER AUTO_INCREMENT NOT NULL,
    name     VARCHAR(255) NOT NULL,
    PRIMARY KEY (id)
);

CREATE TABLE `user`
(
    id       VARCHAR(255) NOT NULL,
    name     VARCHAR(255) NOT NULL,
    password VARCHAR(255) NOT NULL,
    PRIMARY KEY (id)
);

CREATE TABLE card
(
     id BIGINT AUTO_INCREMENT NOT NULL,
     user_id VARCHAR(255) NOT NULL,
     column_id INTEGER NOT NULL,
     subject VARCHAR(255) NOT NULL,
     contents VARCHAR(255) NOT NULL,
     create_time TIMESTAMP NOT NULL,
     update_time TIMESTAMP,
     deleted boolean DEFAULT FALSE,
     PRIMARY KEY (id),
     FOREIGN KEY (user_id) REFERENCES `user` (id),
     FOREIGN KEY (column_id) REFERENCES column (id)
);

CREATE TABLE log
(
    id BIGINT AUTO_INCREMENT NOT NULL,
    user_id VARCHAR(255) NOT NULL,
    subject VARCHAR(255) NOT NULL,
    `from` INTEGER,
    `to` INTEGER,
    active_time TIMESTAMP NOT NULL,
    activity VARCHAR(255) NOT NULL,
    PRIMARY KEY (id),
    FOREIGN KEY (user_id) REFERENCES `user` (id),
    FOREIGN KEY (`from`) REFERENCES column (id),
    FOREIGN KEY (`to`) REFERENCES column (id)
);
  • Card mockup API 구현

    • Card 객체 생성
    • mockupController 구현 (Json 데이터처리만 시험삼아 구현해봤습니다.)
    • Card Repository 생성
    • Card Service 생성
    • Card Controller 생성
    • Test 코드 작성 (몇가지 단위테스트를 진행했으나 완성하지 못했습니다.)

약속된 시간보다 조금 늦게 PR보내게되어서 죄송합니다 🙇‍♂️

ffinn92 and others added 11 commits April 4, 2022 11:47
Member 및 Ground Rules 추가
todo_user, card, log ddl 쿼리 작성
build.gradle h2 dependency 추가
application.properties datasource 등록
schema.sql 수정
1. 디렉토리 MVC 구조로 나누기
2. JSON 데이터 요청 및 응답 mockup으로 구현
3. schema.sql 수정 column table 생성 및 foreign key 조건 할당
save, findById, findAll, delete 구현
card 객체 필드 수정
save_test(), findById 성공, 실패 test 작성
data.sql 작성, schema.sql 수정
@CMSSKKK CMSSKKK added the review-BE Improvements or additions to documentation label Apr 6, 2022
@CMSSKKK CMSSKKK requested a review from blossun April 6, 2022 08:14
@CMSSKKK CMSSKKK changed the title [BE][team-10] 1차 PR [BE][team-10] Todo-list 1주차 PR #1 Apr 6, 2022
Copy link

@blossun blossun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 로니 반스😄 이번에 리뷰를 맡게된 Solar입니다.
첫 PR 고생 많으셨습니다~ 커밋 단위가 잘 나눠져 있어서 리뷰하기 좋았습니다. 👍
테스트 작성하려는 모습도 좋습니다. 😄
한 번 고민해보시면 좋을만한 내용 코멘트로 남겨드렸어요~
수고 많으셨고 남은 미션도 화이팅입니다!!

return cardResponseEntity;
}

@PostMapping("/card/new")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest API 디자인 가이드에 대해서 학습해보시길 추천드립니다~!
링크 하나 첨부해드릴게요 :)
https://meetup.toast.com/posts/92

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

키워드와 링크 공유해주셔서 감사합니다
참고해서 학습해보겠습니다. solar! 🙏

Comment on lines +70 to +72
public void setId(Long id) {
this.id = id;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setter가 필요한가요??

private final String author;
private final String subject;
private final String contents;
private final LocalDateTime create_time;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 변수만 스네이크 케이스이네요?!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 넵! 수정하겠습니다. 감사합니다.

Comment on lines +43 to +45
public LocalDateTime getCreate_time() {
return create_time;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정이 필요해보여요~

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 수정하여 반영하도록 하겠습니다. 감사합니다.


KeyHolder keyHolder = new GeneratedKeyHolder();
namedParameterJdbcTemplate.update(sql, new BeanPropertySqlParameterSource(card), keyHolder);
card.setId(Objects.requireNonNull(keyHolder.getKey()).longValue());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 setter를 사용하시는군요!
Setter 메소드의 사용은 지양하도록 권고드리는데요.
setter는 왜 사용을 지양해야하는지 고민해보시면 좋을 것 같습니다. 😄

간단히 적어보자면
대표적인 이유로 값을 변경한 의도를 파악하기 힘들다는 점과 객체의 일관성을 유지하기 어렵다는 점이 있습니다.
setter대신 생성자나 정적 팩토리 메소드, 또는 목적과 의도가 분명히 나타낼 수 있는 메소드를 추가해주는 것도 좋은 방법입니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setter를 제거하고 정적펙토리메서드로 바꾼다고 생각했을 때, 이렇게 메서드 구상해봤는데... 괜찮은 메서드인지 잘 모르겠습니다ㅠㅠ

public static Card instanceWithId(Long id, Card card) {
        card.id = id;
        return card;
    }

번거로우시겠지만, 한번 확인해주신다면 해당 내용 반영하도록 하겠습니다!
감사합니다!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금같은 경우는 특히 엔티티 클래스이기 때문에 변경한 의도를 파악하기 힘들다보다 객체의 일관성을 유지하기 어렵다라는 포인트에서 Setter 사용을 지양하시길 리뷰드렸습니다.
필요하다면 setter를 사용할 수도 있습니다. 하지만 지금의 경우 엔티티를 식별하는 id가 변경될 수 있는데요. 이때 문제가 발생할 여지가 있을까요? 있다면 왜 문제가 될까요?
식별자 가변성에 대해서 고민해보시길 바랍니다.

지금 요구드리는 것은 아니고 추가적으로 불변 객체에 대해서 한 번 공부해보세요 😊


@Override
public boolean delete(Long id) {
String sql = "update card set deleted = false where id = :id";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

삭제요청이니 deleted = true가 되어야하지 않나요~?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 맞습니다. 수정하겠습니다. 감사합니다.

Comment on lines +23 to +33
id BIGINT AUTO_INCREMENT NOT NULL,
user_id VARCHAR(255) NOT NULL,
column_id INTEGER NOT NULL,
subject VARCHAR(255) NOT NULL,
contents VARCHAR(255) NOT NULL,
create_time TIMESTAMP NOT NULL,
update_time TIMESTAMP,
deleted boolean DEFAULT FALSE,
PRIMARY KEY (id),
FOREIGN KEY (user_id) REFERENCES `user` (id),
FOREIGN KEY (column_id) REFERENCES column (id)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

공백과 들여쓰기를 적절히 사용해서 코드를 읽기 쉽게 하면 좋을 것 같아요~ 예시는 참고만 해주세요!

Suggested change
id BIGINT AUTO_INCREMENT NOT NULL,
user_id VARCHAR(255) NOT NULL,
column_id INTEGER NOT NULL,
subject VARCHAR(255) NOT NULL,
contents VARCHAR(255) NOT NULL,
create_time TIMESTAMP NOT NULL,
update_time TIMESTAMP,
deleted boolean DEFAULT FALSE,
PRIMARY KEY (id),
FOREIGN KEY (user_id) REFERENCES `user` (id),
FOREIGN KEY (column_id) REFERENCES column (id)
id BIGINT AUTO_INCREMENT NOT NULL,
user_id VARCHAR(255) NOT NULL,
column_id INTEGER NOT NULL,
subject VARCHAR(255) NOT NULL,
contents VARCHAR(255) NOT NULL,
create_time TIMESTAMP NOT NULL,
update_time TIMESTAMP,
deleted boolean DEFAULT FALSE,
PRIMARY KEY (id),
FOREIGN KEY (user_id) REFERENCES `user` (id),
FOREIGN KEY (column_id) REFERENCES column (id)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 넵! 가독성이 훨씬 좋아보이네요. 수정하겠습니다. 감사합니다. !

Card card1 = new Card(1L, "ron2", 1, "subject", "contents", LocalDateTime.now(), LocalDateTime.now(), false);
Card card2 = new Card(2L, "vans", 2, "subject", "contents", LocalDateTime.now(), LocalDateTime.now(), false);
ResponseEntity<List<Card>> cardResponseEntity = new ResponseEntity<>(List.of(card1, card2), HttpStatus.OK);
public ResponseEntity<List<CardResponse>> findOne() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요청과 응답 DTO를 적절히 만들어주셨군요👍

@blossun blossun merged commit 948ad35 into codesquad-members-2022:team-10 Apr 7, 2022
Dae-Hwa pushed a commit that referenced this pull request Apr 8, 2022
[BE] 카드 이동 요청 dto 수정
GangWoon pushed a commit that referenced this pull request Apr 14, 2022
[iOS] NewCardView 보이기 기능 구현
eve712 pushed a commit that referenced this pull request Apr 14, 2022
* 카드 등록 - 새로운 카드 입력창 생성 기능 구현 (#36)

* feature: 등록버튼을 누르면 새로운 카드, 카드 개수 렌더링
등록카드의 등록버튼으로 리스트에 새로운 카드를 추가하고 리스트의 카드 개수를 렌더링한다.

* rename: todolistStore.js->todoListStore.js

* feat: 새로운 카드 데이터 post 요청
등록버튼을 누르면 새로운 카드의 데이터를 post 요청하여 업데이트

* 카드 수정 - 내용 수정 기능 구현 (#37)

* feat: 더블 클릭시 수정카드 전환, 수정버튼 활성화
롱클릭과 더블 클릭을 구분하고 수정카드에 기존과 다른 데이터가 입력되면 수정버튼을 활성화

* feat: 등록카드, 수정카드 데이터 fetch 요청
put 메소드로 변경된 카드 데이터를 서버에 보냄

* refactor: activationStore -> todoListStore
모델의 state를 todoListStore모듈에서 관리함

* 카드 삭제 - X 버튼 마우스 오버 이벤트 & 삭제 알럿창 구현 (#41)

* design: delete alert 창 구현

* feat: task x delete button mouseover 이벤트 구현

* mouseover 시 task item 색 변화
* mouseout 시 원래대로 돌아옴

* feat: task title을 이용하여 task 를 삭제하는 함수 구현

* feat: 삭제 Alert 창 생성 기능 구현

* design: delete-button hover 이벤트 클래스로 분리

* feat: Alert 창 결과에 따른 Task 스타일 변화 기능 구현

* remove: todolistStore.js

* rename: todoListStore.js

* 카드 이동 - 리스트 중간에 카드 추가 기능 구현(1) (#42)

* 카드 등록 - 새로운 카드 입력창 생성 기능 구현(1) (#30)

* [team-19] Todo-list 1주차 #1 코드리뷰 요청 (#32)

* Update issue templates

* docs: Update Readme

Readme 1차 업데이트

* docs: Update Readme

기술 스택 추가

* Design: reset scss 적용

* HTML, CSS 작업 - Header, Sidebar (#11)

* design: header HTML markup
Related to: #8

* design: header css style
Related to: #8

* design: sidebar HTML markup
Related to: #8

* design: sidebar css style
Related to: #8

* 메뉴 - 우측 히든 레이어 생성, 애니메이션 구현 (#12)

* feat: sidebar 메뉴 버튼
사이드바 메뉴 버튼 클릭시 사이드바 숨김,보임 기능 구현
Related to: #10

* design: sidebar 애니메이션
왼쪽방향으로 나타나고 오른쪽 방향으로 숨겨지는 애니메이션 구현
Related to: #10

* 메뉴 - 우측 히든 레이어 생성, 애니메이션 구현 (#13)

* feat: sidebar 메뉴 버튼
사이드바 메뉴 버튼 클릭시 사이드바 숨김,보임 기능 구현
Related to: #10

* design: sidebar 애니메이션
왼쪽방향으로 나타나고 오른쪽 방향으로 숨겨지는 애니메이션 구현
Related to: #10

* feat: action분리
action에 따라 sidebar 리스트의 comment를 다르게 출력함
Related to: #10

* feat: timestamp 기능 구현
현재 시간을 기준으로 투두리스트 작성 및 변경 시간을 보여주는 timestamp 구현
Related to: #10

* feat: 을/를, 으로/로 구분
단어의 마지막 글자 종성에 따라 모음을 다르게 렌더하는 기능 구현
Related to: #10

* HTML, CSS 작업 - Card List (#14)

* design: main column list html markup

Related to : #9

* move: svg file move to public/svg

* 기존 public 에 있던 svg 파일을 svg 폴더 내로 이동
* icon-add.svg 파일 추가

Related to : #9

* Design: font mixin 함수 추가

Related to : #9

* design: column list scss style 작성

Related to: #9

* design: column task list scss style 작성

Related to: #9

* design: task commnet padding 을 margin 으로 변경

Related to: #9

* design: sccs convert to css

Related to: #9

* fix: icon svg 파일 경로 수정

Related to: #9

* chore: 빌드환경구성 (#16)

babel, webpack 적용
Related to: #15

* 메뉴 - 사용자 액션 리스트 구현 (#19)

* feat: sidebar 액션 리스트
히든레이어 영역을 애니메이션 효과와 함께 숨김,보임 기능 구현
Related to: #17

* design: sidebar 액션리스트 애니메이션
Related to: #17

* move: package.json, gitignore

* feat: sidebar 스크롤 기능 구현
액션리스트 기록이 많아지면 스크롤을 이용하여 다음 기록을 확인할 수 있음
Related to: #17

* design: 액션리스트 스크롤 구현
Related to: #17

* feature: json server 생성 및 db.json 추가 (#21)

* json server 설치하고 db.json 에 필요한 데이터들을 추가함
Related to: #18

* HTML, CSS 작업 - Card (#22)

* feat: todo-list 입력창 높이 자동 조절
todo-list를 입력하거나 지울 때 입력창의 높이를 자동으로 조절하는 기능 구현
Related to: #20

* design: column button hover color
칼럼 타이틀의 +,x 버튼을 hover할 때 버튼 색상 변경
Related to: #20

* design: 수정카드 디자인 구현
Related to: #20

* 리팩토링 - 1주차 리뷰 반영  (#24)

* refactor: getFinalConsonant 매직넘버 제거
Related to: #23

* refactor: calcTimeForToday 함수 리팩토링
* 매직 넘버 제거
* DayDifference 식 수정
* 몇 년전 조건 추가
Related to: #23

* refactor: writeTime -> timeStamp
Related to: #23

* refactor: identifyCategory 함수 리팩토링

* 구조 분해 할당 적용

Related to: #23

* refactor: svg 파일 경로 변수로 분리

* svg 파일 경로를 constants의 imagePath에 변수로 생성해서 관리하도록 변경

Related to: #23

* feat: fetchData 함수 구현

Related to: #23

* chore: bundle.js

Related to: #23

* refactor: sidebar model 리팩토링

Related to: #23

* refactor: activationStore import 방식 변경

Related to: #23

Co-authored-by: Hemdi <[email protected]>
Co-authored-by: Hemudi <[email protected]>

* 카드 등록 - 새로운 카드 등록 기능 구현 (#29)

* feat: todolist column과 task를 스크립트로 렌더링
list view와 task view를 클래스로 생성하고 db.json의 todolist를 하나의 배열로 묶음

* feat: column add button
칼럼의 추가버튼으로 등록카드 생성,삭제 기능 구현

* feat: task cancle button
등록카드의 취소버튼을 누르면 등록카드를 삭제하는 기능 구현

* refactor: 메인 렌더링 영역을 list에서 main으로 수정
entry point에서 mainInit의 parent를 list에서 main으로 리팩토링

* refactor: input event를 메인에서 task 모듈로 분리
입력창을 autoResize하는 이벤트를 task 모듈로 분리함

* rename: index.js

* feat: 등록버튼 활성화 기능 구현
등록카드에 내용을 입력하면 등록버튼을 활성화, 입력할 수 있는 최대 글자수는 500자

* refactor: registration activation을 todoListStore에서 관리
activiation관리를 task에서 todoListStore로 변경

Co-authored-by: Hemdi <[email protected]>
Co-authored-by: Hemudi <[email protected]>

* Revert "카드 등록 - 새로운 카드 입력창 생성 기능 구현(1) (#30)" (#31)

This reverts commit 7155f85.

* feat: 칼럼 사이 카드 이동
마우스 포인터를 기준으로 드래그중인 카드 아래 새로운 카드 존재 여부에 따라 해당 카드 앞 또는 가장 아래에 드래그 카드 추가

* rename: deleteMenu.js->alertDelete.js

* feat: 드래그앤 드랍 적용
task 인스턴스에 드래그앤드랍 기능 적용

* refactor: export 방식 변경

Co-authored-by: Hemdi <[email protected]>
Co-authored-by: Hemudi <[email protected]>

* feat: task id 추가 + id를 이용한 삭제 기능 구현 (#44)

* 기존 task title 을 이용해 삭제했던 기능을 id 를 이용해 삭제하는 방식으로 변경

Co-authored-by: Hemdi <[email protected]>
Co-authored-by: Hemudi <[email protected]>
SangHwi-Back added a commit that referenced this pull request Apr 15, 2022
[Feat] (iOS) Badge 정보 업데이트 (#26)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-BE Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants