terrier-engine 4.0.3 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db-client.ts +3 -3
- package/package.json +1 -1
package/db-client.ts
CHANGED
|
@@ -197,7 +197,7 @@ export default class DbClient<PM extends ModelTypeMap, UM extends ModelTypeMap,
|
|
|
197
197
|
* @param id the id of the record
|
|
198
198
|
* @param includes relations to include in the returned object
|
|
199
199
|
*/
|
|
200
|
-
async find<T extends keyof PM & string>(modelType: T, id: string, includes?: I
|
|
200
|
+
async find<T extends keyof PM & string>(modelType: T, id: string, includes?: Includes<PM,T,I>): Promise<PM[T]> {
|
|
201
201
|
const query = new ModelQuery<PM,T,I>(modelType).where("id = ?", id)
|
|
202
202
|
if (includes) {
|
|
203
203
|
query.includes(includes)
|
|
@@ -218,9 +218,9 @@ export default class DbClient<PM extends ModelTypeMap, UM extends ModelTypeMap,
|
|
|
218
218
|
* @param idOrSlug the id or slug of the record
|
|
219
219
|
* @param includes relations to include in the returned object
|
|
220
220
|
*/
|
|
221
|
-
async findByIdOrSlug<T extends keyof PM & string>(modelType: T, idOrSlug: string, includes?: I
|
|
221
|
+
async findByIdOrSlug<T extends keyof PM & string>(modelType: T, idOrSlug: string, includes?: Includes<PM, T, I>): Promise<PM[T]> {
|
|
222
222
|
const column = isUuid(idOrSlug) ? "id" : "slug"
|
|
223
|
-
const query = new ModelQuery(modelType).where(`${column} = ?`, idOrSlug)
|
|
223
|
+
const query = new ModelQuery<PM, T, I>(modelType).where(`${column} = ?`, idOrSlug)
|
|
224
224
|
if (includes) {
|
|
225
225
|
query.includes(includes)
|
|
226
226
|
}
|