Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-07-2022 06:29 AM
Hello
I'm facing some issue regarding neoflix-ui app. Method to remove a movie from my favorite list returns an error `` TypeError: service.remove is not a function`
The code in favorite.service.js file seems ok, I don't see where is the problem:
``
// tag::Remove movie from the list[]
async remove(userId, movieId) {
// Open a new Session
const session = this.driver.session()
// Create HAS_FAVORITE relationship within a Write Transaction
const res = await session.executeWrite(
tx => tx.run(
`
MATCH (u:User {userId: $userId})-[r:HAS_FAVORITE]->(m:Movie {tmdbId: $movieId})
DELETE r
RETURN m {
.*,
favorite: false
} AS movie
`,
{ userId, movieId, }
)
)
// Throw an error if the user or movie could not be found
if ( res.records.length === 0 ) {
throw new NotFoundError(
`Could not remove favorite relationship between User ${userId} and Movie ${movieId}`
)
}
// Close the session
await session.close()
// Return movie details and `favorite` property
const [ first ] = res.records
const movie = first.get('movie')
return toNativeTypes(movie)
}
// end::Remove movie from the list[]
12-15-2022 10:19 AM
Hi @darciosavilela - could you share the stack trace in the error message? That will help troubleshoot.
12-15-2022 12:19 PM
Tks William, but I got the error fixed. Just close and open my vs code again and could run properly.
tks
All the sessions of the conference are now available online