@dascompany/product 4.0.10 → 4.0.12

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
@@ -19,8 +19,9 @@
19
19
  },
20
20
  "accountCart": {
21
21
  "select": "SELECT * FROM clients.account_cart WHERE account_id = $account_id::BIGINT",
22
- "insert": "INSERT INTO clients.account_cart(account_id, product_id) VALUES ($account_id::BIGINT, $product_id::BIGINT)",
23
- "delete": "DELETE FROM clients.account_cart WHERE product_id = $product_id::BIGINT AND account_id = $account_id::BIGINT"
22
+ "insert": "INSERT INTO clients.account_cart(account_id, product_id, installation) VALUES ($account_id::BIGINT, $product_id::BIGINT, installation::BOOL)",
23
+ "update": "UPDATE clients.account_cart SET installation = $installation WHERE account_id = $account_id::BIGINT AND product_id = $product_id::BIGINT AND installation = $installation::Bool",
24
+ "delete": "DELETE FROM clients.account_cart WHERE product_id = $product_id::BIGINT AND account_id = $account_id::BIGINT AND installation = $installation::BOOL"
24
25
  },
25
26
  "accountDeliveryDetails": {
26
27
  "select": "SELECT * FROM clients.account_delivery_details WHERE account_id = $account_id::BIGINT",
@@ -98,8 +99,8 @@
98
99
  "select": "SELECT * FROM files.files",
99
100
  "selectId": "SELECT id FROM files.files ",
100
101
  "selectForConnection": "SELECT id, name, catalog, type, sequence FROM files.files JOIN files.file_connections ON file_id = id",
101
- "insert": "INSERT INTO files.files( id, name, orginal_name, catalog, size_kb, type, created_at ) VALUES ( $id::BIGINT, $name::TEXT, $orginal_name::TEXT, $catalog::TEXT, $size_kb::BIGINT, $type::TEXT, now() )",
102
- "update": "UPDATE files.files SET name = $name::TEXT, orginal_name = $orginal_name::TEXT, catalog = $catalog::TEXT, size_kb = $size_kb::BIGINT, type = $type::TEXT WHERE id = $id::BIGINT ",
102
+ "insert": "INSERT INTO files.files( id, name, orginal_name, catalog, size_kb, type, alt, title, created_at ) VALUES ( $id::BIGINT, $name::TEXT, $orginal_name::TEXT, $catalog::TEXT, $size_kb::BIGINT, $type::TEXT, $alt::TEXT, $title::TEXT, now() )",
103
+ "update": "UPDATE files.files SET name = $name::TEXT, orginal_name = $orginal_name::TEXT, catalog = $catalog::TEXT, size_kb = $size_kb::BIGINT, type = $type::TEXT, alt = $alt::TEXT, title = $title::TEXT WHERE id = $id::BIGINT ",
103
104
  "count": "SELECT COUNT(*) AS total_rows FROM files.files",
104
105
  "delete": "DELETE FROM files.files WHERE id = $id::BIGINT ",
105
106
  "selectNextId": "SELECT nextval('files.files_id'::regclass)"
@@ -5,12 +5,16 @@ export default class File extends StockObject {
5
5
  private sizeKb;
6
6
  private type;
7
7
  private orginalName;
8
- constructor(name: string, catalog: string, sizeKb: number, type: string, orginalName: string);
8
+ private alt;
9
+ private title;
10
+ constructor(name: string, catalog: string, sizeKb: number, type: string, orginalName: string, alt?: string, title?: string);
9
11
  getName(): string;
10
12
  getCatalog(): string;
11
13
  getSizeKb(): number;
12
14
  getType(): string;
13
15
  getOrginalName(): string;
16
+ getAlt(): string;
17
+ getTitle(): string;
14
18
  setName(name: string): void;
15
19
  setCatalog(catalog: string): void;
16
20
  setSizeKb(sizeKb: number): void;
@@ -6,13 +6,17 @@ export default class File extends StockObject {
6
6
  sizeKb;
7
7
  type;
8
8
  orginalName;
9
- constructor(name, catalog, sizeKb, type, orginalName) {
9
+ alt;
10
+ title;
11
+ constructor(name, catalog, sizeKb, type, orginalName, alt = '', title = '') {
10
12
  super();
11
13
  this.name = name;
12
14
  this.catalog = catalog;
13
15
  this.sizeKb = sizeKb;
14
16
  this.type = type;
15
17
  this.orginalName = orginalName;
18
+ this.alt = orginalName;
19
+ this.title = title;
16
20
  }
17
21
  getName() {
18
22
  return this.name;
@@ -29,6 +33,12 @@ export default class File extends StockObject {
29
33
  getOrginalName() {
30
34
  return this.orginalName;
31
35
  }
36
+ getAlt() {
37
+ return this.alt;
38
+ }
39
+ getTitle() {
40
+ return this.title;
41
+ }
32
42
  setName(name) {
33
43
  this.name = name;
34
44
  }
@@ -2,7 +2,8 @@ import { Table } from '@dascompany/database';
2
2
  import AccountCartRow from '../../types/rows/AccountCartRow';
3
3
  export default class AccountCartTable extends Table {
4
4
  selectAll(accountId: string): Promise<AccountCartRow[]>;
5
- delete(accountId: string, productId: string): Promise<void>;
6
- insert(accountId: string, productId: string): Promise<void>;
5
+ delete(accountId: string, productId: string, installation: boolean): Promise<void>;
6
+ insert(accountId: string, productId: string, installation: boolean): Promise<void>;
7
+ update(accountId: string, productId: string, oldInstallation: boolean, newInstallation: boolean): Promise<void>;
7
8
  private bindParams;
8
9
  }
@@ -7,18 +7,24 @@ export default class AccountCartTable extends Table {
7
7
  const result = await query.execute();
8
8
  return result.getRows();
9
9
  }
10
- async delete(accountId, productId) {
10
+ async delete(accountId, productId, installation) {
11
11
  const query = this.createQuery(SQL.accountCart.delete);
12
- this.bindParams(query, accountId, productId);
12
+ this.bindParams(query, accountId, productId, installation);
13
13
  await query.execute();
14
14
  }
15
- async insert(accountId, productId) {
15
+ async insert(accountId, productId, installation) {
16
16
  const query = this.createQuery(SQL.accountCart.insert);
17
- this.bindParams(query, accountId, productId);
17
+ this.bindParams(query, accountId, productId, installation);
18
18
  await query.execute();
19
19
  }
20
- bindParams(query, accountId, productId) {
20
+ async update(accountId, productId, oldInstallation, newInstallation) {
21
+ const query = this.createQuery(SQL.accountCart.update);
22
+ this.bindParams(query, accountId, productId, newInstallation);
23
+ await query.execute();
24
+ }
25
+ bindParams(query, accountId, productId, installation) {
21
26
  query.bindParameter('account_id', accountId);
22
27
  query.bindParameter('product_id', productId);
28
+ query.bindParameter('installation', installation);
23
29
  }
24
30
  }
@@ -48,6 +48,8 @@ export default class FilesTable extends Table {
48
48
  query.bindParameter('catalog', file.getCatalog());
49
49
  query.bindParameter('size_kb', file.getSizeKb());
50
50
  query.bindParameter('type', file.getType());
51
+ query.bindParameter('alt', file.getAlt());
52
+ query.bindParameter('title', file.getTitle());
51
53
  }
52
54
  async delete(fileId) {
53
55
  const query = this.createQuery(SQL.files.delete);
@@ -1,4 +1,5 @@
1
1
  export default class AccountCart {
2
- static delete(accountId: string, productId: string): Promise<boolean>;
3
- static insert(accountId: string, productId: string): Promise<boolean>;
2
+ static delete(accountId: string, productId: string, installation: boolean): Promise<boolean>;
3
+ static insert(accountId: string, productId: string, installation: boolean): Promise<boolean>;
4
+ static update(accountId: string, productId: string, oldInstallation: boolean, installation: boolean): Promise<boolean>;
4
5
  }
@@ -1,11 +1,15 @@
1
1
  import DatabaseConnection from "../DatabaseConnection";
2
2
  export default class AccountCart {
3
- static async delete(accountId, productId) {
4
- await DatabaseConnection.getInstance().accountCart.delete(accountId, productId);
3
+ static async delete(accountId, productId, installation) {
4
+ await DatabaseConnection.getInstance().accountCart.delete(accountId, productId, installation);
5
5
  return true;
6
6
  }
7
- static async insert(accountId, productId) {
8
- await DatabaseConnection.getInstance().accountCart.insert(accountId, productId);
7
+ static async insert(accountId, productId, installation) {
8
+ await DatabaseConnection.getInstance().accountCart.insert(accountId, productId, installation);
9
+ return true;
10
+ }
11
+ static async update(accountId, productId, oldInstallation, installation) {
12
+ await DatabaseConnection.getInstance().accountCart.update(accountId, productId, oldInstallation, installation);
9
13
  return true;
10
14
  }
11
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",