From 8399edca721524f0b24d05e9a204ae357928faae Mon Sep 17 00:00:00 2001 From: Omkar Phansopkar Date: Wed, 14 Feb 2024 23:43:34 +0530 Subject: [PATCH] Fixed optional id in todo Signed-off-by: Omkar Phansopkar --- src/services/models/todo.ts | 2 +- src/services/workbenchDB.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/models/todo.ts b/src/services/models/todo.ts index f88a6e77..c28a98b5 100644 --- a/src/services/models/todo.ts +++ b/src/services/models/todo.ts @@ -18,7 +18,7 @@ import { Sequelize, DataTypes, Model } from "sequelize"; import { jsonDataType } from "./databaseUtils"; export interface TodoAttributes { - id?: number; + id: number; detection_id: string; issues: Record; } diff --git a/src/services/workbenchDB.ts b/src/services/workbenchDB.ts index b8d2bf2c..c2acbed3 100644 --- a/src/services/workbenchDB.ts +++ b/src/services/workbenchDB.ts @@ -596,8 +596,9 @@ export class WorkbenchDB { // @TODO - ToDo in scans have a field review_comments, which is ideally an issue // It will be changed in the schema in future const todo: TodoAttributes[] = (rawTopLevelData.todo || []).map( - (todo: RawTopLevelTodo) => { + (todo: RawTopLevelTodo, idx) => { return { + id: idx + 1, detection_id: todo.detection_id, issues: todo.review_comments, };