diff options
-rw-r--r-- | server/initializers/constants.ts | 2 | ||||
-rw-r--r-- | server/initializers/migrations/0780-notification-registration.ts | 30 | ||||
-rw-r--r-- | server/middlewares/rate-limiter.ts | 1 |
3 files changed, 31 insertions, 2 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 020ed68da..a92fd22d6 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -27,7 +27,7 @@ import { CONFIG, registerConfigChangedHandler } from './config' | |||
27 | 27 | ||
28 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
29 | 29 | ||
30 | const LAST_MIGRATION_VERSION = 775 | 30 | const LAST_MIGRATION_VERSION = 780 |
31 | 31 | ||
32 | // --------------------------------------------------------------------------- | 32 | // --------------------------------------------------------------------------- |
33 | 33 | ||
diff --git a/server/initializers/migrations/0780-notification-registration.ts b/server/initializers/migrations/0780-notification-registration.ts new file mode 100644 index 000000000..5f1e0d2ea --- /dev/null +++ b/server/initializers/migrations/0780-notification-registration.ts | |||
@@ -0,0 +1,30 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | async function up (utils: { | ||
4 | transaction: Sequelize.Transaction | ||
5 | queryInterface: Sequelize.QueryInterface | ||
6 | sequelize: Sequelize.Sequelize | ||
7 | }): Promise<void> { | ||
8 | const { transaction } = utils | ||
9 | |||
10 | { | ||
11 | await utils.sequelize.query('DELETE FROM "userNotification" WHERE type = 20 AND "userRegistrationId" IS NULL', { transaction }) | ||
12 | } | ||
13 | |||
14 | { | ||
15 | await utils.sequelize.query( | ||
16 | 'ALTER TABLE "userNotification" DROP CONSTRAINT "userNotification_userRegistrationId_fkey", ' + | ||
17 | 'ADD CONSTRAINT "userNotification_userRegistrationId_fkey" ' + | ||
18 | 'FOREIGN KEY ("userRegistrationId") REFERENCES "userRegistration" ("id") ON DELETE CASCADE ON UPDATE CASCADE', | ||
19 | { transaction }) | ||
20 | } | ||
21 | } | ||
22 | |||
23 | function down (options) { | ||
24 | throw new Error('Not implemented.') | ||
25 | } | ||
26 | |||
27 | export { | ||
28 | up, | ||
29 | down | ||
30 | } | ||
diff --git a/server/middlewares/rate-limiter.ts b/server/middlewares/rate-limiter.ts index 1eef8b360..0e936028c 100644 --- a/server/middlewares/rate-limiter.ts +++ b/server/middlewares/rate-limiter.ts | |||
@@ -45,5 +45,4 @@ export function buildRateLimiter (options: { | |||
45 | 45 | ||
46 | function sendRateLimited (res: express.Response, options: RateLimitHandlerOptions) { | 46 | function sendRateLimited (res: express.Response, options: RateLimitHandlerOptions) { |
47 | return res.status(options.statusCode).send(options.message) | 47 | return res.status(options.statusCode).send(options.message) |
48 | |||
49 | } | 48 | } |