UNPKG

@gameroom/cli

Version:

A command line tool for Gameroom

39 lines (32 loc) 1.04 kB
const { models: { Store, Unit_Extended } } = require('@gameroom/kit'), getAll = require('./getAll') module.exports = async () => { const stores = await Store.get() const warehouse = stores.find(s => s.name.includes('Warehouse')) const lincoln = stores.find(s => s.name.includes('Lincoln')) const omaha = stores.find(s => s.name.includes('Omaha')) const filters = [ { key: 'advertised', value: true }, { key: 'shopified', value: true }, { key: 'quantity', value: 1, comparison: '>=' } ] const warehouse_units = await getAll(Unit_Extended, { filter: { and: [ ...filters, { key: 'store_id', value: warehouse.id } ] } }) const lincoln_units = await getAll(Unit_Extended, { filter: { and: [ ...filters, { key: 'store_id', value: lincoln.id } ] } }) const omaha_units = await getAll(Unit_Extended, { filter: { and: [ ...filters, { key: 'store_id', value: omaha.id } ] } }) return [ ...warehouse_units, ...lincoln_units, ...omaha_units] }