mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 02:35:23 -04:00
feat(note): save createdAt in a separate column
To keep the createdAt date stable, even when the revisions are dropped, this adds a separate column to store this data separately from revisions. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
342efcd7b7
commit
09ec447069
4 changed files with 10 additions and 6 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
JoinTable,
|
||||
ManyToMany,
|
||||
|
@ -94,6 +95,9 @@ export class Note {
|
|||
})
|
||||
version: number;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
private constructor() {}
|
||||
|
||||
|
@ -102,7 +106,10 @@ export class Note {
|
|||
* @param owner The owner of the note
|
||||
* @param alias Optional primary alias
|
||||
*/
|
||||
public static create(owner: User | null, alias?: string): Omit<Note, 'id'> {
|
||||
public static create(
|
||||
owner: User | null,
|
||||
alias?: string,
|
||||
): Omit<Note, 'id' | 'createdAt'> {
|
||||
const newNote = new Note();
|
||||
newNote.publicId = generatePublicId();
|
||||
newNote.aliases = alias
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue