import { DataSource } from 'typeorm';

export function handler(dataSource: DataSource) {
  return dataSource.query(`
    select o.name,t.count value from org o
    left join (
      select count(1) count,u.org_id
      from user u
      where u.org_id is not null
      group by u.org_id 
    ) t
    on o.id=t.org_id
  `);
}
