@dascompany/product 2.1.12 → 2.1.13

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
@@ -78,7 +78,7 @@
78
78
  "delete": "UPDATE orders.orders_products SET in_order = false WHERE id = $id::BIGINT"
79
79
  },
80
80
  "statuses": {
81
- "select": "SELECT s.id, s.order_id, created_at, user_id, s.type as type_id, st.key as type_name FROM orders.statuses as s JOIN orders.status_types as st ON s.type = st.id",
81
+ "select": "SELECT * FROM orders.statuses",
82
82
  "insert": "INSERT INTO orders.statuses( id, type, order_id, user_id ) VALUES ($id::BIGINT, $type::BIGINT, $order_id::BIGINT, $user_id::BIGINT)",
83
83
  "selectNextId": "SELECT nextval('orders.statuses_id'::regclass)"
84
84
  },
@@ -1,3 +1,5 @@
1
+ import { QueryOptions } from "@dascompany/database";
1
2
  export default class StatusTypesReader {
2
- static get(): Promise<any[]>;
3
+ static get(queryOptions: QueryOptions): Promise<any[]>;
4
+ static getAll(queryOptions?: QueryOptions): Promise<any[]>;
3
5
  }
@@ -1,7 +1,11 @@
1
1
  import DatabaseConnection from "../DatabaseConnection";
2
2
  export default class StatusTypesReader {
3
- static async get() {
4
- const statusTypes = await DatabaseConnection.getInstance().statusTypes.select();
3
+ static async get(queryOptions) {
4
+ const statusTypes = await DatabaseConnection.getInstance().statusTypes.select(queryOptions);
5
+ return statusTypes;
6
+ }
7
+ static async getAll(queryOptions) {
8
+ const statusTypes = await DatabaseConnection.getInstance().statusTypes.selectAll(queryOptions);
5
9
  return statusTypes;
6
10
  }
7
11
  }
@@ -1,4 +1,5 @@
1
- import { Table } from '@dascompany/database';
1
+ import { QueryOptions, Table } from '@dascompany/database';
2
2
  export default class StatusTypesTable extends Table {
3
- select(): Promise<any[]>;
3
+ select(queryOptions: QueryOptions): Promise<any[]>;
4
+ selectAll(queryOptions?: QueryOptions): Promise<any[]>;
4
5
  }
@@ -1,8 +1,13 @@
1
1
  import { Table } from '@dascompany/database';
2
2
  import * as SQL from '../../SQL.json';
3
3
  export default class StatusTypesTable extends Table {
4
- async select() {
5
- const query = this.createQuery(SQL.statusTypes.select);
4
+ async select(queryOptions) {
5
+ const query = this.createQuery(SQL.statusTypes.select, queryOptions);
6
+ const result = await query.execute();
7
+ return result.getRow();
8
+ }
9
+ async selectAll(queryOptions) {
10
+ const query = this.createQuery(SQL.statusTypes.select, queryOptions);
6
11
  const result = await query.execute();
7
12
  return result.getRows();
8
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "2.1.12",
3
+ "version": "2.1.13",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",