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
spkjp committed Nov 21, 2019
1 parent 5a9a24c commit 1b7d90a
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/routes/businesses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ export const register = (server: Hapi.Server): void => {
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),
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion packages/core-state/src/wallets/wallet-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ export class WalletRepository implements Contracts.State.WalletRepository {

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

const entries: any[] = this.getIndex("businesses")
Expand Down

0 comments on commit 1b7d90a

Please sign in to comment.