#bookbrainz

/

      • MRiddickW joined the channel
      • 2021-12-06 34027, 2021

      • MRiddickW has quit
      • 2021-12-06 34029, 2021

      • BenOckmore has quit
      • 2021-12-06 34029, 2021

      • BrainzGit has quit
      • 2021-12-06 34030, 2021

      • Leftmost has quit
      • 2021-12-06 34030, 2021

      • agatzk has quit
      • 2021-12-06 34032, 2021

      • kuno has quit
      • 2021-12-06 34032, 2021

      • Freso has quit
      • 2021-12-06 34011, 2021

      • BenOckmore joined the channel
      • 2021-12-06 34011, 2021

      • BrainzGit joined the channel
      • 2021-12-06 34011, 2021

      • CatQuest joined the channel
      • 2021-12-06 34011, 2021

      • agatzk joined the channel
      • 2021-12-06 34011, 2021

      • Leftmost joined the channel
      • 2021-12-06 34011, 2021

      • kuno joined the channel
      • 2021-12-06 34011, 2021

      • Freso joined the channel
      • 2021-12-06 34033, 2021

      • dgw has quit
      • 2021-12-06 34054, 2021

      • dgw joined the channel
      • 2021-12-06 34028, 2021

      • KassOtsimine has quit
      • 2021-12-06 34033, 2021

      • KassOtsimine joined the channel
      • 2021-12-06 34005, 2021

      • Shubh joined the channel
      • 2021-12-06 34010, 2021

      • Shubh
        Hey monkey !
      • 2021-12-06 34030, 2021

      • monkey
        Hi Shubh
      • 2021-12-06 34026, 2021

      • monkey
        Saw your message about debugging with vscode. Any luck with that?
      • 2021-12-06 34027, 2021

      • Shubh
        Nah , i ran that launch script given for for debugging in readme but that stupid error related to some import utils keep popping up
      • 2021-12-06 34012, 2021

      • Shubh
        btw i realized what was causing the website/container to crash !
      • 2021-12-06 34051, 2021

      • Shubh
        BB-635
      • 2021-12-06 34051, 2021

      • BrainzBot
        BB-635: Uncaught ElasticSearch error crashes the website https://tickets.metabrainz.org/browse/BB-635
      • 2021-12-06 34007, 2021

      • monkey
        Ah nice!
      • 2021-12-06 34038, 2021

      • monkey
        What's the culprit ?
      • 2021-12-06 34053, 2021

      • Shubh
        i don't know if it cause the production build to go down as well but still i think its important to be fix !
      • 2021-12-06 34011, 2021

      • Shubh
        ah culprit was that god damn deleted enitty !
      • 2021-12-06 34005, 2021

      • monkey
        Right, the crash was caused by deleting an already deleted entity. But what is the root cause?
      • 2021-12-06 34013, 2021

      • Shubh
        handleDelete got that deleted entity it tries to delete all the relation of that enitty without any try error
      • 2021-12-06 34027, 2021

      • monkey
        Ah I see.
      • 2021-12-06 34029, 2021

      • Shubh
        i made a PR where i check its dataId
      • 2021-12-06 34051, 2021

      • monkey
        Thank you!
      • 2021-12-06 34030, 2021

      • Shubh
        will it cause production build to go down if same error occurs?
      • 2021-12-06 34035, 2021

      • monkey
        It's abannk holiday here but I should have a bit of time today to look that and the vscode debugging
      • 2021-12-06 34051, 2021

      • monkey
        Yes, it crashes the website too
      • 2021-12-06 34005, 2021

      • monkey
        (But it comes back up automatically)
      • 2021-12-06 34031, 2021

      • Shubh
        Ahh thats a relief
      • 2021-12-06 34045, 2021

      • monkey
        But with your PR disallowinh deleting an already deleted entity, that shouldn't happen anymore
      • 2021-12-06 34014, 2021

      • monkey
        And once both fixes are merged I'll deploy a new version of the website
      • 2021-12-06 34037, 2021

      • Shubh
        are you able to debug BB in vscode?
      • 2021-12-06 34009, 2021

      • monkey
        Will try today
      • 2021-12-06 34018, 2021

      • monkey
        Haven't used it in a while
      • 2021-12-06 34044, 2021

      • Shubh
        console logs sometimes don't make it into console! , have to rebuild the whole thing :'
      • 2021-12-06 34027, 2021

      • Shubh has quit
      • 2021-12-06 34020, 2021

      • Shubh joined the channel
      • 2021-12-06 34012, 2021

      • Shubh
        Hey monkey !
      • 2021-12-06 34050, 2021

      • monkey
        👋
      • 2021-12-06 34038, 2021

      • Shubh
        what would the right way to access data from database like details about some entity
      • 2021-12-06 34048, 2021

      • monkey
        I would recommend installing this open-source database tool: DBeaver
      • 2021-12-06 34011, 2021

      • monkey
        It's honestly the best tool I've used to access database data, schema diagrams, etc.
      • 2021-12-06 34020, 2021

      • Shubh
        ahh in BB-site
      • 2021-12-06 34036, 2021

      • monkey
      • 2021-12-06 34002, 2021

      • Shubh
        monkey i mean in BB-site using orm ..
      • 2021-12-06 34027, 2021

      • monkey
        Sorry, I don't understand the question
      • 2021-12-06 34022, 2021

      • Shubh
        I need to fetch information regarding entities ..
      • 2021-12-06 34033, 2021

      • monkey
        Maybe this: the website uses an ORM (see https://github.com/bookbrainz/bookbrainz-data-js)
      • 2021-12-06 34049, 2021

      • vishal5251
        Hi
      • 2021-12-06 34011, 2021

      • monkey
        Which is what we use to access the database in the website and API
      • 2021-12-06 34023, 2021

      • monkey
        Hi vishal5251!
      • 2021-12-06 34003, 2021

      • vishal5251 joined the channel
      • 2021-12-06 34035, 2021

      • vishal5251
        Hi Everyone!
      • 2021-12-06 34046, 2021

      • monkey
        Hi vishal5251 !
      • 2021-12-06 34004, 2021

      • vishal5251
      • 2021-12-06 34013, 2021

      • vishal5251
        hey monkey, my postgres is running in docker
      • 2021-12-06 34034, 2021

      • vishal5251
      • 2021-12-06 34000, 2021

      • monkey
        vishal5251: That all looks right
      • 2021-12-06 34006, 2021

      • monkey
        You might have to stop and restart bookbrainz-site for the configuration changes to take effect
      • 2021-12-06 34007, 2021

      • vishal5251
      • 2021-12-06 34024, 2021

      • monkey
        Ah, well that's a step forward. Connection to database is working
      • 2021-12-06 34050, 2021

      • monkey
        Did you follow these steps to create the database? https://github.com/bookbrainz/bookbrainz-site#dat…
      • 2021-12-06 34028, 2021

      • vishal5251
        while I was setting up, npm install shows error. So I deleted some scripts from package-json just to see that how this project gonna look.
      • 2021-12-06 34052, 2021

      • monkey
        We've made a few changes last week regarding NPM install, so I would recommend to checkout the latest commit from the master repository, and try rebuilding the docker image (`docker-compose build bookbrainz-site`)
      • 2021-12-06 34010, 2021

      • monkey
        If you still run into an issue we can try to figure it out together
      • 2021-12-06 34015, 2021

      • MRiddickW joined the channel
      • 2021-12-06 34038, 2021

      • Shubh
        Hey monkey ..
      • 2021-12-06 34055, 2021

      • monkey
        Yo
      • 2021-12-06 34014, 2021

      • Shubh
        relationshipTypeId
      • 2021-12-06 34042, 2021

      • Shubh
        it is unique for all relation, i assume?
      • 2021-12-06 34011, 2021

      • monkey
        I need some context :)
      • 2021-12-06 34022, 2021

      • monkey
        But at a glance, relationshipType refers to one of the possible types of relationships (i.e. "author wrote work", etc;) rather than each relationship (i.e. "J.K. Rowling wrote Harry Potter")
      • 2021-12-06 34052, 2021

      • Shubh
        Hmm so i need to get some data about entity so i was looking at code which fetches data using orm so i got this
      • 2021-12-06 34019, 2021

      • Shubh
      • 2021-12-06 34013, 2021

      • Shubh
        why relationTypeId hardcoded like this isn't page suppose to show all relation an entity has ?
      • 2021-12-06 34022, 2021

      • monkey
        This code is front-end code, so not related to fetching the data.
      • 2021-12-06 34006, 2021

      • monkey
        This hardcode type gets extracted ffrom other relationships in order to be shown in a separate table, let me make a screenshot for you
      • 2021-12-06 34020, 2021

      • vishal5251 has quit
      • 2021-12-06 34003, 2021

      • monkey
      • 2021-12-06 34020, 2021

      • monkey
        You will see a table of "Works" and below it "Relationships"
      • 2021-12-06 34044, 2021

      • Shubh
        Yes so that means..
      • 2021-12-06 34016, 2021

      • monkey
        All of these are relationships. The code you linked to extracts relationships of a certain type (edition contains work) to show them in that Works table
      • 2021-12-06 34008, 2021

      • monkey
        But if you're looking for how to get data from the database you're looking in the wrong spot. I fyou describe what you're trying to resolve I can point you to a more relevant piece of code
      • 2021-12-06 34036, 2021

      • Shubh
        wait isn't that code for showing relations in Relationships tab?
      • 2021-12-06 34038, 2021

      • monkey
        P.S: The ORM we use has its own repository here: https://github.com/bookbrainz/bookbrainz-data-js/
      • 2021-12-06 34010, 2021

      • monkey
        No this is the WorkDisplayPage
      • 2021-12-06 34054, 2021

      • monkey
        The other relationships are shown in the EntityLinks component below: https://github.com/bookbrainz/bookbrainz-site/blo…
      • 2021-12-06 34043, 2021

      • monkey
        which renders the EntityRelationships component https://github.com/bookbrainz/bookbrainz-site/blo…
      • 2021-12-06 34021, 2021

      • Shubh
        from where EntityRelationships component get its data i mean relations
      • 2021-12-06 34042, 2021

      • monkey
        So for that we need to look at the server code (rather than the client code)
      • 2021-12-06 34048, 2021

      • Shubh
        isn't it that specific line of code that fetches them?
      • 2021-12-06 34019, 2021

      • monkey
        Relationships are loaded using an expressJS middleware called loadEntityRelationships: https://github.com/bookbrainz/bookbrainz-site/blo…
      • 2021-12-06 34038, 2021

      • monkey
        N, again you're looking at front-end code which doesn't fetch anything.
      • 2021-12-06 34031, 2021

      • monkey
        You want to be looking at files in src/server, not in src/client
      • 2021-12-06 34009, 2021

      • Shubh
        but but that workPage
      • 2021-12-06 34017, 2021

      • Shubh
        let start again , how workpage (work/:bbid) load its data?
      • 2021-12-06 34026, 2021

      • monkey
      • 2021-12-06 34059, 2021

      • monkey
        There is a preliminary step that loads the entity for routes with a BBID: https://github.com/bookbrainz/bookbrainz-site/blo…
      • 2021-12-06 34015, 2021

      • monkey
        And after that you see that middleware.loadEntityRelationships is called
      • 2021-12-06 34027, 2021

      • monkey
        That's where we load relationships from the database
      • 2021-12-06 34004, 2021

      • monkey
        And then all that is sent to the react components in entityRoutes.displayEntity
      • 2021-12-06 34031, 2021

      • Shubh
        so that middleware responsible for loading relationships data in req.entity object?
      • 2021-12-06 34038, 2021

      • monkey
        Correct
      • 2021-12-06 34002, 2021

      • monkey
      • 2021-12-06 34055, 2021

      • monkey
        And then more data is loaded about the other entity in the relationship here: https://github.com/bookbrainz/bookbrainz-site/blo…
      • 2021-12-06 34047, 2021

      • Shubh
        so to get data about relationships of an entity i have to add that middleware , correct?
      • 2021-12-06 34048, 2021

      • monkey
        >so that middleware responsible for loading relationships data in req.entity object?
      • 2021-12-06 34048, 2021

      • monkey
        actually they are loaded in `res.locals.entity` which is what is used
      • 2021-12-06 34000, 2021

      • monkey
        Well, I guess it depends where.
      • 2021-12-06 34009, 2021

      • monkey
        If you explained the issue you're trying to solve it would help
      • 2021-12-06 34011, 2021

      • monkey
        Depending on what you're trying to modify, it's possible that the relationships are already loaded
      • 2021-12-06 34039, 2021

      • monkey
        In which case the solution will be to figure out how to access them
      • 2021-12-06 34016, 2021

      • Shubh
        is there way to access to them in client side like without getting that entity object with relations ..
      • 2021-12-06 34058, 2021

      • monkey
        I still don't understand what you're trying to do. Which route are you modifying that doesn't have the entity and its relationships loaded already?
      • 2021-12-06 34007, 2021

      • monkey
        Or which page I should say
      • 2021-12-06 34036, 2021

      • Shubh
        I want to access the relationships data of an entity on /create entity page..
      • 2021-12-06 34055, 2021

      • vishal5251 joined the channel
      • 2021-12-06 34058, 2021

      • monkey
        So for an entity that is being created (i.e that doesn't exist yet in the database), the relationships data is contained in the Redux state
      • 2021-12-06 34036, 2021

      • monkey
        Including whatever data we fetch when adding a new relationship using the search dropdown
      • 2021-12-06 34059, 2021

      • Shubh
        data of an entity *which already exist in database
      • 2021-12-06 34006, 2021

      • vishal5251
      • 2021-12-06 34002, 2021

      • monkey
        Shubh: So in the RelationshipEditor component, there is a search box component that is used here: https://github.com/bookbrainz/bookbrainz-site/blo…
      • 2021-12-06 34013, 2021

      • vishal5251
        hey monkey, see there comes an error while installing packages.
      • 2021-12-06 34003, 2021

      • Shubh
        vishal5251 it might help if you paste whole error log in pastebin
      • 2021-12-06 34015, 2021

      • monkey
        Shubh: But we don't have access too all the entity's data here
      • 2021-12-06 34057, 2021

      • monkey
        vishal5251: That's odd. You're running on Docker for Windows, is that correct?
      • 2021-12-06 34030, 2021

      • vishal5251
        yeah
      • 2021-12-06 34002, 2021

      • monkey
        vishal5251: I'll try to dig into the issue. I suspect this is a windows-only issue, which I won't be able to reproduce.
      • 2021-12-06 34017, 2021

      • monkey
        The sort of thing that shouldn't happen with Docker, but…
      • 2021-12-06 34003, 2021

      • monkey
        In the meantime if it help I think your instinctwas correct and you can remove the "postinstall" script in package.json
      • 2021-12-06 34020, 2021

      • monkey
      • 2021-12-06 34039, 2021

      • monkey
        See if that allows you to build the image correctly
      • 2021-12-06 34023, 2021

      • monkey
        As Shubh suggested, more debug logs could come in handy, which you can send as a pastebin for example
      • 2021-12-06 34037, 2021

      • monkey
      • 2021-12-06 34032, 2021

      • vishal5251
        after removing that thing, it builds but I'll lost the connection with database
      • 2021-12-06 34007, 2021

      • monkey
        Those two issues seem unrelated
      • 2021-12-06 34005, 2021

      • Shubh
        monkey https://github.com/bookbrainz/bookbrainz-site/blo… here in client i need to add that relations ..
      • 2021-12-06 34013, 2021

      • monkey
        Please try building again with the script removed, and with the correct configuration you sent earlier