Add icon column to document (#7066)
* Add icon column to document * Backfill columns --------- Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -64,6 +64,7 @@ import View from "./View";
|
||||
import ParanoidModel from "./base/ParanoidModel";
|
||||
import Fix from "./decorators/Fix";
|
||||
import { DocumentHelper } from "./helpers/DocumentHelper";
|
||||
import IsHexColor from "./validators/IsHexColor";
|
||||
import Length from "./validators/Length";
|
||||
|
||||
export const DOCUMENT_VERSION = 2;
|
||||
@@ -262,6 +263,18 @@ class Document extends ParanoidModel<
|
||||
@Column
|
||||
emoji: string | null;
|
||||
|
||||
@Length({
|
||||
max: 50,
|
||||
msg: `icon must be 50 characters or less`,
|
||||
})
|
||||
@Column
|
||||
icon: string | null;
|
||||
|
||||
/** The color of the icon. */
|
||||
@IsHexColor
|
||||
@Column
|
||||
color: string | null;
|
||||
|
||||
/**
|
||||
* The content of the document as Markdown.
|
||||
*
|
||||
|
||||
@@ -20,6 +20,7 @@ import Document from "./Document";
|
||||
import User from "./User";
|
||||
import IdModel from "./base/IdModel";
|
||||
import Fix from "./decorators/Fix";
|
||||
import IsHexColor from "./validators/IsHexColor";
|
||||
import Length from "./validators/Length";
|
||||
|
||||
@DefaultScope(() => ({
|
||||
@@ -77,6 +78,18 @@ class Revision extends IdModel<
|
||||
@Column
|
||||
emoji: string | null;
|
||||
|
||||
@Length({
|
||||
max: 50,
|
||||
msg: `icon must be 50 characters or less`,
|
||||
})
|
||||
@Column
|
||||
icon: string | null;
|
||||
|
||||
/** The color of the icon. */
|
||||
@IsHexColor
|
||||
@Column
|
||||
color: string | null;
|
||||
|
||||
// associations
|
||||
|
||||
@BelongsTo(() => Document, "documentId")
|
||||
@@ -121,6 +134,8 @@ class Revision extends IdModel<
|
||||
title: document.title,
|
||||
text: document.text,
|
||||
emoji: document.emoji,
|
||||
icon: document.emoji,
|
||||
color: document.color,
|
||||
content: document.content,
|
||||
userId: document.lastModifiedById,
|
||||
editorVersion: document.editorVersion,
|
||||
|
||||
Reference in New Issue
Block a user