@up-im/medotvet_sdk 0.0.14 → 0.0.16

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.
@@ -20,7 +20,10 @@ class ApiAbstract {
20
20
  }
21
21
  else if (Array.isArray(postBody[key])) {
22
22
  for (const value of postBody[key]) {
23
- if (value !== null && typeof value == "object") {
23
+ if (typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
24
+ formData.append(key + '[]', value);
25
+ }
26
+ else if (value !== null && typeof value == "object") {
24
27
  formData.append(key + '[]', JSON.stringify(value));
25
28
  }
26
29
  else {
@@ -174,7 +174,7 @@ class ApiContent extends abstract_1.ApiAbstract {
174
174
  route: (0, apiRoute_1.apiRouteList)({
175
175
  nodeCode: "workplace_type",
176
176
  select: ["id", "title"],
177
- sorters: ["sorter asc", "title asc"],
177
+ sorters: ["title asc"],
178
178
  perPage: 20,
179
179
  filters,
180
180
  page
@@ -61,10 +61,10 @@ export declare class ApiUser extends ApiAbstract {
61
61
  getMyReferer(): Promise<string | null>;
62
62
  /**
63
63
  * Загрузить файлы диплома
64
- * @param data - объект с FileList (ключ diploma)
64
+ * @param data - объект с FileList или File[] (ключ diploma)
65
65
  */
66
66
  uploadDiploma(data: {
67
- diploma: FileList;
67
+ diploma: FileList | File[];
68
68
  }): Promise<{
69
69
  success: boolean;
70
70
  diploma_files: string[];
package/dist/api/user.js CHANGED
@@ -140,7 +140,7 @@ class ApiUser extends abstract_1.ApiAbstract {
140
140
  // =====================================================
141
141
  /**
142
142
  * Загрузить файлы диплома
143
- * @param data - объект с FileList (ключ diploma)
143
+ * @param data - объект с FileList или File[] (ключ diploma)
144
144
  */
145
145
  async uploadDiploma(data) {
146
146
  if (!await this.userStorage.isAuth())
@@ -27,7 +27,10 @@ export interface iUser {
27
27
  birthdate: string | null;
28
28
  workplace_type: number | null;
29
29
  workplace_name: string | null;
30
- diploma_status: DiplomaStatusValue;
30
+ diploma_status: {
31
+ id: DiplomaStatusValue;
32
+ title: string;
33
+ } | null;
31
34
  diploma_files: string[] | null;
32
35
  diploma_reject_reason: string | null;
33
36
  test_status: number | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@up-im/medotvet_sdk",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -43,7 +43,9 @@ export class ApiAbstract {
43
43
  }
44
44
  } else if (Array.isArray(postBody[key])) {
45
45
  for (const value of postBody[key]) {
46
- if (value !== null && typeof value == "object") {
46
+ if (typeof File !== "undefined" && value instanceof File || typeof Blob !== "undefined" && value instanceof Blob) {
47
+ formData.append(key + '[]', value);
48
+ } else if (value !== null && typeof value == "object") {
47
49
  formData.append(key + '[]', JSON.stringify(value));
48
50
  } else {
49
51
  formData.append(key + '[]', value);
@@ -193,7 +193,7 @@ export class ApiContent extends ApiAbstract {
193
193
  route: apiRouteList({
194
194
  nodeCode: "workplace_type",
195
195
  select: ["id", "title"],
196
- sorters: ["sorter asc", "title asc"],
196
+ sorters: ["title asc"],
197
197
  perPage: 20,
198
198
  filters,
199
199
  page
package/src/api/user.ts CHANGED
@@ -143,9 +143,9 @@ export class ApiUser extends ApiAbstract {
143
143
 
144
144
  /**
145
145
  * Загрузить файлы диплома
146
- * @param data - объект с FileList (ключ diploma)
146
+ * @param data - объект с FileList или File[] (ключ diploma)
147
147
  */
148
- async uploadDiploma(data: { diploma: FileList }) {
148
+ async uploadDiploma(data: { diploma: FileList | File[] }) {
149
149
  if (!await this.userStorage.isAuth()) throw new ApiError(401, "Пользователь не авторизован")
150
150
  return await this.fetcher<{
151
151
  success: boolean,
@@ -29,7 +29,7 @@ export interface iUser {
29
29
  birthdate: string | null // дата рождения (Medotvet)
30
30
  workplace_type: number | null // тип учреждения (ID) (Medotvet)
31
31
  workplace_name: string | null // название учреждения (Medotvet)
32
- diploma_status: DiplomaStatusValue // 0-не загружен, 1-на проверке, 2-подтвержден, 3-отклонен (Medotvet)
32
+ diploma_status: { id: DiplomaStatusValue, title: string } | null // 1-не загружен, 2-на проверке, 3-верифицирован, 4-отклонен (Medotvet)
33
33
  diploma_files: string[] | null // массив путей к файлам диплома (Medotvet)
34
34
  diploma_reject_reason: string | null // причина отклонения диплома (Medotvet)
35
35
  test_status: number | null // 0-не пройден, 1-пройден (Medotvet)