From a68b0b2793759d6c89e297b41554122bb68d27fd Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 16 Jan 2024 09:17:28 +0000 Subject: [PATCH] Merge pull request #16527 from overleaf/jpa-wf-hint-oauth [web] add endpoint for checking on prior usage of Writefull oauth GitOrigin-RevId: a8ecc06b7f045237773cdb5c073c2f7d7abd04f9 --- .../20240115172206_oauth_issuer_index.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 services/web/migrations/20240115172206_oauth_issuer_index.js diff --git a/services/web/migrations/20240115172206_oauth_issuer_index.js b/services/web/migrations/20240115172206_oauth_issuer_index.js new file mode 100644 index 0000000000..8a74ed52c9 --- /dev/null +++ b/services/web/migrations/20240115172206_oauth_issuer_index.js @@ -0,0 +1,25 @@ +const Helpers = require('./lib/helpers') + +exports.tags = ['saas'] + +const index = { + key: { + oauthApplication_id: 1, + }, + name: 'oauthApplication_id_1', + partialFilterExpression: { + oauthApplication_id: { + $exists: true, + }, + }, +} + +exports.migrate = async client => { + const { db } = client + await Helpers.addIndexesToCollection(db.oauthAccessTokens, [index]) +} + +exports.rollback = async client => { + const { db } = client + await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [index]) +}