inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

172만명의 커뮤니티!! 함께 토론해봐요.

[세션30] fetchUser시 UseGuard 401에러

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

안녕하세요, jwt토큰을 입력하여 사용자 인가를 받고 싶은데 그 과정에서 계속 오류가 나서 문의드립니다. 제가 확인하기로는 코드도 정확히 입력하고, HTTP HEADERS로 보내주는 토큰도 문제 없어서요. 에러 강의에서 jwt를 넣어주지 않았을 때 발생한다는 에러가 발생합니다. 제가 보기에는 토큰값이 잘못된것 같은데, login으로 받아온 토큰을 바로 넣는거라 만료가 되지도 않았을텐데 해결이 안되네요. 제 코드는 아래와 같습니다. users.resolver.ts // users.resolver.ts import { Args, Int, Mutation, Query, Resolver } from '@nestjs/graphql'; import { User } from './entities/user.entity'; import { UsersService } from './users.service'; import * as bcrypt from 'bcrypt'; import { UseGuards } from '@nestjs/common'; import { GqlAuthAccessGuard } from '../auth/guards/gql-auth.guard'; // import { AuthGuard } from '@nestjs/passport'; // 추가 @Resolver() export class UsersResolver { constructor( private readonly usersService: UsersService, // ) {} @UseGuards(GqlAuthAccessGuard) // 수정 @Query(() => String) fetchUser(): string { console.log('인가에 성공하였습니다'); return '인가에 성공하였습니다.'; } @Mutation(() => User) async createUser( @Args('email') email: string, @Args('password') password: string, @Args('name') name: string, @Args({ name: 'age', type: () => Int }) age: number, ): Promise<User> { // const hashedPassword = await bcrypt.hash(password, 10); // return this.usersService.create({ email, hashedPassword, name, age }); // } return this.usersService.create({ email, password, name, age }); } } gql-auth.guard.ts import { ExecutionContext } from '@nestjs/common'; import { GqlExecutionContext } from '@nestjs/graphql'; import { AuthGuard } from '@nestjs/passport'; export class GqlAuthAccessGuard extends AuthGuard('access') { getRequest(context: ExecutionContext) { const gqlContext = GqlExecutionContext.create(context); return gqlContext.getContext().req; } } jwt-access.strategy.ts import { PassportStrategy } from '@nestjs/passport'; import { ExtractJwt, Strategy } from 'passport-jwt'; export class JwtAccessStrategy extends PassportStrategy(Strategy, 'access') { constructor() { super({ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), secretOrKey: '나의비밀번호', }); } validate(payload) { console.log('페이로드', payload); return { id: payload.sub, }; } } auth.module.ts import { Module } from '@nestjs/common'; import { AuthResolver } from './auth.resolver'; import { AuthService } from './auth.service'; import { UsersModule } from '../users/users.module'; import { JwtModule } from '@nestjs/jwt'; import { JwtAccessStrategy } from './strategy/jwt-access.strategy'; @Module({ imports: [ JwtModule.register({}), UsersModule, // 서비스를 각각 불러오기보다는 module을 통으로 불러오는게 낫다. 원래는 import 에 TypeOrmModule.forFeature([Users])& providers에 UsersServie가 있었음. ], providers: [ JwtAccessStrategy, AuthResolver, // AuthService, // ], }) export class AuthModule {}

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
yskim 댓글 1 좋아요 0 조회수 320

선생님 데이터 import가 안돼요 ㅠㅠ

미해결

[개정판] 파이썬 머신러닝 완벽 가이드

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 강의 내용을 질문할 경우 몇분 몇초의 내용에 대한 것인지 반드시 기재 부탁드립니다. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 선생님 보스턴 가격예측 데이터 임포트가 안돼요 ㅠㅠ

  • python
  • 머신러닝
  • 통계
이호준 댓글 2 좋아요 0 조회수 497

'블랙핑크' 검색 시에만 오류가 뜨는 현상

미해결

[신규 개정판] 이것이 진짜 크롤링이다 - 실전편 (인공지능 수익화)

