Skip to content

Commit

Permalink
Merge branch 'Dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Arteha committed Dec 30, 2019
2 parents d63c8cb + 6a08ed0 commit aa7067d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "admin-bro-typeorm",
"version": "0.1.6-alpha.6",
"version": "0.1.6-alpha.7",
"description": "TypeORM adapter for AdminBro",
"keywords": [
"typeorm",
Expand All @@ -27,7 +27,7 @@
"author": "Artem Zabolotnyi <[email protected]>",
"license": "MIT",
"peerDependencies": {
"admin-bro": ">=1.6.0-beta.5",
"admin-bro": ">=1.6.0-beta.11",
"admin-bro-expressjs": ">=0.4.0",
"typeorm": ">=0.2.21"
},
Expand All @@ -36,7 +36,7 @@
"@types/chai": "^4.2.4",
"@types/mocha": "^5.2.7",
"@types/node": "12.0.10",
"admin-bro": "^1.6.0-beta.5",
"admin-bro": "^1.6.0-beta.11",
"admin-bro-expressjs": "^0.4.0",
"chai": "^4.2.0",
"class-validator": "^0.11.0",
Expand Down
16 changes: 15 additions & 1 deletion src/Resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "reflect-metadata";
import { Property } from "./Property";
import { BaseEntity, Like } from "typeorm";
import { BaseEntity, In, Like } from "typeorm";
import { BaseResource, ValidationError, Filter, PropertyType } from "admin-bro";
import { ParamsType } from "admin-bro/types/src/backend/adapters/base-record";
import { convertFilter } from "./utils/convertFilter";
Expand Down Expand Up @@ -109,6 +109,20 @@ export class Resource extends BaseResource
return records;
}

public async findMany(ids: Array<string>): Promise<Array<ExtendedRecord>>
{
const instances = await this.model.find({ where: { id: In(ids) } });
const records: Array<ExtendedRecord> = [];
for (const instance of instances)
{
const record = new ExtendedRecord(instance, this);
record.setTitle(await getTitle(instance));
records.push(record);
}

return records;
}

public async search(value: any, limit: number = 50): Promise<Array<ExtendedRecord>>
{
const meta = Reflect.getMetadata(SEARCH_FIELD_SYMBOL, this.model);
Expand Down

0 comments on commit aa7067d

Please sign in to comment.