client-manager-fido 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/README.md +0 -0
  2. package/app.js +23 -0
  3. package/package.json +1 -1
package/README.md ADDED
Binary file
package/app.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const postgres = require("./src/modules/postgres");
2
2
  let psql = postgres();
3
+ const { Op } = require("sequelize");
3
4
 
4
5
  module.exports.add_client = async function(name, surname, birth_date, age){
5
6
  try{
@@ -113,4 +114,26 @@ module.exports.get_element_by_id = async function(id){
113
114
  }catch(e){
114
115
  console.log(e + "")
115
116
  }
117
+ }
118
+
119
+ module.exports.get_element_by_id = async function(id, name, surname, from_date, to_date){
120
+ try{
121
+ psql = await psql;
122
+ let clients = await psql.clients.findAll({
123
+ where: {
124
+ id: id ? { [Op.eq]: id } : {},
125
+ name: name ? { [Op.iLike]: `%${name}%` } : {},
126
+ surname: surname ? { [Op.iLike]: `%${surname}%` } : {},
127
+ from_date: from_date ? { [Op.gte]: from_date } : {},
128
+ to_date: to_date ? { [Op.lte]: to_date } : {}
129
+ }
130
+ })
131
+
132
+
133
+ return ({
134
+ clients
135
+ })
136
+ }catch(e){
137
+ console.log(e + "")
138
+ }
116
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "client-manager-fido",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {