fix: emoji column no longer filled in db, simplified state length validation

This commit is contained in:
Tom Moor
2022-08-16 22:05:10 +02:00
parent a738b51d87
commit e57941732a

View File

@@ -222,13 +222,17 @@ class Document extends ParanoidModel {
@Column
editorVersion: string;
@Length({
max: 1,
msg: `Emoji must be a single character`,
})
@Column
emoji: string | null;
@Column(DataType.TEXT)
text: string;
@Length({
@SimpleLength({
max: DocumentValidation.maxStateLength,
msg: `Document collaborative state is too large, you must create a new document`,
})
@@ -335,7 +339,7 @@ class Document extends ParanoidModel {
@BeforeUpdate
static processUpdate(model: Document) {
const { emoji } = parseTitle(model.text);
const { emoji } = parseTitle(model.title);
// emoji in the title is split out for easier display
model.emoji = emoji || null;