程序员

RESTful 获取数据列表并包含关联数据

2017-10-31  本文已影响71人  coolfireApy

/***************************************************************************
 *                                                                          *
 * Whether the blueprint controllers should populate model fetches with     *
 * data from other models which are linked by associations                  *
 * If you have a lot of data in one-to-many associations, leaving this on   *
 * may result in very heavy api calls                                       *
 ***************************************************************************/

populate: false

该参数控制blueprint controllers是否应该用其他关联model中的数据来填充model。如果在一对多的关联中有大量的数据,这将导致非常沉重的api调用,故默认为false,全局restful接口调用不填充。


/**
 * 店员获取接收的信息
 */
'GET /msgToShop/getReceiveMessage': [
    {policy: 'isAuth'},//鉴权
    {policy: 'queryByUser'},//鉴权
    {blueprint: 'find', model: 'msgtoshop', populate: true}
]

数据库中数据
上一篇下一篇

猜你喜欢

热点阅读