@dascompany/product 2.1.12 → 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.
- package/dist/SQL.json +1 -1
- package/dist/reader/OrderStatusReader.d.ts +3 -3
- package/dist/reader/OrderStatusReader.js +1 -2
- package/dist/reader/StatusTypesReader.d.ts +3 -1
- package/dist/reader/StatusTypesReader.js +6 -2
- package/dist/repo/OrderStatusRepo.js +1 -1
- package/dist/stockObjects/Status.d.ts +4 -9
- package/dist/stockObjects/Status.js +6 -14
- package/dist/tables/orders/StatusTypesTable.d.ts +3 -2
- package/dist/tables/orders/StatusTypesTable.js +7 -2
- package/dist/tables/orders/StatusesTable.js +1 -1
- package/dist/types/StatusI.d.ts +2 -2
- package/dist/types/rows/StatusRow.d.ts +1 -2
- package/package.json +1 -1
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
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import { QueryOptions } from "@dascompany/database";
|
|
2
|
-
import
|
|
2
|
+
import StatusI from "../types/StatusI";
|
|
3
3
|
export default class OrderStatusReader {
|
|
4
|
-
static get(queryOptions: QueryOptions): Promise<
|
|
5
|
-
static getAll(queryOptions?: QueryOptions): Promise<
|
|
4
|
+
static get(queryOptions: QueryOptions): Promise<StatusI>;
|
|
5
|
+
static getAll(queryOptions?: QueryOptions): Promise<StatusI[]>;
|
|
6
6
|
private static correctStatus;
|
|
7
7
|
}
|
|
@@ -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
|
}
|
|
@@ -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.
|
|
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
|
|
6
|
-
private typeName;
|
|
5
|
+
private type;
|
|
7
6
|
private createdAt;
|
|
8
|
-
constructor(orderId: number, userId: number,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
7
|
-
typeName;
|
|
6
|
+
type;
|
|
8
7
|
createdAt;
|
|
9
|
-
constructor(orderId, userId,
|
|
8
|
+
constructor(orderId, userId, type, createdAt = null) {
|
|
10
9
|
super();
|
|
11
10
|
this.orderId = orderId;
|
|
12
11
|
this.userId = userId;
|
|
13
|
-
this.
|
|
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
|
-
|
|
45
|
-
this.
|
|
36
|
+
setType(type) {
|
|
37
|
+
this.type = type;
|
|
46
38
|
}
|
|
47
39
|
getMapper() {
|
|
48
40
|
return new StatusMapper(this);
|
|
@@ -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
|
}
|
|
@@ -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.
|
|
25
|
+
query.bindParameter('type', status.getType());
|
|
26
26
|
}
|
|
27
27
|
async selectNextId() {
|
|
28
28
|
const query = this.createQuery(SQL.statuses.selectNextId);
|
package/dist/types/StatusI.d.ts
CHANGED