Ayato-kosaka / spelieve-backend-place

1 stars 1 forks source link

Placeバックエンド動作確認 #7

Closed Takapy1 closed 1 year ago

Takapy1 commented 1 year ago

Placeのテスト用データが欲しいからバックエンドを動作させる

placeID検索に使用サイト

Takapy1 commented 1 year ago

@Ayato-kosaka 動作確認して、curlでplace作成しようとしたら以下のエラー出た。

$ curl -X POST -H "Content-Type:application/json" localhost:3000/PBL002 -d '{"place_id":"ChIJ8dLP9g1cGGAR9TVSa_OmvLs", "language":"ja"}'
{"statusCode":500,"message":"Internal server error"}

結果

[Nest] 3123  - 2022/10/23 9:25:50   ERROR [ExceptionsHandler] Value for argument "data" is not a valid Firestore document. Detected an object of type "GeoPoint" that doesn't match the expected instance (found in field "geometry").
 Please ensure that the Firestore types you are using are from the same NPM package.)

Error: Value for argument "data" is not a valid Firestore document. Detected an object of type "GeoPoint" that doesn't match the expected instance (found in field "geometry"). Please ensure that the Firestore types you are using are from the same NPM package.)
    at validateUserInput (/Users/ganeshatakahiro/Documents/Spelive/spelieve-backend-place/node_modules/@google-cloud/firestore/build/src/serializer.js:332:15)
    at Object.validateUserInput (/Users/ganeshatakahiro/Documents/Spelive/spelieve-backend-place/node_modules/@google-cloud/firestore/build/src/serializer.js:269:13)
    at Object.validateDocumentData (/Users/ganeshatakahiro/Documents/Spelive/spelieve-backend-place/node_modules/@google-cloud/firestore/build/src/write-batch.js:588:18)
    at CollectionReference.add (/Users/ganeshatakahiro/Documents/Spelive/spelieve-backend-place/node_modules/@google-cloud/firestore/build/src/reference.js:2087:23)
    at PBL002UpsertPlaceDataService.doExecute (/Users/ganeshatakahiro/Documents/Spelive/spelieve-backend-place/src/PBL002UpsertPlaceData/PBL002UpsertPlaceData.service.ts:106:29)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at /Users/ganeshatakahiro/Documents/Spelive/spelieve-backend-place/node_modules/@nestjs/core/router/router-execution-context.js:46:28
    at /Users/ganeshatakahiro/Documents/Spelive/spelieve-backend-place/node_modules/@nestjs/core/router/router-proxy.js:9:17

Geopointのところで引っかかってそうだけど、これはnpm install失敗しているかな?

Ayato-kosaka commented 1 year ago

@Takapy1 まじか、ちょっとみるわ

Ayato-kosaka commented 1 year ago

@Takapy1 firebase-admin/firestore と、firebase/firestore で export される Geopointクラスが違うみたい。。。 ゴミ仕様すぎるなぁ、、 とりあえず、Geopointクラスの意義も謎やから、Geopointの利用を廃止して、普通にObjectとして持つわ

Ayato-kosaka commented 1 year ago

そうそう、GeoPoint クラスの互換性がないみたい

Ayato-kosaka commented 1 year ago

でも、ちゃんと内部結合テストしないとだめだってことがわかってよかったわ!

Takapy1 commented 1 year ago

@Ayato-kosaka これはゴミ仕様すぎた。 内部結合性テストって何かわからないので、月曜に教えてくれ

Ayato-kosaka commented 1 year ago

https://github.com/Ayato-kosaka/spelieve-common/commit/0df4186e25b29b89e3df2069dffe26a27f93eac0 でspelieve-common改修して caf0786 で動くようになったはず!

Takapy1 commented 1 year ago

@Ayato-kosaka 試してみます。

Takapy1 commented 1 year ago

@Ayato-kosaka MPlaceの作成、curlコマンドからできるようになったわ! 対応ありがとう!

Ayato-kosaka commented 1 year ago

あ!firestore.ts でdevelopコレクション噛ませてるからうまく疎通できないかも! https://github.com/Ayato-kosaka/spelieve/blob/develop/src/Itinerary/Endpoint/firestore.ts

出来なければ、↓の記載消したら出来るはず!(今日中には開発環境分けるようにするわ!)

if(process.env.NODE_ENV==='development'){
    console.log(process.env.NODE_ENV)
    db = doc(collection(getFirestore(app), 'develop'), 'GOKyrRFVtAffj6kSzKIc') as unknown as Firestore;
}
Ayato-kosaka commented 1 year ago

↑ @Takapy1