Skip to content

Commit 4c053f5

Browse files
refactor(cc-api/commands): use transformZone in ListZoneCommand
1 parent c16a46b commit 4c053f5

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/clients/cc-api/commands/zone/list-zone-command.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { QueryParams } from '../../../../lib/request/query-params.js';
55
import { get } from '../../../../lib/request/request-params-builder.js';
66
import { sortBy } from '../../../../lib/utils.js';
77
import { CcApiSimpleCommand } from '../../lib/cc-api-command.js';
8+
import { transformZone } from './zone-transform.js';
89

910
/**
1011
*
@@ -27,22 +28,6 @@ export class ListZoneCommand extends CcApiSimpleCommand {
2728

2829
/** @type {CcApiSimpleCommand<ListZoneCommandInput, ListZoneCommandOutput>['transformCommandOutput']} */
2930
transformCommandOutput(response) {
30-
return sortBy(
31-
response.map(
32-
/** @param {any} payload */ (payload) => ({
33-
id: payload.id,
34-
name: payload.name,
35-
country: payload.country,
36-
countryCode: payload.countryCode,
37-
city: payload.city,
38-
displayName: payload.displayName,
39-
lat: payload.lat,
40-
lon: payload.lon,
41-
outboundIPs: payload.outboundIPs?.sort() ?? [],
42-
tags: payload?.tags.sort() ?? [],
43-
}),
44-
),
45-
'name',
46-
);
31+
return sortBy(response.map(transformZone), 'name');
4732
}
4833
}

0 commit comments

Comments
 (0)