diff --git a/models/Wwws.js b/models/Wwws.js index 9b734e9..4578224 100644 --- a/models/Wwws.js +++ b/models/Wwws.js @@ -19,7 +19,7 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => { status: 200, ref: "Wwws", msg: "pagedoesnotexist", - data: { pagename }, + data: { pagename } }; } if (locals.pages[pagename].version == version) { @@ -42,13 +42,13 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => { if (fs.existsSync(initname) && 1 != 1) { const init = fs.readJsonSync(initname); if (init.app.version == locals.app.version) { - return { status: 200, ref: "Wwws", msg: "datamodelupdate", data: init }; + return { status: 200, ref: "Wwws", msg: "datamodelnoupdate", data: init }; } } const localstorage = { version: locals.pages[pagename].version, headers: locals.apxtri.headers, - confpages:locals.pages[pagename].confpage, + confpage:locals.pages[pagename].confpage, req: {}, itm:{}, itms: {}, diff --git a/routes/wwws.js b/routes/wwws.js index 6723c64..7544f35 100644 --- a/routes/wwws.js +++ b/routes/wwws.js @@ -31,19 +31,14 @@ router.post( /** * @api {get} /api/adminapi/wwws/updatelocaldbanonymous/:tribe/:appname/:pagename/:version - Get app data model for anonymous only * @apiGroup Wwws - * @apiName getappcontext - * @apiDescription Get data base from backend to localstorage + * @apiName getappcontextforanonymous + * @apiDescription Get data base from backend to localstorage for anonymous (see Get app data model) * * @apiParams {string} tribe (adminapi,smatchit,..) to looking for * @apiParams {string} appname agregate a full data referential to store localy * @apiParams {string} pagename app page name * @apiParams {interger} version the current version - * @apiSuccess {object} contain new version data model for a local web app in a PWA logical in the language of the header or if no new version exist then return - * @apiSuccessExample {json} Success-Response: - * HTTP/1.1 200 OK - * {"status":200, "ref":"Odmdb", "msg":"datamodelupdate", "data":{version,conpages,profils,...}} - * {"status":200, "ref":"Odmdb", "msg":"nonewdatamodel", "data":{}} - */ +*/ router.get( "/updatelocaldbanonymous/:tribe/:appname/:pagename/:version", checkHeaders, @@ -68,17 +63,22 @@ router.get( * @api {get} /api/adminapi/wwws/updatelocaldb/:tribe/:appname/:pagename/:version - Get app data model * @apiGroup Wwws * @apiName getappcontext - * @apiDescription Get data base from backend to localstorage + * @apiDescription Get data base from backend to localstorage for authenticated user * * @apiParams {string} tribe (adminapi,smatchit,..) to looking for * @apiParams {string} appname agregate a full data referential to store localy * @apiParams {string} pagename app page name * @apiParams {interger} version the current version * @apiSuccess {object} contain new version data model for a local web app in a PWA logical in the language of the header or if no new version exist then return - * @apiSuccessExample {json} Success-Response: + * @apiSuccessExample {json} datamodelupdate + * {"status":200, "ref":"Wwws", "msg":"datamodelupdate", "data":{version,confpage,profils,schema,options,ref,tpl,tpldata}} + * @apiSuccessExample {json} datamodelnoupdate * HTTP/1.1 200 OK - * {"status":200, "ref":"Odmdb", "msg":"datamodelupdate", "data":{version,conpages,profils,...}} - * {"status":200, "ref":"Odmdb", "msg":"nonewdatamodel", "data":{}} + * {"status":200, "ref":"Wwws", "msg":"datamodelupdate", "data":{version,confpage,profils,schema,options,ref,tpl,tpldata}} + * @apiSuccessExample {json} pagedoesnotexist + * {status: 200,ref: "Wwws", msg: "pagedoesnotexist", data: { pagename } } + * @apiSuccessExample {json} forbidenaccess + * {status: 200,ref: "Wwws", msg: "forbidenaccess",data: { pagename, profils } } */ router.get( "/updatelocaldb/:tribe/:appname/:pagename/:version",