Skip to content

Commit

Permalink
feat: update namespace from tymly to notify
Browse files Browse the repository at this point in the history
  • Loading branch information
meenahoda committed Feb 22, 2022
1 parent 901e7cd commit 868e2a1
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 48 deletions.
10 changes: 10 additions & 0 deletions lib/blueprints/notify-blueprint/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"namespace": "notify",
"name": "notify-blueprint",
"version": "1.0",
"label": "notify-blueprint",
"author": "WMFS",
"organisation": "West Midlands Fire Service",
"description": "Tymly blueprint to manage notifications",
"categories": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"body": [
{
"type": "Jumbotron",
"title": "GOV UK Notification"
"title": "View Notification"
},
{
"type": "Container",
Expand All @@ -15,7 +15,7 @@
"type": "FactSet",
"facts": [
{
"title": "GOV UK Notify Message Status",
"title": "Message Status",
"value": "{{ data.messageStatus.status }}"
}
]
Expand Down Expand Up @@ -85,8 +85,8 @@
}
],
"templateMeta": {
"name": "gov-uk-notifications",
"title": "GOV UK Notifications",
"category": "system"
"name": "view-notifications",
"title": "View Notifications",
"category": "notify"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"body": [
{
"type": "Jumbotron",
"title": "GOV UK Notifications"
"title": "View Notifications"
},
{
"id": "notifyLookup",
Expand All @@ -14,7 +14,7 @@
"resultsPerPage": 10,
"buttonText": "Search",
"endpoint": {
"name": "tymly_getGovUkNotifications_1_0"
"name": "notify_getNotifications_1_0"
},
"ctxPaths": {
"results": "results",
Expand Down Expand Up @@ -84,9 +84,9 @@
}
],
"templateMeta": {
"name": "gov-uk-notifications",
"title": "GOV UK Notifications",
"category": "system"
"name": "notifications",
"title": "View Notifications",
"category": "notify"
},
"hooks": {
"afterLeave": {
Expand Down
4 changes: 4 additions & 0 deletions lib/blueprints/notify-blueprint/categories/notify.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Notify",
"description": "Notify"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function getGovUkNotifications () {
module.exports = function getNotifications () {
return async function (event, env) {
if (!event.offset) event.offset = 0 // todo: fix this, why is it null?

Expand Down Expand Up @@ -26,15 +26,15 @@ module.exports = function getGovUkNotifications () {

const whereClause = whereParts.length > 0 ? `WHERE ${whereParts.join(' AND ')}` : ''

const totalHitsRes = await client.query(`SELECT COUNT(*) FROM tymly.gov_uk_notifications ${whereClause};`)
const res = await client.query(`SELECT * FROM tymly.gov_uk_notifications ${whereClause} ORDER BY _modified DESC LIMIT ${limit} OFFSET ${offset};`)
const totalHitsRes = await client.query(`SELECT COUNT(*) FROM notify.notifications ${whereClause};`)
const res = await client.query(`SELECT * FROM notify.notifications ${whereClause} ORDER BY _modified DESC LIMIT ${limit} OFFSET ${offset};`)

const results = []

for (const row of res.rows) {
row.launches = [{
title: 'View',
stateMachineName: 'tymly_viewGovUkNotification_1_0',
stateMachineName: 'notify_viewNotification_1_0',
input: { id: row.id }
}]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function setGovUkNotificationInputPath () {
module.exports = function setNotificationInputPath () {
return async function (event) {
const messageStatusInput = {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"Comment": "Get GOV UK Notify Notifications",
"name": "Get GOV UK Notify Notifications",
"Comment": "Get Notifications",
"name": "Get Notifications",
"version": "1.0",
"categories": [
"system"
"notify"
],
"StartAt": "GetData",
"States": {
"GetData": {
"Type": "Task",
"Resource": "function:tymly_getGovUkNotifications",
"Resource": "function:notify_getNotifications",
"End": true
}
},
"restrictions": [
{
"roleId": "tymly_govUkNotifyAdmin",
"roleId": "notify_admin",
"allows": [
"*"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Comment": "View notification sent via GOV UK Notify Service",
"name": "View GOV UK Notify Notification",
"Comment": "View notification sent via Notify Service",
"name": "View Notification",
"version": "1.0",
"categories": [
"system"
"notify"
],
"StartAt": "Finding",
"States": {
Expand All @@ -12,14 +12,14 @@
"InputPath": "$.id",
"Resource": "module:findingById",
"ResourceConfig": {
"modelId": "tymly_govUkNotifications"
"modelId": "notify_notifications"
},
"ResultPath": "$",
"Next": "SetInputPath"
},
"SetInputPath": {
"Type": "Task",
"Resource": "function:tymly_setGovUkNotificationInputPath",
"Resource": "function:notify_setNotificationInputPath",
"ResultPath": "$.messageStatusInput",
"Next": "GetMessageStatus"
},
Expand All @@ -34,15 +34,15 @@
"Type": "Task",
"Resource": "module:awaitingHumanInput",
"ResourceConfig": {
"uiName": "tymly_govUkNotification",
"uiName": "notify_viewNotification",
"dataPath": "$"
},
"End": true
}
},
"restrictions": [
{
"roleId": "tymly_govUkNotifyAdmin",
"roleId": "notify_admin",
"allows": [
"*"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Comment": "View notifications sent via GOV UK Notify Service",
"name": "View GOV UK Notify Notifications",
"Comment": "View notifications sent via Notify Service",
"name": "View Notifications",
"version": "1.0",
"categories": [
"system"
"notify"
],
"instigators": [
"user"
Expand All @@ -15,15 +15,15 @@
"Type": "Task",
"Resource": "module:awaitingHumanInput",
"ResourceConfig": {
"uiName": "tymly_govUkNotifications",
"uiName": "notify_viewNotifications",
"dataPath": "$"
},
"End": true
}
},
"restrictions": [
{
"roleId": "tymly_govUkNotifyAdmin",
"roleId": "notify_admin",
"allows": [
"*"
]
Expand Down
4 changes: 4 additions & 0 deletions lib/blueprints/notify-blueprint/template-roles/admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "notify-admin",
"description": "Notify administrator"
}
10 changes: 0 additions & 10 deletions lib/blueprints/tymly-blueprint/blueprint.json

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion lib/components/services/notify/doc/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
description: 'Provides functions for interacting with Gov UK Notify service',
description: 'Provides functions for interacting with GOV UK Notify service',
blueprintDirs: {
'message-templates': 'One JSON file per message template'
}
Expand Down
2 changes: 1 addition & 1 deletion lib/components/services/notify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class NotifyService {

this.templates = {}

const notificationModel = options.bootedServices.storage.models.tymly_govUkNotifications
const notificationModel = options.bootedServices.storage.models.notify_notifications

if (options.blueprintComponents.messageTemplates) {
for (const [key, definition] of Object.entries(options.blueprintComponents.messageTemplates)) {
Expand Down

0 comments on commit 868e2a1

Please sign in to comment.