@fabrix/spool-cart
Version:
Spool - eCommerce Spool for Fabrix
76 lines (75 loc) • 2.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Collection = {
default: (app) => {
return {
include: [
{
model: app.models['Collection'].instance,
as: 'collections',
attributes: {
exclude: ['created_at', 'updated_at']
},
include: [
{
model: app.models['Image'].instance,
as: 'images',
attributes: {
exclude: ['src', 'created_at', 'updated_at']
}
}
]
},
{
model: app.models['Image'].instance,
as: 'images',
attributes: {
exclude: ['src', 'created_at', 'updated_at']
}
},
{
model: app.models['Tag'].instance,
as: 'tags',
attributes: ['name', 'id'],
order: [['name', 'ASC']]
}
]
};
},
findAndCountDefault: (app) => {
return {
distinct: true,
include: [
{
model: app.models['Collection'].instance,
as: 'collections',
attributes: {
exclude: ['created_at', 'updated_at']
},
include: [
{
model: app.models['Image'].instance,
as: 'images',
attributes: {
exclude: ['src', 'created_at', 'updated_at']
}
}
]
},
{
model: app.models['Image'].instance,
as: 'images',
attributes: {
exclude: ['src', 'created_at', 'updated_at']
}
},
{
model: app.models['Tag'].instance,
as: 'tags',
attributes: ['name', 'id'],
order: [['name', 'ASC']]
}
]
};
}
};