backend-plus 2.0.0-beta.1 → 2.0.0-beta.2

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.
@@ -989,21 +989,20 @@ AppBackend.prototype.start = function start(opts){
989
989
  done(null,false,{message:be.messages.unlogged.login.userOrPassFail});
990
990
  }
991
991
  }).then(async function(userInfo){
992
+ if (!userInfo) return;
992
993
  if (!be.config.login.skipBitacora) {
993
994
  var context = be.getContext(req);
994
- var sessionInfo = client.query(be.generateInsertSQL(be.config.server.bitacoraSchema, be.config.server.bitacoraTableName,{
995
+ var sessionInfo = await client.query(be.generateInsertSQL(be.config.server.bitacoraSchema, be.config.server.bitacoraTableName,{
995
996
  procedure_name: '@login',
996
- parameters: {
997
- user:username,
998
- machine_id: context.machineId,
999
- navigator: context.navigator,
1000
- init_date: bestGlobals.datetime.now(),
1001
- }
997
+ username,
998
+ machine_id: context.machineId,
999
+ navigator: context.navigator,
1000
+ init_date: bestGlobals.datetime.now(),
1001
+ parameters: {}
1002
1002
  })).fetchUniqueValue();
1003
1003
  userInfo.bitacoraId = sessionInfo.value;
1004
1004
  }
1005
1005
  done(null, userInfo);
1006
- return userInfo;
1007
1006
  }).then(function(){
1008
1007
  client.done();
1009
1008
  }).catch(function(err){
@@ -2598,6 +2597,8 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
2598
2597
  linesCreate.push("drop schema if exists "+schema+' cascade;');
2599
2598
  linesCreate.push("create schema "+schema+';');
2600
2599
  linesCreate.push("grant usage on schema "+schema+' to '+user+';');
2600
+ linesCreate.push("create schema if not exists his;");
2601
+ linesCreate.push("grant usage on schema his to "+user+';');
2601
2602
  if(be.config.install.dump["admin-can-create-tables"]){
2602
2603
  linesCreate.push("grant create on schema "+schema+' to '+user+';');
2603
2604
  }
@@ -2,15 +2,16 @@
2
2
 
3
3
  module.exports = function(context){
4
4
  const BITACORA_TABLENAME = context.be.config.server.bitacoraTableName;
5
+ const BITACORA_SCHEMA = context.be.config.server.bitacoraSchema;
5
6
  return context.be.tableDefAdapt({
6
7
  name:'bitacora',
7
8
  title:'Bitacora',
8
9
  tableName: BITACORA_TABLENAME,
10
+ schema: BITACORA_SCHEMA,
9
11
  editable:context.forDump,
10
12
  fields:[
11
13
  {name:'id' , typeName:'bigint' , nullable:false, sequence:{name: 'secuencia_bitacora', firstValue: 1}},
12
14
  {name:'procedure_name' , typeName:'text' , nullable:false },
13
- {name:'parameters_definition' , typeName:'text' , nullable:false },
14
15
  {name:'parameters' , typeName:'text' , nullable:false },
15
16
  {name:'username' , typeName:'text' , nullable:false },
16
17
  {name:'machine_id' , typeName:'text' , nullable:false },
@@ -3,6 +3,7 @@
3
3
  module.exports = function(context){
4
4
  return context.be.tableDefAdapt({
5
5
  name:'locks',
6
+ schema:'his',
6
7
  allow:{
7
8
  insert:true,
8
9
  delete:false,
@@ -4,6 +4,7 @@ module.exports = function(context){
4
4
  var $1_is_num=`$1 ~ '^\\s*(\\d+(\\.\\d*)?|\\.\\d+)\\s*$'`
5
5
  return context.be.tableDefAdapt({
6
6
  name:'summary',
7
+ schema:'his',
7
8
  editable:context.forDump,
8
9
  fields:[
9
10
  {name:'table_name' , typeName:'text' , visible:false},
@@ -5,6 +5,7 @@ module.exports = function(context){
5
5
  return context.be.tableDefAdapt({
6
6
  name:'tokens',
7
7
  elementName:'token',
8
+ schema:'his',
8
9
  editable:admin,
9
10
  fields:[
10
11
  {name:'token' , typeName:'text' , nullable:false },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "backend-plus",
3
3
  "description": "Backend for the anti Pareto rule",
4
- "version": "2.0.0-beta.1",
4
+ "version": "2.0.0-beta.2",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",
@@ -81,7 +81,7 @@
81
81
  "@types/js-yaml": "^4.0.5",
82
82
  "@types/mocha": "^10.0.1",
83
83
  "@types/multiparty": "~0.0.33",
84
- "@types/node": "^20.3.3",
84
+ "@types/node": "^20.4.1",
85
85
  "@types/nodemailer": "^6.4.8",
86
86
  "@types/numeral": "~2.0.2",
87
87
  "@types/session-file-store": "^1.2.2",
@@ -98,7 +98,7 @@
98
98
  "kill-9": "~0.4.3",
99
99
  "mocha": "^10.2.0",
100
100
  "nyc": "^15.1.0",
101
- "puppeteer": "^20.7.4",
101
+ "puppeteer": "^20.8.0",
102
102
  "sinon": "^15.2.0",
103
103
  "supertest": "^6.3.3",
104
104
  "types.d.ts": "~0.6.15",