Skip to content

Commit 4e59dc0

Browse files
committed
update nbn domain for refactored diffo
1 parent 4c7b75f commit 4e59dc0

22 files changed

Lines changed: 202 additions & 86 deletions

lib/access/services/characteristic_values/aggregate_interface.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ defmodule DiffoExample.Access.AggregateInterface do
1313
jason do
1414
pick [:name, :physical_interface, :physical_layer, :link_layer, :svlan_id, :vpi]
1515
compact(true)
16+
17+
rename physical_interface: "physicalInterface",
18+
physical_layer: "physicalLayer",
19+
link_layer: "linkLayer",
20+
svlan_id: "svlanId",
21+
vpi: "VPI"
1622
end
1723

1824
outstanding do

lib/access/services/characteristic_values/circuit.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ defmodule DiffoExample.Access.Circuit do
1515
jason do
1616
pick [:circuit_id, :cvlan_id, :vci, :encapsulation, :bandwidth_profile]
1717
compact(true)
18+
rename circuit_id: "circuitId", vci: "VCI", bandwidth_profile: "bandwidthProfile"
1819
end
1920

2021
outstanding do
@@ -41,8 +42,7 @@ defmodule DiffoExample.Access.Circuit do
4142
constraints: [one_of: [:PPPoA, :PPPoE, :IPoE]],
4243
description: "the circuit encapsulation"
4344

44-
field :bandwidth_profile, BandwidthProfile,
45-
description: "the circuit bandwidth profile"
45+
field :bandwidth_profile, BandwidthProfile, description: "the circuit bandwidth profile"
4646
end
4747

4848
defimpl String.Chars do

lib/access/services/characteristic_values/constraints.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ defmodule DiffoExample.Access.Constraints do
1313
jason do
1414
pick [:max_latency, :min_profile]
1515
compact(true)
16+
rename max_latency: "maxLatency", min_profile: "minProfile"
1617
end
1718

1819
outstanding do

lib/nbn/resources/avc.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ defmodule DiffoExample.Nbn.Avc do
112112
def mine_related(changeset, _context) when is_struct(changeset, Ash.Changeset) do
113113
reverse_relationships = Ash.Changeset.get_attribute(changeset, :reverse_relationships)
114114

115-
cvlan = {:cvlan, hd(hd(reverse_relationships).characteristics).value}
115+
cvlan = {:cvlan, Diffo.Unwrap.unwrap(hd(hd(reverse_relationships).characteristics).value)}
116116

117117
Ash.Changeset.force_set_argument(changeset, :characteristic_value_updates, avc: [cvlan])
118118
end

lib/nbn/resources/characteristic_values/avc_value.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ defmodule DiffoExample.Nbn.AvcValue do
2222
end
2323

2424
typed_struct do
25-
field :cvlan, :string, description: "the cvlan of the AVC, assigned by the related CVC"
25+
field :cvlan, :integer,
26+
constraints: [min: 0, max: 4000],
27+
description: "the cvlan of the AVC, assigned by the related CVC"
2628

2729
field :bandwidth_profile, BandwidthProfile, description: "the bandwidth profile of the AVC"
2830
end

lib/nbn/resources/characteristic_values/cvc_value.ex

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ defmodule DiffoExample.Nbn.CvcValue do
2020
end
2121

2222
typed_struct do
23-
field :svlan, :string, description: "the svlan of the CVC, assigned by the related NNI Group"
23+
field :svlan, :integer,
24+
constraints: [min: 0, max: 4000],
25+
description: "the svlan of the CVC, assigned by the related NNI Group"
2426

25-
field :bandwidth, :integer, description: "total CVC bandwidth in Mbps"
27+
field :bandwidth, :integer,
28+
constraints: [min: 0, max: 10000],
29+
description: "total CVC bandwidth in Mbps"
2630
end
2731

2832
defimpl String.Chars do

lib/nbn/resources/characteristic_values/nni_value.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ defmodule DiffoExample.Nbn.NniValue do
1313
jason do
1414
pick [:port_id, :capacity, :technology]
1515
compact(true)
16+
rename port_id: "portId"
1617
end
1718

1819
outstanding do

lib/nbn/resources/characteristic_values/ntd_value.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ defmodule DiffoExample.Nbn.NtdValue do
2626

2727
field :serial_number, :string, description: "the NTD serial number"
2828

29-
field :technology, Technology, description: "the access technology type", default: Technology.default
29+
field :technology, Technology,
30+
description: "the access technology type",
31+
default: Technology.default()
3032
end
3133

3234
defimpl String.Chars do

lib/nbn/resources/characteristic_values/pri_value.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ defmodule DiffoExample.Nbn.PriValue do
1717
jason do
1818
pick [:avcid, :uniid, :technology, :bandwidth_profile, :speeds]
1919
compact(true)
20+
rename avcid: "AVCID", uniid: "UNIID", bandwidth_profile: "bandwidthProfile"
2021
end
2122

2223
outstanding do

lib/nbn/resources/cvc.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ defmodule DiffoExample.Nbn.Cvc do
127127
def mine_related(changeset, _context) when is_struct(changeset, Ash.Changeset) do
128128
reverse_relationships = Ash.Changeset.get_attribute(changeset, :reverse_relationships)
129129

130-
svlan = {:svlan, hd(hd(reverse_relationships).characteristics).value}
130+
svlan = {:svlan, Diffo.Unwrap.unwrap(hd(hd(reverse_relationships).characteristics).value)}
131131

132132
Ash.Changeset.force_set_argument(changeset, :characteristic_value_updates, cvc: [svlan])
133133
end

0 commit comments

Comments
 (0)