분류 전체보기

Task Scheduling
NestJS의 Task Scheduling원하는 time interval, 또는 정해진 시간과 날짜에 fuction을 실행할 수 있다.고정된 날짜/시간, 반복 간격 또는 지정된 간격마다 특정 메서드나 함수를 한 번 실행되도록 예약할 수 있다. NestJS 문서Task SchedulingTask scheduling allows you to schedule arbitrary code (methods/functions) to execute at a fixed date/time, at recurring intervals, or once after a specified interval. In the Linux world, this is often handled by packages like cron at the..

relationship 옵션 ( eager relationships, Lazy relations)
eager relationships@ManyToMany(type => Category, category => category.questions, {eager: true})@JoinTable()categories: Category[];Eager relation은 데이터베이스에서 엔티티를 로드할 때마다 자동으로 relation 필드들을 로드한다.너무 많은걸 load 하면 서버 부하가 심하므로 주의해야 한다.// 나쁜예 - 많은 정보를 load 하고 있다.subscription { cookedOrders { restaurant { name } total customer { email restaurants { owner { email..

for...of와 forEach 차이
🧐 for...of 루프- 반복을 중간에 멈출 수 있다🧐 forEach 메서드- 중간에 반복을 멈출 수 없다.- 예외를 던지는 방법을 사용하면 멈출 수는 있지만 권장되지 않음 const items = [ { name: 'Pickle', extra: 1 }, { name: 'Size', choices: ['Small', 'Medium', 'Large'] }]; for...of 루프for (const item of items) { console.log(item.name);}for...of 루프는 배열이나 다른 이터러블 객체의 요소를 반복하는 데 사용된다.반복을 중간에 멈출 수 있다. forEach 메서드items.forEach(item => { console.log(item.name);});..

Relations 정리 Many-to-Many, @JoinTable()
@Many-to-Many데이터베이스에서 두 엔터티가 서로 다수의 관계를 가질 수 있는 경우를 의미한다.예를 들어, 학생과 강좌의 관계는 다대다 관계이다. 한 학생은 여러 강좌를 수강할 수 있고, 한 강좌도 여러 학생이 수강할 수 있다.Many-to-Many 관계를 설정하려면 @ManyToMany 어노테이션을 사용하고, 중간 테이블을 명시하기 위해 @JoinTable 어노테이션을 사용한다. import { Entity, PrimaryGeneratedColumn, Column, ManyToMany, JoinTable } from 'typeorm';import { Course } from './Course';@Entity()export class Student { @PrimaryGeneratedColu..