Make NoteEdit entity match the database schema

This commit is contained in:
Hazelnoot 2025-04-13 19:19:49 -04:00
parent 353728929e
commit 8957cd9f3e
3 changed files with 9 additions and 10 deletions

View file

@ -26,11 +26,6 @@ export class NoteEdit {
@JoinColumn()
public note: MiNote | null;
@Column('text', {
nullable: true,
})
public oldText: string | null;
@Column('text', {
nullable: true,
})
@ -54,8 +49,14 @@ export class NoteEdit {
})
public updatedAt: Date;
@Column('text', {
nullable: true,
})
public oldText: string | null;
@Column('timestamp with time zone', {
comment: 'The old date from before the edit',
nullable: true,
})
public oldDate: Date;
public oldDate: Date | null;
}

View file

@ -106,7 +106,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
for (const edit of edits) {
editArray.push({
oldDate: edit.oldDate.toISOString(),
oldDate: (edit.oldDate ?? edit.updatedAt).toISOString(),
updatedAt: edit.updatedAt.toISOString(),
text: edit.oldText ?? edit.newText ?? null,
});