From e0c723a1681866ca9c70294123c47faebef98e2b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Jan 2022 11:07:00 +0530 Subject: [PATCH 1/2] Adding executable field for ActivitySpec --- src/model/ActivitySpec.ts | 1 + src/repository/couch/ActivitySpecRepository.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/model/ActivitySpec.ts b/src/model/ActivitySpec.ts index 3865ff91..c3db273d 100644 --- a/src/model/ActivitySpec.ts +++ b/src/model/ActivitySpec.ts @@ -9,4 +9,5 @@ export class ActivitySpec { public temporal_slice_schema?: JSONSchema public settings_schema?: JSONSchema public category?: Tab[] | null + public executable?: string | null } diff --git a/src/repository/couch/ActivitySpecRepository.ts b/src/repository/couch/ActivitySpecRepository.ts index f8144ba3..d0b46309 100644 --- a/src/repository/couch/ActivitySpecRepository.ts +++ b/src/repository/couch/ActivitySpecRepository.ts @@ -22,6 +22,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 } as any) return {} } catch (error) { @@ -39,7 +40,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 }, ], }) From ef3a1471d4ac6ba6e0198550e3cecc78c644262e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jan 2022 12:01:34 +0530 Subject: [PATCH 2/2] 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 }, } )