Skip to content

Commit

Permalink
feat(core-api): add additional fields to businesses search sche… (#3160)
Browse files Browse the repository at this point in the history
  • Loading branch information
dated authored and faustbrian committed Oct 29, 2019
1 parent 3443f3a commit 05dd51f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/core-api/src/handlers/businesses/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,13 @@ export const search: object = {
businessId: Joi.number()
.integer()
.min(1),
name: Joi.string()
.regex(/^[a-zA-Z0-9_-]+$/)
.max(40),
website: Joi.string().max(50),
vat: Joi.string()
.alphanum()
.max(15),
repository: Joi.string().max(50),
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ export class WalletsBusinessRepository implements Database.IWalletsBusinessRepos

private searchBusinesses(params: Database.IParameters = {}): ISearchContext<any> {
const query: Record<string, string[]> = {
exact: ["businessId", "name", "website"],
exact: ["businessId", "vat"],
like: ["name", "repository", "website"],
};

const entries: any[] = this.databaseServiceProvider()
Expand Down

0 comments on commit 05dd51f

Please sign in to comment.