Nonprofit-Exchange-Hub/web-app

Fix bug with /api/assets?type=request&search=

marvinsjsu opened this issue · 1 comments

When going to /search-results?category=Needs, we get an error regarding assets.map. We have a ticket to take care of the frontend, but we need to look into the corresponding API call, GET on /api/assets?type=request&search=. The request is causing a 500 error.

Error log from /server:

error: error: column Asset.searchtitle does not exist
[Nest] 14710  - 07/19/2023, 9:53:44 PM   ERROR [ExceptionsHandler] column Asset.searchtitle does not exist
QueryFailedError: column Asset.searchtitle does not exist
    at PostgresQueryRunner.query (/Users/marvinmante/Projects/web-app/server/src/driver/postgres/PostgresQueryRunner.ts:299:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at SelectQueryBuilder.loadRawResults (/Users/marvinmante/Projects/web-app/server/src/query-builder/SelectQueryBuilder.ts:3789:25)
    at SelectQueryBuilder.executeEntitiesAndRawResults (/Users/marvinmante/Projects/web-app/server/src/query-builder/SelectQueryBuilder.ts:3541:26)
    at SelectQueryBuilder.getRawAndEntities (/Users/marvinmante/Projects/web-app/server/src/query-builder/SelectQueryBuilder.ts:1670:29)
    at SelectQueryBuilder.getMany (/Users/marvinmante/Projects/web-app/server/src/query-builder/SelectQueryBuilder.ts:1760:25)
    at /Users/marvinmante/Projects/web-app/server/node_modules/@nestjs/core/router/router-execution-context.js:46:28
    at /Users/marvinmante/Projects/web-app/server/node_modules/@nestjs/core/router/router-proxy.js:9:17
[Nest] 14710  - 07/19/2023, 9:53:44 PM     LOG [HTTP] GET /api/assets?type=request&search= 500 52 - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Error on dev console:

Image

Related to https://github.com/orgs/Nonprofit-Exchange-Hub/projects/14/views/1?pane=issue&itemId=33627395

hi @taoliu12, I think in our last dev sync-up (and if I remember correctly) you mentioned that we just needed to seed data and this will fix the issue, but I was wondering if it'd still be good to have a fix so that even if we didn't have any request type of asset, we wouldn't error out.