client-manager-fido 1.0.1 → 1.0.4

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.
Files changed (3) hide show
  1. package/README.md +0 -0
  2. package/app.js +29 -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{
@@ -49,6 +50,12 @@ module.exports.edit_client = async function(id, name, surname, birth_date, age){
49
50
  }
50
51
  })
51
52
 
53
+ client = await psql.clients.findOne({
54
+ where:{
55
+ id,
56
+ }
57
+ })
58
+
52
59
  return({
53
60
  msg: "edited",
54
61
  client
@@ -107,4 +114,26 @@ module.exports.get_element_by_id = async function(id){
107
114
  }catch(e){
108
115
  console.log(e + "")
109
116
  }
117
+ }
118
+
119
+ module.exports.get_elements_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
+ }
110
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "client-manager-fido",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {