findOne Optional Fields and Return Single Model

PersistedModel findOne passes single object not array, also filter
have optional fields.
This commit is contained in:
Baris Cicek 2017-02-17 15:25:34 +03:00
parent 84c6b159fa
commit bb4c60bbdd

2
loopback/index.d.ts vendored
View File

@ -1262,7 +1262,7 @@ declare namespace l {
* @param {Array} model First model instance that matches the filter or null if none found
*/
static findOne(filter?: {fields: string|any|any[]; include: string|any|any[]; order: string; skip: number; where: any; }, callback?: (err: Error, model: any[]) => void): void;
static findOne(filter?: {fields?: string|any|any[]; include?: string|any|any[]; order?: string; skip?: number; where?: any; }, callback?: (err: Error, model: any) => void): void;
/**
* Finds one record matching the optional filter object. If not found, creates