Skip to content

Commit

Permalink
Merge branch 'main' into mask-token
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-k committed Oct 7, 2024
2 parents 51c3943 + 0221f87 commit 6b0968c
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 27 deletions.
11 changes: 7 additions & 4 deletions app/lib/commands/contacts/create.liquid
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{% liquid
function object = 'commands/contacts/create/build', object: object
function object = 'commands/contacts/create/check', object: object

if object.valid
function object = 'commands/contacts/create/execute', object: object
function _ = 'modules/core/commands/events/publish', type: 'contact_created', object: object
assign event_object = '{}' | parse_json | hash_merge: id: object.id
hash_assign event_object["email"] = object.email
log event_object, type: 'event object'
function _ = 'modules/core/commands/events/publish', type: 'contact_created', object: event_object, delay: null, max_attempts: null
endif

return object
%}
%}
2 changes: 1 addition & 1 deletion app/lib/consumers/contact_created/notify_submitter.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"data": {}
}
{% endparse_json %}
{% function _ = 'modules/core/lib/commands/email/send', object: object %}
{% function _ = 'modules/core/commands/email/send', object: object %}
2 changes: 1 addition & 1 deletion app/pos-modules.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"modules": {
"core": "1.5.0"
"core": "1.5.2"
}
}
2 changes: 1 addition & 1 deletion app/pos-modules.lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"modules": {
"core": "1.5.0"
"core": "1.5.2"
}
}
21 changes: 9 additions & 12 deletions app/views/pages/contacts/create.liquid
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
---
method: post
---
{% function contact = 'commands/contacts/create', object: context.params.contact %}
{% if contact.valid %}
{% log contact, type: 'contact after valid' %}
{% assign event_object = '{}' | parse_json | hash_merge: id: contact.id %}
{% hash_assign event_object["email"] = contact.email %}
{% log event_object, type: 'event object' %}
{% function _ = 'modules/core/commands/events/publish', type: 'contact_created', object: event_object %}
{% redirect_to '/contacts/thanks' %}
{% else %}
{% render 'contacts/form', contact: contact %}
{% endif %}

{% liquid
function contact = 'commands/contacts/create', object: context.params.contact
if contact.valid
log contact, type: 'contact after valid'
redirect_to '/contacts/thanks'
else
render 'contacts/form', contact: contact
endif
%}
4 changes: 3 additions & 1 deletion modules/core/public/lib/commands/statuses/create.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- timestamp (optional)
- reference_schema (optional)
- payload (optional)
- delay (optional)
- max_attempts (optional)
{% endcomment %}
{% liquid
function object = 'modules/core/commands/statuses/create/build', name: name, timestamp: timestamp, reference_id: reference_id, reference_schema: reference_schema, payload: payload, requester_id: requester_id
Expand All @@ -18,7 +20,7 @@
if object.valid
function object = 'modules/core/commands/execute', mutation_name: 'modules/core/statuses/create' object: object
if object.valid
function _ = 'modules/core/commands/events/publish', type: 'status_created', object: object
function _ = 'modules/core/commands/events/publish', type: 'status_created', object: object, delay: delay, max_attempts: max_attempts
endif
else
log object, 'showme STATUS-INVALID'
Expand Down
4 changes: 2 additions & 2 deletions modules/core/public/lib/validations/equal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

if message == blank and key == blank
if not_verbose
assign message = 'test.should.equal_not_verbose' | t
assign message = 'modules/core/validation.equal_not_verbose' | t
else
assign message = 'test.should.equal' | t: given: given, expected: expected
assign message = 'modules/core/validation.equal' | t: given: given, expected: expected
endif
endif
function c = 'modules/core/helpers/register_error', contract: c, field_name: field_name, message: message, key: key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
endunless
endif

function c = 'modules/core/validations/length', c: c, object: object, value: decoded_pw, field_name: field_name, maximum: maximum, minimum: minimum, message_minimum: key: 'modules/core/validation.too_short'
function c = 'modules/core/validations/length', c: c, object: object, value: decoded_pw, field_name: field_name, maximum: maximum, minimum: minimum, message_minimum: key: 'modules/core/validation.too_short', allow_blank: null

return c
%}
2 changes: 2 additions & 0 deletions modules/core/public/translations/en/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ en:
not_url: is not valid url
blank: cannot be blank
email: must be a valid email
equal: expected %{given} to equal %{expected}
equal_not_verbose: does not match
array:
not_included: '`%{value}` is not a valid value'
not_unique: elements must be unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

if message == blank and key == blank
if not_verbose
assign message = 'test.should.equal_not_verbose' | t
assign message = 'modules/core/validation.equal_not_verbose' | t
else
assign message = 'test.should.equal' | t: given: given, expected: expected
assign message = 'modules/core/validation.equal' | t: given: given, expected: expected
endif
endif
function c = 'modules/core/lib/helpers/register_error', contract: c, field_name: field_name, message: message, key: key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
endunless
endif

function c = 'modules/core/lib/validations/length', c: c, object: object, value: decoded_pw, field_name: 'password', maximum: 256, minimum: 6, message_minimum: key: 'modules/core/validation.too_short'
function c = 'modules/core/lib/validations/length', c: c, object: object, value: decoded_pw, field_name: 'password', maximum: 256, minimum: 6, message_minimum: key: 'modules/core/validation.too_short', allow_blank: null

return c
%}
2 changes: 1 addition & 1 deletion modules/core/template-values.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "Pos Module Core",
"machine_name": "core",
"type": "module",
"version": "1.5.0",
"version": "1.5.2",
"dependencies": {}
}

0 comments on commit 6b0968c

Please sign in to comment.