fix(server/tasks): missing utcDateModified causing errors on create

This commit is contained in:
Elian Doran 2025-02-18 21:07:06 +02:00
parent c00505cd7b
commit 373e0b45f2
No known key found for this signature in database
3 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import date_utils from "../../services/date_utils.js";
import AbstractBeccaEntity from "./abstract_becca_entity.js"; import AbstractBeccaEntity from "./abstract_becca_entity.js";
import type BOption from "./boption.js"; import type BOption from "./boption.js";
import type { TaskRow } from "./rows.js"; import type { TaskRow } from "./rows.js";
@ -45,6 +46,7 @@ export default class BTask extends AbstractBeccaEntity<BOption> {
this.dueDate = row.dueDate; this.dueDate = row.dueDate;
this.isDone = !!row.isDeleted; this.isDone = !!row.isDeleted;
this._isDeleted = !!row.isDeleted; this._isDeleted = !!row.isDeleted;
this.utcDateModified = row.utcDateModified;
if (this.taskId) { if (this.taskId) {
this.becca.tasks[this.taskId] = this; this.becca.tasks[this.taskId] = this;
@ -57,13 +59,20 @@ export default class BTask extends AbstractBeccaEntity<BOption> {
} }
} }
protected beforeSaving(opts?: {}): void {
super.beforeSaving();
this.utcDateModified = date_utils.utcNowDateTime();
}
getPojo() { getPojo() {
return { return {
taskId: this.taskId, taskId: this.taskId,
parentNoteId: this.parentNoteId, parentNoteId: this.parentNoteId,
title: this.title, title: this.title,
dueDate: this.dueDate, dueDate: this.dueDate,
isDeleted: this.isDeleted isDeleted: this.isDeleted,
utcDateModified: this.utcDateModified
}; };
} }

View File

@ -144,4 +144,5 @@ export interface TaskRow {
dueDate?: string; dueDate?: string;
isDone?: boolean; isDone?: boolean;
isDeleted?: boolean; isDeleted?: boolean;
utcDateModified: string;
} }

View File

@ -6,6 +6,7 @@ export interface FTaskRow {
title: string; title: string;
dueDate?: string; dueDate?: string;
isDone?: boolean; isDone?: boolean;
utcDateModified: string;
} }
export default class FTask { export default class FTask {
@ -15,6 +16,7 @@ export default class FTask {
title!: string; title!: string;
dueDate?: string; dueDate?: string;
isDone!: boolean; isDone!: boolean;
utcDateModified!: string;
constructor(froca: Froca, row: FTaskRow) { constructor(froca: Froca, row: FTaskRow) {
this.froca = froca; this.froca = froca;
@ -27,5 +29,6 @@ export default class FTask {
this.title = row.title; this.title = row.title;
this.dueDate = row.dueDate; this.dueDate = row.dueDate;
this.isDone = !!row.isDone; this.isDone = !!row.isDone;
this.utcDateModified = row.utcDateModified;
} }
} }