@dascompany/product 2.1.6 → 2.1.8

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/dist/SQL.json CHANGED
@@ -101,7 +101,7 @@
101
101
  "fileConnections": {
102
102
  "select": "SELECT * FROM files.file_connections ",
103
103
  "insert": "INSERT INTO files.file_connections( file_id, connection_type, connection_id, sequence) VALUES ($file_id::BIGINT, $connection_type::TEXT, $connection_id::BIGINT, $sequence::BIGINT)",
104
- "delete": "DELETE FROM files.file_connections WHERE id = $id::BIGINT"
104
+ "delete": "DELETE FROM files.file_connections"
105
105
  },
106
106
  "paymentMethods": {
107
107
  "select": "SELECT * FROM settings.payment_methods",
@@ -1,4 +1,5 @@
1
1
  import DatabaseConnection from '../DatabaseConnection';
2
+ import createQueryOptionsForId from '../utils/createQueryOptionsForId';
2
3
  export default class FileConnectionMapper {
3
4
  fileConnection;
4
5
  fileConnectionsTable;
@@ -9,7 +10,7 @@ export default class FileConnectionMapper {
9
10
  async save() {
10
11
  const id = this.fileConnection.getId();
11
12
  if (id)
12
- await this.fileConnectionsTable.delete(id);
13
+ await this.fileConnectionsTable.delete(createQueryOptionsForId(id));
13
14
  await this.fileConnectionsTable.insert(this.fileConnection);
14
15
  }
15
16
  async delete() {
@@ -17,7 +17,7 @@ export default class PaymentDetailsReader {
17
17
  }]);
18
18
  const queryOptionsForPaymentStatus = new QueryOptions();
19
19
  queryOptionsForPaymentStatus.setWhere([{
20
- name: 'peyment_details_id',
20
+ name: 'payment_details_id',
21
21
  type: ParameterType.bigint,
22
22
  value: paymentDetails.id
23
23
  }]);
@@ -2,7 +2,7 @@ import { QueryOptions } from "@dascompany/database";
2
2
  import FileConnection from "../stockObjects/FileConnection";
3
3
  export default class FileConnectionsRepo {
4
4
  static getAll(queryOptions?: QueryOptions): Promise<FileConnection[]>;
5
- static delete(id: number): Promise<boolean>;
5
+ static delete(queryOptions: QueryOptions): Promise<boolean>;
6
6
  private static correctFileConnections;
7
7
  private static correctFileConnection;
8
8
  }
@@ -5,8 +5,8 @@ export default class FileConnectionsRepo {
5
5
  const fileConnections = await DatabaseConnection.getInstance().fileConnections.selectAll(queryOptions);
6
6
  return this.correctFileConnections(fileConnections);
7
7
  }
8
- static async delete(id) {
9
- return await DatabaseConnection.getInstance().fileConnections.delete(id);
8
+ static async delete(queryOptions) {
9
+ return await DatabaseConnection.getInstance().fileConnections.delete(queryOptions);
10
10
  }
11
11
  static correctFileConnections(dataRows) {
12
12
  const fileConnections = [];
@@ -4,6 +4,6 @@ import FileConnectionRow from '../../types/rows/FileConnectionRow';
4
4
  export default class FileConnectionsTable extends Table {
5
5
  selectAll(queryOptions?: QueryOptions): Promise<FileConnectionRow[]>;
6
6
  insert(fileConnection: FileConnection): Promise<void>;
7
- delete(id: number): Promise<boolean>;
7
+ delete(queryOptions: QueryOptions): Promise<boolean>;
8
8
  private bindParameters;
9
9
  }
@@ -11,9 +11,8 @@ export default class FileConnectionsTable extends Table {
11
11
  this.bindParameters(query, fileConnection);
12
12
  await query.execute();
13
13
  }
14
- async delete(id) {
15
- const query = this.createQuery(SQL.fileConnections.delete);
16
- query.bindParameter('id', id);
14
+ async delete(queryOptions) {
15
+ const query = this.createQuery(SQL.fileConnections.delete, queryOptions);
17
16
  await query.execute();
18
17
  return true;
19
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",