update
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This module have to be use in back as well front
|
||||
can be include in project with
|
||||
- into a browser : <script src="https://townName.nationName.dns/nationchains/contracts/Checkjson.js"></script>
|
||||
- >into a browser : <script src="https://townName.nationName.dns/nationchains/contracts/Checkjson.js"></script>
|
||||
- into a node.js : const Checkjson = require( `../nationchains/socialworld/contracts/Checkjson.js`);
|
||||
*/
|
||||
// --##
|
||||
|
@@ -352,10 +352,13 @@ Odmdb.cud = (objectPathname, crud, itm, role) => {
|
||||
data: { missingkey: getschema.data.schema.apxid },
|
||||
};
|
||||
}
|
||||
const pathindex=`${objectPathname}/idx/lst_${getschema.data.schema.apxid}.json`;
|
||||
if (!fs.existsSync(pathindex)){
|
||||
fs.outputJSONSync(pathindex,[])
|
||||
fs.ensureDirSync(`${objectPathname}/itm/`);
|
||||
}
|
||||
const existid = fs
|
||||
.readJSONSync(
|
||||
`${objectPathname}/idx/lst_${getschema.data.schema.apxid}.json`
|
||||
)
|
||||
.readJSONSync(pathindex)
|
||||
.includes(itm[getschema.data.schema.apxid]);
|
||||
if (existid && crud == "C") {
|
||||
return {
|
||||
@@ -392,7 +395,7 @@ Odmdb.cud = (objectPathname, crud, itm, role) => {
|
||||
// set owner cause this is a Create
|
||||
itm.owner = role.xalias;
|
||||
}
|
||||
//get accessrigh {C:[],R:[],U:[],D:[]} if exist means authorize, if array contain properties (for R and U) right is only allowed on properties
|
||||
//get accessright {C:[],R:[],U:[],D:[]} if exist means authorize, if array contain properties (for R and U) right is only allowed on properties
|
||||
const accessright = Odmdb.accessright(
|
||||
getschema.data.schema.apxaccessrights,
|
||||
role
|
||||
|
@@ -1,57 +1,29 @@
|
||||
const glob = require("glob");
|
||||
const path = require("path");
|
||||
const fs = require("fs-extra");
|
||||
const dayjs = require("dayjs");
|
||||
const axios = require("axios");
|
||||
const conf = require(`${process.env.dirtown}/conf.json`);
|
||||
const Checkjson = require(`./Checkjson.js`);
|
||||
|
||||
const Trackings = {}
|
||||
|
||||
/**
|
||||
* Tracking management:
|
||||
*
|
||||
* without header:
|
||||
* https://dns.xx/trk/pathtofile?alias=anonymous&uuid=1b506f71-1bff-416c-9057-cb8b86296f60&src=btnregister&version=1&lg=fr
|
||||
* Tracking system management
|
||||
*
|
||||
* with header
|
||||
* https://dns.xx/trk/pathtofile?src=btnregister&version=1
|
||||
*
|
||||
* where pathtofile is a ressource accessible from https://dns.xx/pathtofile
|
||||
*
|
||||
* We get :
|
||||
* alias: if athenticated from header else anonymous
|
||||
* uuid: a uuid v4 générate the first time a web page is open on a browser
|
||||
* src: source action that trig this get
|
||||
* version: can be an int, date or any version of the src
|
||||
* tm: optionnal is a timestamp of action when it is not immediate (offline app)
|
||||
*
|
||||
* html usage to track a loading page or email when a picture is load
|
||||
* using apxwebapp in /src/ we got:
|
||||
* <img src="static/img/photo.jpg" data-trksrckey="loadpage" data-version="1">
|
||||
*
|
||||
* using html + apx.js (or at least with header {xalias,xuuid,xlang})
|
||||
* <img lazysrc="trk/static/img/photo.jpg data-trksrckey="loadpage" data-version="1">
|
||||
*
|
||||
*
|
||||
* in js action:
|
||||
* <button></button> or
|
||||
* <a data-trksrc="linktoblabla" href='https:..'
|
||||
* onclick="apx.trackvisit("btnaction",1);actionfct();">
|
||||
* </a>
|
||||
* will hit an eventlistener
|
||||
* axios.get("https://dns.xx/trk/cdn/empty.json?alias=anonymous&uuid=1b506f71-1bff-416c-9057-cb8b86296f60&src=btnregister&version=1");
|
||||
*
|
||||
*
|
||||
* or if no js available (example:email or pdf document)
|
||||
* <img src="https://dns.xx/trk/static/img/photo.jpg?alias=anonymous&uuid=1b506f71-1bff-416c-9057-cb8b86296f60&srckey=loadpage&version=1" will hit a tracker
|
||||
*
|
||||
* <a href="https://dns.xx/trk/redirect?alias=anonymous&uuid=1b506f71-1bff-416c-9057-cb8b86296f60&srckey=loadpage&version=1&url=http://..." will hit a tracker then redirect to url></a> *
|
||||
*
|
||||
*
|
||||
* if you use apx.js :
|
||||
* in html add in <button>, <img>, <a> tag data-trksrc="srckey"
|
||||
* <img src="https://dns.xx/static/img/photo.jpg" data-trkversion="1" data-trksrckey="registerform">
|
||||
* <button data-trksrc="https://dns.xx/static/img/photo.jpg" data-trkversion="1" data-trksrckey="registerform">
|
||||
* in js call apx.track(srckey);
|
||||
*
|
||||
* Tracking log into tribe/logs/nginx/tribe_appname.trk.log
|
||||
* Src have to be manage in tribe/api/models/lg/src_en.json
|
||||
* {"srckey":{
|
||||
* "app":"presentation|app|apptest",
|
||||
* "title":"",
|
||||
* "description":""
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
* Data collection is done from nginx log system see routes/trackings.js for doc
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Process plan to run each night or on demand to collect log data and cleanup
|
||||
*/
|
||||
Trackings.logcollection=()=>{
|
||||
|
||||
}
|
||||
|
||||
Trackings.dashboard=(graphname)=>{
|
||||
console.log('Process data to provide a specific graph')
|
||||
}
|
||||
|
||||
module.export = Trackings;
|
@@ -4,10 +4,11 @@
|
||||
"getschema": "Schema {{{conf.name}}}",
|
||||
"schemanotfound": "Schema introuvable dans {{{schemaPath}}}",
|
||||
"pathnamedoesnotexist": "Le repertoire n'existe pas {{{indexpath}}}",
|
||||
"objectfiledoesnotexist": "Le fichier n'exuiste pas {{{objectpath}}}",
|
||||
"objectfiledoesnotexist": "Le fichier n'existe pas {{{objectpath}}}",
|
||||
"cudsuccessfull": "Mise à jour effectuée avec succés",
|
||||
"misssingprimarykey": "Il manque une clé primaire apxid pour stocker et identifier les objects",
|
||||
"missingprimarykey": "Il manque une clé primaire apxid pour stocker et identifier les objects",
|
||||
"unconsistencyapxidx": "L'index {{name}} doit contenir en objkey au moins {{apxid}} car keyval n'est pas unique",
|
||||
"profilnotallow": "Vous n'avez pas le profil de {{profils}}, cette action n'est pas authorisée",
|
||||
"successreindex": "Objet reindexé à partir des items, vos index sont à jour"
|
||||
"successreindex": "Objet reindexé à partir des items, vos index sont à jour",
|
||||
"indexexist":"L'indexe existe"
|
||||
}
|
||||
|
Reference in New Issue
Block a user