fix: Increase possible length of user and team avatar urls

This commit is contained in:
Tom Moor
2022-09-27 23:14:03 -04:00
parent 463a8c7ccd
commit 047b17b479
3 changed files with 35 additions and 2 deletions

View File

@@ -0,0 +1,33 @@
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.changeColumn("users", "avatarUrl", {
type: Sequelize.STRING(4096),
allowNull: true,
transaction,
});
await queryInterface.changeColumn("teams", "avatarUrl", {
type: Sequelize.STRING(4096),
allowNull: true,
transaction,
});
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.changeColumn("users", "avatarUrl", {
type: Sequelize.STRING,
allowNull: true,
transaction,
});
await queryInterface.changeColumn("teams", "avatarUrl", {
type: Sequelize.STRING,
allowNull: true,
transaction,
});
});
}
};

View File

@@ -89,7 +89,7 @@ class Team extends ParanoidModel {
@AllowNull
@IsUrl
@Length({ max: 255, msg: "avatarUrl must be 255 characters or less" })
@Length({ max: 4096, msg: "avatarUrl must be 4096 characters or less" })
@Column
avatarUrl: string | null;

View File

@@ -170,7 +170,7 @@ class User extends ParanoidModel {
@AllowNull
@IsUrl
@Length({ max: 1000, msg: "avatarUrl must be less than 1000 characters" })
@Length({ max: 4096, msg: "avatarUrl must be less than 4096 characters" })
@Column(DataType.STRING)
get avatarUrl() {
const original = this.getDataValue("avatarUrl");