Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Commit

Permalink
Merge pull request #9 from RiotGames/dev
Browse files Browse the repository at this point in the history
DNS zones should include records
  • Loading branch information
Zach authored Nov 21, 2018
2 parents 388dbfb + aed8514 commit 3797753
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions cinq_collector_dns/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,19 @@ class DNSZonesExport(BaseView):
@rollback
@check_auth(ROLE_USER)
def get(self):
self.reqparse.add_argument('page', type=int, default=1, required=True)
self.reqparse.add_argument('count', type=int, default=99999, required=True)
self.reqparse.add_argument('fileFormat', type=str, default='json', choices=['json', 'xlsx'])
zones = DNSZone.get_all()

args = self.reqparse.parse_args()
output = []
for zoneID in zones:
zone = DNSZone.get(zoneID)
output.append({
'zone': zoneID,
'data': [x.to_json() for x in zone.records]
})

total, zones = DNSZone.search(limit=99999, page=args['page'])
total = len(output)
output = [{
'zones': [x.to_json(with_records=False) for x in zones],
'zones': output,
'zoneCount': total
}]

Expand Down

0 comments on commit 3797753

Please sign in to comment.