@hapl/api-queries 0.1.105 → 0.1.107

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.
@@ -36,6 +36,7 @@ export * from './serviceRequest/findServiceRequestDuplicates';
36
36
  export * from './serviceRequest/findServiceRequests';
37
37
  export * from './serviceRequest/findServiceRequestShortInfo';
38
38
  export * from './serviceRequest/findServiceRequestShortInfoById';
39
+ export * from './serviceRequest/findServiceRequestShortInfoByDealId';
39
40
  export * from './serviceRequest/findServiceRequestCategorizedFiles';
40
41
  export * from './serviceRequest/returnDeferredServiceRequest';
41
42
  export * from './serviceRequest/sendServiceRequestToModeration';
@@ -0,0 +1,34 @@
1
+ import { AxiosResponse, AxiosError } from 'axios';
2
+ import { ServiceRequest, Realty, User } from '../../../types';
3
+ declare type SuccessData = {
4
+ success: true;
5
+ data: Pick<ServiceRequest, 'id' | 'curator' | 'publicationTestPeriodDays' | 'realtyExtId'> & {
6
+ realty?: Pick<Realty, 'price' | 'roomsNumber' | 'floorsNumber' | 'area' | 'realtyType'>;
7
+ user?: Pick<User, 'firstName'> & {
8
+ phonePostfix: string;
9
+ };
10
+ };
11
+ };
12
+ declare type ErrorData = {
13
+ success: false;
14
+ data: {
15
+ error: string;
16
+ };
17
+ };
18
+ declare type ResultData = SuccessData['data'];
19
+ declare type ResultError = ErrorData['data']['error'];
20
+ export declare type FindServiceRequestShortInfoByDealIdUrlParams = {
21
+ id: number;
22
+ };
23
+ export declare type FindServiceRequestShortInfoByDealIdHeaders = {
24
+ 'x-auth-hc': string;
25
+ };
26
+ export declare type FindServiceRequestShortInfoByDealIdData = AxiosResponse<ResultData>;
27
+ export declare type FindServiceRequestShortInfoByDealIdError = AxiosError<ResultError>;
28
+ export declare type FindServiceRequestShortInfoByDealIdConfig = {
29
+ baseURL?: string;
30
+ urlParams: FindServiceRequestShortInfoByDealIdUrlParams;
31
+ headers: FindServiceRequestShortInfoByDealIdHeaders;
32
+ };
33
+ export declare function findServiceRequestShortInfoByDealIdRequest({ baseURL, urlParams, headers, }: FindServiceRequestShortInfoByDealIdConfig): Promise<FindServiceRequestShortInfoByDealIdData>;
34
+ export {};
@@ -31,6 +31,7 @@ export declare const UserDictionary: {
31
31
  trainee: string;
32
32
  expert: string;
33
33
  mentor: string;
34
+ invest: string;
34
35
  teamlead: string;
35
36
  call_operator: string;
36
37
  admin: string;
@@ -40,6 +40,7 @@ export declare class Api {
40
40
  findServiceRequests: (params: api.FindServiceRequestsParams, headers: api.FindServiceRequestsHeaders) => Promise<api.FindServiceRequestsData>;
41
41
  findServiceRequestShortInfo: (params: api.FindServiceRequestsShortInfoParams, headers: api.FindServiceRequestShortInfoHeaders) => Promise<api.FindServiceRequestShortInfoData>;
42
42
  findServiceRequestShortInfoById: (urlParams: api.FindServiceRequestShortInfoByIdUrlParams, headers: api.FindServiceRequestShortInfoByIdHeaders) => Promise<api.FindServiceRequestShortInfoByIdData>;
43
+ findServiceRequestShortInfoByDealId: (urlParams: api.FindServiceRequestShortInfoByDealIdUrlParams, headers: api.FindServiceRequestShortInfoByDealIdHeaders) => Promise<api.FindServiceRequestShortInfoByDealIdData>;
43
44
  findServiceRequestCategorizedFiles: (urlParams: api.FindServiceRequestCategorizedFilesUrlParams, params: api.FindServiceRequestCategorizedFilesParams, headers: api.FindServiceRequestCategorizedFilesHeaders) => Promise<api.FindServiceRequestCategorizedFilesData>;
44
45
  sendServiceRequestToModeration: (urlParams: api.SendServiceRequestToModerationUrlParams, headers: api.SendServiceRequestToModerationHeaders) => Promise<api.SendServiceRequestToModerationData>;
45
46
  returnDeferredServiceRequest: (body: api.ReturnDeferredServiceRequestBody, headers: api.ReturnDeferredServiceRequestHeaders) => Promise<api.ReturnDeferredServiceRequestData>;
@@ -37,7 +37,6 @@ export declare type Deal = {
37
37
  buyer: Partial<Buyer> & Required<Pick<Buyer, 'id'>>;
38
38
  incomes: Array<Partial<Income> & Required<Pick<Income, 'id'>>>;
39
39
  participants: Array<Partial<DealParticipant> & Required<Pick<DealParticipant, 'id'>>>;
40
- investSellServiceRequestId?: number;
41
40
  comment?: string;
42
41
  lawyer?: Partial<User> & Required<Pick<User, 'id'>>;
43
42
  files?: Array<Partial<File> & Required<Pick<File, 'id'>>>;
@@ -57,5 +56,8 @@ export declare type Deal = {
57
56
  isInvestBuyout?: boolean;
58
57
  investBuyoutPrepaymentSum?: number;
59
58
  investBuyoutPrepaymentAt?: string;
59
+ investSellServiceRequest?: {
60
+ id: number;
61
+ };
60
62
  };
61
63
  };
@@ -95,8 +95,12 @@ export declare type ServiceRequest = {
95
95
  user: Partial<User> & {
96
96
  id: number;
97
97
  };
98
- investBuyoutDealId?: number;
99
- investType?: ServiceRequestInvestType;
98
+ invest?: {
99
+ investType?: ServiceRequestInvestType;
100
+ investBuyoutDeal?: {
101
+ id: number;
102
+ };
103
+ };
100
104
  canBePublishedAt?: string;
101
105
  closeRequestedAt?: string;
102
106
  closedAt?: string;
@@ -34,6 +34,7 @@ export declare enum UserRole {
34
34
  Trainee = "trainee",
35
35
  Expert = "expert",
36
36
  Mentor = "mentor",
37
+ Invest = "invest",
37
38
  Teamlead = "teamlead",
38
39
  CallOperator = "call_operator",
39
40
  Admin = "admin",
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.105",
2
+ "version": "0.1.107",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -43,6 +43,7 @@ export * from './serviceRequest/findServiceRequestDuplicates';
43
43
  export * from './serviceRequest/findServiceRequests';
44
44
  export * from './serviceRequest/findServiceRequestShortInfo';
45
45
  export * from './serviceRequest/findServiceRequestShortInfoById';
46
+ export * from './serviceRequest/findServiceRequestShortInfoByDealId';
46
47
  export * from './serviceRequest/findServiceRequestCategorizedFiles';
47
48
  export * from './serviceRequest/returnDeferredServiceRequest';
48
49
  export * from './serviceRequest/sendServiceRequestToModeration';
@@ -0,0 +1,45 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { ServiceRequest, Realty, User } from '../../../types';
3
+
4
+ type SuccessData = {
5
+ success: true;
6
+ data: Pick<ServiceRequest, 'id' | 'curator' | 'publicationTestPeriodDays' | 'realtyExtId'> & {
7
+ realty?: Pick<Realty, 'price' | 'roomsNumber' | 'floorsNumber' | 'area' | 'realtyType'>;
8
+ user?: Pick<User, 'firstName'> & { phonePostfix: string };
9
+ };
10
+ };
11
+ type ErrorData = { success: false; data: { error: string } };
12
+
13
+ type ResultData = SuccessData['data'];
14
+ type ResultError = ErrorData['data']['error'];
15
+
16
+ export type FindServiceRequestShortInfoByDealIdUrlParams = { id: number };
17
+ export type FindServiceRequestShortInfoByDealIdHeaders = { 'x-auth-hc': string };
18
+ export type FindServiceRequestShortInfoByDealIdData = AxiosResponse<ResultData>;
19
+ export type FindServiceRequestShortInfoByDealIdError = AxiosError<ResultError>;
20
+
21
+ export type FindServiceRequestShortInfoByDealIdConfig = {
22
+ baseURL?: string;
23
+ urlParams: FindServiceRequestShortInfoByDealIdUrlParams;
24
+ headers: FindServiceRequestShortInfoByDealIdHeaders;
25
+ };
26
+
27
+ export function findServiceRequestShortInfoByDealIdRequest({
28
+ baseURL = 'https://clients.homeapp.ru',
29
+ urlParams,
30
+ headers,
31
+ }: FindServiceRequestShortInfoByDealIdConfig) {
32
+ return axios
33
+ .get(`/api/service-request-by-deal-id/short/${urlParams.id}`, {
34
+ baseURL,
35
+ headers: { Accept: 'application/json', ...headers },
36
+ transformResponse: [
37
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
38
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
39
+ ],
40
+ })
41
+ .then((res: FindServiceRequestShortInfoByDealIdData) => res)
42
+ .catch((err: FindServiceRequestShortInfoByDealIdError) => {
43
+ throw err;
44
+ });
45
+ }
@@ -42,6 +42,7 @@ export const UserDictionary = {
42
42
  [UserRole.Trainee]: 'Стажер',
43
43
  [UserRole.Expert]: 'Эксперт',
44
44
  [UserRole.Mentor]: 'Наставник',
45
+ [UserRole.Invest]: 'Сотрудник инвестотдела',
45
46
  [UserRole.Teamlead]: 'Руководитель отдела продаж',
46
47
  [UserRole.CallOperator]: 'Оператор',
47
48
  [UserRole.Admin]: 'Администратор',
@@ -234,6 +234,13 @@ export class Api {
234
234
  return api.findServiceRequestShortInfoByIdRequest({ urlParams, headers, baseURL: this.baseURL });
235
235
  };
236
236
 
237
+ findServiceRequestShortInfoByDealId = (
238
+ urlParams: api.FindServiceRequestShortInfoByDealIdUrlParams,
239
+ headers: api.FindServiceRequestShortInfoByDealIdHeaders
240
+ ) => {
241
+ return api.findServiceRequestShortInfoByDealIdRequest({ urlParams, headers, baseURL: this.baseURL });
242
+ };
243
+
237
244
  findServiceRequestCategorizedFiles = (
238
245
  urlParams: api.FindServiceRequestCategorizedFilesUrlParams,
239
246
  params: api.FindServiceRequestCategorizedFilesParams,
@@ -41,7 +41,6 @@ export type Deal = {
41
41
  buyer: Partial<Buyer> & Required<Pick<Buyer, 'id'>>;
42
42
  incomes: Array<Partial<Income> & Required<Pick<Income, 'id'>>>;
43
43
  participants: Array<Partial<DealParticipant> & Required<Pick<DealParticipant, 'id'>>>;
44
- investSellServiceRequestId?: number;
45
44
  comment?: string;
46
45
  lawyer?: Partial<User> & Required<Pick<User, 'id'>>;
47
46
  files?: Array<Partial<File> & Required<Pick<File, 'id'>>>;
@@ -59,5 +58,6 @@ export type Deal = {
59
58
  isInvestBuyout?: boolean;
60
59
  investBuyoutPrepaymentSum?: number;
61
60
  investBuyoutPrepaymentAt?: string;
61
+ investSellServiceRequest?: { id: number };
62
62
  };
63
63
  };
@@ -97,8 +97,10 @@ export type ServiceRequest = {
97
97
  type: ServiceRequestType;
98
98
  user: Partial<User> & { id: number };
99
99
 
100
- investBuyoutDealId?: number;
101
- investType?: ServiceRequestInvestType;
100
+ invest?: {
101
+ investType?: ServiceRequestInvestType;
102
+ investBuyoutDeal?: { id: number };
103
+ };
102
104
  canBePublishedAt?: string;
103
105
  closeRequestedAt?: string;
104
106
  closedAt?: string;
@@ -40,6 +40,7 @@ export enum UserRole {
40
40
  Trainee = 'trainee',
41
41
  Expert = 'expert',
42
42
  Mentor = 'mentor',
43
+ Invest = 'invest',
43
44
  Teamlead = 'teamlead',
44
45
  CallOperator = 'call_operator',
45
46
  Admin = 'admin',