-
Notifications
You must be signed in to change notification settings - Fork 7
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 #526 from hanshino:feature/attack-message
Add attack message template tags functionality
- Loading branch information
Showing
9 changed files
with
444 additions
and
279 deletions.
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,13 +1,3 @@ | ||
const Sentry = require("@sentry/node"); | ||
// or use es6 import statements | ||
// import * as Sentry from '@sentry/node'; | ||
|
||
Sentry.init({ dsn: process.env.SENTRY_DSN }); | ||
|
||
module.exports = async function HandleError(context, props) { | ||
console.error(props.error.stack); | ||
|
||
if (process.env.NODE_ENV === "production") { | ||
Sentry.captureException(props.error); | ||
} | ||
}; |
19 changes: 19 additions & 0 deletions
19
app/migrations/20240916025031_create_attack_message_has_tags_table.js
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,19 @@ | ||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.up = function (knex) { | ||
return knex.schema.createTable("attack_message_has_tags", table => { | ||
table.increments("id").primary(); | ||
table.integer("attack_message_id").unsigned().notNullable(); | ||
table.string("tag").notNullable(); | ||
}); | ||
}; | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.down = function (knex) { | ||
return knex.schema.dropTable("attack_message_has_tags"); | ||
}; |
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
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
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,15 @@ | ||
const base = require("../base"); | ||
|
||
class AttackMessageTags extends base { | ||
/** | ||
* Get all tags | ||
* @returns {Promise<string[]>} | ||
*/ | ||
async getTags() { | ||
return this.knex.distinct("tag").then(result => result.map(item => item.tag)); | ||
} | ||
} | ||
|
||
module.exports = new AttackMessageTags({ | ||
table: "attack_message_has_tags", | ||
}); |
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
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
Oops, something went wrong.