From ef3a1471d4ac6ba6e0198550e3cecc78c644262e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jan 2022 12:01:34 +0530 Subject: [PATCH] Executable field for ActivitySpec view --- src/repository/couch/ActivitySpecRepository.ts | 1 + src/repository/mongo/ActivitySpecRepository.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/repository/couch/ActivitySpecRepository.ts b/src/repository/couch/ActivitySpecRepository.ts index d0b46309..fbddf951 100644 --- a/src/repository/couch/ActivitySpecRepository.ts +++ b/src/repository/couch/ActivitySpecRepository.ts @@ -9,6 +9,7 @@ export class ActivitySpecRepository implements ActivitySpecInterface { id: x.doc._id, ...x.doc, _id: undefined, + executable: !!id ? x.doc.executable : undefined, _rev: undefined, })) } diff --git a/src/repository/mongo/ActivitySpecRepository.ts b/src/repository/mongo/ActivitySpecRepository.ts index b777e8a3..1b6c6c7a 100644 --- a/src/repository/mongo/ActivitySpecRepository.ts +++ b/src/repository/mongo/ActivitySpecRepository.ts @@ -9,10 +9,11 @@ export class ActivitySpecRepository implements ActivitySpecInterface { ? await MongoClientDB.collection("activity_spec").find({$or: [ { _deleted: false, _id: id }, { _deleted: undefined, _id: id } ]}).maxTimeMS(60000).toArray() : await MongoClientDB.collection("activity_spec").find({$or: [ { _deleted: false }, { _deleted: undefined } ]}).maxTimeMS(60000).toArray() return (data as any).map((x: any) => ({ - id: x._id, + id: x._id, ...x, _id: undefined, __v: undefined, + executable: !!id ? x.executable : undefined, _deleted: undefined, })) } @@ -27,6 +28,7 @@ export class ActivitySpecRepository implements ActivitySpecInterface { temporal_slice_schema: object.temporal_slice_schema ?? {}, settings_schema: object.settings_schema ?? {}, category: object.category ?? null, + executable: object.executable ?? null, _deleted: false, } as any) return {} @@ -45,7 +47,8 @@ export class ActivitySpecRepository implements ActivitySpecInterface { static_data_schema: object.static_data_schema ?? orig.static_data_schema, temporal_slice_schema: object.temporal_slice_schema ?? orig.temporal_slice_schema, settings_schema: object.settings_schema ?? orig.settings_schema, - category: object.category ?? orig.category + category: object.category ?? orig.category, + executable: object.executable ?? orig.executable }, } )