dateCreated hot init extension

pull/85/head
Piero Toffanin 2019-06-04 10:18:58 -04:00
rodzic 434b84bf7c
commit 3909c0a677
6 zmienionych plików z 24 dodań i 6 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ REST API to access ODM
=== Version information === Version information
[%hardbreaks] [%hardbreaks]
_Version_ : 1.5.1 _Version_ : 1.5.2
=== Contact information === Contact information
@ -295,6 +295,8 @@ Creates a new task and places it at the end of the processing queue. For uploadi
_optional_|An optional UUID string that will be used as UUID for this task instead of generating a random one.|string| _optional_|An optional UUID string that will be used as UUID for this task instead of generating a random one.|string|
|*Query*|*token* + |*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string| _optional_|Token required for authentication (when authentication is required).|string|
|*FormData*|*dateCreated* +
_optional_|An optional timestamp overriding the default creation date of the task.|integer|
|*FormData*|*images* + |*FormData*|*images* +
_optional_|Images to process, plus an optional GCP file (*.txt) and/or an optional seed file (seed.zip). If included, the GCP file should have .txt extension. If included, the seed archive pre-polulates the task directory with its contents.|file| _optional_|Images to process, plus an optional GCP file (*.txt) and/or an optional seed file (seed.zip). If included, the GCP file should have .txt extension. If included, the seed archive pre-polulates the task directory with its contents.|file|
|*FormData*|*name* + |*FormData*|*name* +
@ -402,6 +404,8 @@ Initialize the upload of a new task. If successful, a user can start uploading f
_optional_|An optional UUID string that will be used as UUID for this task instead of generating a random one.|string| _optional_|An optional UUID string that will be used as UUID for this task instead of generating a random one.|string|
|*Query*|*token* + |*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string| _optional_|Token required for authentication (when authentication is required).|string|
|*FormData*|*dateCreated* +
_optional_|An optional timestamp overriding the default creation date of the task.|integer|
|*FormData*|*name* + |*FormData*|*name* +
_optional_|An optional name to be associated with the task|string| _optional_|An optional name to be associated with the task|string|
|*FormData*|*options* + |*FormData*|*options* +

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -87,6 +87,12 @@ let server;
* required: false * required: false
* type: string * type: string
* - * -
* name: dateCreated
* in: formData
* description: 'An optional timestamp overriding the default creation date of the task.'
* required: false
* type: integer
* -
* name: token * name: token
* in: query * in: query
* description: 'Token required for authentication (when authentication is required).' * description: 'Token required for authentication (when authentication is required).'
@ -239,6 +245,12 @@ app.post('/task/new/commit/:uuid', authCheck, taskNew.getUUID, taskNew.handleCom
* required: false * required: false
* type: string * type: string
* - * -
* name: dateCreated
* in: formData
* description: 'An optional timestamp overriding the default creation date of the task.'
* required: false
* type: integer
* -
* name: token * name: token
* in: query * in: query
* description: 'Token required for authentication (when authentication is required).' * description: 'Token required for authentication (when authentication is required).'

Wyświetl plik

@ -38,13 +38,13 @@ const utils = require('./utils');
const statusCodes = require('./statusCodes'); const statusCodes = require('./statusCodes');
module.exports = class Task{ module.exports = class Task{
constructor(uuid, name, options = [], webhook = null, skipPostProcessing = false, outputs = [], done = () => {}){ constructor(uuid, name, options = [], webhook = null, skipPostProcessing = false, outputs = [], dateCreated = new Date().getTime(), done = () => {}){
assert(uuid !== undefined, "uuid must be set"); assert(uuid !== undefined, "uuid must be set");
assert(done !== undefined, "ready must be set"); assert(done !== undefined, "ready must be set");
this.uuid = uuid; this.uuid = uuid;
this.name = name !== "" ? name : "Task of " + (new Date()).toISOString(); this.name = name !== "" ? name : "Task of " + (new Date()).toISOString();
this.dateCreated = new Date().getTime(); this.dateCreated = isNaN(parseInt(dateCreated)) ? new Date().getTime() : parseInt(dateCreated);
this.processingTime = -1; this.processingTime = -1;
this.setStatus(statusCodes.QUEUED); this.setStatus(statusCodes.QUEUED);
this.options = options; this.options = options;
@ -96,6 +96,7 @@ module.exports = class Task{
taskJson.webhook, taskJson.webhook,
taskJson.skipPostProcessing, taskJson.skipPostProcessing,
taskJson.outputs, taskJson.outputs,
taskJson.dateCreated,
(err, task) => { (err, task) => {
if (err) done(err); if (err) done(err);
else{ else{

Wyświetl plik

@ -353,6 +353,7 @@ module.exports = {
req.body.webhook, req.body.webhook,
req.body.skipPostProcessing === 'true', req.body.skipPostProcessing === 'true',
req.body.outputs, req.body.outputs,
req.body.dateCreated,
(err, task) => { (err, task) => {
if (err) cb(err); if (err) cb(err);
else { else {

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "node-opendronemap", "name": "NodeODM",
"version": "1.5.1", "version": "1.5.2",
"description": "REST API to access ODM", "description": "REST API to access ODM",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {