@hapl/api-queries 0.1.116 → 0.1.117

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.
@@ -61,3 +61,4 @@ export * from './users/updateUser';
61
61
  export * from './users/fireUser';
62
62
  export * from './users/assignSubordinateUsers';
63
63
  export * from './task/findTasks';
64
+ export * from './valuation/findValuationByServiceRequestId';
@@ -0,0 +1,29 @@
1
+ import { AxiosResponse, AxiosError } from 'axios';
2
+ import { Valuation } from '../../../types';
3
+ declare type SuccessData = {
4
+ success: true;
5
+ data: Valuation;
6
+ };
7
+ declare type ErrorData = {
8
+ success: false;
9
+ data: {
10
+ error: string;
11
+ };
12
+ };
13
+ declare type ResultData = SuccessData['data'];
14
+ declare type ResultError = ErrorData['data']['error'];
15
+ export declare type FindValuationByServiceRequestIdUrlParams = {
16
+ id: number;
17
+ };
18
+ export declare type FindValuationByServiceRequestIdParams = {
19
+ withDrafts?: boolean;
20
+ };
21
+ export declare type FindValuationByServiceRequestIdData = AxiosResponse<ResultData>;
22
+ export declare type FindValuationByServiceRequestIdError = AxiosError<ResultError>;
23
+ export declare type FindValuationByServiceRequestIdConfig = {
24
+ baseURL?: string;
25
+ urlParams: FindValuationByServiceRequestIdUrlParams;
26
+ params?: FindValuationByServiceRequestIdParams;
27
+ };
28
+ export declare function findValuationByServiceRequestIdRequest({ baseURL, urlParams, params, }: FindValuationByServiceRequestIdConfig): Promise<FindValuationByServiceRequestIdData>;
29
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ValuationConcurrency } from '../types';
2
+ export declare const ValuationDictionary: {
3
+ Concurrency: {
4
+ low: string;
5
+ medium: string;
6
+ "medium-high": string;
7
+ high: string;
8
+ "very-high": string;
9
+ };
10
+ };
@@ -16,3 +16,4 @@ export * from './ServiceRequestCategorizedFile';
16
16
  export * from './Shape';
17
17
  export * from './Task';
18
18
  export * from './User';
19
+ export * from './Valuation';
@@ -65,6 +65,7 @@ export declare class Api {
65
65
  updateUser: (urlParams: api.UpdateUserUrlParams, body: api.UpdateUserBody, headers: api.UpdateUserHeaders) => Promise<api.UpdateUserData>;
66
66
  fireUser: (urlParams: api.FireUserUrlParams, body: api.FireUserBody, headers: api.FireUserHeaders) => Promise<api.FireUserData>;
67
67
  assignSubordinateUsers: (urlParams: api.AssignSubordinateUsersUrlParams, body: api.AssignSubordinateUsersBody, headers: api.AssignSubordinateUsersHeaders) => Promise<api.AssignSubordinateUsersData>;
68
+ findValuationByServiceRequestId: (urlParams: api.FindValuationByServiceRequestIdUrlParams, params?: api.FindValuationByServiceRequestIdParams | undefined) => Promise<api.FindValuationByServiceRequestIdData>;
68
69
  }
69
70
  export * from './api';
70
71
  export * from './dictionaries';
@@ -0,0 +1,69 @@
1
+ import { ServiceRequest } from './ServiceRequest';
2
+ export declare enum ValuationConcurrency {
3
+ Low = "low",
4
+ Medium = "medium",
5
+ MediumHigh = "medium-high",
6
+ High = "high",
7
+ VeryHigh = "very-high"
8
+ }
9
+ declare type ValueRange = {
10
+ max: number;
11
+ min: number;
12
+ p10: number;
13
+ p50: number;
14
+ p90: number;
15
+ };
16
+ declare type Stats = {
17
+ count: number;
18
+ outOfRange: number;
19
+ area?: ValueRange;
20
+ price?: ValueRange;
21
+ realtyIds?: number[];
22
+ };
23
+ export declare type Valuation = {
24
+ addresses: number[];
25
+ comments: Array<{
26
+ comment: string;
27
+ realtyId: number;
28
+ }>;
29
+ createdAt: string;
30
+ id: number;
31
+ isDraft: boolean;
32
+ isOnlyInMarketRangeShown: boolean;
33
+ realties: number[];
34
+ realtyParams: any[] | {
35
+ address?: string;
36
+ area?: number;
37
+ floor?: number;
38
+ lat?: number;
39
+ lng?: number;
40
+ price?: number;
41
+ roomsNumber?: number;
42
+ };
43
+ serviceRequest: Partial<ServiceRequest> & Required<Pick<ServiceRequest, 'id'>>;
44
+ calculationData?: {
45
+ active: Stats;
46
+ concurrencyLevel: ValuationConcurrency;
47
+ inventoryPerBuyer: number;
48
+ sold: Stats;
49
+ };
50
+ comment?: string;
51
+ filter?: {
52
+ address?: string;
53
+ area?: {
54
+ from?: number;
55
+ to?: number;
56
+ };
57
+ floor?: {
58
+ from?: number;
59
+ to?: number;
60
+ };
61
+ floorsNumber?: {
62
+ from: number;
63
+ to: number;
64
+ };
65
+ isShortDateRange?: boolean;
66
+ roomsNumber?: number[];
67
+ };
68
+ };
69
+ export {};
@@ -27,3 +27,4 @@ export * from './Task';
27
27
  export * from './User';
28
28
  export * from './UserCase';
29
29
  export * from './UserPhone';
