WIL

level·2023년 8월 27일

TIL

목록 보기
86/95

nest g res : Generate a new CRUD resource

DTO를 PartialType으로 재사용하기

export class UpdateDto extends PartialType(CreateDto) {}

<table class="table">

부트스트랩 (Bootstrap) 그리드 시스템을 활용하여 테이블의 크기를 조절

부트스트랩 그리드 시스템은 열(col)과 행(row)을 사용하여 페이지를 나누고 레이아웃을 조절

await 을 붙여주지 안으면 promise 로 타입이 지정되서 엔티티에 정의된 타입과 달라서 에러가 남.
커서를 올리면 타입을 알려주니까 엔티티 타입이랑 비교
create, insert

컨트롤 스페이스 + 설정할 요소 선택 => 자동 임포트

댓글의 수정 버튼을 눌렀을때 모달을 띄우고 모달에 기존댓글내용을 붙여주는 과정에서 null이 뜨는 오류가 났다.
타겟을 불러오는 과정에서 오류가 난것으로 보고 그 부분을 수정해주었다.
버튼의 카드를 불러온 다음 그 카드의 text를 불러오는 것으로 수정했다.

수정 전

const commentId = button.getAttribute('data-comment-id');
const commentContent = button.parentNode.querySelector('.fs-md.text-muted.mb-1').textContent;

      const editCommentContent = document.getElementById('editCommentContent');
      editCommentContent.value = commentContent;

      editCommentModal.show();

수정 후

const commentId = button.getAttribute('data-comment-id');
          const commentCard = button.closest('.comment-card');
          const commentContent = commentCard.querySelector('.fs-md.text-muted.mb-1').textContent;
          const editCommentContent = document.getElementById('editCommentContent');
          editCommentContent.value = commentContent;

          editCommentModal.show();

0개의 댓글