feat: filter call by from and to (#180)

This commit is contained in:
Hoan Luu Huu
2023-06-09 06:36:54 +07:00
committed by GitHub
parent f9df2b3028
commit 46fb9b8875
5 changed files with 85 additions and 9 deletions

View File

@@ -20,7 +20,7 @@ router.get('/', async(req, res) => {
logger.debug({opts: req.query}, 'GET /RecentCalls');
const account_sid = parseAccountSid(req.originalUrl);
const service_provider_sid = account_sid ? null : parseServiceProviderSid(req.originalUrl);
const {page, count, trunk, direction, days, answered, start, end} = req.query || {};
const {page, count, trunk, direction, days, answered, start, end, from, to} = req.query || {};
if (!page || page < 1) throw new DbErrorBadRequest('missing or invalid "page" query arg');
if (!count || count < 25 || count > 500) throw new DbErrorBadRequest('missing or invalid "count" query arg');
@@ -35,6 +35,8 @@ router.get('/', async(req, res) => {
answered,
start: days ? undefined : start,
end: days ? undefined : end,
from,
to
});
res.status(200).json(data);
}
@@ -49,6 +51,8 @@ router.get('/', async(req, res) => {
answered,
start: days ? undefined : start,
end: days ? undefined : end,
from,
to
});
res.status(200).json(data);
}

View File

@@ -3046,6 +3046,18 @@ paths:
enum:
- inbound
- outbound
- in: query
name: from
required: false
schema:
type: string
description: calling number to retrieve
- in: query
name: to
required: false
schema:
type: string
description: called number to retrieve
get:
tags:
- Accounts
@@ -3245,6 +3257,18 @@ paths:
enum:
- inbound
- outbound
- in: query
name: from
required: false
schema:
type: string
description: calling number to retrieve
- in: query
name: to
required: false
schema:
type: string
description: called number to retrieve
get:
tags:
- Service Providers