30
+ export * from './Valuation';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.116",
2
+ "version": "0.1.117",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -72,3 +72,5 @@ export * from './users/fireUser';
72
72
  export * from './users/assignSubordinateUsers';
73
73
 
74
74
  export * from './task/findTasks';
75
+
76
+ export * from './valuation/findValuationByServiceRequestId';
@@ -0,0 +1,42 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import qs from 'qs';
3
+ import { Valuation } from '../../../types';
4
+
5
+ type SuccessData = { success: true; data: Valuation };
6
+ type ErrorData = { success: false; data: { error: string } };
7
+
8
+ type ResultData = SuccessData['data'];
9
+ type ResultError = ErrorData['data']['error'];
10
+
11
+ export type FindValuationByServiceRequestIdUrlParams = { id: number };
12
+ export type FindValuationByServiceRequestIdParams = { withDrafts?: boolean };
13
+ export type FindValuationByServiceRequestIdData = AxiosResponse<ResultData>;
14
+ export type FindValuationByServiceRequestIdError = AxiosError<ResultError>;
15
+
16
+ export type FindValuationByServiceRequestIdConfig = {
17
+ baseURL?: string;
18
+ urlParams: FindValuationByServiceRequestIdUrlParams;
19
+ params?: FindValuationByServiceRequestIdParams;
20
+ };
21
+
22
+ export function findValuationByServiceRequestIdRequest({
23
+ baseURL = 'https://clients.homeapp.ru',
24
+ urlParams,
25
+ params,
26
+ }: FindValuationByServiceRequestIdConfig) {
27
+ return axios
28
+ .get(`/api/valuation/${urlParams.id}`, {
29
+ baseURL,
30
+ params,
31
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
32
+ headers: { Accept: 'application/json' },
33
+ transformResponse: [
34
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
35
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
36
+ ],
37
+ })
38
+ .then((res: FindValuationByServiceRequestIdData) => res)
39
+ .catch((err: FindValuationByServiceRequestIdError) => {
40
+ throw err;
41
+ });
42
+ }
@@ -0,0 +1,11 @@
1
+ import { ValuationConcurrency } from '../types';
2
+
3
+ export const ValuationDictionary = {
4
+ Concurrency: {
5
+ [ValuationConcurrency.Low]: 'Не высокий',
6
+ [ValuationConcurrency.Medium]: 'Средний',
7
+ [ValuationConcurrency.MediumHigh]: 'Выше среднего',
8
+ [ValuationConcurrency.High]: 'Высокий',
9
+ [ValuationConcurrency.VeryHigh]: 'Очень высокий',
10
+ },
11
+ };
@@ -16,3 +16,4 @@ export * from './ServiceRequestCategorizedFile';
16
16
  export * from './Shape';
17
17
  export * from './Task';
18
18
  export * from './User';
19
+ export * from './Valuation';
@@ -396,6 +396,15 @@ export class Api {
396
396
  ) => {
397
397
  return api.assignSubordinateUsersRequest({ urlParams, body, headers, baseURL: this.baseURL });
398
398
  };
399
+
400
+ // valuation
401
+
402
+ findValuationByServiceRequestId = (
403
+ urlParams: api.FindValuationByServiceRequestIdUrlParams,
404
+ params?: api.FindValuationByServiceRequestIdParams
405
+ ) => {
406
+ return api.findValuationByServiceRequestIdRequest({ urlParams, params, baseURL: this.baseURL });
407
+ };
399
408
  }
400
409
 
401
410
  export * from './api';
@@ -0,0 +1,57 @@
1
+ import { ServiceRequest } from './ServiceRequest';
2
+
3
+ export enum ValuationConcurrency {
4
+ Low = 'low',
5
+ Medium = 'medium',
6
+ MediumHigh = 'medium-high',
7
+ High = 'high',
8
+ VeryHigh = 'very-high',
9
+ }
10
+
11
+ type ValueRange = { max: number; min: number; p10: number; p50: number; p90: number };
12
+
13
+ type Stats = {
14
+ count: number;
15
+ outOfRange: number;
16
+ area?: ValueRange;
17
+ price?: ValueRange;
18
+ realtyIds?: number[];
19
+ };
20
+
21
+ export type Valuation = {
22
+ addresses: number[];
23
+ comments: Array<{ comment: string; realtyId: number }>;
24
+ createdAt: string;
25
+ id: number;
26
+ isDraft: boolean;
27
+ isOnlyInMarketRangeShown: boolean;
28
+ realties: number[];
29
+ realtyParams:
30
+ | any[]
31
+ | {
32
+ address?: string;
33
+ area?: number;
34
+ floor?: number;
35
+ lat?: number;
36
+ lng?: number;
37
+ price?: number;
38
+ roomsNumber?: number;
39
+ };
40
+ serviceRequest: Partial<ServiceRequest> & Required<Pick<ServiceRequest, 'id'>>;
41
+
42
+ calculationData?: {
43
+ active: Stats;
44
+ concurrencyLevel: ValuationConcurrency;
45
+ inventoryPerBuyer: number;
46
+ sold: Stats;
47
+ };
48
+ comment?: string;
49
+ filter?: {
50
+ address?: string;
51
+ area?: { from?: number; to?: number };
52
+ floor?: { from?: number; to?: number };
53
+ floorsNumber?: { from: number; to: number };
54
+ isShortDateRange?: boolean;
55
+ roomsNumber?: number[];
56
+ };
57
+ };
@@ -27,3 +27,4 @@ export * from './Task';
27
27
  export * from './User';
28
28
  export * from './UserCase';
29
29
  export * from './UserPhone';
30
+ export * from './Valuation';