안녕하세요. 강사님 아래 코드에서 '블랙핑크' 를 검색할 때 Traceback (most recent call last): File "c:\pratice_crolling\심화1_\03_스포츠 뉴스 크롤링.py ", line 52, in <module> print(article_title.text.strip()) ^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'text' 다음과 같은 오류가 뜹니다 ㅠㅠ CSS 선택자, 오타도 모두 맞게 확인이 되는데 왜 저 검색어만 오류가 뜰까요ㅠㅠ? # -*- coding: euc-kr -*- # 네이버에서 손흥민, 오승환과 같은 스포츠 관련 검색어 크롤링하기 import requests from bs4 import BeautifulSoup import pyautogui import time search = pyautogui.prompt("어떤 것을 검색하시겠어요?") response = requests.get(f"https://search.naver.com/search.naver?sm=tab_hty.top&where=news&query={search}&oquery=%EC%98%B7%EC%9C%BC%ED%99%98&tqi=i74G%2FdprvTossZPeMhCssssssko-058644") html = response.text soup = BeautifulSoup(html, "html.parser") articles = soup.select(".info_group") for article in articles: # '네이버뉴스' 가 있는 기사만 추출한다. (<a> 하이퍼링크가 2개 이상인 경우에 해당) links = article.select("a.info") if len(links) >=2 : url = links[1].attrs['href'] response = requests.get(url, headers={'User-agent':'Mozila/5.0'}) html = response.text soup = BeautifulSoup(html, "html.parser") # 스포츠 기사인 경우 if "sports" in url: article_title = soup.select_one("h4.title") article_body = soup.select_one("#newsEndContents") # 본문 내에 불필요한 내용 제거 p태그와 div태그의 내용은 출력할 필요가 없다. 없애주자. p_tags = article_body.select("p") # 본문에서 p 태그인 것들을 추출 for p_tag in p_tags: p_tag.decompose() div_tags = article_body.select("div") # 본문에서 div 태그인 것들을 추출 for div_tag in div_tags: div_tag.decompose() # 연예 기사인 경우 elif "entertain" in url: article_title = soup.select_one(".end_tit") article_body = soup.select_one("#articeBody") # 일반 뉴스 기사인 경우 else: article_title = soup.select_one("#title_area") article_body = soup.select_one("#dic_area") # 출력문 print("==================================================== 주소 ===========================================================") print(url.strip()) print("==================================================== 제목 ===========================================================") print(article_title.text.strip()) print("==================================================== 본문 ===========================================================") print(article_body.text.strip()) #strip 함수는 앞 뒤의 공백을 제거한다. time.sleep(0.3)

  • python
  • 웹-크롤링
댓글 2 좋아요 0 조회수 325

몽고 db를 백업방법을 부탁합니다.

해결됨

mongoDB 기초부터 실무까지(feat. Node.js)

mongodump로 로컬에 설치된 몽고 db를 백업하려 하는데 아래의 오류가 나옵니다.해결방법을 부탁합니다. - (mongodump.exe)를 별도로 다운받아야 하나요? -최신버전에는 mongodump.exe파일이 설치되어 있지 않습니다. [오류메세지] 'mongodump'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다

  • javascript
  • node.js
  • aws
  • mongodb
  • rest-api
  • dbms/rdbms
  • 데이터-엔지니어링
Jongwoo Park 댓글 1 좋아요 0 조회수 626

첫 메인 화면 $isLogin 인증 부분 궁금한점이 있습니다.

해결됨

Svelte REST-API 프로젝트

처음 화면에서 http://127.0.0.1:3012 을 호출하면 http://127.0.0.1:3012/articles/all 주소로 자동 이동합니다. 궁금한 점은 articles/all 화면에서 제일 상단에 인증되면 보이는 입력칸이 보입니다. {#if $isLogin} 으로 조건이 되어도 true 인지 입력칸이 보입니다. 로그아웃 버튼을 누르면 로그인을 하지 않은 첫화면인데 작동이 되어 로그아웃으로 해제 됩니다. 이 부분이 궁금합니다. <script> import ArticleHeader from '../components/ArticleHeader.svelte'; import ArticleList from '../components/ArticleList.svelte' import ArticleAddForm from '../components/ArticleAddForm.svelte' import Comments from '../pages/Comments.svelte' import { isLogin } from '../stores' import { Route } from 'tinro' </script> <ArticleHeader /> <main class="slog-main "> {#if $isLogin} <ArticleAddForm /> {/if} <ArticleList /> <Route path="/comments/:id" > <Comments /> </Route> </main> function setIsLogin() { const checkLogin = derived(auth, $auth => $auth.Authorization ? true : false) return checkLogin }

  • rest-api
  • svelte
  • 인증
  • islogin
