From af831c42932c9a7370e714c7fe37a89ac1bae5ec Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Mar 2022 18:42:02 +0530 Subject: [PATCH 1/2] _schema removed, help_contents-> description, script_contents -> executable --- src/model/ActivitySpec.ts | 11 +++++----- .../couch/ActivitySpecRepository.ts | 22 +++++++++---------- .../mongo/ActivitySpecRepository.ts | 22 +++++++++---------- src/utils/OpenAPISchema.json | 6 ++--- 4 files changed, 28 insertions(+), 33 deletions(-) diff --git a/src/model/ActivitySpec.ts b/src/model/ActivitySpec.ts index c3db273d..e9b903f7 100644 --- a/src/model/ActivitySpec.ts +++ b/src/model/ActivitySpec.ts @@ -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_slice?: JSONSchema + public settings?: JSONSchema public category?: Tab[] | null - public executable?: string | null } diff --git a/src/repository/couch/ActivitySpecRepository.ts b/src/repository/couch/ActivitySpecRepository.ts index fbddf951..40347523 100644 --- a/src/repository/couch/ActivitySpecRepository.ts +++ b/src/repository/couch/ActivitySpecRepository.ts @@ -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_slice: object.temporal_slice ?? {}, + settings: object.settings ?? {}, category: object.category ?? null, - executable: object.executable ?? null } as any) return {} } catch (error) { @@ -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_slice: object.temporal_slice ?? orig.temporal_slice, + settings: object.settings ?? orig.settings, category: object.category ?? orig.category, - executable:object.executable ?? orig.executable }, ], }) diff --git a/src/repository/mongo/ActivitySpecRepository.ts b/src/repository/mongo/ActivitySpecRepository.ts index 1b6c6c7a..9580c16e 100644 --- a/src/repository/mongo/ActivitySpecRepository.ts +++ b/src/repository/mongo/ActivitySpecRepository.ts @@ -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_slice: object.temporal_slice ?? {}, + settings: object.settings ?? {}, + category: object.category ?? null, _deleted: false, } as any) return {} @@ -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_slice: object.temporal_slice ?? orig.temporal_slice, + settings: object.settings ?? orig.settings, category: object.category ?? orig.category, - executable: object.executable ?? orig.executable }, } ) diff --git a/src/utils/OpenAPISchema.json b/src/utils/OpenAPISchema.json index 98b2ccf3..f19fc2c2 100644 --- a/src/utils/OpenAPISchema.json +++ b/src/utils/OpenAPISchema.json @@ -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" @@ -6674,7 +6674,7 @@ } ] }, - "temporal_event_schema": { + "temporal_event": { "allOf": [ { "$ref": "#/components/schemas/JSONSchema" @@ -6723,7 +6723,7 @@ } ] }, - "settings_schema": { + "settings": { "allOf": [ { "$ref": "#/components/schemas/JSONSchema" From 4fbabcf0b77fe0f04095120d05b5707e8bd25ebd Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Mar 2022 19:36:31 +0530 Subject: [PATCH 2/2] temporal_slice -> temporal_slices --- src/model/ActivitySpec.ts | 2 +- src/repository/couch/ActivitySpecRepository.ts | 4 ++-- src/repository/mongo/ActivitySpecRepository.ts | 4 ++-- src/utils/OpenAPISchema.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/model/ActivitySpec.ts b/src/model/ActivitySpec.ts index e9b903f7..f6f69f34 100644 --- a/src/model/ActivitySpec.ts +++ b/src/model/ActivitySpec.ts @@ -6,7 +6,7 @@ export class ActivitySpec { public description?: string public executable?: string public static_data?: JSONSchema - public temporal_slice?: JSONSchema + public temporal_slices?: JSONSchema public settings?: JSONSchema public category?: Tab[] | null } diff --git a/src/repository/couch/ActivitySpecRepository.ts b/src/repository/couch/ActivitySpecRepository.ts index 40347523..c9da8530 100644 --- a/src/repository/couch/ActivitySpecRepository.ts +++ b/src/repository/couch/ActivitySpecRepository.ts @@ -20,7 +20,7 @@ export class ActivitySpecRepository implements ActivitySpecInterface { description: object.description ?? null, executable: object.executable ?? null, static_data: object.static_data ?? {}, - temporal_slice: object.temporal_slice ?? {}, + temporal_slices: object.temporal_slices ?? {}, settings: object.settings ?? {}, category: object.category ?? null, } as any) @@ -38,7 +38,7 @@ export class ActivitySpecRepository implements ActivitySpecInterface { description: object.description ?? orig.description, executable: object.executable ?? orig.executable, static_data: object.static_data ?? orig.static_data, - temporal_slice: object.temporal_slice ?? orig.temporal_slice, + temporal_slices: object.temporal_slices ?? orig.temporal_slices, settings: object.settings ?? orig.settings, category: object.category ?? orig.category, }, diff --git a/src/repository/mongo/ActivitySpecRepository.ts b/src/repository/mongo/ActivitySpecRepository.ts index 9580c16e..ae297aff 100644 --- a/src/repository/mongo/ActivitySpecRepository.ts +++ b/src/repository/mongo/ActivitySpecRepository.ts @@ -25,7 +25,7 @@ export class ActivitySpecRepository implements ActivitySpecInterface { description: object.description ?? null, executable: object.executable ?? null, static_data: object.static_data ?? {}, - temporal_slice: object.temporal_slice ?? {}, + temporal_slices: object.temporal_slices ?? {}, settings: object.settings ?? {}, category: object.category ?? null, _deleted: false, @@ -44,7 +44,7 @@ export class ActivitySpecRepository implements ActivitySpecInterface { description: object.description ?? orig.description, executable: object.executable ?? orig.executable, static_data: object.static_data ?? orig.static_data, - temporal_slice: object.temporal_slice ?? orig.temporal_slice, + temporal_slices: object.temporal_slices ?? orig.temporal_slices, settings: object.settings ?? orig.settings, category: object.category ?? orig.category, }, diff --git a/src/utils/OpenAPISchema.json b/src/utils/OpenAPISchema.json index f19fc2c2..a8ea86bd 100644 --- a/src/utils/OpenAPISchema.json +++ b/src/utils/OpenAPISchema.json @@ -6674,7 +6674,7 @@ } ] }, - "temporal_event": { + "temporal_slices": { "allOf": [ { "$ref": "#/components/schemas/JSONSchema"