dexter has uploaded this change for review.
mnesia_db_rest: add comment on why we create an euicc entry early
Even though it is technically not necessary, we ensure that an
entry is present in the euicc table on each REST API call. Let's
add a comment to explain why we do it anyway.
Change-Id: Ifb9340655c5f36e074a1a92c0e234ef62c79b9d8
---
M src/mnesia_db_rest.erl
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/91/42991/1
diff --git a/src/mnesia_db_rest.erl b/src/mnesia_db_rest.erl
index 41b4a0c..0976beb 100644
--- a/src/mnesia_db_rest.erl
+++ b/src/mnesia_db_rest.erl
@@ -41,7 +41,13 @@
% Create REST resource (order)
create(Facility, EidValue, Order) ->
+ % Ensure that an euicc entry is present in the database for the given EidValue. In case no entry exists yet, a new
+ % entry is created with default parameters from sys.config, which is is sufficient in many usecases. From the
+ % technical perspective, this is just a convenience feature, which frees the REST API user from having to create an
+ % euicc entry manually before performming the first operation.
ok = mnesia_db_euicc:create_if_not_exist(EidValue),
+
+ % Continue with the normal creation of the REST resource.
ResourceId = uuid:uuid_to_string(uuid:get_v4_urandom()),
Timestamp = os:system_time(seconds),
Row = #rest{
To view, visit change 42991. To unsubscribe, or for help writing mail filters, visit settings.