inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

유성현님의 게시글

유성현 유성현

@you

수강평 작성수
10
평균평점
5.0

게시글 3

질문&답변

하나만 더 질문드릴게요!

감사합니다ㅎㅎ 답변 달아주신거 보고 해결했습니다. ( 앱 모달창으로 한번에 하나의 item만 수정할 수 있습니다. ) export const ReviseCafeData = async ( params: any ) => { try { const { cafe_id , introduction , beans , phone } = params ; let updateBody: any = {} ; if ( introduction && !beans && !phone ) updateBody = { 'cafe_info.introduction' : introduction } ; else if ( !introduction && beans && !phone ) updateBody = { 'cafe_info.beans' : beans } ; else if ( !introduction && !beans && phone ) updateBody = { 'cafe_info.phone' : phone } ; else console . log ( '데이터가 하나만 등록되어야 함' ) ; // 배포 시 return err 처리 return await CafeModel . findOneAndUpdate ({ cafe_id } , updateBody , { new : true }) ; } catch ( err ) { console . log ( err ) ; return { err } ; } } ;

좋아요수
2
댓글수
2
조회수
252