Skip to content

Commit

Permalink
cmd_acc: added command to list missed calls records
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Oct 10, 2024
1 parent 68b2b84 commit 13679f7
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions kamcli/commands/cmd_acc.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,51 @@ def acc_list(ctx, oformat, ostyle, limit):
ioutils_dbres_print(ctx, oformat, ostyle, res)


@cli.command(
"mc-list",
short_help="List missed calls records",
)
@click.option(
"oformat",
"--output-format",
"-F",
type=click.Choice(["raw", "json", "table", "dict"]),
default=None,
help="Format the output",
)
@click.option(
"ostyle",
"--output-style",
"-S",
default=None,
help="Style of the output (tabulate table format)",
)
@click.option(
"limit",
"--limit",
"-l",
type=int,
default=20,
help="The limit of listed records (default: 20)",
)
@pass_context
def acc_mc_list(ctx, oformat, ostyle, limit):
"""List missed calls records
\b
"""
e = create_engine(ctx.gconfig.get("db", "rwurl"))
ctx.vlog("Showing missed calls records")
query = ""
if limit == 0:
query = "select * from missed_calls order by id desc"
else:
query = "select * from missed_calls order by id desc limit {0}".format(limit)
res = e.execute(query)
ioutils_dbres_print(ctx, oformat, ostyle, res)



@cli.command(
"cdrs-generate",
short_help="Run SQL stored procedure to generate CDRS",
Expand Down

0 comments on commit 13679f7

Please sign in to comment.