const _ = require('koa-route');
const { teams } = require('src/api');
const { read } = require('src/middlewares/methods');


module.exports = [
  _.get('/teams/', read(teams.list, {
    schema: {
      type: 'object',
      properties: {
        page: {default: '1'},
        per_page: {default: '100'}
      }
    },
    access: {permission: true}
  })),

  _.get('/teams/:id', read(teams.get, {
    access: {permission: true}
  }))
];

const _ = require('koa-route');
const { teams } = require('src/api');
const { read } = require('src/middlewares/methods');


module.exports = [
  _.get('/organizations/:orgId/teams/', read(teams.list, {
    schema: {
      type: 'object',
      properties: {
        page: {default: '1'},
        per_page: {default: '100'}
      }
    },
    access: {permission: true}
  })),

  _.get('/teams/:id', read(teams.get, {
    access: {permission: true}
  }))
];

Fix team list endpoint to start with /organizations/:orgId
Fix team list endpoint to start with /organizations/:orgId
