포트폴리오 과정의 'N:M 등록 및 조회/회원가입'을 처리하는 중 질문할 것이 나와 질문을 드립니다. User의 생성부분을 구현하기 위해 CreateUserInput 타입을 만들었고 해당 부분에서 유저 아이디, 패스워드, 이메일 등을 기입하도록 하였습니다. @InputType() export class CreateUserInput { @Field(() => String) loginId: string; @Field(() => String) @MinLength(8) password: string; @Field(() => String) name: string; @Field(() => String) address: string; @Field(() => String) @IsPhoneNumber('KR') phone: string; @Field(() => String) @IsEmail() @Transform(({ value }) => value.toLowerCase()) email: string; } 그리고 User의 수정 부분을 구현하기 위해 UpdateUserInput 타입을 만들었습니다. 단순히 OmitType으로 CreateUserInput 부분을 넘겨 만들었습니다만, API 동작에서 패스워드 부분을 넘기지 않으면 필수 항목을 입력하지 않았다고 수정이 되지 않았습니다. @InputType() export class UpdateUserInput extends OmitType(CreateUserInput, ['loginId', 'email'], InputType) { } 그래서 그냥 PartialType까지 상속하고 싶었습니다만 타입스크립트도 다중 상속을 지원하지 않는지 OmitType과 PartialType을 함께 쓸 수 없었습니다. 이러면 그냥 CreateUserInput처럼 전부 구현할 수 밖에 없나요? API 부분에서 넘기지 않은 부분은 그냥 그대로 냅두는 것을 목적으로 합니다.
1. 강의를 따라 하다 보면 중간 테이블의 이름이 product_product_tags_product_tag 라고 만들어지는데 중간 테이블의 이름은 어떤 걸 기준으로, 어떤 규칙으로 만들어지는 건가요? 2. 자동으로 생성된 중간 테이블의 이름을 임의로 변경해도 되나요? 3. 지금 만들어진 테이블들은 저희가 만들어 놓은 entity 파일을 기준으로 서버를 실행하면 TypeOrm 이 만들어 주는 게 맞는 거죠?
안녕하세요. ELK와 Redis를 이용하여 검색 API 숙제를 하는 중 질문이 있습니다. 캐시를 이용하여 검색 결과를 반환할 때, 폴링 등을 통해서 새로운 데이터가 들어온다면 기존의 캐시를 이용하지 못할 것 같은데요, 제 생각으로는 강의중 말씀해주신 정확도를 포기하는 대신 성능을 얻기 위해서 캐시를 일단 TTL 만료 이전까지 사용해야 할 것 같습니다만, 좋은 방법이 무엇일까요? 강의 내에서는 폴링을 통해 테이블 컬럼의 전체가 아닌 일부 컬럼만을 Elasticsearch에 넣으셨었는데 전체를 넣지않는 이유가 있을까요? (데이터가 커져서? Join 데이터를 포함하면 많아질 것 같기는 합니다.) 일부만 넣는 이유가 있다면 게시판 검색을 만든다고 생각하면 제가 생각한 아래의 방식으로도 사용되는 편일까요? 1) ID를 포함하여 검색 결과 목록에 노출될 제목 등을 얻어오는 데에 ELK와 캐시를 이용 2) 상세보기를 클릭했을 때는 DB 인덱스로 사용되는 ID를 이용하여 디비에서 필요한 모든 컬럼을 얻어오기 강의 막바지를 향해 달려가고 있습니다. 좋은 강의 제공해주셔서 감사드립니다.
공식문서 힌트에서, Prefer applying filters by using classes instead of instances when possible. It reduces memory usage since Nest can easily reuse instances of the same class across your entire module. 와 같이, 인스턴스 대신에 클래스를 사용하라고 나와있는데요, 클래스를 사용하는 것이 UseFIlter(HttpExceptionFilter) 가 아니라, UseFIlter(new HttpExceptionFilter()) 이렇게 사용하는 건가요..? 공식문서에서 클래스를 사용하는 것이 권장된다고 나와 있고 클래스로 사용하는 것이 1번인줄 이해했는데, 그 문장 이후에도 2번 과 같이 쓰여서 헷갈려서 질문 올립니다!
문제점: 제목 그대로 유닛테스트 도중 'findByEmail' 의 함수를 못찾고 있습니다. <에러발생 사진> <제 코드> users.service.spec.ts users.service.ts 추가질문 : 추가 질문으로 위로 올려 보시면 users.Service.spec.ts 에서 두번째 사진중 빨간네모박스 체크를 했는데 기존 UsersServie 코드로 하면 모듈에서 인식을 못하는지 아래와 같은 에러가 떴습니다. 이거 다른해결 방법이 있나요? < 모듈 사진추가> users.module.ts app.module.ts
강의 잘듣고 있는데 제가 아직 초보라서 강의를 듣고 게시판이나 로그인 같은것들을 잘 구현할수 있을지 nest js 와 잘 연동할수 있을지 감이 안잡혀서요 혹시 prisma 강의에서 로그인, 로그아웃 게시판 만들기 이미지 업로드 구현 같은 구체적인 기능 구현 강의는 추가 안되나요?
질문1 prisma 설정하고 미들웨어 사용해보기까지의 schema.prisma 코드가 있으신가요? 질문2 그리고 prisma.push 하면 schema.prisma 에 모델로 설정되어 있는 것들만 스키마의 테이블로 등록 되는건가요? 혹시 없는 테이블들이 pgadmin 에서 미리 만들어져 있을 경우 어떻게 되나요? prisma.push 만 사용하면 장고처럼 migrations migrate 따로 관리 안해도 되나요? 질문3 프리즈마 서비스 생성자 함수에 다음과 같이 설정하면 프리즈마 쿼리와 에러 정보를 확인 할수 있다 그렇게 생각하면 되나요? 그리고 그게 미들웨어 방식으로 설정하는 거죠? 질문4 아래 코드에서 params 는 백엔드에서 orm 으로 넘기는 파라미터 정보 next 는 디비로부터 오는 정보가 맞나요? 그리고 이 미들웨어는 자동으로 실행되는건가요? return 값은 어디로 가나요?
제 본인 프로젝트에 해당되는 내용입니다. 구글인증까지는 무난하게 되는데요. 1. 파란색이 Entity() 에서 뽑아온 Column명에 해당하는 변수로 알고 있습니다. 2. 구글인증을 통과한 후에 name, email, password를 req.user로 넣어서 보내주는 걸로 알고 있습니다. <질문의도> name, email, password를 req.user객체에 넣어서 받았으니, req.user.name , req.user.email , req.user.password, 데이터를 꺼내서 개별적으로 컬럼에 저장되는 변수에 userName = req.user.name userEmail = req.user.email userPassword = req.user.password 위와 같이 저장되어야 하지 않아 생각해 봅니다. 그런데 아래 오류메시지의 경우 <property 'email' does not exist on type 'User & Pick<User, userEmail, userName, userPassword> ↑ 왜(why) req.user에서 userEmail, userName, userPassword를 찾고 있는지 이해가 가지 않습니다. ---------------------------------------------------------- 제가 지금 머릿속에서 뭔가 꼬인 것 같습니다. 답변 부탁드릴께요. 진도를 못나가고 있어요ㅠ
테스트를 잠깐 해 보았는데요. 다른 모듈에있는 Service를 사용하기 위해서는 (지금까지 배운 내용에 한해서) 1. B Module 에 A Module , A Service 등록하기. 2. B Module 에 A Service 만 등록하기 3. A Module 에서 A Service 를 exports 에 등록하고, B Module에서는 A Module 을 등록하기 정도 생각이 들었고 테스트 해 보았습니다. 강사님꼐서는 1번과 3번을 예시로 들어주셨는데요, 좋지않은 예시(1번) 에서 CatsModule 까지 import 한 이유가 있을까요? AppModule에 CatsModule을 import 하지 않고, CatsService 만 providers 에 등록해 준 것과 다른가요? 아니면, 2번 에서 암시적으로 A Module이 import된다거나 하는게 있는건가요? ++ 인스턴스 가 새로 생성되는 것이라면, 서버사이드에서 는 굳이 싱글톤이 아니어도 될 인스턴스 객체들이 많을 것이라 보이는데, 다른 이유가 있나요?
안녕하세요. 위 파일은 product.entity.ts 파일입니다. product.entity.ts 파일에서 @JoinColumn() 을 productSaleslocation 테이블에만 해주시는 이유가 무엇인지 알 수 있을까요? product테이블과 서로 관계를 맺고 있는 productSaleslocation 테이블과 users 테이블에도 @JoinColumn()을 해줘야 하는 것 아닌가요? 상품테이블은 productCategory테이블과(상품카테고리_id)ManyToOne 관계를 맺고 있으며, User 테이블과 (유저_id) ManyToOne 관계를 맺고 있어서 각각 JoinColumn을 해줘야 하는 것으로 생각했는데, 제 생각이 틀린 것일까요? 좋은 강의 해주셔서 진심으로 감사합니다!
안녕하세요. 좋은 강의 감사합니다. entity 구현 1:1 강의에서 npm i 후 package: '@angular-devkit/core@15.1.4', Unsupported engine 이라고 나오는데, 이렇게 터미널에 찍히는 이유가 무엇인가요? 계속 사용할 경우 어떤 문제가 발생하나요? npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@angular-devkit/core@15.1.4', npm WARN EBADENGINE required: { npm WARN EBADENGINE node: '^14.20.0 || ^16.13.0 || >=18.10.0', npm WARN EBADENGINE npm: '^6.11.0 || ^7.5.6 || >=8.0.0', npm WARN EBADENGINE yarn: '>= 1.13.0' npm WARN EBADENGINE }, npm WARN EBADENGINE current: { node: 'v16.12.0', npm: '8.1.0' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@angular-devkit/schematics@15.1.4', npm WARN EBADENGINE required: { npm WARN EBADENGINE node: '^14.20.0 || ^16.13.0 || >=18.10.0', npm WARN EBADENGINE npm: '^6.11.0 || ^7.5.6 || >=8.0.0', npm WARN EBADENGINE yarn: '>= 1.13.0' npm WARN EBADENGINE }, npm WARN EBADENGINE current: { node: 'v16.12.0', npm: '8.1.0' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@angular-devkit/schematics-cli@15.1.4', npm WARN EBADENGINE required: { npm WARN EBADENGINE node: '^14.20.0 || ^16.13.0 || >=18.10.0', npm WARN EBADENGINE npm: '^6.11.0 || ^7.5.6 || >=8.0.0', npm WARN EBADENGINE yarn: '>= 1.13.0' npm WARN EBADENGINE }, npm WARN EBADENGINE current: { node: 'v16.12.0', npm: '8.1.0' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@angular-devkit/core@15.0.4', npm WARN EBADENGINE required: { npm WARN EBADENGINE node: '^14.20.0 || ^16.13.0 || >=18.10.0', npm WARN EBADENGINE npm: '^6.11.0 || ^7.5.6 || >=8.0.0', npm WARN EBADENGINE yarn: '>= 1.13.0' npm WARN EBADENGINE }, npm WARN EBADENGINE current: { node: 'v16.12.0', npm: '8.1.0' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@angular-devkit/schematics@15.0.4', npm WARN EBADENGINE required: { npm WARN EBADENGINE node: '^14.20.0 || ^16.13.0 || >=18.10.0', npm WARN EBADENGINE npm: '^6.11.0 || ^7.5.6 || >=8.0.0', npm WARN EBADENGINE yarn: '>= 1.13.0' npm WARN EBADENGINE }, npm WARN EBADENGINE current: { node: 'v16.12.0', npm: '8.1.0' } npm WARN EBADENGINE } npm WARN deprecated apollo-datasource@3.3.2: The `apollo-datasource` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. npm WARN deprecated apollo-server-errors@3.3.1: The `apollo-server-errors` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. npm WARN deprecated apollo-server-plugin-base@3.7.1: The `apollo-server-plugin-base` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. npm WARN deprecated apollo-server-types@3.7.1: The `apollo-server-types` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead npm WARN deprecated apollo-server-express@3.11.1: The `apollo-server-express` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. npm WARN deprecated apollo-reporting-protobuf@3.3.3: The `apollo-reporting-protobuf` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/usage-reporting-protobuf` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. npm WARN deprecated apollo-server-env@4.2.1: The `apollo-server-env` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/utils.fetcher` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. npm WARN deprecated subscriptions-transport-ws@0.11.0: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md npm WARN deprecated apollo-server-core@3.11.1: The `apollo-server-core` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. added 806 packages, and audited 807 packages in 21s 98 packages are looking for funding run `npm fund` for details found 0 vulnerabilities
아래 질문과 동일한 에러가 발생해서 알려주신 해결책으로 진행했는데...이번에는 다른 문제가 발생했습니다. Error: Access denied for user 'root'@' localhost ' (using password: YES) 구글링으로 아무리 찾아서 해보아도 해결이 안되고 있습니다. 아래 테이블 만들었구요 권한문제인가 싶어서 user 테이블의 root 의 authentication_string 을 바꿔도 해쉬값으로 저장되지도 않고...현재는 NULL로 해놓고 있는데 도무지 해결이 되지 않습니다. 도와주세요 ㅠㅠ
yarn seed를 통해 더미데이터를 생성하려 했으나 "seeder is not a constructor" 라는 에러에 마주칩니다. 어느 부분이 잘못됫는지 알아보기 위해 에러코드를 살펴봤으나 제 코드 부분이 아닌 typeorm-extension 부분에서 에러가 나는것 같아 해결하기 어렵습니다. TypeError: seeder is not a constructor at /Users/jinyoung/Desktop/try-own-version/practice-version/node_modules/typeorm-extension/src/seeder/module.ts:122:19 at Generator.next (<anonymous>) at fulfilled (/Users/jinyoung/Desktop/try-own-version/practice-version/node_modules/typeorm-extension/dist/seeder/module.js:5:58) dataSource.ts import dotenv from 'dotenv'; //dataSource에 entity를 입력해줄때는 절대경로면 못찾아온다. 그래서 상대 경로로 써줘야함 import { User } from './src/users/entities/user.entity'; import { DataSource } from 'typeorm'; const mode = process.env.NODE_ENV || 'development'; dotenv.config({ path: process.cwd() + `/.env.${mode}` }); const dataSource = new DataSource({ type: 'mysql', host: 'localhost', port: 3306, database: process.env.DB_DATABASE, username: process.env.DB_USERNAME, password: process.env.DB_PASSWORD, charset: 'utf8mb4_general_ci', entities: [User], migrations: [__dirname + '/src/migrations/*.ts'], synchronize: true, logging: true, }); export default dataSource; package.json seed부분 설정 "seed": "ts-node ./node_modules/typeorm-extension/dist/cli/index.js seed -d ./dataSource.ts" database/seeds/create-initial-data.ts import { User } from '../../users/entities/user.entity'; import { DataSource } from 'typeorm'; import { Seeder, SeederFactoryManager } from 'typeorm-extension'; export class UserSeeder implements Seeder { async run( dataSource: DataSource, factoryManager: SeederFactoryManager, ): Promise<any> { const userRepository = dataSource.getRepository(User); await userRepository.save({ email: 'ggg@gmail.com', firstName: 'sfvs', lastName: 'wdwdwd', nickname: 'hihi', }); } } typeorm-extension 버젼 "typeorm-extension": "^2.4.2", "typeorm": "^0.3.12", 시도해본 내용 1. dataSource 생성시 new DataSource({ ... 중략 seed:["create-initial-data.ts 경로"] 추가 }) 2. db 삭제후 다시 생성(생성시 테이블 싱크까지 맞춘후 seed 시도) 3. typeorm-extension 버전 문제일까 해서 다운그레이드 시도 4. typeorm 0.3대는 유지하고 0.3.11, 0.3.10등 다른 버전으로 시도 결과 모두 실패