Skip to content

Commit

Permalink
Merge pull request #185 from BIDMCDigitalPsychiatry/issue-467-new
Browse files Browse the repository at this point in the history
_schema removed, help_contents-> description, script_contents -> exec…
  • Loading branch information
sarithapillai8 authored Mar 3, 2022
2 parents b736156 + c46a2f8 commit d56bdde
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 33 deletions.
11 changes: 5 additions & 6 deletions src/model/ActivitySpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ type JSONSchema = any
type Tab = 'learn' | 'assess' | 'manage' | 'prevent'
export class ActivitySpec {
public name?: string
public help_contents?: string
public script_contents?: string
public static_data_schema?: JSONSchema
public temporal_slice_schema?: JSONSchema
public settings_schema?: JSONSchema
public description?: string
public executable?: string
public static_data?: JSONSchema
public temporal_slices?: JSONSchema
public settings?: JSONSchema
public category?: Tab[] | null
public executable?: string | null
}
22 changes: 10 additions & 12 deletions src/repository/couch/ActivitySpecRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ export class ActivitySpecRepository implements ActivitySpecInterface {
try {
await Database.use("activity_spec").insert({
_id: object.name,
help_contents: object.help_contents ?? null,
script_contents: object.script_contents ?? null,
static_data_schema: object.static_data_schema ?? {},
temporal_slice_schema: object.temporal_slice_schema ?? {},
settings_schema: object.settings_schema ?? {},
description: object.description ?? null,
executable: object.executable ?? null,
static_data: object.static_data ?? {},
temporal_slices: object.temporal_slices ?? {},
settings: object.settings ?? {},
category: object.category ?? null,
executable: object.executable ?? null
} as any)
return {}
} catch (error) {
Expand All @@ -36,13 +35,12 @@ export class ActivitySpecRepository implements ActivitySpecInterface {
docs: [
{
...orig,
help_contents: object.help_contents ?? orig.help_contents,
script_contents: object.script_contents ?? orig.script_contents,
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,
description: object.description ?? orig.description,
executable: object.executable ?? orig.executable,
static_data: object.static_data ?? orig.static_data,
temporal_slices: object.temporal_slices ?? orig.temporal_slices,
settings: object.settings ?? orig.settings,
category: object.category ?? orig.category,
executable:object.executable ?? orig.executable
},
],
})
Expand Down
22 changes: 10 additions & 12 deletions src/repository/mongo/ActivitySpecRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ export class ActivitySpecRepository implements ActivitySpecInterface {
try {
await MongoClientDB.collection("activity_spec").insertOne({
_id: object.name,
help_contents: object.help_contents ?? null,
script_contents: object.script_contents ?? null,
static_data_schema: object.static_data_schema ?? {},
temporal_slice_schema: object.temporal_slice_schema ?? {},
settings_schema: object.settings_schema ?? {},
category: object.category ?? null,
description: object.description ?? null,
executable: object.executable ?? null,
static_data: object.static_data ?? {},
temporal_slices: object.temporal_slices ?? {},
settings: object.settings ?? {},
category: object.category ?? null,
_deleted: false,
} as any)
return {}
Expand All @@ -42,13 +41,12 @@ export class ActivitySpecRepository implements ActivitySpecInterface {
{ _id: orig._id },
{
$set: {
help_contents: object.help_contents ?? orig.help_contents,
script_contents: object.script_contents ?? orig.script_contents,
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,
description: object.description ?? orig.description,
executable: object.executable ?? orig.executable,
static_data: object.static_data ?? orig.static_data,
temporal_slices: object.temporal_slices ?? orig.temporal_slices,
settings: object.settings ?? orig.settings,
category: object.category ?? orig.category,
executable: object.executable ?? orig.executable
},
}
)
Expand Down
6 changes: 3 additions & 3 deletions src/utils/OpenAPISchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6647,7 +6647,7 @@
"type": "string",
"description": "The WebView-compatible script that provides this Activity on mobile or desktop (IFrame) clients."
},
"static_data_schema": {
"static_data": {
"allOf": [
{
"$ref": "#/components/schemas/JSONSchema"
Expand All @@ -6674,7 +6674,7 @@
}
]
},
"temporal_event_schema": {
"temporal_slices": {
"allOf": [
{
"$ref": "#/components/schemas/JSONSchema"
Expand Down Expand Up @@ -6723,7 +6723,7 @@
}
]
},
"settings_schema": {
"settings": {
"allOf": [
{
"$ref": "#/components/schemas/JSONSchema"
Expand Down

0 comments on commit d56bdde

Please sign in to comment.