@dascompany/product 2.1.13 → 2.1.14

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.
@@ -1,7 +1,7 @@
1
1
  import { QueryOptions } from "@dascompany/database";
2
- import OrderStatusI from "../types/StatusI";
2
+ import StatusI from "../types/StatusI";
3
3
  export default class OrderStatusReader {
4
- static get(queryOptions: QueryOptions): Promise<OrderStatusI>;
5
- static getAll(queryOptions?: QueryOptions): Promise<OrderStatusI[]>;
4
+ static get(queryOptions: QueryOptions): Promise<StatusI>;
5
+ static getAll(queryOptions?: QueryOptions): Promise<StatusI[]>;
6
6
  private static correctStatus;
7
7
  }
@@ -19,8 +19,7 @@ export default class OrderStatusReader {
19
19
  orderId: status.order_id,
20
20
  createdAt: status.created_at,
21
21
  userId: status.user_id,
22
- typeId: status.type_id,
23
- typeName: status.type_name,
22
+ type: status.type
24
23
  };
25
24
  return correctStatus;
26
25
  }
@@ -18,7 +18,7 @@ export default class OrderStatusRepo {
18
18
  return statuses;
19
19
  }
20
20
  static async createStatusFromRow(dataRow) {
21
- const status = new Status(dataRow.order_id, dataRow.user_id, dataRow.type_id, dataRow.type_name, dataRow.created_at);
21
+ const status = new Status(dataRow.order_id, dataRow.user_id, dataRow.type, dataRow.created_at);
22
22
  status.setId(dataRow.id);
23
23
  return status;
24
24
  }
@@ -2,21 +2,16 @@ import { StockObject, StockObjectMapper } from "@dascompany/database";
2
2
  export default class Status extends StockObject {
3
3
  private orderId;
4
4
  private userId;
5
- private typeId;
6
- private typeName;
5
+ private type;
7
6
  private createdAt;
8
- constructor(orderId: number, userId: number, typeId: number, typeName?: string | null, createdAt?: string | null);
7
+ constructor(orderId: number, userId: number, type: number, createdAt?: string | null);
9
8
  getOrderId(): number;
10
9
  getCreatedAt(): string | null;
11
10
  getUserId(): number;
12
- getTypeId(): number;
13
- getType(): {
14
- id: number;
15
- name: string | null;
16
- };
11
+ getType(): number;
17
12
  setOrderId(orderId: number): void;
18
13
  setCreatedAt(createdAt: string): void;
19
14
  setUserId(userId: number): void;
20
- setTypeId(typeId: number): void;
15
+ setType(type: number): void;
21
16
  protected getMapper(): StockObjectMapper;
22
17
  }
@@ -3,15 +3,13 @@ import StatusMapper from "../mappers/StatusMapper";
3
3
  export default class Status extends StockObject {
4
4
  orderId;
5
5
  userId;
6
- typeId;
7
- typeName;
6
+ type;
8
7
  createdAt;
9
- constructor(orderId, userId, typeId, typeName = null, createdAt = null) {
8
+ constructor(orderId, userId, type, createdAt = null) {
10
9
  super();
11
10
  this.orderId = orderId;
12
11
  this.userId = userId;
13
- this.typeId = typeId;
14
- this.typeName = typeName;
12
+ this.type = type;
15
13
  this.createdAt = createdAt;
16
14
  }
17
15
  getOrderId() {
@@ -23,14 +21,8 @@ export default class Status extends StockObject {
23
21
  getUserId() {
24
22
  return this.userId;
25
23
  }
26
- getTypeId() {
27
- return this.typeId;
28
- }
29
24
  getType() {
30
- return {
31
- id: this.typeId,
32
- name: this.typeName
33
- };
25
+ return this.type;
34
26
  }
35
27
  setOrderId(orderId) {
36
28
  this.orderId = orderId;
@@ -41,8 +33,8 @@ export default class Status extends StockObject {
41
33
  setUserId(userId) {
42
34
  this.userId = userId;
43
35
  }
44
- setTypeId(typeId) {
45
- this.typeId = typeId;
36
+ setType(type) {
37
+ this.type = type;
46
38
  }
47
39
  getMapper() {
48
40
  return new StatusMapper(this);
@@ -22,7 +22,7 @@ export default class StatusesTable extends Table {
22
22
  bindParameters(query, status) {
23
23
  query.bindParameter('order_id', status.getOrderId());
24
24
  query.bindParameter('user_id', status.getUserId());
25
- query.bindParameter('type', status.getTypeId());
25
+ query.bindParameter('type', status.getType());
26
26
  }
27
27
  async selectNextId() {
28
28
  const query = this.createQuery(SQL.statuses.selectNextId);
@@ -1,7 +1,7 @@
1
1
  export default interface StatusI {
2
2
  id: number;
3
+ orderId: number;
3
4
  createdAt: string;
4
5
  userId: number;
5
- typeId: number;
6
- typeName: string;
6
+ type: number;
7
7
  }
@@ -3,6 +3,5 @@ export default interface StatusRow {
3
3
  order_id: number;
4
4
  created_at: string;
5
5
  user_id: number;
6
- type_id: number;
7
- type_name: string;
6
+ type: number;
8
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",