starta.apiclient 1.37.3528 → 1.37.3541
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.
|
@@ -15,6 +15,7 @@ import StartaTransactions from './startaTransactions';
|
|
|
15
15
|
import Warehouses from './warehouses';
|
|
16
16
|
import Products from './products';
|
|
17
17
|
import ProductCategories from './productCategories';
|
|
18
|
+
import ProductOperations from './productOperations';
|
|
18
19
|
export declare type TariffDetails = {
|
|
19
20
|
tariff: 'lite' | 'pro';
|
|
20
21
|
period: 'monthly' | 'yearly';
|
|
@@ -107,5 +108,6 @@ export default class Organizations {
|
|
|
107
108
|
get warehouses(): Warehouses;
|
|
108
109
|
get products(): Products;
|
|
109
110
|
get productCategories(): ProductCategories;
|
|
111
|
+
get productsOperations(): ProductOperations;
|
|
110
112
|
get startaTransactions(): StartaTransactions;
|
|
111
113
|
}
|
|
@@ -16,6 +16,7 @@ const startaTransactions_1 = require("./startaTransactions");
|
|
|
16
16
|
const warehouses_1 = require("./warehouses");
|
|
17
17
|
const products_1 = require("./products");
|
|
18
18
|
const productCategories_1 = require("./productCategories");
|
|
19
|
+
const productOperations_1 = require("./productOperations");
|
|
19
20
|
const _helpers_1 = require("../_helpers");
|
|
20
21
|
class Organizations {
|
|
21
22
|
constructor(requestRunner) {
|
|
@@ -250,6 +251,9 @@ class Organizations {
|
|
|
250
251
|
get productCategories() {
|
|
251
252
|
return new productCategories_1.default(this._requestRunner);
|
|
252
253
|
}
|
|
254
|
+
get productsOperations() {
|
|
255
|
+
return new productOperations_1.default(this._requestRunner);
|
|
256
|
+
}
|
|
253
257
|
get startaTransactions() {
|
|
254
258
|
return new startaTransactions_1.default(this._requestRunner);
|
|
255
259
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProductOperation, StartaRequestRunner } from '../../types';
|
|
2
|
+
export default class ProductOperations {
|
|
3
|
+
private _requestRunner;
|
|
4
|
+
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
+
index(organizationLogin: string): Promise<import("../../types").StartaResponse>;
|
|
6
|
+
add(organizationLogin: string, { date, type, supplier, warehouseId, products, isPaid, comment, }: ProductOperation): Promise<import("../../types").StartaResponse>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class ProductOperations {
|
|
4
|
+
constructor(requestRunner) {
|
|
5
|
+
this._requestRunner = requestRunner;
|
|
6
|
+
}
|
|
7
|
+
index(organizationLogin) {
|
|
8
|
+
return this._requestRunner.performRequest({
|
|
9
|
+
url: `accounts/${organizationLogin}/productOperations`,
|
|
10
|
+
method: 'GET',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
add(organizationLogin, { date, type, supplier, warehouseId, products, isPaid, comment, }) {
|
|
14
|
+
return this._requestRunner.performRequest({
|
|
15
|
+
url: `accounts/${organizationLogin}/productOperations`,
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: {
|
|
18
|
+
date,
|
|
19
|
+
type,
|
|
20
|
+
supplier,
|
|
21
|
+
warehouseId,
|
|
22
|
+
products,
|
|
23
|
+
isPaid,
|
|
24
|
+
comment,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.default = ProductOperations;
|
package/lib/types.d.ts
CHANGED
|
@@ -76,6 +76,23 @@ export declare type Product = {
|
|
|
76
76
|
criticalStock?: number;
|
|
77
77
|
desiredStock?: number;
|
|
78
78
|
};
|
|
79
|
+
export declare type ProductOperation = {
|
|
80
|
+
organizationLogin: string;
|
|
81
|
+
date: Date;
|
|
82
|
+
type: 'receiving' | 'writeOff';
|
|
83
|
+
supplier?: string;
|
|
84
|
+
warehouseId: string;
|
|
85
|
+
products: Array<{
|
|
86
|
+
id: string;
|
|
87
|
+
supplyPrice: number;
|
|
88
|
+
quantity: number;
|
|
89
|
+
discount: number;
|
|
90
|
+
discountType: 'relative' | 'absolute';
|
|
91
|
+
totalPrice: number;
|
|
92
|
+
}>;
|
|
93
|
+
isPaid?: boolean;
|
|
94
|
+
comment?: string;
|
|
95
|
+
};
|
|
79
96
|
export declare type OrganizationSchedule = {
|
|
80
97
|
name: any;
|
|
81
98
|
location: {
|