import type { Request, Response } from 'express';
import { queryNum } from '@/api/http/request';
import ScopeService from '@/services/scope';

export async function children(req: Request, res: Response): Promise<void> {
  const payload = await ScopeService.listChildren(
    req.query.parentLevel,
    req.query.parentId,
    queryNum(req.query.limit),
    req.currentUser,
  );
  res.status(200).send(payload);
}
