bx-rest 0.0.1
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/.editorconfig +17 -0
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/package.json +36 -0
- package/src/const/time.ts +3 -0
- package/src/index.ts +0 -0
- package/src/rest/user/user.ts +341 -0
- package/src/services/base.ts +187 -0
- package/src/services/http/HttpData.ts +142 -0
- package/src/services/http/base/HttpData.ts +140 -0
- package/src/services/http/base/base.ts +39 -0
- package/src/services/http/base/http.ts +67 -0
- package/src/services/http/http.ts +182 -0
- package/src/services/snack-bar/snack-bar.service.ts +40 -0
- package/src/services/snack-bar/toast-message/toast-message.component.html +13 -0
- package/src/services/snack-bar/toast-message/toast-message.component.scss +53 -0
- package/src/services/snack-bar/toast-message/toast-message.component.spec.ts +24 -0
- package/src/services/snack-bar/toast-message/toast-message.component.ts +26 -0
- package/src/typification/rest/base/ApiPaginationBX.ts +3 -0
- package/src/typification/rest/base/OrderOptions.ts +3 -0
- package/src/typification/rest/base/YesNo.ts +1 -0
- package/src/typification/rest/base/fieldBXType.ts +1 -0
- package/src/typification/rest/base/filterGenerator.ts +3 -0
- package/src/typification/rest/base/httpAnswerBX.ts +15 -0
- package/src/typification/rest/settings.ts +7 -0
- package/src/typification/rest/support/param.ts +8 -0
- package/src/typification/rest/user/CustomUserFieldInfo.ts +70 -0
- package/src/typification/rest/user/UserFilterSearch.ts +43 -0
- package/src/typification/rest/user/get.ts +17 -0
- package/src/typification/rest/user/user.ts +68 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
|
2
|
+
import { ToastMessageComponent } from './toast-message.component'
|
|
3
|
+
|
|
4
|
+
describe('ToastMessageComponent', () => {
|
|
5
|
+
let component: ToastMessageComponent;
|
|
6
|
+
let fixture: ComponentFixture<ToastMessageComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
declarations: [ ToastMessageComponent ]
|
|
11
|
+
})
|
|
12
|
+
.compileComponents();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
fixture = TestBed.createComponent(ToastMessageComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
fixture.detectChanges();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should create', () => {
|
|
22
|
+
expect(component).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Component, inject, Inject, ViewEncapsulation } from '@angular/core'
|
|
2
|
+
import { MAT_SNACK_BAR_DATA, MatSnackBarRef } from '@angular/material/snack-bar'
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-view',
|
|
6
|
+
templateUrl: './toast-message.component.html',
|
|
7
|
+
styleUrls: ['./toast-message.component.scss'],
|
|
8
|
+
encapsulation: ViewEncapsulation.None,
|
|
9
|
+
})
|
|
10
|
+
export class ToastMessageComponent {
|
|
11
|
+
|
|
12
|
+
snackBarRef = inject(MatSnackBarRef)
|
|
13
|
+
|
|
14
|
+
constructor(@Inject(MAT_SNACK_BAR_DATA) public data: { message: string, type: 'error' | 'warning' | 'success' }) {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getClass():string{
|
|
18
|
+
switch (this.data.type){
|
|
19
|
+
case 'error':
|
|
20
|
+
case 'warning':
|
|
21
|
+
case 'success':
|
|
22
|
+
return this.data.type + '-message';
|
|
23
|
+
}
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type iBXRestYesNo = 'Y' | 'N' // wtf BX?
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type iFieldBXType = 'text' | 'link' | 'datetime' | 'list' | 'phone' | 'timezone' | 'userField' | 'multilist'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default interface iHttpAnswerBX<T> {
|
|
2
|
+
result?: T | undefined,
|
|
3
|
+
next?: number,
|
|
4
|
+
total?: number,
|
|
5
|
+
time?: {
|
|
6
|
+
start: number,
|
|
7
|
+
finish: number,
|
|
8
|
+
duration: number,
|
|
9
|
+
processing: number,
|
|
10
|
+
date_start: string,
|
|
11
|
+
date_finish: string
|
|
12
|
+
},
|
|
13
|
+
error?: string,
|
|
14
|
+
error_description?: string
|
|
15
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { iBXRestUserKey } from '@/lib/typification/bitrix/api/rest/user/user'
|
|
2
|
+
import { iBXRestYesNo } from '@/lib/typification/bitrix/api/rest/base/YesNo'
|
|
3
|
+
|
|
4
|
+
export interface iCustomUserFieldInfo {
|
|
5
|
+
ID: string,
|
|
6
|
+
ENTITY_ID: "USER",
|
|
7
|
+
FIELD_NAME: iBXRestUserKey,
|
|
8
|
+
USER_TYPE_ID: iCustomUserFieldInfoType,
|
|
9
|
+
XML_ID: string | null,
|
|
10
|
+
SORT: string,
|
|
11
|
+
MULTIPLE: iBXRestYesNo,
|
|
12
|
+
MANDATORY: iBXRestYesNo,
|
|
13
|
+
SHOW_FILTER: 'E' | 'N', // ??? это что вообще?
|
|
14
|
+
SHOW_IN_LIST: iBXRestYesNo,
|
|
15
|
+
EDIT_IN_LIST: iBXRestYesNo,
|
|
16
|
+
IS_SEARCHABLE: iBXRestYesNo,
|
|
17
|
+
SETTINGS:
|
|
18
|
+
iCustomUserFieldInfoSETTINGSTypeString
|
|
19
|
+
| iCustomUserFieldInfoSETTINGSTypeFile
|
|
20
|
+
| iCustomUserFieldInfoSETTINGSTypeEnumeration
|
|
21
|
+
| iCustomUserFieldInfoSETTINGSTypeDatetime
|
|
22
|
+
LIST?: iCustomUserFieldInfoSETTINGSTypeEnumerationLIST[],
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface iCustomUserFieldInfoSETTINGSTypeString {
|
|
26
|
+
SIZE: number,
|
|
27
|
+
ROWS: number,
|
|
28
|
+
REGEXP: string | null,
|
|
29
|
+
MIN_LENGTH: number,
|
|
30
|
+
MAX_LENGTH: number,
|
|
31
|
+
DEFAULT_VALUE: string | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface iCustomUserFieldInfoSETTINGSTypeFile {
|
|
35
|
+
SIZE: number,
|
|
36
|
+
LIST_WIDTH: number,
|
|
37
|
+
LIST_HEIGHT: number,
|
|
38
|
+
MAX_SHOW_SIZE: number,
|
|
39
|
+
MAX_ALLOWED_SIZE: number,
|
|
40
|
+
EXTENSIONS: any[], // TODO: Позже описать
|
|
41
|
+
TARGET_BLANK: iBXRestYesNo
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface iCustomUserFieldInfoSETTINGSTypeEnumeration {
|
|
45
|
+
DISPLAY: 'UI' | 'DIALOG',
|
|
46
|
+
LIST_HEIGHT: number,
|
|
47
|
+
CAPTION_NO_VALUE: string,
|
|
48
|
+
SHOW_NO_VALUE: iBXRestYesNo
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface iCustomUserFieldInfoSETTINGSTypeEnumerationLIST{
|
|
52
|
+
ID: string,
|
|
53
|
+
SORT: string,
|
|
54
|
+
VALUE: string,
|
|
55
|
+
DEF: iBXRestYesNo
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface iCustomUserFieldInfoSETTINGSTypeDatetime {
|
|
59
|
+
DEFAULT_VALUE: {
|
|
60
|
+
TYPE: 'NONE',
|
|
61
|
+
VALUE: string
|
|
62
|
+
},
|
|
63
|
+
"USE_SECOND": iBXRestYesNo,
|
|
64
|
+
"USE_TIMEZONE": iBXRestYesNo
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
export type iCustomUserFieldInfoType = 'string' | 'file' | 'enumeration' | 'datetime'
|
|
69
|
+
|
|
70
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export default interface UserFilterSearch {
|
|
2
|
+
NAME?: string // имя
|
|
3
|
+
LAST_NAME?: string, // фамилия
|
|
4
|
+
SECOND_NAME?: string, // отчество
|
|
5
|
+
WORK_POSITION?: string, // должность
|
|
6
|
+
UF_DEPARTMENT_NAME?: string, //название подразделения
|
|
7
|
+
USER_TYPE?: 'employee' | 'extranet' | 'email',
|
|
8
|
+
FIND?: string // поиск по всем выше перечисленным полям
|
|
9
|
+
ACTIVE?: boolean
|
|
10
|
+
EMAIL?: string,
|
|
11
|
+
LAST_LOGIN?: string,
|
|
12
|
+
DATE_REGISTER?: string,
|
|
13
|
+
IS_ONLINE?: 'Y' | 'N', // wtf BX?
|
|
14
|
+
PERSONAL_GENDER?: 'M' | 'F', // wtf BX? Where is others 48 gender?
|
|
15
|
+
PERSONAL_PROFESSION?: string,
|
|
16
|
+
PERSONAL_WWW?: string,
|
|
17
|
+
PERSONAL_BIRTHDAY?: string,
|
|
18
|
+
PERSONAL_PHOTO?: string,
|
|
19
|
+
PERSONAL_ICQ?: string,
|
|
20
|
+
PERSONAL_PHONE?: string,
|
|
21
|
+
PERSONAL_FAX?: string,
|
|
22
|
+
PERSONAL_MOBILE?: string,
|
|
23
|
+
PERSONAL_PAGER?: string,
|
|
24
|
+
PERSONAL_STREET?: string,
|
|
25
|
+
PERSONAL_CITY?: string,
|
|
26
|
+
PERSONAL_STATE?: string,
|
|
27
|
+
PERSONAL_ZIP?: string,
|
|
28
|
+
PERSONAL_COUNTRY?: string,
|
|
29
|
+
TIME_ZONE_OFFSET?: string,
|
|
30
|
+
WORK_COMPANY?: string,
|
|
31
|
+
WORK_PHONE?: string,
|
|
32
|
+
UF_DEPARTMENT?: number[]
|
|
33
|
+
UF_INTERESTS?: string,
|
|
34
|
+
UF_SKILLS?: string,
|
|
35
|
+
UF_WEB_SITES?: string,
|
|
36
|
+
UF_XING?: string,
|
|
37
|
+
UF_LINKEDIN?: string,
|
|
38
|
+
UF_FACEBOOK?: string,
|
|
39
|
+
UF_TWITTER?: string,
|
|
40
|
+
UF_SKYPE?: string,
|
|
41
|
+
UF_DISTRICT?: string,
|
|
42
|
+
UF_PHONE_INNER?: string
|
|
43
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { iBXRestYesNo } from '../base/YesNo'
|
|
2
|
+
import { iBXRestBaseParam } from '../support/param'
|
|
3
|
+
|
|
4
|
+
export interface iBXGetParam extends iBXRestBaseParam {
|
|
5
|
+
ID?: number[] | number, // по ID
|
|
6
|
+
PERSONAL_BIRTHDAY?: string | string[]
|
|
7
|
+
order?: 'ASC' | 'DESC', // сортировка
|
|
8
|
+
UF_DEPARTMENT?: number[], // принадлежность к структуре компании
|
|
9
|
+
UF_PHONE_INNER?: string, // внутренний телефонный номер
|
|
10
|
+
IS_ONLINE?: iBXRestYesNo, // позволяет показать только авторизованных или нет пользователей
|
|
11
|
+
NAME_SEARCH?: string, // быстрый поиск по персональным данным
|
|
12
|
+
USER_TYPE?: 'employee' | 'extranet' | 'email', // Тип пользователя. Может принимать следующие значения:
|
|
13
|
+
// employee - сотрудник,
|
|
14
|
+
// extranet - пользователь экстранета,
|
|
15
|
+
// email - почтовый пользователь
|
|
16
|
+
ACTIVE?: 2 | 1 | 0 // при значении 1 исключает из запроса уволенных пользователей. 2 - если нужны и те и те
|
|
17
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { iBXRestYesNo } from '@/lib/typification/bitrix/api/rest/base/YesNo'
|
|
2
|
+
|
|
3
|
+
export interface iBXRestUser extends iBXRestUserBase {
|
|
4
|
+
ID: number,
|
|
5
|
+
IS_ONLINE: boolean,
|
|
6
|
+
DATE_REGISTER: Date,
|
|
7
|
+
PERSONAL_BIRTHDAY: Date,
|
|
8
|
+
LAST_LOGIN?: Date
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface iBXRestUserHttp extends iBXRestUserBase {
|
|
12
|
+
ID: string,
|
|
13
|
+
IS_ONLINE: iBXRestYesNo,
|
|
14
|
+
DATE_REGISTER: string,
|
|
15
|
+
PERSONAL_BIRTHDAY: string,
|
|
16
|
+
LAST_LOGIN?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface iBXRestUserBase {
|
|
20
|
+
ACTIVE: boolean,
|
|
21
|
+
EMAIL: string,
|
|
22
|
+
NAME: string,
|
|
23
|
+
LAST_NAME: string,
|
|
24
|
+
SECOND_NAME: string,
|
|
25
|
+
PERSONAL_GENDER: iAllBXGender,
|
|
26
|
+
PERSONAL_PROFESSION: string,
|
|
27
|
+
PERSONAL_WWW: string,
|
|
28
|
+
PERSONAL_BIRTHDAY: string | Date,
|
|
29
|
+
PERSONAL_PHOTO: string,
|
|
30
|
+
PERSONAL_ICQ: string,
|
|
31
|
+
PERSONAL_PHONE: string,
|
|
32
|
+
PERSONAL_FAX: string,
|
|
33
|
+
PERSONAL_MOBILE: string,
|
|
34
|
+
PERSONAL_PAGER: string,
|
|
35
|
+
PERSONAL_STREET: string,
|
|
36
|
+
PERSONAL_CITY: string,
|
|
37
|
+
PERSONAL_STATE: string,
|
|
38
|
+
PERSONAL_ZIP: string,
|
|
39
|
+
PERSONAL_COUNTRY: string,
|
|
40
|
+
TIME_ZONE: string,
|
|
41
|
+
TIME_ZONE_OFFSET: string,
|
|
42
|
+
WORK_COMPANY: string,
|
|
43
|
+
WORK_POSITION: string,
|
|
44
|
+
WORK_PHONE: string,
|
|
45
|
+
UF_DEPARTMENT: number[]
|
|
46
|
+
UF_INTERESTS: string,
|
|
47
|
+
UF_SKILLS: string,
|
|
48
|
+
UF_WEB_SITES: string,
|
|
49
|
+
UF_XING: string,
|
|
50
|
+
UF_LINKEDIN: string,
|
|
51
|
+
UF_FACEBOOK: string,
|
|
52
|
+
UF_TWITTER: string,
|
|
53
|
+
UF_SKYPE: string,
|
|
54
|
+
UF_DISTRICT: string,
|
|
55
|
+
UF_PHONE_INNER: string,
|
|
56
|
+
[keys: string]: any // Поля каcтомные поля для приложений
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type iAllBXGender = 'M' | 'F' | '' // wtf BX? Where is others 48 gender?
|
|
60
|
+
|
|
61
|
+
export type iBXRestUserKey = keyof iBXRestUser
|
|
62
|
+
|
|
63
|
+
export type MapKeyBx<Type> = {
|
|
64
|
+
[Property in keyof Type]: string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface iBXRestUserHttpField extends MapKeyBx<iBXRestUserBase>{
|
|
68
|
+
}
|