update schema et odmdb

This commit is contained in:
philc 2024-11-11 00:33:30 +01:00
parent fe82e06cc3
commit 5a6d49d072
19 changed files with 3411 additions and 25 deletions

View File

@ -183,7 +183,7 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
if (schemaPath.substring(0, 4) == "http") {
// lance requete http pour recuperer le schema avec un await axios
} else {
schemaPath = `../../${schemaPath}`;
schemaPath = `../${schemaPath}`;
/*if (log)
console.log(
currentmod,
@ -227,13 +227,13 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
propertie.comment = `options:${propertie.options["$ref"]}}`;
optionstype = "options";
optionsfile = path.resolve(
`../../${propertie.options["$ref"]}_${lg}.json`
`../${propertie.options["$ref"]}_${lg}.json`
);
}
if (propertie.options["$ref"].includes("/idx/")) {
(propertie.comment = `itms:${propertie.options["$ref"]}}`),
(optionstype = "idx");
optionsfile = path.resolve(`../../${propertie.options["$ref"]}.json`);
optionsfile = path.resolve(`../${propertie.options["$ref"]}.json`);
}
//if (log) console.log(currentmod, "Lien vers options:", optionsfile);
if (!fs.existsSync(optionsfile)) {
@ -352,7 +352,7 @@ Odmdb.Schema = (objectPathname, validschema, lg = "en") => {
if (!res.data.schema.apxuniquekey.includes(res.data.schema.apxid)) {
res.data.schema.apxuniquekey.push(res.data.schema.apxid);
}
//`../../${req.session.header.xtribe}/objects/persons`
//`../${req.session.header.xtribe}/objects/persons`
res.data.schema.apxidx.forEach((idx) => {
if (
idx.objkey &&
@ -776,7 +776,10 @@ Odmdb.runidx = (objectPathname, schema) => {
//if (log) console.log(currentmod, `idx for ${objectPathname}`);
if (!schema || !schema.apxid) {
const getschema = Odmdb.Schema(objectPathname, true);
if (getschema.status != 200) return getschema;
if (getschema.status != 200) {
console.log(getschema)
return getschema;
}
schema = getschema.data.schema;
}
const ventil = {};
@ -791,7 +794,7 @@ Odmdb.runidx = (objectPathname, schema) => {
ventil[id.name].filter = id.filter ? id.filter.replace(/;/g, "") : ""; // check integrity of string
ventil[id.name].data = {};
} else {
if (schema.properties[id.keyval]){
if (!schema.properties[id.keyval]){
console.log(`Check ${objectPathname} index ${id.name} property ${id.keyval} does not exist`)
process.exit(0)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
{
"title": "Profil",
"description": "Profil available in adminapi",
"commment": "",
"lastupdatedata": "",
"lst_idx": [
"anonymous",
"pagan",
"mayor",
"druid",
"person"
],
"itms": {
"anonymous": {
"title": "Unidentified user",
"description": "Unknown to the apxtri network"
},
"pagan": {
"title": "User with an apxtri identity",
"description": "This profile can digitally sign on the apxtri blockchain"
},
"mayor": {
"title": "Administrator of a city",
"description": "He manages the rules specific to a tribe grouping, he finances this city and can define its billing terms for welcoming tribes"
},
"druid": {
"title": "Administrator of a tribe",
"description": "He has a private space in a city, to apply and enforce the rules of the tribe."
},
"person": {
"title": "A member of a tribe",
"description": "A person has an account in a tribe with their alias, it allows them to exchange within a tribe according to the rules set by the druid."
}
}
}

View File

@ -0,0 +1,34 @@
{
"title": "Profil",
"description": "Profil disponible dans adminapi",
"commment": "",
"lastupdatedata": "",
"lst_idx": [
"anonymous",
"pagan",
"mayor",
"druid",
"person"
],
"itms": {
"anonymous": {
"title": "Utilisateur non identifié",
"description": "Inconnu du réseau apxtri"
},
"pagan": {
"title": "Utilisateur avec une identité apxtri",
"description": "Ce profil peux signer numériquement sur la blockchain apxtri"
},
"mayor": {
"title": "Administrateur d'une ville",
"description": "Il gére les régles propres à un regroupement de tribu, il finance cette ville et peut definir ses modalités de facturation pour accueillir des tribus"
},
"druid": {
"title": "Administrateur d'une tribu",
"description": "Il dispose d'un espace privée dans une ville , pour y appliquer et faire respecter les régles de la tribu."
},
"person": {
"title": "Un membre d'une tribu",
"description": "Une personne dispose d'un compte dans une tribu avec son alias, il permet d'echanger au sein d'une tribu en fonction des régles mises en place par le druid."
} }
}

View File

@ -0,0 +1,6 @@
{
"validcheck":"Your data are valid",
"typedoesnnotexistinschema":"This type in your propertie is not manage by Checkjson.js",
"dataerrpropertie":"Check your data that not fit your schema rules propertie",
"dataerrpropertiesrequired":"This propertie is required and not present in your data"
}

View File

@ -0,0 +1,7 @@
{
"validcheck":"Your data are valid",
"typedoesnnotexistinschema":"This type in your propertie is not manage by Checkjson.js",
"dataerrpropertie":"Check your data that not fit your schema rules propertie",
"dataerrpropertiesrequired":"This propertie is required and not present in your data",
"externalrefnotload":"You have in your schema a relative sub schema, you have to load it before"
}

View File

@ -0,0 +1,7 @@
{
"nationnamedesc":"Nom unique d'une nation dans un monde social",
"nationnamedesclong":"Nom unique identifiant une nation dans le monde social créer par un maire d'une nouvelle ville avec un contrat sociale specifique",
"nationnameinfo":"<p> Une nation posséde un nom unique, un contrat sociale (contracts/name.js) signé et validé par tous les maires des villes associées à cette nation </p>",
"statusdesc":"Statut de la nation",
"statusactive":"Nation active"
}

View File

@ -0,0 +1,13 @@
{
"missingconf":"Il manque un smtp/sms valide pour {{tribe}} ou sur le serveur /conf.json",
"missingdata":"Il manque des données obligatoire dans data {{#missingk}} {{.}} {{/missingk}}",
"missingfile":"Le ou les fichiers suivants n'existent pas {{#missingfile}} {{.}} {{/missingfile}}",
"errsendmail":"Une erreur s'est produite lors de l'envoie de l'email",
"successfullsentemail":"Email correctement envoyé",
"errsendsms":"Une erreur s'est produite lors de l'envoie du sms",
"successfullsentsms":"Sms bien envoyé à {{To}}",
"registersuccess":"Vous avez bien été enregistré pour être recontacté.",
"formaterror":"Verifier vos données",
"typekeyunknown":"Verifier typekey qui doit etre email ou telephone et qui est {{typeky}}",
"destinnotallow":"Check {{destin}} that not exist"
}

View File

@ -0,0 +1,13 @@
{
"missingconf":"Il manque un smtp/sms valide pour {{tribe}} ou sur le serveur /conf.json",
"missingdata":"Il manque des données obligatoire dans data {{#missingk}} {{.}} {{/missingk}}",
"missingfile":"Le ou les fichiers suivants n'existent pas {{#missingfile}} {{.}} {{/missingfile}}",
"errsendmail":"Une erreur s'est produite lors de l'envoie de l'email",
"successfullsentemail":"Email correctement envoyé",
"errsendsms":"Une erreur s'est produite lors de l'envoie du sms",
"successfullsentsms":"Sms bien envoyé à {{To}}",
"registersuccess":"Vous avez bien été enregistré pour être recontacté.",
"formaterror":"Verifier vos données",
"typekeyunknown":"Verifier typekey qui doit etre email ou telephone et qui est {{typeky}}",
"destinnotallow":"Check {{destin}} that not exist"
}

View File

@ -0,0 +1,21 @@
{
"alreadyexist": "An {{objectname}} object with the {{key}} key already exists with {{val}}",
"doesnotexist": "The {{objectname}} object does not exist with {{key}}:{{val}}",
"getschema": "Schema {{{conf.name}}}",
"schemanotfound": "Schema not found in {{{schemaPath}}}",
"pathnamedoesnotexist": "The directory does not exist {{{indexpath}}}",
"objectfiledoesnotexist": "The file does not exist {{{objectpath}}}",
"cudsuccessfull": "Update successful",
"successfulcreatewithoutemail":"Create without sending an email",
"successfulcreatewitemail":"Create you will receive an email",
"missingprimarykey": "Missing a primary key apxid to store and identify objects",
"missinglocalref":"You use a local definition with {{missingref}} but no $defs in your schema with this definition",
"unconsistencyapxidx": "The index {{name}} must contain at least {{apxid}} in objkey because keyval is not unique",
"profilnotallow": "As {{person}} your profiles are not allow, this action is not authorized",
"profilallow": "You are allowed for this action",
"successreindex": "Object reindexed from items, your indexes are up to date",
"indexexist":"The index exists",
"typenotavailable":"The type: {{type}} for the propertie: {{propertie}} of the object:{{objectPathname}} is not taken into account for indexing",
"objectslist":"List of objects from apxtri and {{tribe}}",
"errordelete":"Sorry, unable to delete this account"
}

View File

@ -0,0 +1,20 @@
{
"alreadyexist": "Un object {{objectname}} avec la clé {{key}} existe déjà avec {{val}}",
"doesnotexist": "L'object {{objectname}} n'existe pas avec {{key}}:{{val}}",
"getschema": "Schema {{{conf.name}}}",
"schemanotfound": "Schema introuvable dans {{{schemaPath}}}",
"pathnamedoesnotexist": "Le repertoire n'existe pas {{{indexpath}}}",
"objectfiledoesnotexist": "Le fichier n'existe pas {{{objectpath}}}",
"cudsuccessfull": "Mise à jour effectuée avec succés",
"successfulcreatewithoutemail":"Créer sans envoi d'email",
"successfulcreatewitemail":"Créer vous allez recevoir un email",
"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 pour faire cette action.",
"profilallow": "Vous avez été authorisé à faire cette action",
"successreindex": "Objet reindexé à partir des items, vos index sont à jour",
"indexexist":"L'indexe existe",
"typenotavailable":"Le type: {{type}} pour la propertie : {{propertie}} de l'object :{{objectPathname}} n'est pas pris en compte pour l'indexation",
"objectslist":"Liste des objects d'apxtri et de {{tribe}}",
"errordelete":"Desolé impossible de supprimer ce compte"
}

View File

@ -0,0 +1,10 @@
{
"aliasexist":"This alias {{alias]} exist",
"aliasdoesnotexist":"This alias {{alias}} does not exist ",
"personexist":"This person {{alias}} exist for {{tribeid}}",
"successfullcreate": "This identity {{alias}} creation was successfull. {{#withemail}} An email was sent to {{email}}, if you do not receive it, please download your keys before living this page.{{/withemail}}",
"successfulluppdate": "Your alias as a Person is now update into {{tribeid}}",
"tribedoesnotexist": "Your tribe {{tribeid}} does not exist in this town",
"recoveryemailnotfound":"No identity found for {{tribe}} with this recovery search ",
"recoveryemailsent": "We send you {{numberemailsent}} email with your keys"
}

View File

@ -0,0 +1,15 @@
{ "invalidalias":"Alias doit être composé exclusivement de minuscules ou de chiffres et contenir au moins 4 caracteres",
"aliasexist": "Cet alias {{alias}} existe",
"emailerr": "Verifier votre email {{email}}",
"aliasorprivkeytooshort": "Vérifiez votre alias et votre clé privée",
"aliasdoesnotexist": "Cet alias {{alias}} n'existe pas",
"personexist": "Cette personne {{alias}} existe pour {{tribeid}}",
"persondoesnotexist": "Cette personne {{alias}} n'existe pas pour {{tribeid}}",
"successfulcreate":"Votre identité {{alias}} a été créee à partir de vos clés.{{#emailsent}} Un email a été envoyé à {{email}}, si vous ne le recevez pas, veuillez télécharger vos clés avant de quitter cette page.{{/emailsent}} {{#emailerror}}Un problème lors de l'envoi sur {{email}} s'est produit. Veuillez télécharger vos clés avant de quitter cette page.{{/emailerror}}<br>{{#createperson}}Félicitation Votre compte est ouvert chez {{tribe}}. {{/createperson}} {{#errorperson}}Attention votre identité n'a pas été associée à {{tribe}}. Vous pourrez rejoindre {{tribe}} dans l'écran suivant. {{/errorperson}}",
"successfulluppdate": "Votre alias en tant que Personne est maintenant mis à jour dans {{tribeid}}",
"errcreate": "Desolé, un probléme inconnu empeche la creation",
"logout": "Votre token a été supprimé du server",
"recoveryemailnotfound":"Auncune identité n'a été enregistrée sur {{tribe}} avec ce critere ",
"recoveryemailsent":"Nous avons envoyés {{numbermailsent}} message(s) avec vos clés par alias.",
"templatedoesnotexist":"Le template {{tplfile}} n'existe pas"
}

View File

@ -0,0 +1,3 @@
{
"actionmissing":"L'action {{data.action}} n'existe pas pour la tribut {{data.tribe}}."
}

View File

@ -0,0 +1,10 @@
{
"errrequest": "Backend seems not available",
"unconsistentpgp": "Your keys are not consistent {{err}}",
"missingheader": "Some header miss to have a valid request: {{#missinghearder}} {{.}} {{/missingheader}}",
"tribeiddoesnotexist": "Header xtribe: {{xtribe}} does not exist in this town you cannot access",
"unconsistentcleartextmessage":"Your xhash: {{xhash}} is not consistent as a clear msg {{{clearmsg}}}",
"authenticated": "Your alias: {{{xalias}}} is authenticated",
"notauthenticated": "Your alias: {{xalias}} is not authenticated {{^xaliasexists}} and this alias does not exist !{{/xaliasexists}}",
"signaturefailled": "Your signature is not valid for your alias."
}

View File

@ -0,0 +1,10 @@
{
"errrequest": "Le serveur ne semble pas répondre",
"unconsistentpgp": "Vos clés ne sont pas conforme {{err}}",
"missingheader": "Certains en-têtes manquent pour avoir une requête valide : {{#missinghearder}} {{.}} {{/missingheader}}",
"tribeiddoesnotexist": "L'en-tête xtribe : {{xtribe}} n'existe pas dans cette ville, vous ne pouvez pas y accéder",
"unconsistentcleartextmessage":"Votre xhash: {{xhash}} n'est pas lisible par openpgp.js avec le clearmsg: {{{clearmsg}}}",
"authenticated": "Votre alias {{{xalias}}} est authentifié",
"notauthenticated": "Votre alias : {{xalias}} n'est pas authentifié {{^xaliasexists}} et cet alias n'existe pas !{{/xaliasexists}}",
"signaturefailled": "Desolé votre signature n'est pas valide pour cet alias."
}

185
schema/persons.json Normal file
View File

@ -0,0 +1,185 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "/schema/persons",
"title": "Person minimum definition to link a person to a pagan identity",
"description": "A person is a human with a apxtri identity (alias = Public Private Key) that accept to be part of a tribe (a person is store inside a tribe). Information stored for a person are only visible from the town's Mayor and the tribe's Druid. You need at least trust the druid that trust the mayor (for sensitive data Mayor and Druid can be the same apx Identity.) Only a pagan that have the privateKey can read cipher data. The purpose of this schema is to link a person to a tribe and manage basic activities, profil for specific purpose will be a tribe object that can be add additionalProperties of this is set at true.",
"type": "object",
"properties": {
"alias": {
"title": "alias",
"description": "A unique string identifying a unique public key",
"type": "string",
"options": { "$ref": "adminapi/objects/pagans/idx/lst_alias" }
},
"owner": {
"title": "Owner of this person",
"description": "For accessright purpose this is always equal as alias",
"type": "string",
"options": { "$ref": "adminapi/objects/pagans/idx/lst_alias" }
},
"dt_create": {
"title": "Creation date",
"type": "string",
"format": "date-time"
},
"dt_update": {
"type": "string",
"format": "date-time"
},
"dt_lastlogin": {
"title": "Last time login",
"description": "Last time this person authentify as alias access to this tribe",
"type": "string",
"format": "date-time"
},
"dt_delete": {
"title": "Date of leaving tribe",
"description": "Date from when this alias is ban of tribe by druid or want to leave. A pocess of data cleaning has to be run depending of Tribe's rules.",
"type": "string",
"format": "date"
},
"will": {
"title": "Will script after leaving tribe",
"description": "This will script will be apply on your data 30 days after your delete",
"type": "string"
},
"dt_birth": {
"title": "Your birthdate",
"description": "Date of birth you want to communicate",
"type": "string",
"format": "date"
},
"emailcom": {
"title": "email use to communicate with you",
"description": "email used by tribe to communicate with you, depending of your profil you can also define other mail to interact with other person",
"type": "string",
"format": "email"
},
"hobbies": {
"title": "My hobbies",
"type": "array",
"comment": "from a tree word combinaison /lg/hobbies_xx"
},
"biography": {
"title": "Your bio or few words to define yourself",
"description": "Use this to share your values, this will be public to all of tribe's members and link to your person",
"type": "string",
"pattern": "^.{O,1000}$"
},
"imgbase64_imgavatar": {
"title": "Temporary img to update or create",
"description": "image will be store in /objects/persons/{alias}_imgavatar.webp",
"sizeHW": [80, 80],
"type": "string",
"format": "imgbase64"
},
"imgavatar": {
"title": "A picture of your person or personnality",
"description": "This picture will be public to all tribe's member",
"type": "string",
"format": "uri"
},
"profils": {
"title": "Array of profil",
"description": "List of profil to get accessright on object",
"type": "array",
"items": {
"type": "string",
"options": { "$ref": "smatchit/objects/options/profil" }
}
}
},
"required": ["alias", "profils"],
"additionalProperties": true,
"apxref": [],
"apxid": "alias",
"apxuniquekey": ["alias"],
"apxidx": [
{
"name": "lst_alias",
"type": "array",
"keyval": "alias"
},
{
"name": "lst_profils",
"type": "array",
"keyval": "profils"
},
{
"name": "alias",
"type": "view",
"keyval": "alias",
"objkey": [
"alias",
"dt_create",
"dt_update",
"last_login",
"dt_birth",
"emailcom",
"hobbies",
"biography",
"imgavatar",
"profils"
],
"filter": ""
},
{
"name": "profils_alias",
"type": "distribution",
"keyval": "profils",
"filter": ""
},
{
"name": "emailcom_alias",
"type": "distribution",
"keyval": "emailcom",
"filter": ""
},
{
"name": "hobbies_alias",
"type": "distribution",
"keyval": "hobbies",
"filter": ""
}
],
"commentaccessrights": "only a pagans can create a persons by joining the tribe smatchit. An adminrecruiters can Read person and update only profil by adding value recruiters or interviewers, that will create for this alias a recruiters itm or interviewers itm, use /api/smatchit/profilmanagers/join/:profils/:recruiteralias",
"apxaccessrights": {
"owner": {
"D": [],
"R": [
"alias",
"owner",
"profils",
"dt_create",
"dt_update",
"dt_lastlogin",
"dt_birth",
"emailcom",
"hobbies",
"biography",
"imgavatar",
"profils"
],
"U": [
"dt_birth",
"emailcom",
"hobbies",
"biography",
"imgavatar",
"profils"
]
},
"pagans": {
"C": []
},
"mayors": {
"D": [],
"R": ["alias"]
},
"druids": {
"D": [],
"R": ["alias"]
}
}
}

View File

@ -5,29 +5,11 @@
"description": "A space web available for a domaine, with accessright",
"type": "object",
"properties": {
"tribeId": {
"title": "Tribe name",
"description": "A unique string as tribe",
"options": {
"$ref": "adminapi/objects/tribess/idx/lst_tribeId.json"
}
},
"website": {
"description": "Folder name into a tribeId/www/",
"title": "web space",
"type": "string"
},
"status": {
"title": "Status",
"description": "Status of website ",
"default": "active",
"type": "string",
"enum": [
"chain",
"tochain",
"unchain"
]
},
"dns": {
"title": "domaine name list to access",
"description": "Add in nginx nameserver local website.tribeId LAN domaine.tld",
@ -76,7 +58,8 @@
"comment": "the tribeid"
},
"xuuid": {
"type": "string""default": 0
"type": "string",
"default": 0
}
},
"required": [
@ -108,6 +91,9 @@
"status"
],
"apxid": "website",
"apxuniquekey": [
"website"
],
"apxidx": [
{
"name": "lst_website",