From 075233c1a9d788269017e9ac8213dc87d4b5b2ea Mon Sep 17 00:00:00 2001 From: Alexander Sadovsky Date: Wed, 25 Jul 2018 23:10:55 +0200 Subject: [PATCH] added descriptions for attributes --- api/models/Asset.ts | 19 +++++++++++++++---- api/models/Job.ts | 25 +++++++++++++++++++------ api/models/Task.ts | 18 +++++++++++++----- api/models/User.ts | 7 +++++++ api/models/Webhook.ts | 16 +++++++++++++--- 5 files changed, 67 insertions(+), 18 deletions(-) diff --git a/api/models/Asset.ts b/api/models/Asset.ts index 5fe1761..701c28a 100644 --- a/api/models/Asset.ts +++ b/api/models/Asset.ts @@ -16,24 +16,35 @@ module.exports = { }, file: { - type: 'binary' + type: 'binary', + description: 'an actual file (asset)' }, isReference: { - type: 'boolean' + type: 'boolean', + description: 'if is set to true, then the Asset is not suppossed to be actionable.' }, sourceLanguage: { - type: 'string' + type: 'string', + description: 'language code of the source' }, encoding: { - type: 'string' + type: 'string', + description: 'encoding code' }, jobId: { model: 'job' } + }, + + // custom validation functions + types: { + // This is a workaround for having description in the attributes. + // Otherwise there would be an error. + description: () => true } }; diff --git a/api/models/Job.ts b/api/models/Job.ts index 5809f99..18201a0 100644 --- a/api/models/Job.ts +++ b/api/models/Job.ts @@ -17,7 +17,8 @@ module.exports = { name: { type: 'string', - required: true + required: true, + description: 'name of a Job' }, description: { @@ -25,19 +26,23 @@ module.exports = { }, submitDate: { - type: 'datetime' + type: 'datetime', + description: 'a date when the Job was submit' }, dueDate: { - type: 'datetime' + type: 'datetime', + description: 'a date with a deadline' }, closedDate: { - type: 'datetime' + type: 'datetime', + description: 'a date when the Job was closed' }, submitter: { - type: 'integer' + type: 'integer', + description: 'id of the user who did submit the Job' }, assets: { @@ -51,9 +56,17 @@ module.exports = { }, externalId: { - type: 'string' + type: 'string', + description: 'external project id, as is defined on the external system' } + }, + + // custom validation functions + types: { + // This is a workaround for having description in the attributes. + // Otherwise there would be an error. + description: () => true } }; diff --git a/api/models/Task.ts b/api/models/Task.ts index 446d733..393a330 100644 --- a/api/models/Task.ts +++ b/api/models/Task.ts @@ -21,7 +21,8 @@ export = { }, targetLanguage: { - type: 'string' + type: 'string', + description: 'language code of the target' }, assetId: { @@ -34,18 +35,25 @@ export = { }, assignedTo: { - // user Id - type: 'integer' + type: 'integer', + description: 'id of the user who it is assigned to' }, file: { - // deliverable - type: 'binary' + type: 'binary', + description: 'an actual file (deliverable)' }, jobId: { model: 'job' } + }, + + // custom validation functions + types: { + // This is a workaround for having description in the attributes. + // Otherwise there would be an error. + description: () => true } }; diff --git a/api/models/User.ts b/api/models/User.ts index 92b5c65..efdff26 100644 --- a/api/models/User.ts +++ b/api/models/User.ts @@ -9,6 +9,13 @@ module.exports = { attributes: { + }, + + // custom validation functions + types: { + // This is a workaround for having description in the attributes. + // Otherwise there would be an error. + description: () => true } }; diff --git a/api/models/Webhook.ts b/api/models/Webhook.ts index 7ecab91..58dd855 100644 --- a/api/models/Webhook.ts +++ b/api/models/Webhook.ts @@ -16,7 +16,8 @@ module.exports = { }, name: { - type: 'string' + type: 'string', + description: 'name of the Webhook' }, description: { @@ -24,7 +25,8 @@ module.exports = { }, url: { - type: 'string' + type: 'string', + description: 'url which the server will make a request to when an event occurs' }, eventType: { @@ -39,8 +41,16 @@ module.exports = { 'assetCreated', 'assetUpdated', 'assetDeleted' - ] + ], + description: 'type of event - if this event occurs, then the "url" will be requested by the TAPICC server' } + }, + + // custom validation functions + types: { + // This is a workaround for having description in the attributes. + // Otherwise there would be an error. + description: () => true } };