재우닝 댓글 2 좋아요 0 조회수 576

회원 가입을 위해 정보를 입력해주세요 과제 정답지 어디가면 알 수 있나요?!

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

display-flex; 이게 안먹혀서 position을 주고 했는데<!DOCTYPE html> <html lang="ko"> <head> <title>회원가입</title> <!-- <link href="homework01.css" rel="stylesheet"> --> <style> .box{ position: absolute; top: 60px; left: 625px; width: 670px; height: 960px; border: 1px solid #AACDFF; border-radius: 20px; box-shadow: 7px 7px 39px 0px #0068FF40; } .head{ position : fixed; top: 132px; left: 725px; width: 466px; height: 94px; color: #0068FF; } .head2{ position : fixed; top: 286px; left: 725px; width: 158px; height: 23.65px; color: #797979; } .head3{ position : fixed; top: 387px; left: 725px; width: 158px; height: 23.65px; color: #797979; } .head4{ position : fixed; top: 488px; left: 725px; width: 158px; height: 23.65px; color: #797979; } .head5{ position : fixed; top: 589px; left: 725px; width: 158px; height: 23.65px; color: #797979; } .wo{ position : fixed; top: 719x; left: 850px; width: 200px; height: 23.94px; color: #797979; } .man{ position : fixed; top: 719x; left: 1000px; width: 200px; height: 23.94px; color: #797979; } .ch{ position : fixed; top: 793x; left: 738px; width: 509px; height: 21px; color: #797979; font-size: 13px; } .box2{ position: fixed; top: 895px; left: 725px; width: 470px; height: 75px; border: 1px solid #0068FF; border-radius: 10px; } .text{ position : fixed; top: 899x; left: 925px; width: 70px; height: 27px; color: #0068FF; } </style> </head> <body> <div class="box"> <div class="head"><h1>회원 가입을 위해<br> 정보를 입력해주세요</h1> <div class="head2">*이메일 </div> <div><br><br></div><br><br><hr> <div class="head3">*이름 </div> <div><br><br></div><br><br><hr> <div class="head4">*비밀번호 </div> <div><br><br></div><br><br><hr> <div class="head5">*비밀번호 확인</div> <div><br><br></div><br><br><hr> <br><br> <div class="wo"><input type="radio" name="gender">여성</div> <div class="man"><input type="radio" name="gender">남성</div> <br><br><br><br> <div class="ch"><input type="checkbox">이용약관 개인정보 수집 및 이용, 마케팅 활용 선택에 모두 동의합니다.</div> <div><br><br></div><hr> <br><br> <div class="box2"> <div class="text"><br>가입하기</div> </div> </div> </body> </html> 이렇게 코드로 모양만 갖췄는데 어려워서 코드리뷰를 하고싶어서 그러는데 정답지가 있나요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
보이지않니 댓글 1 좋아요 0 조회수 573

ApolloDriverConfig를 찾지를 못해요

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

import { Module } from '@nestjs/common'; import { BoardModule } from './apis/boards/boards.module'; import { GraphQLModule } from '@nestjs/graphql'; import { ApolloDriver } from '@nestjs/apollo'; @Module({ imports: [ BoardModule, GraphQLModule.forRoot<apolloDriverConfig>({ driver: ApolloDriver, autoSchemaFile: 'src/commons/graphql/schema.gql', }), ], }) export class AppModule {} yarn add @nestjs/graphql @nestjs/apollo graphql apollo-server-express 이거 추가하고 수업 따라서 진행하는데 apolloDriverConfig이놈만 찾지를 못하네요... 버전이 달라서 그런걸까요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
신찬영 댓글 1 좋아요 0 조회수 383

08-06 docker my-backend 접속이 안됩니다 ㅠㅠ

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

밑에 질문글이 있어서 똑같이 해봤는데 계속 안되네요 ㅠ..ㅠ db접속까지는 되는데 backend에서 접속이 계속 안됩니다... 살려주세요

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
건태 댓글 2 좋아요 0 조회수 425

개인 프로젝트 관련 질문

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

안녕하세요 드디어 강의 완강했습니다!!^^ 뒷부분 부터는 퀴즈가 없어서 비교적 빨리 수강했네요. 강의 후에 해봐야 할 것들을 생각해보았는데 조언을 듣고 싶어서 질문남깁니다. 일단은 지금 것 했던 "나만의 ~~프로젝트"를 리팩토링(성능/안정성/가독성/로직개선)하고 api기능추가, 테스트코드 작성, DB쿼리성능개선등을 해보고자합니다. 전부 다 하려면 시간이 오래걸리겠지만(ㅠ) 마지막에 취업준비강의에서 말씀하신 3년차개발자로 생각되기 위해선 해야할게 많은 것 같습니다..ㅎㅎ(3년차 같은 신입을 뽑는다니!!ㅠㅠ) 그래서 일단 목표는 실제 현업에서 하는 것처럼 코드를 작성해보고자 하는데요, 막상 하려니 좀 막막하네요. 질문은: 지금 제 생각은 현업에서 쓰는 좋은 코드를 보고 어떤 식으로 설계했는지 테스트코드는 어떻게 작성했는지 등등 참고하고 분석하고 공부해서 제 나름대로 프로젝트를 리팩토링해보고 싶은 생각입니다. 그게 가장 실력도 늘 것 같구요. 그래서 혹시 관련 코드나 책이나 자료등이 있으면 추천해주시면 감사하겠습니다. 아! 그리고 백엔드 심화강의에서 마이크로큐와 await의 관계를 굉장히 감명깊게 들었습니다. 비동기과정이 정말 헷갈렸는데 속이 시원해졌습니다.ㅎㅎ 혹시 이런 자바스크립트 원리나 cs관련내용도 추천해주실만한 책이나 자료 있으면 알려주시면 감사하겠습니다. 일단 방향은 이렇게 잡았는데 조언해주시면 참고하겠습니다!! 끝으로 제가 지금것 들었던 개발강의중 가장 자세하고 친절하고 이해도 잘되고 재밌는 강의였습니다!! 퀴즈 할때나 버그나 에러날때 힘들긴 했지만, 그래도 개발이 점점 더 재밌어지고 더 잘하고 싶네요. 궁금한 것있으면 또 질문해도 되겠죠?^^;;; 감사합니다!!

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
nya 댓글 2 좋아요 0 조회수 476

import 오류

미해결

실리콘밸리 엔지니어가 가르치는 파이썬 장고 웹프로그래밍

path('signup/', views.SignUpView.as_view(), name='signup'), 이 부분에서 from . import views가 되지 않아 오류가 생기는 것 같습니다 왜 오류인지 잘 모르겠습니다 ImportError: cannot import name 'views' from 'dealershop' (/Users/minjiwon/Desktop/py/dealershop/dealershop/__init__.py) inventory 에서는 from . import views를 해도 잘 되는데 저쪽 부분에서만 되질 않습니다

  • python
  • django
  • bootstrap
  • rest-api
  • drf
댓글 1 좋아요 1 조회수 578

form.save() 부분이 안돼요

미해결

실리콘밸리 엔지니어가 가르치는 파이썬 장고 웹프로그래밍

Internal Server Error: /polls/survey/ Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: no such table: polls_survey The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in get response response = wrapped_callback(request, callback_args, *callback_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/minjiwon/Desktop/py/mysite/polls/views.py", line 98, in survey form.save () File "/opt/homebrew/lib/python3.11/site-packages/django/forms/models.py", line 542, in save self.instance.save () File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/base.py", line 814, in save self.save _base( File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/base.py", line 877, in save_base updated = self._save_table( ^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/base.py", line 1020, in save table results = self._do_insert( ^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/base.py", line 1061, in do insert return manager._insert( ^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/query.py", line 1805, in _insert return query.get_compiler(using=using).execute_sql(returning_fields) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1822, in execute_sql cursor.execute(sql, params) File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 102, in execute return super().execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in execute with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/opt/homebrew/lib/python3.11/site-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ django.db.utils.OperationalError: no such table: polls_survey [05/Jul/2023 05:30:34] "POST /polls/survey/ HTTP/1.1" 500 141650 이렇게 뜨면서 안되고 어드민에서 survey 들어가는 것도 안되는데 makemigrations 다시 해봐도 똑같아요

  • python
  • django
  • bootstrap
  • rest-api
  • drf
Zmann 댓글 1 좋아요 1 조회수 360

인덱스 생성시점

해결됨

mongoDB 기초부터 실무까지(feat. Node.js)

선생님, 안녕하세요! 좋은 강의 정말로 감사드립니다! 이번 강의를 보면서, 궁금한 게 생겼는데요. 이번강의에서 인덱스를 생성하면서, 탐색속도가 훨씬 빨라진다는 걸 알게되었습니다. 기존에 생성되어있는 (인덱스가 걸려있지 않은)데이터들에도 인덱스를 걸어주면 더 빨라지는 걸로 보이는데요. 그런데, 이번 강의에서 인덱스를 걸고 데이터를 생성하면, 인덱스를 걸지않았을 때보다 생성시간이 오래걸리는 부분이 있었습니다. 그렇다면 기존에 인덱스가 걸려있지않은 데이터들에 새로 인덱스를 걸 때는 기존 데이터들에 인덱스를 새로 걸어주는 건가요?

  • javascript
  • node.js
  • aws
  • mongodb
  • rest-api
  • dbms/rdbms
  • 데이터-엔지니어링
google_user 댓글 1 좋아요 0 조회수 737

PDF파일이 어디에 있나요?

해결됨

Python 알고리즘 베스트 10

안녕하세요 PDF파일은 출력하려고 하는데, 노션을 보면 "PDF 노션 페이지에서 다운로드하실 수 있습니다." 로만 되어있는데 다운받을 수 있는 링크는 어디에 있나요? 노션에서 전체PDF출력하려면 비지니스라서 불가능한데... 확인부탁드립니다.

  • python
  • 코딩-테스트
한형섭 댓글 2 좋아요 0 조회수 485

CounterState 질문입니다.

미해결

[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part6: 웹 서버

순수한 궁금증으로 여쭤뵙습니다. 혹시 해당 cs를 구현하지않고 private static int currentCount를 사용한다면 유저마다 보이는 currentCounter가 다를까요? 아니면 공통적으로 서버가 닫히기전까지 모든 유저가 동일한 숫자가 보일까요?

  • rest-api
  • blazor
  • web-api
  • asp.net-core
박정현 댓글 1 좋아요 0 조회수 416

섹션34 마이크로서비스 실습중 에러

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

안녕하세요 강의 재밌게듣고있습니다. 섹션34 강의 전부듣고 rest, graphql, nginx에서 각각 실습했는데 문제가 생겨 질문드립니다. 일단 도커 빌드와 실행은 3개다 정상적으로 되지만 포스트맨과 크롬에서는 아예 접속이 안됩니다. 포트를 확인해봤는데 rest는 정상적으로 포트연결이 되어있고 graphql과 nginx는 포트도 안 잡힙니다. 코드도 강의랑 같고 버전도 강의대로 했는데 뭐가 문제인지 모르겠네요... 뭘 확인해봐야할까요..??

  • node.js
  • docker
  • rest-api
  • nestjs
nya 댓글 1 좋아요 0 조회수 324

$pull 문법에 대한 질문

해결됨

mongoDB 기초부터 실무까지(feat. Node.js)

선생님, 안녕하세요. 좋은 강의 너무 감사드립니다. 답변도 잘해주셔서 너무 감사드려요! 이번 강의를 들으면서, Blog.updateMany( { "comments.user": userId }, { $pull: { comments: { user: userId } } } ) 이 구문이 나왔는데요. 여기서 updateMany의 첫번째 변수인 { "comments.user": userId }, 는 comments배열의 user가 userId인 객체를 찾는거고, { $pull: { comments: { user: userId } } } 여기서도 comments배열안의 user가 userId인 객체를 찾는 거라서, 사실상 같은거를 두번 써준 게 아닌가요?? 그래서 const [user] = await Promise.all([ User.findOneAndDelete({ _id: userId }), Blog.deleteMany({ "user._id": userId }), Blog.updateMany( { "comments.user": userId } // { $pull: { comments: { user: userId } } } ), Comment.deleteMany({ user: userId }), ]); 이런식으로 updateMany의 두번째 변수만 Blog.updateMany( { "comments.user": userId } // { $pull: { comments: { user: userId } } } ), 이런식으로 주석처리를 해줬습니다. 그러자 { "err": "Cast to ObjectId failed for value \"2023-07-03T10:17:04.313Z\" (type Date) at path \"user\" because of \"BSONError\"" } 이런 에러가 나왔어요. 그래서 확인해보니, User.findOneAndDelete({ _id: userId }), Blog.deleteMany({ "user._id": userId }), Comment.deleteMany({ user: userId }), updateMany말고 다른 구문들은 다 실행이 됬더라구요. 그래서 user도 삭제되고 블로그도 삭제되고, comment도 삭제되었지만 blog안의 user가 작성한 comment는 pull되지 않아서 그대로 남아있었습니다. 그런데 여기서 궁금한게, promise.all로 묶어서 같이 실행하면, 하나라도 에러가 나면 바로 실행을 중단하고 에러를 배출한다고 배운 것 같은데, Blog.updateMany의 아래 구문인, Comment.deleteMany가 실행됬더라구요. 트랜잭션까지는 아니더라도 updateMany에서 에러가 나면 Comment.deleteMany는 실행이 안될 줄 알았는데, 이거까지 실행된 거를 보면, Promise.all에서는 전부 순서없이 비동기로 동시에?실행되는 걸까요?

  • javascript
  • node.js
  • aws
  • mongodb
  • rest-api
  • dbms/rdbms
  • 데이터-엔지니어링
google_user 댓글 1 좋아요 0 조회수 386

admin 에 나타나지 않는 몇몇 필드들

미해결

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트

안녕하세요, 강의를 잘 듣고 있습니다. 모델 필드에 있는 몇몇 필드들이 admin에 나타나지 않더군요 예를 들면, updated_at, created_at 같은 필드들이요 이를 위해서 admin 페이지에 일일히 모델 필드를 list_display에 등록해줘야 하는게 맞나요? from django.contrib import admin # Register your models here. from .models import * admin.site .empty_value_display = "-empty-" admin.site .register(Product) admin.site .register(CartProduct) class OrderAdmin(admin.ModelAdmin): list_display = ['customer', 'transaction_id', 'total_price'] admin.site .register(Category) admin.site .register(UserProfile) admin.site .register(Order) admin.site .register(OrderedProduct) admin.site .register(ShipmentInfo) 그럼 제가 직접만든 모델의 경우에는 그렇다 쳐도.. allauth에 있는 site domain 부분이 나오질 않는거에요 ㅠㅠ... 제가 뭘 잘못 건드렸는 지 모르겠는데, 맨처음 프로젝트할 때에는 allauth의 소셜 어플리케이션 부분에 사이트 도메인을 입력할 수 있는 커다란 박스가 있었는데, 그것만 또 안난옵니다. 제가 뭘 잘못한건지 ㅠㅠ 원래 잘 나오던건데... 이번에 파이참 커뮤니티 에디션에서 유료버전으로 바꾸고, 프로젝트를 만들고 나니 admin에 몇몇 모델의 필드들이 잘 보이지 않습니다. verbose name을 설정된것들이 특히 그런 거 같은데 무엇이 문제인지 도통 모르겠습니다. 그렇다고 allauth를 제가 admin에 등록해야하는걸까요? 2.제가 모르는 무언가가 있는걸까요?

  • react
  • python
  • django
  • docker
paichai17 댓글 1 좋아요 0 조회수 307

refreshToken

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

refreshToken 은 DB에 저장을 따로 안해도 되나요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
alice 댓글 1 좋아요 0 조회수 345

curl -X 매개변수를 찾을 수 없습니다

미해결

테스트주도개발(TDD)로 만드는 NodeJS API 서버

윈도우 11에서 강의를 수강중입니다. Hello World를 찍기위해 curl -X GET ' localhost:3000 '을 하면 아래와 같이 뜹니다. cs의 터미널, 파워쉘에서 했을 때 똑같이 이렇게 뜨고 크롬에서 localhost :3000으로 했을 때 Hello World가 찍히는걸 보면 실행은 제대로 되었는데 왜 이렇게 뜰까요? 구글링 해도 잘 나오지 않아 질문합니다. curl -X GET 'localhost:3000' Invoke-WebRequest : 매개 변수 이름 'X'과(와) 일치하는 매개 변수를 찾을 수 없습니다. 위치 줄:1 문자:6 + curl -X GET 'localhost:3000' + ~~ + CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

  • node.js
  • express
  • tdd
  • rest-api
  • 소프트웨어-테스트
mia.gh 댓글 1 좋아요 0 조회수 2211

인기 태그

인프런 TOP Writers

주간 인기글