-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from pushme-tgxn/develop
Develop
- Loading branch information
Showing
4 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
version: "3.5" | ||
|
||
networks: | ||
pushme-net: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h1>Account Deletion Policy</h1> | ||
<p>Last updated: April 03, 2024</p> | ||
<p> | ||
You can delete your account via the app, on the "Settings" page. | ||
</p> | ||
<p> | ||
If you need help with this button, please contact us at the address below. Thanks. | ||
</p> | ||
<h1>Contact Us</h1> | ||
<p>If you have any questions about this Policy, You can contact us:</p> | ||
<ul> | ||
<li>By email: pushme+deletion@tgxn.net</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const { getTopicBySecretKey } = require("../services/topic"); | ||
|
||
const { createPushToTopic, pushToTopicDevices } = require("../services/push"); | ||
|
||
const { appLogger } = require("../middleware/logging.js"); | ||
|
||
const createGrafanaPushRequest = async (request, response, next) => { | ||
try { | ||
console.log("inputPayload", request.body); | ||
let { title, state, message } = request.body; | ||
console.log("inputPayload", { title, state, message }); | ||
|
||
const pushPayload = { | ||
categoryId: "simple.push", | ||
title: `Grafana: ${title}`, | ||
body: message, | ||
}; | ||
|
||
const foundTopic = await getTopicBySecretKey(request.params.topicSecret); | ||
if (!foundTopic) { | ||
return next(new Error("Topic secret key does not exist")); | ||
} | ||
appLogger.debug("foundTopic", foundTopic.dataValues.id); | ||
|
||
const createdPush = await createPushToTopic(foundTopic); | ||
appLogger.info("createPush", createdPush.dataValues); | ||
|
||
// respond early | ||
response | ||
.status(200) | ||
.json({ | ||
success: true, | ||
pushIdent: createdPush.dataValues.pushIdent, | ||
}) | ||
.send(); | ||
|
||
await pushToTopicDevices(foundTopic, createdPush, pushPayload); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
createGrafanaPushRequest, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters