From 93f4f8c9950c270a983eb0f04ebad7202dc7702e Mon Sep 17 00:00:00 2001 From: Sajed Date: Thu, 4 Aug 2022 13:00:07 +0200 Subject: [PATCH 1/4] Update predefined item model to include the ids of all groups in which the current item is included | [Product page] CRM-19576 --- swagger.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/swagger.yaml b/swagger.yaml index ea084f3..8c8a02e 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -9660,9 +9660,20 @@ components: item_group_id: type: string format: bson-id - description: ID of the predefined item group (or empty if the item is not in a group) + deprecated: true + description: ID of the first predefined item group in which the current item is included (or empty if the item is not in a group) readOnly: true example: 5c9a53599007ba58f13c8119 + item_group_ids: + type: array + description: List of IDs of the predefined item groups in which the current item is included + readOnly: true + items: + type: string + format: bson-id + example: + - 5c79510e9007ba3f7519e819 + - 5c9a53349007ba58f13c8118 Deal_item: description: >- A user-configured item representing a product or service, which can be used to standardize deal creation From 264864264bb736dc27777df91664d45710b4f541 Mon Sep 17 00:00:00 2001 From: Sajed Date: Fri, 12 Aug 2022 20:49:03 +0200 Subject: [PATCH 2/4] Update predefined items and group | [Product page] CRM-19576 --- swagger.yaml | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/swagger.yaml b/swagger.yaml index 8c8a02e..57fbc5f 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -1755,7 +1755,17 @@ paths: description: tags: - Predefined Items - parameters: [] + parameters: + - $ref: '#/components/parameters/query_predefined_items_search' + - $ref: '#/components/parameters/query_date_filter' + - $ref: '#/components/parameters/query_since' + - $ref: '#/components/parameters/query_until' + - $ref: '#/components/parameters/query_modified_since' + - $ref: '#/components/parameters/query_unmodified_since' + - $ref: '#/components/parameters/query_sort_by' + - $ref: '#/components/parameters/query_order' + - $ref: '#/components/parameters/query_page' + - $ref: '#/components/parameters/query_per_page' responses: 200: description: OK @@ -1973,7 +1983,17 @@ paths: description: tags: - Predefined Item Groups - parameters: [] + parameters: + - $ref: '#/components/parameters/query_predefined_items_search' + - $ref: '#/components/parameters/query_date_filter' + - $ref: '#/components/parameters/query_since' + - $ref: '#/components/parameters/query_until' + - $ref: '#/components/parameters/query_modified_since' + - $ref: '#/components/parameters/query_unmodified_since' + - $ref: '#/components/parameters/query_sort_by' + - $ref: '#/components/parameters/query_order' + - $ref: '#/components/parameters/query_page' + - $ref: '#/components/parameters/query_per_page' responses: 200: description: OK @@ -2023,6 +2043,10 @@ paths: type: string description: Name of the predefined item group example: Electronics + description: + type: string + description: Description of the predefined item group + example: Electronics devices deal_items: type: array description: List of IDs of the predefined/deal items in the predefined item group @@ -10795,6 +10819,14 @@ components: schema: type: string example: Jack Aranda + query_predefined_items_search: + name: search + in: query + required: false + description: Search by name + schema: + type: string + example: Partner query_contacts_owner_id: name: owner_id in: query From 9a24563a7da300059f9e0e6788d2aa420f99cc02 Mon Sep 17 00:00:00 2001 From: Sajed Date: Tue, 8 Nov 2022 17:33:32 +0200 Subject: [PATCH 3/4] Update products API with the new performance improvements and serialization models | [Product page] CRM-19576 --- swagger.yaml | 140 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 128 insertions(+), 12 deletions(-) diff --git a/swagger.yaml b/swagger.yaml index 57fbc5f..a9e02cb 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -1799,6 +1799,57 @@ paths: $ref: '#/components/responses/409' 500: $ref: '#/components/responses/500' + /predefined_items/with_groups: + get: + summary: Get the list of predefined groups and items (for the logged API user's account) + description: '' + tags: + - Predefined Items + parameters: + - $ref: '#/components/parameters/query_predefined_item_groups_include_items' + - $ref: '#/components/parameters/query_predefined_items_search' + - $ref: '#/components/parameters/query_date_filter' + - $ref: '#/components/parameters/query_since' + - $ref: '#/components/parameters/query_until' + - $ref: '#/components/parameters/query_modified_since' + - $ref: '#/components/parameters/query_unmodified_since' + - $ref: '#/components/parameters/query_sort_by' + - $ref: '#/components/parameters/query_order' + - $ref: '#/components/parameters/query_page' + - $ref: '#/components/parameters/query_per_page' + responses: + 200: + description: OK + content: + application/json: + schema: + properties: + status: + $ref: '#/components/schemas/Success/properties/status' + message: + $ref: '#/components/schemas/Success/properties/message' + timestamp: + $ref: '#/components/schemas/Success/properties/timestamp' + data: + properties: + predefined_items_with_groups: + type: array + items: + properties: + predefined_item_group: + $ref: '#/components/schemas/Predefined_item_group' + 400: + $ref: '#/components/responses/400' + 401: + $ref: '#/components/responses/401' + 403: + $ref: '#/components/responses/403' + 404: + $ref: '#/components/responses/404' + 409: + $ref: '#/components/responses/409' + 500: + $ref: '#/components/responses/500' post: summary: Create a new predefined item description: @@ -1980,10 +2031,11 @@ paths: /predefined_item_groups: get: summary: Get the list of predefined item groups (for the logged API user's account) - description: + description: '' tags: - Predefined Item Groups parameters: + - $ref: '#/components/parameters/query_predefined_item_groups_include_items' - $ref: '#/components/parameters/query_predefined_items_search' - $ref: '#/components/parameters/query_date_filter' - $ref: '#/components/parameters/query_since' @@ -2029,7 +2081,7 @@ paths: $ref: '#/components/responses/500' post: summary: Create a new predefined item group - description: + description: '' tags: - Predefined Item Groups parameters: [] @@ -2047,9 +2099,19 @@ paths: type: string description: Description of the predefined item group example: Electronics devices + items_ids: + type: array + description: List of IDs of the predefined/deal items in the predefined item group + items: + type: string + format: bson-id + example: + - 5c79510e9007ba3f7519e819 + - 5c9a53349007ba58f13c8118 deal_items: type: array description: List of IDs of the predefined/deal items in the predefined item group + deprecated: true items: type: string format: bson-id @@ -2122,6 +2184,36 @@ paths: $ref: '#/components/responses/409' 500: $ref: '#/components/responses/500' + put: + summary: Update a specific predefined item group + description: + tags: + - Predefined Item Groups + parameters: + - $ref: '#/components/parameters/path_predefined_item_group_id' + requestBody: + required: true + content: + application/json: + schema: + properties: + name: + type: string + description: Name of the predefined item + example: Solar panels + description: + type: string + description: Description text of the predefined item + example: Photovoltaic solar panels (2019 model) + items_ids: + type: array + description: List of IDs of the predefined/deal items in the predefined item group + items: + type: string + format: bson-id + example: + - 5c79510e9007ba3f7519e819 + - 5c9a53349007ba58f13c8118 delete: summary: Delete a specific predefined item group description: @@ -9678,6 +9770,7 @@ components: position: type: integer format: int32 + deprecated: true description: Position of the predefined item in the items list readOnly: true example: 1 @@ -9688,16 +9781,6 @@ components: description: ID of the first predefined item group in which the current item is included (or empty if the item is not in a group) readOnly: true example: 5c9a53599007ba58f13c8119 - item_group_ids: - type: array - description: List of IDs of the predefined item groups in which the current item is included - readOnly: true - items: - type: string - format: bson-id - example: - - 5c79510e9007ba3f7519e819 - - 5c9a53349007ba58f13c8118 Deal_item: description: >- A user-configured item representing a product or service, which can be used to standardize deal creation @@ -9786,21 +9869,46 @@ components: type: string description: Name of the predefined item group example: Electronics + description: + type: string + description: Description text of the deal item + example: Photovoltaic solar panels (2019 model) position: type: integer format: int32 + deprecated: true description: Position of the group in the list of predefined item groups readOnly: true example: 1 count: type: integer format: int32 + deprecated: true description: Number of predefined items in the predefined item group readOnly: true example: 2 + subcount: + type: integer + format: int32 + description: Number of predefined items in the predefined item group + readOnly: true + example: 2 + cost: + type: number + format: float + readOnly: true + description: Cost of the predefined item + example: 95.00 + price: + type: number + format: float + readOnly: true + description: Price of the predefined item + example: 149.99 item_ids: type: array description: List of IDs of the predefined/deal items in the predefined item group + deprecated: true readOnly: true items: type: string @@ -10827,6 +10935,14 @@ components: schema: type: string example: Partner + query_predefined_item_groups_include_items: + name: include_items + in: query + required: false + description: Determine whether to include the group items in the response or not + schema: + type: boolean + example: false query_contacts_owner_id: name: owner_id in: query From b180cc27f3c841fb44a6a575cf965c2c93bb31c9 Mon Sep 17 00:00:00 2001 From: Sajed Date: Tue, 22 Nov 2022 21:57:44 +0200 Subject: [PATCH 4/4] Serialize products collection from index endpoints directly into the parent array | [Product page] CRM-19576 --- swagger.yaml | 139 +++++++++++++++++++++++++++++---------------------- 1 file changed, 79 insertions(+), 60 deletions(-) diff --git a/swagger.yaml b/swagger.yaml index a9e02cb..c3f5501 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -1784,60 +1784,7 @@ paths: predefined_items: type: array items: - properties: - predefined_item: - $ref: '#/components/schemas/Predefined_item' - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 403: - $ref: '#/components/responses/403' - 404: - $ref: '#/components/responses/404' - 409: - $ref: '#/components/responses/409' - 500: - $ref: '#/components/responses/500' - /predefined_items/with_groups: - get: - summary: Get the list of predefined groups and items (for the logged API user's account) - description: '' - tags: - - Predefined Items - parameters: - - $ref: '#/components/parameters/query_predefined_item_groups_include_items' - - $ref: '#/components/parameters/query_predefined_items_search' - - $ref: '#/components/parameters/query_date_filter' - - $ref: '#/components/parameters/query_since' - - $ref: '#/components/parameters/query_until' - - $ref: '#/components/parameters/query_modified_since' - - $ref: '#/components/parameters/query_unmodified_since' - - $ref: '#/components/parameters/query_sort_by' - - $ref: '#/components/parameters/query_order' - - $ref: '#/components/parameters/query_page' - - $ref: '#/components/parameters/query_per_page' - responses: - 200: - description: OK - content: - application/json: - schema: - properties: - status: - $ref: '#/components/schemas/Success/properties/status' - message: - $ref: '#/components/schemas/Success/properties/message' - timestamp: - $ref: '#/components/schemas/Success/properties/timestamp' - data: - properties: - predefined_items_with_groups: - type: array - items: - properties: - predefined_item_group: - $ref: '#/components/schemas/Predefined_item_group' + $ref: '#/components/schemas/Predefined_item' 400: $ref: '#/components/responses/400' 401: @@ -1909,6 +1856,55 @@ paths: $ref: '#/components/responses/409' 500: $ref: '#/components/responses/500' + /predefined_items/with_groups: + get: + summary: Get the list of predefined groups and items (for the logged API user's account) + description: '' + tags: + - Predefined Items + parameters: + - $ref: '#/components/parameters/query_predefined_item_groups_include_items' + - $ref: '#/components/parameters/query_predefined_items_search' + - $ref: '#/components/parameters/query_date_filter' + - $ref: '#/components/parameters/query_since' + - $ref: '#/components/parameters/query_until' + - $ref: '#/components/parameters/query_modified_since' + - $ref: '#/components/parameters/query_unmodified_since' + - $ref: '#/components/parameters/query_sort_by' + - $ref: '#/components/parameters/query_order' + - $ref: '#/components/parameters/query_page' + - $ref: '#/components/parameters/query_per_page' + responses: + 200: + description: OK + content: + application/json: + schema: + properties: + status: + $ref: '#/components/schemas/Success/properties/status' + message: + $ref: '#/components/schemas/Success/properties/message' + timestamp: + $ref: '#/components/schemas/Success/properties/timestamp' + data: + properties: + predefined_items_with_groups: + type: array + items: + $ref: '#/components/schemas/Predefined_item_group' + 400: + $ref: '#/components/responses/400' + 401: + $ref: '#/components/responses/401' + 403: + $ref: '#/components/responses/403' + 404: + $ref: '#/components/responses/404' + 409: + $ref: '#/components/responses/409' + 500: + $ref: '#/components/responses/500' /predefined_items/{predefined_item_id}: get: summary: Get a specific predefined item @@ -1992,8 +1988,8 @@ paths: $ref: '#/components/schemas/Success/properties/timestamp' data: properties: - predefined_action: - $ref: '#/components/schemas/Predefined_action' + predefined_item: + $ref: '#/components/schemas/Predefined_item' 400: $ref: '#/components/responses/400' 401: @@ -2064,9 +2060,7 @@ paths: predefined_item_groups: type: array items: - properties: - predefined_item_group: - $ref: '#/components/schemas/Predefined_item_group' + $ref: '#/components/schemas/Predefined_item_group' 400: $ref: '#/components/responses/400' 401: @@ -2133,7 +2127,7 @@ paths: $ref: '#/components/schemas/Success/properties/timestamp' data: properties: - predefined_item: + predefined_item_group: $ref: '#/components/schemas/Predefined_item_group' 400: $ref: '#/components/responses/400' @@ -2214,6 +2208,23 @@ paths: example: - 5c79510e9007ba3f7519e819 - 5c9a53349007ba58f13c8118 + responses: + 200: + description: OK + content: + application/json: + schema: + properties: + status: + $ref: '#/components/schemas/Success/properties/status' + message: + $ref: '#/components/schemas/Success/properties/message' + timestamp: + $ref: '#/components/schemas/Success/properties/timestamp' + data: + properties: + predefined_item_group: + $ref: '#/components/schemas/Predefined_item_group' delete: summary: Delete a specific predefined item group description: @@ -9757,6 +9768,10 @@ components: type: string description: Description text of the predefined item example: Photovoltaic solar panels (2019 model) + type: + type: string + description: Type of the entry (item ot subitem) + example: item cost: type: number format: float @@ -9873,6 +9888,10 @@ components: type: string description: Description text of the deal item example: Photovoltaic solar panels (2019 model) + type: + type: string + description: Type of the entry + example: group position: type: integer format: int32