Feature/filter item activities from search results (#1759)

* Filter ITEM activities from search results

* Update changelog
pull/1760/head
Thomas Kaul 2 years ago committed by GitHub
parent f3333f24da
commit a5b49b286d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Filtered activities with type `ITEM` from search results
- Considered the user's language in the _Stripe_ checkout
- Upgraded the _Stripe_ dependencies
- Upgraded `twitter-api-v2` from version `1.10.3` to `1.14.2`

@ -16,6 +16,7 @@ import { Injectable, Logger } from '@nestjs/common';
import { DataSource, SymbolProfile } from '@prisma/client';
import bent from 'bent';
import * as cheerio from 'cheerio';
import { isUUID } from 'class-validator';
import { addDays, format, isBefore } from 'date-fns';
@Injectable()
@ -162,7 +163,7 @@ export class ManualService implements DataProviderInterface {
}
public async search(aQuery: string): Promise<{ items: LookupItem[] }> {
const items = await this.prismaService.symbolProfile.findMany({
let items = await this.prismaService.symbolProfile.findMany({
select: {
currency: true,
dataSource: true,
@ -189,6 +190,11 @@ export class ManualService implements DataProviderInterface {
}
});
items = items.filter(({ symbol }) => {
// Remove UUID symbols (activities of type ITEM)
return !isUUID(symbol);
});
return { items };
}
}

Loading…
Cancel
Save