Same collection type, Different views?

Hi, I have a collection type with a boolean (paid === true or paid === false) and i would like to have the paid ones in one view and the free in another view. I know that i could make two seperate collection types but this seems hacky because they are both the same collection type and i dont want to have to try and keep them in sync as it seems hacky… Is there any way to do this or should i just duplicate the collection type?

There is actually a workaround to achieve this.

You can try to create two identical colleciton types (one will be called Paid and another Unpaid), you should name them differently but let them use the SAME table from db.

So now you should make something to filter the data in each collection, for that you can use beforeFind lifecycle hook.

**/models/Paid.js

module.exports = {
  /**
   * Triggered before find, so you can add an extra parameter to filter data
   */
  lifecycles: {
    async beforeFind(params,populate) {
      params.paid = 1;
    },
  },
};

**/models/Unpaid.js

module.exports = {
  /**
   * Triggered before find, so you can add an extra parameter to filter data
   */
  lifecycles: {
    async beforeFind(params,populate) {
      params.paid = 0;
    },
  },
};