From 988a4c5ac1db129a68990ba0b7a34248a730477f Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 17 Mar 2024 13:23:20 -0400 Subject: [PATCH] Add refreshToken to IntegrationAuthentication --- ...40317171826-add-authentication-refresh-token.js | 14 ++++++++++++++ server/models/IntegrationAuthentication.ts | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 server/migrations/20240317171826-add-authentication-refresh-token.js diff --git a/server/migrations/20240317171826-add-authentication-refresh-token.js b/server/migrations/20240317171826-add-authentication-refresh-token.js new file mode 100644 index 000000000..53d6169b4 --- /dev/null +++ b/server/migrations/20240317171826-add-authentication-refresh-token.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + async up (queryInterface, Sequelize) { + await queryInterface.addColumn("authentications", "refreshToken", { + type: Sequelize.BLOB, + allowNull: true, + }); + }, + + async down (queryInterface) { + await queryInterface.removeColumn("authentications", "refreshToken"); + } +}; \ No newline at end of file diff --git a/server/models/IntegrationAuthentication.ts b/server/models/IntegrationAuthentication.ts index f444aabe7..0b0585582 100644 --- a/server/models/IntegrationAuthentication.ts +++ b/server/models/IntegrationAuthentication.ts @@ -38,6 +38,16 @@ class IntegrationAuthentication extends IdModel< setEncryptedColumn(this, "token", value); } + @Column(DataType.BLOB) + @Encrypted + get refreshToken() { + return getEncryptedColumn(this, "refreshToken"); + } + + set refreshToken(value: string) { + setEncryptedColumn(this, "refreshToken", value); + } + // associations @BelongsTo(() => User, "userId")