@igea/oac_backend 1.0.44 → 1.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -70,6 +70,24 @@ router.get('/schema/:format', (req, res) => {
|
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
+
router.get('/counter/:name', (req, res) => {
|
|
74
|
+
let name = req.params.name;
|
|
75
|
+
Investigations.getCounter(name).then( (count) => {
|
|
76
|
+
res.json({
|
|
77
|
+
success: true,
|
|
78
|
+
data: count,
|
|
79
|
+
message: `Counter ${name} value retrieved`
|
|
80
|
+
});
|
|
81
|
+
}).catch( (err) => {
|
|
82
|
+
console.log(err);
|
|
83
|
+
res.status(500).json({
|
|
84
|
+
success: false,
|
|
85
|
+
data: null,
|
|
86
|
+
message: `Error retrieving counter ${name}: ${err}`
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
73
91
|
router.post('/validate', (req, res) => {
|
|
74
92
|
let turtle = req.body.turtle;
|
|
75
93
|
let schema = getSchema('ttl2');
|
|
@@ -14,6 +14,19 @@ class Investigations {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
static getCounter(name){
|
|
18
|
+
return new Promise(async (resolve, reject) => {
|
|
19
|
+
try{
|
|
20
|
+
const sql = `SELECT nextval('${name}') as count`;
|
|
21
|
+
const result = await db.raw(sql);
|
|
22
|
+
const count = result.rows[0].count;
|
|
23
|
+
resolve(count)
|
|
24
|
+
}catch(e){
|
|
25
|
+
reject(e)
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
static save(item){
|
|
18
31
|
item.format = item.format || 'turtle'
|
|
19
32
|
return new Promise(async (resolve, reject) => {
|
|
@@ -117,14 +117,14 @@ ex:E29ActorShape
|
|
|
117
117
|
sh:targetClass crm:E29_Actor ;
|
|
118
118
|
sh:property [
|
|
119
119
|
sh:path ex:ente_richiedente ;
|
|
120
|
-
|
|
120
|
+
sh:datatype xsd:string ;
|
|
121
121
|
|
|
122
122
|
#sh:name "Ente richiedente" ;
|
|
123
123
|
#sh:maxCount 1 ;
|
|
124
124
|
|
|
125
125
|
sh:name "ID" ;
|
|
126
126
|
sh:nodeKind sh:IRI;
|
|
127
|
-
sh:description "http://diagnostica/actor/$
|
|
127
|
+
sh:description "http://diagnostica/actor/$SEQ3$" ;
|
|
128
128
|
|
|
129
129
|
] ;
|
|
130
130
|
sh:property [
|