| ... | @@ -64,5 +64,51 @@ export function getEntityById(entityType: string, id: string, fieldsToHide: stri |
... | @@ -64,5 +64,51 @@ export function getEntityById(entityType: string, id: string, fieldsToHide: stri |
|
|
*/
|
|
*/
|
|
|
export function getSingleEntity(entityType: string, query: any, fieldsToHide: string[], fieldsToKeep: string[], context: Context, runHook: boolean = false): object | null
|
|
export function getSingleEntity(entityType: string, query: any, fieldsToHide: string[], fieldsToKeep: string[], context: Context, runHook: boolean = false): object | null
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* return list of entities
|
|
|
|
* @param query
|
|
|
|
* @param fields
|
|
|
|
* @param me
|
|
|
|
* @param context
|
|
|
|
*/
|
|
|
|
export function getEntityList(entityType: string, query: Query, fieldsToHide: string[], fieldsToKeep: string[], context: Context, runHook: boolean = false)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get list of entities given id array
|
|
|
|
* @param query
|
|
|
|
* @param fields
|
|
|
|
* @param me
|
|
|
|
* @param context
|
|
|
|
*/
|
|
|
|
export function getEntitiesByIds(entityType: string, ids: string[], fieldsToHide: string[], fieldsToKeep: string[], context: Context, useCache: boolean = true, runHook: boolean = false)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* similar to getEntityList but returned result will contain total count from the query, good for pagination
|
|
|
|
*/
|
|
|
|
export function getEntityListWithCount(entityType: string, query: Query, fieldsToHide: string[], fieldsToKeep: string[], context: Context, runHook: boolean = false)
|
|
|
|
|
|
|
|
export function createEntity(entityType: string, obj: any, context: Context, runHook: boolean = false)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bulk create documents in given collection in batch. Note that beforeSave and afterSave batch won't be invoked in this case to avoid n+1 issues. Caller should
|
|
|
|
* handle beforeSave and afterSave logic by writing optimized code if needed.
|
|
|
|
* @param entityType
|
|
|
|
* @param objs
|
|
|
|
* @param context
|
|
|
|
*/
|
|
|
|
export function batchCreate(entityType: string, objs: object[], context: Context)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mainly used by graphql directly, not for normal usage
|
|
|
|
*/
|
|
|
|
export function updateEntity(entityType: string, query: any, context: Context, runHook: boolean = false)
|
|
|
|
|
|
|
|
export function update(entityType: string, findQuery: object, uQuery: object, context: Context, isMulti: boolean = false)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* refer to mongo aggregate for details
|
|
|
|
*/
|
|
|
|
export function aggregate(entityType: string, arr: any[], context: Context)
|
|
|
|
|
|
|
|
|
export function count(entityType: string, args: object, context: Context)
|
|
|
``` |
|
``` |
|
|
|
\ No newline at end of file |