@escapenavigator/services 1.4.15 → 1.4.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.
@@ -0,0 +1,6 @@
1
+ import { AgregatorPostCardRO } from '@escapenavigator/types/dist/agregator/agregator-post-card.ro';
2
+ import { ApiMethodDeclaration } from '..';
3
+ declare type ParamsData = undefined;
4
+ declare type ResponseData = AgregatorPostCardRO[];
5
+ export declare const findAllPosts: ApiMethodDeclaration<ParamsData, ResponseData>;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findAllPosts = void 0;
4
+ var findAllPosts = function () { return ({
5
+ url: '/agregator/posts',
6
+ method: 'GET',
7
+ }); };
8
+ exports.findAllPosts = findAllPosts;
@@ -0,0 +1,6 @@
1
+ import { AgregatorPostCardRO } from '@escapenavigator/types/dist/agregator/agregator-post-card.ro';
2
+ import { ApiMethodDeclaration } from '..';
3
+ declare type ParamsData = undefined;
4
+ declare type ResponseData = AgregatorPostCardRO[];
5
+ export declare const findPopularPosts: ApiMethodDeclaration<ParamsData, ResponseData>;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findPopularPosts = void 0;
4
+ var findPopularPosts = function () { return ({
5
+ url: '/agregator/popular-posts',
6
+ method: 'GET',
7
+ }); };
8
+ exports.findPopularPosts = findPopularPosts;
@@ -0,0 +1,7 @@
1
+ import { AgregatorPostBySlugDTO } from '@escapenavigator/types/dist/agregator/dto/agregator-post-by-slug.dto';
2
+ import { AgregatorPostCardRO } from '@escapenavigator/types/dist/agregator/agregator-post-card.ro';
3
+ import { ApiMethodDeclaration } from '..';
4
+ declare type ParamsData = AgregatorPostBySlugDTO;
5
+ declare type ResponseData = AgregatorPostCardRO[];
6
+ export declare const findPostBySlug: ApiMethodDeclaration<ParamsData, ResponseData>;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findPostBySlug = void 0;
4
+ var findPostBySlug = function (params) { return ({
5
+ url: '/agregator/posts/slug/',
6
+ method: 'GET',
7
+ params: params
8
+ }); };
9
+ exports.findPostBySlug = findPostBySlug;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findQuestroomBySlug = void 0;
4
- var findQuestroomBySlug = function (query) { return ({
4
+ var findQuestroomBySlug = function (params) { return ({
5
5
  url: '/agregator/questroom/slug/',
6
6
  method: 'GET',
7
- query: query
7
+ params: params
8
8
  }); };
9
9
  exports.findQuestroomBySlug = findQuestroomBySlug;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findQuestroomsByOrganizationId = void 0;
4
- var findQuestroomsByOrganizationId = function (organizationId) { return ({
5
- url: '/agregator/questrooms/organization/' + organizationId,
4
+ var findQuestroomsByOrganizationId = function (organizationSlug) { return ({
5
+ url: '/agregator/questrooms/organization/' + organizationSlug,
6
6
  method: 'GET'
7
7
  }); };
8
8
  exports.findQuestroomsByOrganizationId = findQuestroomsByOrganizationId;
@@ -1,3 +1,6 @@
1
+ import { findPostBySlug } from './find-post-by-slug';
2
+ import { findPopularPosts } from './find-popular-posts';
3
+ import { findAllPosts } from './find-all-posts';
1
4
  import { findCitiesByCountry } from './find-cities-by-country';
2
5
  import { findCityBySlug } from './find-city-by-slug';
3
6
  import { findCurrentCity } from './find-current-city';
@@ -23,6 +26,9 @@ declare type ApiDeclaration = {
23
26
  findQuestroomsByTags: typeof findQuestroomsByTags;
24
27
  findQuestroomsByTitle: typeof findQuestroomsByTitle;
25
28
  findSimilaQuestroomsNear: typeof findSimilaQuestroomsNear;
29
+ findAllPosts: typeof findAllPosts;
30
+ findPopularPosts: typeof findPopularPosts;
31
+ findPostBySlug: typeof findPostBySlug;
26
32
  };
27
33
  export declare const agregatorApiDeclaration: ApiDeclaration;
28
34
  export {};
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.agregatorApiDeclaration = void 0;
4
+ var find_post_by_slug_1 = require("./find-post-by-slug");
5
+ var find_popular_posts_1 = require("./find-popular-posts");
6
+ var find_all_posts_1 = require("./find-all-posts");
4
7
  var find_cities_by_country_1 = require("./find-cities-by-country");
5
8
  var find_city_by_slug_1 = require("./find-city-by-slug");
6
9
  var find_current_city_1 = require("./find-current-city");
@@ -26,4 +29,7 @@ exports.agregatorApiDeclaration = {
26
29
  findQuestroomsByTags: find_questrooms_by_tags_1.findQuestroomsByTags,
27
30
  findQuestroomsByTitle: find_questrooms_by_title_1.findQuestroomsByTitle,
28
31
  findSimilaQuestroomsNear: find_similar_questrooms_near_1.findSimilaQuestroomsNear,
32
+ findAllPosts: find_all_posts_1.findAllPosts,
33
+ findPopularPosts: find_popular_posts_1.findPopularPosts,
34
+ findPostBySlug: find_post_by_slug_1.findPostBySlug,
29
35
  };
@@ -0,0 +1,9 @@
1
+ import { ArticleResponseObject } from '@escapenavigator/types/dist/article/article.ro';
2
+ import { CreateArticleDto } from '@escapenavigator/types/dist/article/create-article.dto';
3
+ import { ApiMethodDeclaration } from '..';
4
+ declare type ParamsData = {
5
+ data: CreateArticleDto;
6
+ };
7
+ declare type ResponseData = ArticleResponseObject;
8
+ export declare const create: ApiMethodDeclaration<ParamsData, ResponseData>;
9
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.create = void 0;
4
+ var create = function (_a) {
5
+ var data = _a.data;
6
+ return ({
7
+ url: '/articles',
8
+ method: 'POST',
9
+ data: data,
10
+ });
11
+ };
12
+ exports.create = create;
@@ -0,0 +1,7 @@
1
+ import { ArticleResponseObject } from '@escapenavigator/types/dist/article/article.ro';
2
+ import { ApiMethodDeclaration } from '..';
3
+ /** ID статьи */
4
+ declare type ParamsData = number;
5
+ declare type ResponseData = ArticleResponseObject;
6
+ export declare const getOne: ApiMethodDeclaration<ParamsData, ResponseData>;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOne = void 0;
4
+ var getOne = function (id) { return ({
5
+ url: "/articles/".concat(id),
6
+ method: 'GET',
7
+ }); };
8
+ exports.getOne = getOne;
@@ -0,0 +1,14 @@
1
+ import { create } from './create';
2
+ import { getOne } from './get-one';
3
+ import { query } from './query';
4
+ import { remove } from './remove';
5
+ import { update } from './update';
6
+ declare type ApiDeclaration = {
7
+ create: typeof create;
8
+ remove: typeof remove;
9
+ update: typeof update;
10
+ query: typeof query;
11
+ getOne: typeof getOne;
12
+ };
13
+ export declare const articlesApiDeclaration: ApiDeclaration;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.articlesApiDeclaration = void 0;
4
+ var create_1 = require("./create");
5
+ var get_one_1 = require("./get-one");
6
+ var query_1 = require("./query");
7
+ var remove_1 = require("./remove");
8
+ var update_1 = require("./update");
9
+ exports.articlesApiDeclaration = {
10
+ create: create_1.create,
11
+ remove: remove_1.remove,
12
+ update: update_1.update,
13
+ query: query_1.query,
14
+ getOne: get_one_1.getOne,
15
+ };
@@ -0,0 +1,8 @@
1
+ import { ArticleResponseObject } from '@escapenavigator/types/dist/article/article.ro';
2
+ import { QueryDto } from '@escapenavigator/types/dist/shared/query.dto';
3
+ import { ApiMethodDeclaration } from '..';
4
+ /** SearchText - поиск по названию статьи */
5
+ declare type ParamsData = QueryDto;
6
+ declare type ResponseData = ArticleResponseObject[];
7
+ export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.query = void 0;
4
+ var query = function (params) { return ({
5
+ url: '/articles',
6
+ method: 'GET',
7
+ params: params,
8
+ }); };
9
+ exports.query = query;
@@ -0,0 +1,7 @@
1
+ import { ArticleResponseObject } from '@escapenavigator/types/dist/article/article.ro';
2
+ import { ApiMethodDeclaration } from '..';
3
+ /** ID поста */
4
+ declare type ParamsData = number;
5
+ declare type ResponseData = ArticleResponseObject;
6
+ export declare const remove: ApiMethodDeclaration<ParamsData, ResponseData>;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remove = void 0;
4
+ var remove = function (id) { return ({
5
+ url: "/articles/".concat(id),
6
+ method: 'DELETE',
7
+ }); };
8
+ exports.remove = remove;
@@ -0,0 +1,10 @@
1
+ import { ArticleResponseObject } from '@escapenavigator/types/dist/article/article.ro';
2
+ import { UpdateArticleDto } from '@escapenavigator/types/dist/article/update-article.dto';
3
+ import { ApiMethodDeclaration } from '..';
4
+ declare type ParamsData = {
5
+ id: number;
6
+ data: UpdateArticleDto;
7
+ };
8
+ declare type ResponseData = ArticleResponseObject;
9
+ export declare const update: ApiMethodDeclaration<ParamsData, ResponseData>;
10
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.update = void 0;
4
+ var update = function (_a) {
5
+ var id = _a.id, data = _a.data;
6
+ return ({
7
+ url: "/articles/".concat(id),
8
+ method: 'PATCH',
9
+ data: data,
10
+ });
11
+ };
12
+ exports.update = update;
@@ -31,6 +31,7 @@ import { widgetsOpenApiDeclaration } from './widgets-openapi';
31
31
  import { citiesApiDeclaration } from './cities-api';
32
32
  import { agregatorApiDeclaration } from './agregator-api';
33
33
  import { Api } from '.';
34
+ import { articlesApiDeclaration } from './articles-api';
34
35
  export declare type InitApiDeclaration = {
35
36
  cities: Api<typeof citiesApiDeclaration>;
36
37
  agregator: Api<typeof agregatorApiDeclaration>;
@@ -64,5 +65,6 @@ export declare type InitApiDeclaration = {
64
65
  certificatesales: Api<typeof certificateSalesApiDeclaration>;
65
66
  support: Api<typeof supportApiDeclaration>;
66
67
  registrationRequests: Api<typeof registrationRequestsApiDeclaration>;
68
+ articles: Api<typeof articlesApiDeclaration>;
67
69
  };
68
70
  export declare const initClientApi: (url: string) => InitApiDeclaration;
@@ -34,6 +34,7 @@ var widgets_openapi_1 = require("./widgets-openapi");
34
34
  var cities_api_1 = require("./cities-api");
35
35
  var agregator_api_1 = require("./agregator-api");
36
36
  var _1 = require(".");
37
+ var articles_api_1 = require("./articles-api");
37
38
  var initClientApi = function (url) {
38
39
  return {
39
40
  cities: (0, _1.initApi)(cities_api_1.citiesApiDeclaration, url),
@@ -68,6 +69,7 @@ var initClientApi = function (url) {
68
69
  certificatesales: (0, _1.initApi)(certificatesales_api_1.certificateSalesApiDeclaration, url),
69
70
  support: (0, _1.initApi)(support_1.supportApiDeclaration, url),
70
71
  registrationRequests: (0, _1.initApi)(registration_requests_api_1.registrationRequestsApiDeclaration, url),
72
+ articles: (0, _1.initApi)(articles_api_1.articlesApiDeclaration, url),
71
73
  };
72
74
  };
73
75
  exports.initClientApi = initClientApi;
@@ -5,7 +5,7 @@ export declare type OptionsType<T> = Array<{
5
5
  declare type ConvertToOptions = <T extends {
6
6
  id: string | number;
7
7
  [field: string]: any;
8
- }>(data: T[], field?: string) => Array<{
8
+ }>(data: T[]) => Array<{
9
9
  key: T['id'];
10
10
  content: any;
11
11
  }>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToOptions = void 0;
4
- var convertToOptions = function (data, field) { return data.map(function (item) { return ({
4
+ var convertToOptions = function (data) { return data.map(function (item) { return ({
5
5
  key: item.id,
6
- content: (field && item[field]) || item.title || item.surname ? "".concat(item.name, " ").concat(item.surname) : item.name,
6
+ content: item.title || item.surname ? "".concat(item.name, " ").concat(item.surname) : item.name,
7
7
  }); }); };
8
8
  exports.convertToOptions = convertToOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@escapenavigator/services",
3
- "version": "1.4.15",
3
+ "version": "1.4.16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,9 +12,9 @@
12
12
  "scripts": {
13
13
  "build": "rm -rf dist && tsc --project tsconfig.json"
14
14
  },
15
- "gitHead": "bb7599aeb8c073e6591d25967173163182ad3e82",
15
+ "gitHead": "51739bc10f224d63b4440d62c6e5e1e48aa77ede",
16
16
  "dependencies": {
17
- "@escapenavigator/types": "^1.4.15",
17
+ "@escapenavigator/types": "^1.4.16",
18
18
  "axios": "^0.21.4",
19
19
  "class-transformer": "^0.5.1",
20
20
  "class-validator": "^0.13.1",