Skip to content

Commit

Permalink
Merge pull request #175 from BIDMCDigitalPsychiatry/issue-467
Browse files Browse the repository at this point in the history
Adding executable field for ActivitySpec
  • Loading branch information
sarithapillai8 authored Jan 21, 2022
2 parents 18ad9db + ef3a147 commit c1c9c09
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/model/ActivitySpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export class ActivitySpec {
public temporal_slice_schema?: JSONSchema
public settings_schema?: JSONSchema
public category?: Tab[] | null
public executable?: string | null
}
5 changes: 4 additions & 1 deletion src/repository/couch/ActivitySpecRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}))
}
Expand All @@ -22,6 +23,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) {
Expand All @@ -39,7 +41,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
},
],
})
Expand Down
7 changes: 5 additions & 2 deletions src/repository/mongo/ActivitySpecRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}))
}
Expand All @@ -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 {}
Expand All @@ -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
},
}
)
Expand Down

0 comments on commit c1c9c09

Please sign in to comment.