diff --git a/app/assets/app.css b/app/assets/app.css new file mode 100644 index 0000000..b9c4069 --- /dev/null +++ b/app/assets/app.css @@ -0,0 +1,14 @@ +#nav { + margin-bottom: 30px; + display: flex; + justify-content: space-between; + align-items: center; +} + +#nav ul { + display: flex; + justify-content: end; + align-items: center; + column-gap: 20px; + font-size: 16px; +} diff --git a/app/config.yml b/app/config.yml index e69de29..12bcb9f 100644 --- a/app/config.yml +++ b/app/config.yml @@ -0,0 +1,3 @@ +--- +escape_output_instead_of_sanitize: true +--- diff --git a/app/graphql/contacts/delete.graphql b/app/graphql/contacts/delete.graphql new file mode 100644 index 0000000..d957ba7 --- /dev/null +++ b/app/graphql/contacts/delete.graphql @@ -0,0 +1,6 @@ +mutation delete($id: ID!) { + record_delete( + table: "contact" + id: $id + ){ id } +} diff --git a/app/graphql/contacts/search.graphql b/app/graphql/contacts/search.graphql new file mode 100644 index 0000000..21f2263 --- /dev/null +++ b/app/graphql/contacts/search.graphql @@ -0,0 +1,25 @@ +query contacts_search($page: Int = 1, $per_page: Int = 20, $keyword: String) { + records( + page: $page + per_page: $per_page + filter: { + table: { value: "contact" } + or: [ + { properties: [ { name: "email", contains: $keyword } ] } + { properties: [ { name: "body", contains: $keyword } ] } + ] + } + sort: [{ + id: { order: DESC } + }] + ) { + total_pages + results { + id + body: property(name: "body") + email: property(name: "email") + created_at + } + } +} + diff --git a/app/lib/commands/contacts/create.liquid b/app/lib/commands/contacts/create.liquid index d84639b..e747c9d 100644 --- a/app/lib/commands/contacts/create.liquid +++ b/app/lib/commands/contacts/create.liquid @@ -6,7 +6,6 @@ function object = 'commands/contacts/create/execute', 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 diff --git a/app/lib/commands/contacts/delete.liquid b/app/lib/commands/contacts/delete.liquid new file mode 100644 index 0000000..e84ad84 --- /dev/null +++ b/app/lib/commands/contacts/delete.liquid @@ -0,0 +1,9 @@ +{% liquid + graphql r = 'contacts/delete', id: id + assign object = r.record_delete + + assign event_object = '{}' | parse_json | hash_merge: id: id + function _ = 'modules/core/commands/events/publish', type: 'contact_deleted', object: event_object, delay: null, max_attempts: null + + return object +%} diff --git a/app/lib/events/contact_deleted.liquid b/app/lib/events/contact_deleted.liquid new file mode 100644 index 0000000..0910a68 --- /dev/null +++ b/app/lib/events/contact_deleted.liquid @@ -0,0 +1,12 @@ +--- +metadata: + event: + id +--- +{% liquid + assign c = '{ "errors": {}, "valid": true }' | parse_json + + function c = 'modules/core/validations/presence', c: c, object: event, field_name: 'id' + + return c +%} diff --git a/app/lib/queries/contacts/search.liquid b/app/lib/queries/contacts/search.liquid new file mode 100644 index 0000000..a4bc355 --- /dev/null +++ b/app/lib/queries/contacts/search.liquid @@ -0,0 +1,9 @@ +{% liquid + assign limit = limit | default: 20 + assign page = params.page | to_positive_integer: 1 + assign keyword = params.keyword | default: null + + graphql res = 'contacts/search', per_page: limit, page: page, keyword: keyword + + return res.records +%} diff --git a/app/modules/user/public/lib/queries/role_permissions/permissions.liquid b/app/modules/user/public/lib/queries/role_permissions/permissions.liquid new file mode 100644 index 0000000..e49d85e --- /dev/null +++ b/app/modules/user/public/lib/queries/role_permissions/permissions.liquid @@ -0,0 +1,11 @@ +{% parse_json data %} +{ + "anonymous": ["sessions.create", "users.register"], + "authenticated": ["sessions.destroy","oauth.manage"], + "admin": ["admin_pages.view", "contacts.manage", "admin.users.manage", "users.impersonate"], + "member": ["profile.manage"], + "superadmin": ["users.impersonate_superadmin"] +} +{% endparse_json %} + +{% return data %} diff --git a/app/pos-modules.json b/app/pos-modules.json index 36b45d7..4d870f2 100644 --- a/app/pos-modules.json +++ b/app/pos-modules.json @@ -1,6 +1,7 @@ { "modules": { - "core": "1.5.2", - "common-styling": "1.29.0" + "core": "2.0.7", + "common-styling": "1.32.0", + "user": "5.1.1" } } \ No newline at end of file diff --git a/app/pos-modules.lock.json b/app/pos-modules.lock.json index 36b45d7..4d870f2 100644 --- a/app/pos-modules.lock.json +++ b/app/pos-modules.lock.json @@ -1,6 +1,7 @@ { "modules": { - "core": "1.5.2", - "common-styling": "1.29.0" + "core": "2.0.7", + "common-styling": "1.32.0", + "user": "5.1.1" } } \ No newline at end of file diff --git a/app/views/layouts/application.liquid b/app/views/layouts/application.liquid index b0d2d3b..7fcfbcf 100644 --- a/app/views/layouts/application.liquid +++ b/app/views/layouts/application.liquid @@ -7,13 +7,22 @@ {% render 'modules/common-styling/init', reset: true %} +
- {{ content_for_layout }} + {% render 'layout/nav' %} + +