From c13d4555e2720e811927a8b34deefb138d1e1246 Mon Sep 17 00:00:00 2001 From: Steve Ives Date: Fri, 20 Dec 2019 13:09:10 -0800 Subject: [PATCH] Adding additional documentation related arttributes to endpoints in controllers. --- PostManTests.postman_collection.json | 286 +++++++++--------- .../CustomerNotesController.dbl | 42 ++- Services.Controllers/CustomersController.dbl | 97 ++++-- Services.Controllers/ItemsController.dbl | 134 ++++++-- Services.Controllers/OrderItemsController.dbl | 69 ++++- Services.Controllers/OrdersController.dbl | 73 ++++- .../Services.Controllers.synproj | 6 + Services.Controllers/VendorsController.dbl | 85 ++++-- Services.Models/CustomerMetaData.dbl | 8 +- Services.Models/CustomerNoteMetaData.dbl | 2 +- Services.Models/ItemMetaData.dbl | 10 +- Services.Models/OrderItemMetaData.dbl | 10 +- Services.Models/OrderMetaData.dbl | 8 +- Services.Models/VendorMetaData.dbl | 8 +- Services.Test/UnitTests/CustomerTests.dbl | 42 +-- Services/Startup.dbl | 20 +- Templates/HarmonyCoreCustomization.tpl | 26 ++ Templates/ODataController.tpl | 70 ++++- Templates/ODataMetaData.tpl | 6 +- Templates/ODataStartup.tpl | 20 +- 20 files changed, 710 insertions(+), 312 deletions(-) create mode 100644 Templates/HarmonyCoreCustomization.tpl diff --git a/PostManTests.postman_collection.json b/PostManTests.postman_collection.json index e857a99f..53f4a1d3 100644 --- a/PostManTests.postman_collection.json +++ b/PostManTests.postman_collection.json @@ -1,16 +1,16 @@ { "info": { - "_postman_id": "dfe00c34-df7c-456c-b5e7-53541069b0a1", + "_postman_id": "722e3a72-2087-4809-bb2a-7fc49825a59b", "name": "Harmony Core Sample API", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { - "_postman_id": "0a94e660-63d6-4a78-aed9-83ee3e715347", + "_postman_id": "8abd5f36-1a2b-4c67-b0ae-72330ef15c4e", "name": "Customer Tests", "item": [ { - "_postman_id": "1d19723a-40e5-456d-8d6b-f30af1b9ebac", + "_postman_id": "cecf81eb-5de7-4f30-8ebd-4b2537f713b5", "name": "Read customers", "request": { "method": "GET", @@ -38,7 +38,7 @@ } , { - "_postman_id": "85704387-02a1-45ae-a171-23e831baee20", + "_postman_id": "6bdc6755-5323-4f40-91da-cd46e3f4db53", "name": "Count customers", "request": { "method": "GET", @@ -67,7 +67,7 @@ } , { - "_postman_id": "7308d869-36a5-481a-914e-16659024295c", + "_postman_id": "37904712-4585-4974-b646-f3a6dd37708f", "name": "Read customer", "request": { "method": "GET", @@ -95,7 +95,7 @@ } , { - "_postman_id": "298adb47-423b-4d65-ac49-2fbad95dbee7", + "_postman_id": "4314a2b1-6a5e-49a3-9a3b-e35a1cb66d1e", "name": "Read customers by State", "request": { "method": "GET", @@ -123,7 +123,7 @@ } , { - "_postman_id": "fe687f62-eecc-4ced-b1f7-a65b80086d14", + "_postman_id": "5386a591-b77c-4de6-b843-6adeabb27f6f", "name": "Count customers by State", "request": { "method": "GET", @@ -152,7 +152,7 @@ } , { - "_postman_id": "69287b29-7fca-4a45-a64b-9162d637fe12", + "_postman_id": "e3f5fbd4-5e1b-4c70-99a7-3142459ba4a7", "name": "Read customers by Zip", "request": { "method": "GET", @@ -180,7 +180,7 @@ } , { - "_postman_id": "4800e0cb-fa0a-4708-8e2a-6f52bb35f1e8", + "_postman_id": "b7123cd6-bec0-4c04-9b99-bfdea8e9a3ad", "name": "Count customers by Zip", "request": { "method": "GET", @@ -209,7 +209,7 @@ } , { - "_postman_id": "79fc9fcf-4c14-4469-910e-0e6aa1cbb2b4", + "_postman_id": "140c090f-f79a-4e91-8fda-427d865191a4", "name": "Read customers by PaymentTerms", "request": { "method": "GET", @@ -237,7 +237,7 @@ } , { - "_postman_id": "49a1f1f4-f230-4e40-9ee0-40e7b8aa4c49", + "_postman_id": "9da84c85-e1ed-4576-9d87-a897299ee5ab", "name": "Count customers by PaymentTerms", "request": { "method": "GET", @@ -266,7 +266,7 @@ } , { - "_postman_id": "27adfc8b-2cc5-45cf-a809-f259368f858c", + "_postman_id": "9c80e4b5-e957-4550-a437-f74279fdbcd0", "name": "Read customer name", "request": { "method": "GET", @@ -294,7 +294,7 @@ } , { - "_postman_id": "1e6e1bc6-ddbd-4e74-bb66-1cf79b5bfc0c", + "_postman_id": "a7bc248f-3c33-47da-b074-e00b43e35949", "name": "Read customer street", "request": { "method": "GET", @@ -322,7 +322,7 @@ } , { - "_postman_id": "d5b0ef6f-4e62-4e5e-9395-b922f7193c57", + "_postman_id": "93b3b45b-4f34-492c-a924-4196ef361ac6", "name": "Read customer city", "request": { "method": "GET", @@ -350,7 +350,7 @@ } , { - "_postman_id": "5c49669a-c01d-46f5-bd78-7a41cf20554c", + "_postman_id": "5bd14ac5-b48f-4efc-bdd3-f0a51a7d8366", "name": "Read customer state", "request": { "method": "GET", @@ -378,7 +378,7 @@ } , { - "_postman_id": "14723c6d-4195-476f-9efb-0df6b5bda8c7", + "_postman_id": "bd00114d-6db0-4705-88b3-9f145067529d", "name": "Read customer zipCode", "request": { "method": "GET", @@ -406,7 +406,7 @@ } , { - "_postman_id": "85f89803-1577-497d-a0d6-c9e95fec44e3", + "_postman_id": "177db1ff-6c93-4dc9-aa12-058a7dc75804", "name": "Read customer contact", "request": { "method": "GET", @@ -434,7 +434,7 @@ } , { - "_postman_id": "47e63825-ef96-4f6a-a838-81e6cd96b027", + "_postman_id": "070045b6-335d-4b48-9fae-ac0651fd213d", "name": "Read customer phone", "request": { "method": "GET", @@ -462,7 +462,7 @@ } , { - "_postman_id": "6726d956-5f72-46e7-bd95-8febb1c232d9", + "_postman_id": "c7b2d6d7-202b-4623-9573-a24de892d517", "name": "Read customer fax", "request": { "method": "GET", @@ -490,7 +490,7 @@ } , { - "_postman_id": "953aefde-d3fd-4b56-ae3e-f844658e9cf9", + "_postman_id": "072358a0-621e-479c-9253-9941e2da6099", "name": "Read customer favoriteItem", "request": { "method": "GET", @@ -518,7 +518,7 @@ } , { - "_postman_id": "ba3bb2dc-512e-47be-bb89-3af27278ea08", + "_postman_id": "5c0a11d3-2da4-46e7-8fd4-09539135824a", "name": "Read customer paymentTermsCode", "request": { "method": "GET", @@ -546,7 +546,7 @@ } , { - "_postman_id": "b1a52620-1786-4184-a1aa-4b33a24a63c9", + "_postman_id": "9f887290-e71f-4b76-b500-a08175c1a7e4", "name": "Read customer taxId", "request": { "method": "GET", @@ -574,7 +574,7 @@ } , { - "_postman_id": "30be5bc2-edda-4cfa-9a4a-bb0e6cdb2884", + "_postman_id": "93fc2900-2d63-4ab0-adbe-2a124a074a0c", "name": "Read customer creditLimit", "request": { "method": "GET", @@ -602,7 +602,7 @@ } , { - "_postman_id": "92159d55-7df5-46c4-927a-fa4fb18d6e83", + "_postman_id": "3d5e62fc-66e1-4340-aefa-e02db0dd2368", "name": "Create customer (auto assign key)", "request": { "method": "POST", @@ -630,7 +630,7 @@ } , { - "_postman_id": "9ed04cb3-39d7-47ed-a4a1-a954004afff0", + "_postman_id": "24b53059-62af-47f1-bb9b-5f6906f8bf8d", "name": "Create or update customer", "request": { "method": "PUT", @@ -685,7 +685,7 @@ } , { - "_postman_id": "f6f5a9af-2566-4dc1-8006-9c9bce947b0e", + "_postman_id": "a87943bc-8cf3-41bd-9846-a57572771c35", "name": "Delete customer", "request": { "method": "DELETE", @@ -714,11 +714,11 @@ ] }, { - "_postman_id": "085683e8-deb9-4423-8819-991c282c3d63", + "_postman_id": "b6909bdc-3dba-4e1a-9ba6-666ce7b5850d", "name": "CustomerNote Tests", "item": [ { - "_postman_id": "61662799-ef1f-42e8-a755-64f4237bfbfa", + "_postman_id": "5dab2697-9c2d-4c5f-90f2-d0d091477bbe", "name": "Read customerNotes", "request": { "method": "GET", @@ -746,7 +746,7 @@ } , { - "_postman_id": "f27d9691-0661-478b-9c4a-785043fecef3", + "_postman_id": "97a20f9d-7d16-4134-9831-ef828c940336", "name": "Count customerNotes", "request": { "method": "GET", @@ -775,7 +775,7 @@ } , { - "_postman_id": "8b3fa126-4b56-44ba-91a4-65033d25af4d", + "_postman_id": "e518a699-960c-4d49-9e17-d5dfb8008388", "name": "Read customerNote", "request": { "method": "GET", @@ -803,7 +803,7 @@ } , { - "_postman_id": "004e0d26-bc33-43db-af24-ce3e1f64651d", + "_postman_id": "0941eb0d-3b2c-4a37-ae40-5acd1e1a276b", "name": "Read customerNote noteNumber", "request": { "method": "GET", @@ -831,7 +831,7 @@ } , { - "_postman_id": "dddf3730-d5ff-4fe2-9bac-fd44d2a1fd7c", + "_postman_id": "7a261633-a6b2-4ad8-b521-402055887bbd", "name": "Read customerNote noteText", "request": { "method": "GET", @@ -859,7 +859,7 @@ } , { - "_postman_id": "9e84fc11-0c64-4322-86ab-2b7745542733", + "_postman_id": "a182f016-e39f-48f1-8024-037384048098", "name": "Create customerNote (auto assign key)", "request": { "method": "POST", @@ -887,7 +887,7 @@ } , { - "_postman_id": "5357c2a0-9ccc-462c-a7ee-575224ddaeb3", + "_postman_id": "c18d157f-82b8-43db-8e35-f64924305faf", "name": "Create or update customerNote", "request": { "method": "PUT", @@ -942,7 +942,7 @@ } , { - "_postman_id": "3622c002-34d5-4774-a44b-35397328307d", + "_postman_id": "f63ffadc-2d70-4b38-afa1-a49a74eed1ea", "name": "Delete customerNote", "request": { "method": "DELETE", @@ -971,11 +971,11 @@ ] }, { - "_postman_id": "686bfe0c-efff-406e-abeb-2e829e0a46b2", + "_postman_id": "ccc5e2fa-5f5a-405d-9499-dda4e049a600", "name": "Item Tests", "item": [ { - "_postman_id": "c4115bd9-6081-454d-bed9-fa885956339f", + "_postman_id": "8e50aa41-b806-4615-bec6-c39f123be60b", "name": "Read items", "request": { "method": "GET", @@ -1003,7 +1003,7 @@ } , { - "_postman_id": "ac4b72cd-20ec-4e97-a669-ecd3fd0ea4b2", + "_postman_id": "7c707b5b-1bea-4d31-b3ec-34532203e52e", "name": "Count items", "request": { "method": "GET", @@ -1032,7 +1032,7 @@ } , { - "_postman_id": "ac0cba6f-8d65-4e34-b9dd-d34d3a01547c", + "_postman_id": "add02f29-925f-4bdb-abce-d9c5b07ab2fd", "name": "Read item", "request": { "method": "GET", @@ -1060,7 +1060,7 @@ } , { - "_postman_id": "3e44e37c-90eb-423a-93dd-8816df613874", + "_postman_id": "5dde2843-4a6d-4207-ba89-469f0679002d", "name": "Read items by VendorNumber", "request": { "method": "GET", @@ -1088,7 +1088,7 @@ } , { - "_postman_id": "8c3ae983-c32e-45a0-9636-25bd796a544c", + "_postman_id": "6d1a2bf4-e06f-4b07-8948-aba6b6085d1d", "name": "Count items by VendorNumber", "request": { "method": "GET", @@ -1117,7 +1117,7 @@ } , { - "_postman_id": "d66664ab-0629-4891-b8f0-c375caabc533", + "_postman_id": "cb9452f3-c6a9-4a94-ab79-fcc432d055f8", "name": "Read items by Color", "request": { "method": "GET", @@ -1145,7 +1145,7 @@ } , { - "_postman_id": "9d1bff03-a097-4645-aab4-34aefb1660cb", + "_postman_id": "b3ed225e-7bfc-4c59-99d1-c656989f760c", "name": "Count items by Color", "request": { "method": "GET", @@ -1174,7 +1174,7 @@ } , { - "_postman_id": "dff30772-0eda-4b48-9f8c-49eb53c4dc15", + "_postman_id": "983f22d0-f2f5-43a3-bd78-416579970a32", "name": "Read items by Size", "request": { "method": "GET", @@ -1202,7 +1202,7 @@ } , { - "_postman_id": "a6c0d2b3-47e7-452a-87c0-1d1e9c9a7829", + "_postman_id": "2b97df45-ed52-43f8-b268-50cab43d315b", "name": "Count items by Size", "request": { "method": "GET", @@ -1231,7 +1231,7 @@ } , { - "_postman_id": "a2241148-32b0-4c0a-9615-ab510322531a", + "_postman_id": "4e170f22-0b58-45f0-8c81-bc722f44d9ba", "name": "Read items by Name", "request": { "method": "GET", @@ -1259,7 +1259,7 @@ } , { - "_postman_id": "b50013d3-9fb9-4e08-a30e-1786204e51bc", + "_postman_id": "40ea4e0e-1e88-4d07-ae20-2ffd74e2f483", "name": "Count items by Name", "request": { "method": "GET", @@ -1288,7 +1288,7 @@ } , { - "_postman_id": "8461699b-fa76-48cb-9ab4-2fe31081bb98", + "_postman_id": "ed44e948-23ec-4fa2-b710-78aeaee77059", "name": "Read item vendorNumber", "request": { "method": "GET", @@ -1316,7 +1316,7 @@ } , { - "_postman_id": "2d5aaf8d-ac8c-42e3-8829-463f709609d3", + "_postman_id": "36cf85cc-89f8-45ab-bf52-c7ba48debd7e", "name": "Read item size", "request": { "method": "GET", @@ -1344,7 +1344,7 @@ } , { - "_postman_id": "ba69d821-2844-4961-b181-c38e56a19f6d", + "_postman_id": "8144de35-eba3-4aa5-91a9-5aa3aa4cddaf", "name": "Read item commonName", "request": { "method": "GET", @@ -1372,7 +1372,7 @@ } , { - "_postman_id": "c1ea479d-d0b3-467b-bd32-f4e970df8335", + "_postman_id": "3fdd7c4f-4f46-4b5b-a4d5-58b50c994834", "name": "Read item latinName", "request": { "method": "GET", @@ -1400,7 +1400,7 @@ } , { - "_postman_id": "e4301b60-6642-4920-9709-62406b0dbf9d", + "_postman_id": "e0861904-3770-4011-bda1-a30a99df55f4", "name": "Read item zoneCode", "request": { "method": "GET", @@ -1428,7 +1428,7 @@ } , { - "_postman_id": "f69f0339-bf5e-438c-b162-9eeb317ac5fa", + "_postman_id": "a1a89740-b039-4adc-85d1-7c2c708d3db5", "name": "Read item type", "request": { "method": "GET", @@ -1456,7 +1456,7 @@ } , { - "_postman_id": "22f5ad0d-1ebf-4cf6-99ca-edd8641025ea", + "_postman_id": "106f71c5-a7d1-4f89-8f1e-708b6fcd9096", "name": "Read item flowering", "request": { "method": "GET", @@ -1484,7 +1484,7 @@ } , { - "_postman_id": "167b0db3-bd99-447a-aa23-d8736169f629", + "_postman_id": "0aa2d3ca-40a2-4de3-a399-8748a01878da", "name": "Read item flowerColor", "request": { "method": "GET", @@ -1512,7 +1512,7 @@ } , { - "_postman_id": "6888b4a8-cc15-45ad-a90c-2cc3ee91fac7", + "_postman_id": "7fe855e8-ac8b-430a-bce0-f50f8d5d5172", "name": "Read item shape", "request": { "method": "GET", @@ -1540,7 +1540,7 @@ } , { - "_postman_id": "bf551490-c992-4735-84b9-96f59cd6545a", + "_postman_id": "1b69a2d4-982b-4a7e-a948-6c2dbcf481de", "name": "Read item maxHeight", "request": { "method": "GET", @@ -1568,7 +1568,7 @@ } , { - "_postman_id": "1f75cdab-1971-44e9-a783-0381055270ab", + "_postman_id": "504d59dc-e12f-42e1-83ca-715b1704fa52", "name": "Read item maxWidth", "request": { "method": "GET", @@ -1596,7 +1596,7 @@ } , { - "_postman_id": "8d61925b-b71c-4488-b8d0-b531f443e509", + "_postman_id": "32d048a1-d803-47eb-8ef0-14c444bc88d9", "name": "Read item waterRequirement", "request": { "method": "GET", @@ -1624,7 +1624,7 @@ } , { - "_postman_id": "77209e08-24a0-4d35-9228-5e364acf08f0", + "_postman_id": "89b3862c-15ea-458e-b360-e37f62f4afa9", "name": "Read item sunRequirement", "request": { "method": "GET", @@ -1652,7 +1652,7 @@ } , { - "_postman_id": "27364276-cdef-402b-831c-a6fc42c9f6d8", + "_postman_id": "acd642f4-0404-48f7-822c-d293af5b5c44", "name": "Read item binLocation", "request": { "method": "GET", @@ -1680,7 +1680,7 @@ } , { - "_postman_id": "7339b6e7-0c6f-4458-bb80-9463b3182dc4", + "_postman_id": "6a1c0274-69b3-431a-abec-eddb47c3be97", "name": "Read item qtyOnHand", "request": { "method": "GET", @@ -1708,7 +1708,7 @@ } , { - "_postman_id": "8dc5def5-c7ab-411d-89d1-722093a72683", + "_postman_id": "73e7fb35-ae91-4524-b205-7f366817287c", "name": "Read item qtyAllocated", "request": { "method": "GET", @@ -1736,7 +1736,7 @@ } , { - "_postman_id": "d80eedd2-db3b-4e3e-815d-3e8dc4a3177c", + "_postman_id": "0c2a6b1c-07b4-4365-a5ca-6fce64c11261", "name": "Read item qtyOnOrder", "request": { "method": "GET", @@ -1764,7 +1764,7 @@ } , { - "_postman_id": "f734fe1a-4aaa-4b15-9147-0aebde700363", + "_postman_id": "a22ac35b-bf85-4b65-8bb1-ba0559fe5ac5", "name": "Read item reorderLevel", "request": { "method": "GET", @@ -1792,7 +1792,7 @@ } , { - "_postman_id": "920041f3-197e-42e7-9d4e-702e9ec450a7", + "_postman_id": "3c8103f3-a739-4b40-9143-b29137e77d58", "name": "Read item unitPrice", "request": { "method": "GET", @@ -1820,7 +1820,7 @@ } , { - "_postman_id": "a350c4f1-8eec-4ac1-9ab5-366023e797f8", + "_postman_id": "0095561d-c576-4bba-b2ba-f8bfdd39a309", "name": "Read item costPrice", "request": { "method": "GET", @@ -1848,7 +1848,7 @@ } , { - "_postman_id": "3b4792b6-5eba-400f-905f-e8e924331736", + "_postman_id": "247cd286-7ce0-4bf0-b316-7e6ea19ffe72", "name": "Create item (auto assign key)", "request": { "method": "POST", @@ -1876,7 +1876,7 @@ } , { - "_postman_id": "f00d350f-198c-4316-9951-3ac95f4ceb76", + "_postman_id": "a1db6b3f-8b32-4103-baf5-8b053629a37d", "name": "Create or update item", "request": { "method": "PUT", @@ -1931,7 +1931,7 @@ } , { - "_postman_id": "dc06ad0d-2dfd-4937-9886-af6b7fe70b7f", + "_postman_id": "f4ca3919-2abb-44e0-867b-48821fc9a654", "name": "Delete item", "request": { "method": "DELETE", @@ -1960,11 +1960,11 @@ ] }, { - "_postman_id": "1b0f0db1-b772-4175-afa8-7389e10764de", + "_postman_id": "a312b998-ce45-45a9-97bf-595c73d8c13f", "name": "Order Tests", "item": [ { - "_postman_id": "a88c11d1-bfb0-4570-8da5-b022d2c6626d", + "_postman_id": "f61c7f51-7220-486b-ae2f-290680c50de0", "name": "Read orders", "request": { "method": "GET", @@ -1992,7 +1992,7 @@ } , { - "_postman_id": "94fc5b84-117e-452d-87f2-bd072e5c77b4", + "_postman_id": "eb1c970d-081f-4268-90be-9626aa1f2eae", "name": "Count orders", "request": { "method": "GET", @@ -2021,7 +2021,7 @@ } , { - "_postman_id": "e0255d48-6ccc-4356-87cb-59d22f430ab3", + "_postman_id": "ff960fca-6f86-46e0-81f4-97be5c733f2c", "name": "Read order", "request": { "method": "GET", @@ -2049,7 +2049,7 @@ } , { - "_postman_id": "ee539eda-e33c-411a-a79d-51cdbc827ebf", + "_postman_id": "08786db3-5ee9-45f5-945f-827b29298080", "name": "Read orders by CustomerNumber", "request": { "method": "GET", @@ -2077,7 +2077,7 @@ } , { - "_postman_id": "cd306d9f-8b90-450d-9c03-dcc2854d4226", + "_postman_id": "ccf22f6a-3da6-4b89-8a78-51786a51d6d7", "name": "Count orders by CustomerNumber", "request": { "method": "GET", @@ -2106,7 +2106,7 @@ } , { - "_postman_id": "249f7bf5-ae14-42b7-9759-d840b6d8c6a3", + "_postman_id": "28699109-e7f6-400a-bc63-5cbedb8a2012", "name": "Read orders by DateOrdered", "request": { "method": "GET", @@ -2121,12 +2121,12 @@ "raw": "" }, "url": { - "raw": "{{ServerBaseUri}}/Orders(DateOrdered=2019-11-01)", + "raw": "{{ServerBaseUri}}/Orders(DateOrdered=2019-12-19)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "Orders(DateOrdered=2019-11-01)" + "Orders(DateOrdered=2019-12-19)" ] } }, @@ -2134,7 +2134,7 @@ } , { - "_postman_id": "a8c16a60-a018-49f2-9fca-5758ede1f176", + "_postman_id": "2714928e-f455-42bf-9b1e-0dffa1a4b11c", "name": "Count orders by DateOrdered", "request": { "method": "GET", @@ -2149,12 +2149,12 @@ "raw": "" }, "url": { - "raw": "{{ServerBaseUri}}/Orders(DateOrdered=2019-11-01)/$count", + "raw": "{{ServerBaseUri}}/Orders(DateOrdered=2019-12-19)/$count", "host": [ "{{ServerBaseUri}}" ], "path": [ - "Orders(DateOrdered=2019-11-01)", + "Orders(DateOrdered=2019-12-19)", "$count" ] } @@ -2163,7 +2163,7 @@ } , { - "_postman_id": "109dc607-2ff3-4822-bba9-87872e528232", + "_postman_id": "1c330be2-9269-4bcc-b3da-8d626727e762", "name": "Read orders by DateCompleted", "request": { "method": "GET", @@ -2178,12 +2178,12 @@ "raw": "" }, "url": { - "raw": "{{ServerBaseUri}}/Orders(DateCompleted=2019-11-01)", + "raw": "{{ServerBaseUri}}/Orders(DateCompleted=2019-12-19)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "Orders(DateCompleted=2019-11-01)" + "Orders(DateCompleted=2019-12-19)" ] } }, @@ -2191,7 +2191,7 @@ } , { - "_postman_id": "51779480-5864-45f8-bd07-62401a63dc82", + "_postman_id": "1ecdbaf1-666f-4a9f-adb6-0c364e4b4906", "name": "Count orders by DateCompleted", "request": { "method": "GET", @@ -2206,12 +2206,12 @@ "raw": "" }, "url": { - "raw": "{{ServerBaseUri}}/Orders(DateCompleted=2019-11-01)/$count", + "raw": "{{ServerBaseUri}}/Orders(DateCompleted=2019-12-19)/$count", "host": [ "{{ServerBaseUri}}" ], "path": [ - "Orders(DateCompleted=2019-11-01)", + "Orders(DateCompleted=2019-12-19)", "$count" ] } @@ -2220,7 +2220,7 @@ } , { - "_postman_id": "48100900-58f3-4669-840a-6e678842af17", + "_postman_id": "20598ae2-0188-45a2-b7b7-05c2e66cfe37", "name": "Read order customerNumber", "request": { "method": "GET", @@ -2248,7 +2248,7 @@ } , { - "_postman_id": "1ca25bf1-3082-408f-a326-99a19d18e1d3", + "_postman_id": "5d101588-1bd8-46a5-8a78-6f1d99311f92", "name": "Read order placedBy", "request": { "method": "GET", @@ -2276,7 +2276,7 @@ } , { - "_postman_id": "ffad9b13-285d-4782-99c6-6d6ecdabd8a5", + "_postman_id": "8006867f-f822-4a66-8be9-6f81c768df28", "name": "Read order customerReference", "request": { "method": "GET", @@ -2304,7 +2304,7 @@ } , { - "_postman_id": "17e5870b-aac8-4553-b9da-e576428196de", + "_postman_id": "278e091e-57dd-4efb-9d3d-dbe138d52577", "name": "Read order paymentTermsCode", "request": { "method": "GET", @@ -2332,7 +2332,7 @@ } , { - "_postman_id": "5c926a8e-24d2-49ac-80c1-62e1cb9052f5", + "_postman_id": "c6010301-6f6a-4f42-96c0-e9a2a39c140c", "name": "Read order dateOrdered", "request": { "method": "GET", @@ -2360,7 +2360,7 @@ } , { - "_postman_id": "7b158a10-ae83-4b71-93ac-91da370eb290", + "_postman_id": "826ca7a7-7ad0-4e69-afc1-b948038f841d", "name": "Read order dateCompleted", "request": { "method": "GET", @@ -2388,7 +2388,7 @@ } , { - "_postman_id": "46da8652-168d-41bf-b619-688b8b6d874d", + "_postman_id": "8f2fea32-da34-47cd-9387-3595064b3550", "name": "Create order (auto assign key)", "request": { "method": "POST", @@ -2416,7 +2416,7 @@ } , { - "_postman_id": "1a177d54-316d-410b-a82c-82607b46653b", + "_postman_id": "2aa1f1dd-0c23-47a2-8f09-1f7b7edac311", "name": "Create or update order", "request": { "method": "PUT", @@ -2471,7 +2471,7 @@ } , { - "_postman_id": "a67316a9-21dd-422d-be26-f7ce7e1b5d10", + "_postman_id": "efc507b6-2346-48cd-80cb-d949635fa085", "name": "Delete order", "request": { "method": "DELETE", @@ -2500,11 +2500,11 @@ ] }, { - "_postman_id": "65943952-8cba-4e96-877a-6c934d3a8624", + "_postman_id": "fcffb7e6-ba02-464f-9cc3-79a95522dc9d", "name": "OrderItem Tests", "item": [ { - "_postman_id": "d703a2a8-7bf9-4b20-891d-1ab7f8410b5a", + "_postman_id": "44d4c589-dca3-407f-9410-a72b3c63ee80", "name": "Read orderItems", "request": { "method": "GET", @@ -2532,7 +2532,7 @@ } , { - "_postman_id": "2c4c4e6d-3700-4d03-b96c-e8ee927d87b3", + "_postman_id": "31c2b682-e8d1-4dbe-b43f-9d25836ac936", "name": "Count orderItems", "request": { "method": "GET", @@ -2561,7 +2561,7 @@ } , { - "_postman_id": "141b903c-ebd4-4f29-8f9b-90c23bb0c94d", + "_postman_id": "1eee9641-69f9-4df9-8296-d35f1793d4bb", "name": "Read orderItem", "request": { "method": "GET", @@ -2589,7 +2589,7 @@ } , { - "_postman_id": "217735b8-c24d-4e62-9628-9843e94b5560", + "_postman_id": "6805ddce-b715-4f10-b6f5-139884652416", "name": "Read orderItems by ItemOrdered", "request": { "method": "GET", @@ -2617,7 +2617,7 @@ } , { - "_postman_id": "8d935792-1549-4197-8035-a684f930ce34", + "_postman_id": "91ef4cf0-d121-4c4d-99fc-ea13911064c5", "name": "Count orderItems by ItemOrdered", "request": { "method": "GET", @@ -2646,7 +2646,7 @@ } , { - "_postman_id": "f6391ecc-8a90-487c-8a91-6473efda5107", + "_postman_id": "c000798a-391d-4926-87f3-1d258e1e0254", "name": "Read orderItems by DateShipped", "request": { "method": "GET", @@ -2661,12 +2661,12 @@ "raw": "" }, "url": { - "raw": "{{ServerBaseUri}}/OrderItems(DateShipped=2019-11-01)", + "raw": "{{ServerBaseUri}}/OrderItems(DateShipped=2019-12-19)", "host": [ "{{ServerBaseUri}}" ], "path": [ - "OrderItems(DateShipped=2019-11-01)" + "OrderItems(DateShipped=2019-12-19)" ] } }, @@ -2674,7 +2674,7 @@ } , { - "_postman_id": "d8e4eff9-e41d-4b9c-8457-dd7554b801a8", + "_postman_id": "3db382cf-ef45-4702-adca-e6c3c8852dfb", "name": "Count orderItems by DateShipped", "request": { "method": "GET", @@ -2689,12 +2689,12 @@ "raw": "" }, "url": { - "raw": "{{ServerBaseUri}}/OrderItems(DateShipped=2019-11-01)/$count", + "raw": "{{ServerBaseUri}}/OrderItems(DateShipped=2019-12-19)/$count", "host": [ "{{ServerBaseUri}}" ], "path": [ - "OrderItems(DateShipped=2019-11-01)", + "OrderItems(DateShipped=2019-12-19)", "$count" ] } @@ -2703,7 +2703,7 @@ } , { - "_postman_id": "3592fa3b-7921-43f7-a7c7-fcc4d9d709dd", + "_postman_id": "b1fb94e0-b4d2-436b-9214-c9b1a4887b24", "name": "Read orderItems by InvoiceNumber", "request": { "method": "GET", @@ -2731,7 +2731,7 @@ } , { - "_postman_id": "2dd13338-5b15-4f65-8694-eafc539c196f", + "_postman_id": "df199dd2-b29b-4fec-bd39-08b38f7de6fb", "name": "Count orderItems by InvoiceNumber", "request": { "method": "GET", @@ -2760,7 +2760,7 @@ } , { - "_postman_id": "cf722ff1-cdcb-42a0-84e6-3b9de347f100", + "_postman_id": "e1e0c0fc-5c77-4397-8323-dce5ea8481d6", "name": "Read orderItem itemOrdered", "request": { "method": "GET", @@ -2788,7 +2788,7 @@ } , { - "_postman_id": "927c1379-12c2-46ba-a5e6-e4a239b59deb", + "_postman_id": "ec32e0c0-ab74-49da-b4e8-83f36e05e00b", "name": "Read orderItem quantityOrdered", "request": { "method": "GET", @@ -2816,7 +2816,7 @@ } , { - "_postman_id": "cf7092e4-5b6c-4cdf-8b20-ccb674a8581c", + "_postman_id": "f81112ef-298d-48d5-9748-7ab68a3410a3", "name": "Read orderItem unitPrice", "request": { "method": "GET", @@ -2844,7 +2844,7 @@ } , { - "_postman_id": "00d980a3-25de-4ab1-aa81-41d9236ff65a", + "_postman_id": "9f098296-15da-4032-b6a1-851eedef6f93", "name": "Read orderItem dateShipped", "request": { "method": "GET", @@ -2872,7 +2872,7 @@ } , { - "_postman_id": "33918ead-b600-4d6a-b334-674e939d68e1", + "_postman_id": "6d8b9ee0-15c2-4871-812a-1cec14ea7cf2", "name": "Read orderItem invoiceNumber", "request": { "method": "GET", @@ -2900,7 +2900,7 @@ } , { - "_postman_id": "ad60b94e-f863-4139-870f-15882eb78655", + "_postman_id": "834f1617-003e-4983-b368-a992fe5e9c96", "name": "Create orderItem (auto assign key)", "request": { "method": "POST", @@ -2928,7 +2928,7 @@ } , { - "_postman_id": "f80fde28-6de3-4b4f-9dde-712d6ae4971e", + "_postman_id": "84171fed-fc38-4a4d-831f-cd580711c677", "name": "Create or update orderItem", "request": { "method": "PUT", @@ -2983,7 +2983,7 @@ } , { - "_postman_id": "a2db9439-479b-4440-b303-731818d5ba9f", + "_postman_id": "076acacb-c805-4b41-968a-77c375fd1a80", "name": "Delete orderItem", "request": { "method": "DELETE", @@ -3012,11 +3012,11 @@ ] }, { - "_postman_id": "531f320f-7be7-4c07-8469-0511a6e701cc", + "_postman_id": "8a610e78-ac76-4fd9-b95c-2fa4b48da7ee", "name": "Vendor Tests", "item": [ { - "_postman_id": "49bacb56-8cb8-4176-815d-3056b894c4c1", + "_postman_id": "fc72f153-9b1e-4139-9c82-c00cddc67d6e", "name": "Read vendors", "request": { "method": "GET", @@ -3044,7 +3044,7 @@ } , { - "_postman_id": "afcf56ac-6ad3-4953-9151-a918303a1371", + "_postman_id": "cb7f135c-1f14-4da0-97c8-c13a2967cb51", "name": "Count vendors", "request": { "method": "GET", @@ -3073,7 +3073,7 @@ } , { - "_postman_id": "9e4bb770-0219-48cd-9593-beedcd2a353c", + "_postman_id": "5402fca6-1155-426b-b717-c927aba0bf4e", "name": "Read vendor", "request": { "method": "GET", @@ -3101,7 +3101,7 @@ } , { - "_postman_id": "c2049101-2672-42e2-8f4a-c9ac53a1a544", + "_postman_id": "424688c5-1fd3-4d75-90b2-66907cdae34a", "name": "Read vendors by State", "request": { "method": "GET", @@ -3129,7 +3129,7 @@ } , { - "_postman_id": "3d44c4da-af6c-4e80-b7c0-1337779bf0f9", + "_postman_id": "c4a9f2f3-064e-4146-9cf1-d00f6bca1eec", "name": "Count vendors by State", "request": { "method": "GET", @@ -3158,7 +3158,7 @@ } , { - "_postman_id": "18bd515a-d199-45be-8b0d-94f4ea04ff55", + "_postman_id": "8d8b5640-6200-4603-bbe4-a2e156b7ba61", "name": "Read vendors by Zip", "request": { "method": "GET", @@ -3186,7 +3186,7 @@ } , { - "_postman_id": "bc4e8569-87c9-4559-b23d-90adfa8033c1", + "_postman_id": "ee361251-ca39-4e55-abab-7041afd372a2", "name": "Count vendors by Zip", "request": { "method": "GET", @@ -3215,7 +3215,7 @@ } , { - "_postman_id": "b33acef1-6741-4c89-8bef-b77b86e7341d", + "_postman_id": "70126293-78d6-4909-857c-abdd74b36771", "name": "Read vendors by PaymentTerms", "request": { "method": "GET", @@ -3243,7 +3243,7 @@ } , { - "_postman_id": "c0ff12a3-5e60-45ac-b1ff-858bc7bab9e9", + "_postman_id": "45932926-ea91-460c-b77e-faa43d8ec562", "name": "Count vendors by PaymentTerms", "request": { "method": "GET", @@ -3272,7 +3272,7 @@ } , { - "_postman_id": "504596c1-c62f-448b-ad5b-aefc92b013c1", + "_postman_id": "4d6a6caf-7584-4a68-8bf8-cfbe9a4a4d1c", "name": "Read vendor name", "request": { "method": "GET", @@ -3300,7 +3300,7 @@ } , { - "_postman_id": "864be61b-ce62-4794-8e15-dc9c7550ef27", + "_postman_id": "381196ca-e10d-4144-88dd-ac9e91f0f3ec", "name": "Read vendor street", "request": { "method": "GET", @@ -3328,7 +3328,7 @@ } , { - "_postman_id": "2fee6a82-2da3-49ee-b06c-5a20eb39e377", + "_postman_id": "898407b2-1c13-4892-a682-a1c7eeeced4c", "name": "Read vendor city", "request": { "method": "GET", @@ -3356,7 +3356,7 @@ } , { - "_postman_id": "c264de22-014a-44f8-961b-c8e53516c309", + "_postman_id": "6567d001-d62f-4846-85c7-78d31d06df14", "name": "Read vendor state", "request": { "method": "GET", @@ -3384,7 +3384,7 @@ } , { - "_postman_id": "89daafef-31c8-4119-bed9-3240fd427fa3", + "_postman_id": "143bf9b8-8de1-4e0c-aa02-899ccc500d02", "name": "Read vendor zipCode", "request": { "method": "GET", @@ -3412,7 +3412,7 @@ } , { - "_postman_id": "9ba30289-8a0f-4ca1-b380-eb3229008ec2", + "_postman_id": "e17473af-1776-4488-929b-d3a80d3699a9", "name": "Read vendor contact", "request": { "method": "GET", @@ -3440,7 +3440,7 @@ } , { - "_postman_id": "e9b4a4bb-a696-424b-b5b1-5be2008ad82b", + "_postman_id": "8aacbf1c-51ff-4c91-b2e8-1a095c3e60fc", "name": "Read vendor phone", "request": { "method": "GET", @@ -3468,7 +3468,7 @@ } , { - "_postman_id": "3627a09d-0a91-4d9d-80f6-6bee7889b71f", + "_postman_id": "4677c5a3-939e-4f04-a81c-cb42ab531616", "name": "Read vendor fax", "request": { "method": "GET", @@ -3496,7 +3496,7 @@ } , { - "_postman_id": "727870c9-cb8d-434d-a913-85bf6cdecb8f", + "_postman_id": "44afc1ca-f750-48e8-b87b-b91834ef152b", "name": "Read vendor paymentTermsCode", "request": { "method": "GET", @@ -3524,7 +3524,7 @@ } , { - "_postman_id": "8ce3b463-6bb9-43f6-9b02-2805e4fd151c", + "_postman_id": "f4e169b2-dcb4-4ce4-b1c8-f3d3b0177c47", "name": "Create vendor (auto assign key)", "request": { "method": "POST", @@ -3552,7 +3552,7 @@ } , { - "_postman_id": "103c3a53-4a62-4e5c-ad89-3c72a6fa6c85", + "_postman_id": "13da7dd1-89e4-4837-9901-92bf726e025c", "name": "Create or update vendor", "request": { "method": "PUT", @@ -3607,7 +3607,7 @@ } , { - "_postman_id": "d8ecc7ad-f3d6-4081-9e2e-4bac4ffd26b4", + "_postman_id": "72538e22-eca3-42cf-b352-d44becae0636", "name": "Delete vendor", "request": { "method": "DELETE", @@ -3640,7 +3640,7 @@ { "listen": "prerequest", "script": { - "id": "3370dffc-cefc-40d8-afe9-c4a0cd4d3dd0", + "id": "7a2a2ea4-7484-4ebf-bbf4-188b254ced26", "type": "text/javascript", "exec": [ "" @@ -3650,7 +3650,7 @@ { "listen": "test", "script": { - "id": "047093e2-74c4-406c-97b3-80a6c5f3ec03", + "id": "7ebffd1b-16ce-45db-b7ea-564e5b27cbdc", "type": "text/javascript", "exec": [ "" diff --git a/Services.Controllers/CustomerNotesController.dbl b/Services.Controllers/CustomerNotesController.dbl index ca93c84b..2a78fd8e 100644 --- a/Services.Controllers/CustomerNotesController.dbl +++ b/Services.Controllers/CustomerNotesController.dbl @@ -10,6 +10,8 @@ ;; Any changes you make will be lost of the file is re-generated. ;;***************************************************************************** +import Microsoft.AspNetCore.Http +import Microsoft.OData import Microsoft.AspNetCore.JsonPatch import Microsoft.AspNetCore.Mvc import Microsoft.AspNet.OData @@ -17,6 +19,7 @@ import Microsoft.AspNet.OData.Routing import Microsoft.EntityFrameworkCore import Microsoft.EntityFrameworkCore.Infrastructure import Microsoft.Extensions.Options +import System.Collections.Generic import System.ComponentModel.DataAnnotations import Harmony.Core.EF.Extensions import Harmony.Core.Interface @@ -27,6 +30,7 @@ import Services.Models namespace Services.Controllers {ApiVersion("1")} + {ODataRoutePrefix("CustomerNotes")} ;;; ;;; OData controller for CustomerNotes ;;; @@ -53,7 +57,9 @@ namespace Services.Controllers this._AppSettings = aAppSettings endmethod - {ODataRoute("CustomerNotes")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get all CustomerNotes @@ -64,7 +70,10 @@ namespace Services.Controllers mreturn Ok(_DbContext.CustomerNotes.AsNoTracking()) endmethod - {ODataRoute("CustomerNotes(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(CustomerNote),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get a single CustomerNote by primary key. @@ -79,7 +88,9 @@ namespace Services.Controllers endmethod - {ODataRoute("CustomerNotes({key})/NoteNumber")} + {ODataRoute("({key})/NoteNumber")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the NoteNumber property of a single CustomerNote, by primary key. ;;; @@ -97,7 +108,9 @@ namespace Services.Controllers mreturn OK(result.NoteNumber) endmethod - {ODataRoute("CustomerNotes({key})/NoteText")} + {ODataRoute("({key})/NoteText")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the NoteText property of a single CustomerNote, by primary key. ;;; @@ -115,7 +128,10 @@ namespace Services.Controllers mreturn OK(result.NoteText) endmethod - {ODataRoute("CustomerNotes")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(CustomerNote),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} ;;; ;;; Create a new customerNote (automatically assigned primary key). ;;; @@ -152,7 +168,11 @@ namespace Services.Controllers endmethod - {ODataRoute("CustomerNotes(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status201Created)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Create (with a client-supplied primary key) or replace a customerNote. ;;; @@ -201,7 +221,11 @@ namespace Services.Controllers endmethod - {ODataRoute("CustomerNotes(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Patch (partial update) a customerNote. ;;; @@ -252,7 +276,9 @@ namespace Services.Controllers endmethod - {ODataRoute("CustomerNotes(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Delete a customerNote. ;;; diff --git a/Services.Controllers/CustomersController.dbl b/Services.Controllers/CustomersController.dbl index 44f56515..03e88056 100644 --- a/Services.Controllers/CustomersController.dbl +++ b/Services.Controllers/CustomersController.dbl @@ -10,6 +10,8 @@ ;; Any changes you make will be lost of the file is re-generated. ;;***************************************************************************** +import Microsoft.AspNetCore.Http +import Microsoft.OData import Microsoft.AspNetCore.JsonPatch import Microsoft.AspNetCore.Mvc import Microsoft.AspNet.OData @@ -17,6 +19,7 @@ import Microsoft.AspNet.OData.Routing import Microsoft.EntityFrameworkCore import Microsoft.EntityFrameworkCore.Infrastructure import Microsoft.Extensions.Options +import System.Collections.Generic import System.ComponentModel.DataAnnotations import Harmony.Core.EF.Extensions import Harmony.Core.Interface @@ -27,6 +30,7 @@ import Services.Models namespace Services.Controllers {ApiVersion("1")} + {ODataRoutePrefix("Customers")} ;;; ;;; OData controller for Customers ;;; @@ -53,7 +57,9 @@ namespace Services.Controllers this._AppSettings = aAppSettings endmethod - {ODataRoute("Customers")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get all Customers @@ -64,7 +70,10 @@ namespace Services.Controllers mreturn Ok(_DbContext.Customers.AsNoTracking()) endmethod - {ODataRoute("Customers(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(Customer),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get a single Customer by primary key. @@ -78,7 +87,10 @@ namespace Services.Controllers mreturn new SingleResult(_DbContext.Customers.AsNoTracking().FindQuery(_DbContext, aCustomerNumber)) endmethod - {ODataRoute("Customers(State={aState})")} + {ODataRoute("(State={aState})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get customers by alternate key key State. @@ -95,7 +107,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Customers(ZipCode={aZipCode})")} + {ODataRoute("(ZipCode={aZipCode})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get customers by alternate key key Zip. @@ -112,7 +127,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Customers(PaymentTermsCode={aPaymentTermsCode})")} + {ODataRoute("(PaymentTermsCode={aPaymentTermsCode})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get customers by alternate key key PaymentTerms. @@ -130,7 +148,9 @@ namespace Services.Controllers endmethod - {ODataRoute("Customers({key})/Name")} + {ODataRoute("({key})/Name")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Name property of a single Customer, by primary key. ;;; @@ -148,7 +168,9 @@ namespace Services.Controllers mreturn OK(result.Name) endmethod - {ODataRoute("Customers({key})/Street")} + {ODataRoute("({key})/Street")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Street property of a single Customer, by primary key. ;;; @@ -166,7 +188,9 @@ namespace Services.Controllers mreturn OK(result.Street) endmethod - {ODataRoute("Customers({key})/City")} + {ODataRoute("({key})/City")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the City property of a single Customer, by primary key. ;;; @@ -184,7 +208,9 @@ namespace Services.Controllers mreturn OK(result.City) endmethod - {ODataRoute("Customers({key})/State")} + {ODataRoute("({key})/State")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the State property of a single Customer, by primary key. ;;; @@ -202,7 +228,9 @@ namespace Services.Controllers mreturn OK(result.State) endmethod - {ODataRoute("Customers({key})/ZipCode")} + {ODataRoute("({key})/ZipCode")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the ZipCode property of a single Customer, by primary key. ;;; @@ -220,7 +248,9 @@ namespace Services.Controllers mreturn OK(result.ZipCode) endmethod - {ODataRoute("Customers({key})/Contact")} + {ODataRoute("({key})/Contact")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Contact property of a single Customer, by primary key. ;;; @@ -238,7 +268,9 @@ namespace Services.Controllers mreturn OK(result.Contact) endmethod - {ODataRoute("Customers({key})/Phone")} + {ODataRoute("({key})/Phone")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Phone property of a single Customer, by primary key. ;;; @@ -256,7 +288,9 @@ namespace Services.Controllers mreturn OK(result.Phone) endmethod - {ODataRoute("Customers({key})/Fax")} + {ODataRoute("({key})/Fax")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Fax property of a single Customer, by primary key. ;;; @@ -274,7 +308,9 @@ namespace Services.Controllers mreturn OK(result.Fax) endmethod - {ODataRoute("Customers({key})/FavoriteItem")} + {ODataRoute("({key})/FavoriteItem")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the FavoriteItem property of a single Customer, by primary key. ;;; @@ -292,7 +328,9 @@ namespace Services.Controllers mreturn OK(result.FavoriteItem) endmethod - {ODataRoute("Customers({key})/PaymentTermsCode")} + {ODataRoute("({key})/PaymentTermsCode")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the PaymentTermsCode property of a single Customer, by primary key. ;;; @@ -310,7 +348,9 @@ namespace Services.Controllers mreturn OK(result.PaymentTermsCode) endmethod - {ODataRoute("Customers({key})/TaxId")} + {ODataRoute("({key})/TaxId")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the TaxId property of a single Customer, by primary key. ;;; @@ -328,7 +368,9 @@ namespace Services.Controllers mreturn OK(result.TaxId) endmethod - {ODataRoute("Customers({key})/CreditLimit")} + {ODataRoute("({key})/CreditLimit")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the CreditLimit property of a single Customer, by primary key. ;;; @@ -346,7 +388,10 @@ namespace Services.Controllers mreturn OK(result.CreditLimit) endmethod - {ODataRoute("Customers")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(Customer),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} ;;; ;;; Create a new customer (automatically assigned primary key). ;;; @@ -383,7 +428,11 @@ namespace Services.Controllers endmethod - {ODataRoute("Customers(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status201Created)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Create (with a client-supplied primary key) or replace a customer. ;;; @@ -432,7 +481,11 @@ namespace Services.Controllers endmethod - {ODataRoute("Customers(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Patch (partial update) a customer. ;;; @@ -483,7 +536,9 @@ namespace Services.Controllers endmethod - {ODataRoute("Customers(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Delete a customer. ;;; diff --git a/Services.Controllers/ItemsController.dbl b/Services.Controllers/ItemsController.dbl index 8ac0cc82..411ca9cb 100644 --- a/Services.Controllers/ItemsController.dbl +++ b/Services.Controllers/ItemsController.dbl @@ -10,6 +10,8 @@ ;; Any changes you make will be lost of the file is re-generated. ;;***************************************************************************** +import Microsoft.AspNetCore.Http +import Microsoft.OData import Microsoft.AspNetCore.JsonPatch import Microsoft.AspNetCore.Mvc import Microsoft.AspNet.OData @@ -17,6 +19,7 @@ import Microsoft.AspNet.OData.Routing import Microsoft.EntityFrameworkCore import Microsoft.EntityFrameworkCore.Infrastructure import Microsoft.Extensions.Options +import System.Collections.Generic import System.ComponentModel.DataAnnotations import Harmony.Core.EF.Extensions import Harmony.Core.Interface @@ -27,6 +30,7 @@ import Services.Models namespace Services.Controllers {ApiVersion("1")} + {ODataRoutePrefix("Items")} ;;; ;;; OData controller for Items ;;; @@ -53,7 +57,9 @@ namespace Services.Controllers this._AppSettings = aAppSettings endmethod - {ODataRoute("Items")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get all Items @@ -64,7 +70,10 @@ namespace Services.Controllers mreturn Ok(_DbContext.Items.AsNoTracking()) endmethod - {ODataRoute("Items(ItemNumber={aItemNumber})")} + {ODataRoute("(ItemNumber={aItemNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(Item),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get a single Item by primary key. @@ -78,7 +87,10 @@ namespace Services.Controllers mreturn new SingleResult(_DbContext.Items.AsNoTracking().FindQuery(_DbContext, aItemNumber)) endmethod - {ODataRoute("Items(VendorNumber={aVendorNumber})")} + {ODataRoute("(VendorNumber={aVendorNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get items by alternate key key VendorNumber. @@ -95,7 +107,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Items(FlowerColor={aFlowerColor})")} + {ODataRoute("(FlowerColor={aFlowerColor})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get items by alternate key key Color. @@ -112,7 +127,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Items(Size={aSize})")} + {ODataRoute("(Size={aSize})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get items by alternate key key Size. @@ -129,7 +147,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Items(CommonName={aCommonName})")} + {ODataRoute("(CommonName={aCommonName})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get items by alternate key key Name. @@ -147,7 +168,9 @@ namespace Services.Controllers endmethod - {ODataRoute("Items({key})/VendorNumber")} + {ODataRoute("({key})/VendorNumber")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the VendorNumber property of a single Item, by primary key. ;;; @@ -165,7 +188,9 @@ namespace Services.Controllers mreturn OK(result.VendorNumber) endmethod - {ODataRoute("Items({key})/Size")} + {ODataRoute("({key})/Size")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Size property of a single Item, by primary key. ;;; @@ -183,7 +208,9 @@ namespace Services.Controllers mreturn OK(result.Size) endmethod - {ODataRoute("Items({key})/CommonName")} + {ODataRoute("({key})/CommonName")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the CommonName property of a single Item, by primary key. ;;; @@ -201,7 +228,9 @@ namespace Services.Controllers mreturn OK(result.CommonName) endmethod - {ODataRoute("Items({key})/LatinName")} + {ODataRoute("({key})/LatinName")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the LatinName property of a single Item, by primary key. ;;; @@ -219,7 +248,9 @@ namespace Services.Controllers mreturn OK(result.LatinName) endmethod - {ODataRoute("Items({key})/ZoneCode")} + {ODataRoute("({key})/ZoneCode")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the ZoneCode property of a single Item, by primary key. ;;; @@ -237,7 +268,9 @@ namespace Services.Controllers mreturn OK(result.ZoneCode) endmethod - {ODataRoute("Items({key})/Type")} + {ODataRoute("({key})/Type")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Type property of a single Item, by primary key. ;;; @@ -255,7 +288,9 @@ namespace Services.Controllers mreturn OK(result.Type) endmethod - {ODataRoute("Items({key})/Flowering")} + {ODataRoute("({key})/Flowering")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Flowering property of a single Item, by primary key. ;;; @@ -273,7 +308,9 @@ namespace Services.Controllers mreturn OK(result.Flowering) endmethod - {ODataRoute("Items({key})/FlowerColor")} + {ODataRoute("({key})/FlowerColor")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the FlowerColor property of a single Item, by primary key. ;;; @@ -291,7 +328,9 @@ namespace Services.Controllers mreturn OK(result.FlowerColor) endmethod - {ODataRoute("Items({key})/Shape")} + {ODataRoute("({key})/Shape")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Shape property of a single Item, by primary key. ;;; @@ -309,7 +348,9 @@ namespace Services.Controllers mreturn OK(result.Shape) endmethod - {ODataRoute("Items({key})/MaxHeight")} + {ODataRoute("({key})/MaxHeight")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the MaxHeight property of a single Item, by primary key. ;;; @@ -327,7 +368,9 @@ namespace Services.Controllers mreturn OK(result.MaxHeight) endmethod - {ODataRoute("Items({key})/MaxWidth")} + {ODataRoute("({key})/MaxWidth")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the MaxWidth property of a single Item, by primary key. ;;; @@ -345,7 +388,9 @@ namespace Services.Controllers mreturn OK(result.MaxWidth) endmethod - {ODataRoute("Items({key})/WaterRequirement")} + {ODataRoute("({key})/WaterRequirement")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the WaterRequirement property of a single Item, by primary key. ;;; @@ -363,7 +408,9 @@ namespace Services.Controllers mreturn OK(result.WaterRequirement) endmethod - {ODataRoute("Items({key})/SunRequirement")} + {ODataRoute("({key})/SunRequirement")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the SunRequirement property of a single Item, by primary key. ;;; @@ -381,7 +428,9 @@ namespace Services.Controllers mreturn OK(result.SunRequirement) endmethod - {ODataRoute("Items({key})/BinLocation")} + {ODataRoute("({key})/BinLocation")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the BinLocation property of a single Item, by primary key. ;;; @@ -399,7 +448,9 @@ namespace Services.Controllers mreturn OK(result.BinLocation) endmethod - {ODataRoute("Items({key})/QtyOnHand")} + {ODataRoute("({key})/QtyOnHand")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the QtyOnHand property of a single Item, by primary key. ;;; @@ -417,7 +468,9 @@ namespace Services.Controllers mreturn OK(result.QtyOnHand) endmethod - {ODataRoute("Items({key})/QtyAllocated")} + {ODataRoute("({key})/QtyAllocated")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the QtyAllocated property of a single Item, by primary key. ;;; @@ -435,7 +488,9 @@ namespace Services.Controllers mreturn OK(result.QtyAllocated) endmethod - {ODataRoute("Items({key})/QtyOnOrder")} + {ODataRoute("({key})/QtyOnOrder")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the QtyOnOrder property of a single Item, by primary key. ;;; @@ -453,7 +508,9 @@ namespace Services.Controllers mreturn OK(result.QtyOnOrder) endmethod - {ODataRoute("Items({key})/ReorderLevel")} + {ODataRoute("({key})/ReorderLevel")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the ReorderLevel property of a single Item, by primary key. ;;; @@ -471,7 +528,9 @@ namespace Services.Controllers mreturn OK(result.ReorderLevel) endmethod - {ODataRoute("Items({key})/UnitPrice")} + {ODataRoute("({key})/UnitPrice")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the UnitPrice property of a single Item, by primary key. ;;; @@ -489,7 +548,9 @@ namespace Services.Controllers mreturn OK(result.UnitPrice) endmethod - {ODataRoute("Items({key})/CostPrice")} + {ODataRoute("({key})/CostPrice")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the CostPrice property of a single Item, by primary key. ;;; @@ -507,7 +568,10 @@ namespace Services.Controllers mreturn OK(result.CostPrice) endmethod - {ODataRoute("Items")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(Item),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} ;;; ;;; Create a new item (automatically assigned primary key). ;;; @@ -544,7 +608,11 @@ namespace Services.Controllers endmethod - {ODataRoute("Items(ItemNumber={aItemNumber})")} + {ODataRoute("(ItemNumber={aItemNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status201Created)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Create (with a client-supplied primary key) or replace a item. ;;; @@ -593,7 +661,11 @@ namespace Services.Controllers endmethod - {ODataRoute("Items(ItemNumber={aItemNumber})")} + {ODataRoute("(ItemNumber={aItemNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Patch (partial update) a item. ;;; @@ -644,7 +716,9 @@ namespace Services.Controllers endmethod - {ODataRoute("Items(ItemNumber={aItemNumber})")} + {ODataRoute("(ItemNumber={aItemNumber})")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Delete a item. ;;; diff --git a/Services.Controllers/OrderItemsController.dbl b/Services.Controllers/OrderItemsController.dbl index 77a01c42..b772ea9d 100644 --- a/Services.Controllers/OrderItemsController.dbl +++ b/Services.Controllers/OrderItemsController.dbl @@ -10,6 +10,8 @@ ;; Any changes you make will be lost of the file is re-generated. ;;***************************************************************************** +import Microsoft.AspNetCore.Http +import Microsoft.OData import Microsoft.AspNetCore.JsonPatch import Microsoft.AspNetCore.Mvc import Microsoft.AspNet.OData @@ -17,6 +19,7 @@ import Microsoft.AspNet.OData.Routing import Microsoft.EntityFrameworkCore import Microsoft.EntityFrameworkCore.Infrastructure import Microsoft.Extensions.Options +import System.Collections.Generic import System.ComponentModel.DataAnnotations import Harmony.Core.EF.Extensions import Harmony.Core.Interface @@ -27,6 +30,7 @@ import Services.Models namespace Services.Controllers {ApiVersion("1")} + {ODataRoutePrefix("OrderItems")} ;;; ;;; OData controller for OrderItems ;;; @@ -53,7 +57,9 @@ namespace Services.Controllers this._AppSettings = aAppSettings endmethod - {ODataRoute("OrderItems")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get all OrderItems @@ -64,7 +70,10 @@ namespace Services.Controllers mreturn Ok(_DbContext.OrderItems.AsNoTracking()) endmethod - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(OrderItem),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get a single OrderItem by primary key. @@ -81,7 +90,10 @@ namespace Services.Controllers mreturn new SingleResult(_DbContext.OrderItems.AsNoTracking().FindQuery(_DbContext, aOrderNumber,aItemNumber)) endmethod - {ODataRoute("OrderItems(ItemOrdered={aItemOrdered})")} + {ODataRoute("(ItemOrdered={aItemOrdered})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get orderItems by alternate key key ItemOrdered. @@ -98,7 +110,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("OrderItems(DateShipped={aDateShipped})")} + {ODataRoute("(DateShipped={aDateShipped})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get orderItems by alternate key key DateShipped. @@ -115,7 +130,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("OrderItems(InvoiceNumber={aInvoiceNumber})")} + {ODataRoute("(InvoiceNumber={aInvoiceNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get orderItems by alternate key key InvoiceNumber. @@ -134,7 +152,9 @@ namespace Services.Controllers - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/ItemOrdered")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/ItemOrdered")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the ItemOrdered property of a single OrderItem, by primary key. ;;; @@ -155,7 +175,9 @@ namespace Services.Controllers mreturn OK(result.ItemOrdered) endmethod - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/QuantityOrdered")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/QuantityOrdered")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the QuantityOrdered property of a single OrderItem, by primary key. ;;; @@ -176,7 +198,9 @@ namespace Services.Controllers mreturn OK(result.QuantityOrdered) endmethod - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/UnitPrice")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/UnitPrice")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the UnitPrice property of a single OrderItem, by primary key. ;;; @@ -197,7 +221,9 @@ namespace Services.Controllers mreturn OK(result.UnitPrice) endmethod - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/DateShipped")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/DateShipped")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the DateShipped property of a single OrderItem, by primary key. ;;; @@ -218,7 +244,9 @@ namespace Services.Controllers mreturn OK(result.DateShipped) endmethod - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/InvoiceNumber")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})/InvoiceNumber")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the InvoiceNumber property of a single OrderItem, by primary key. ;;; @@ -239,7 +267,10 @@ namespace Services.Controllers mreturn OK(result.InvoiceNumber) endmethod - {ODataRoute("OrderItems")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(OrderItem),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} ;;; ;;; Create a new orderItem (automatically assigned primary key). ;;; @@ -277,7 +308,11 @@ namespace Services.Controllers endmethod - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status201Created)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Create (with a client-supplied primary key) or replace a orderItem. ;;; @@ -330,7 +365,11 @@ namespace Services.Controllers endmethod - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Patch (partial update) a orderItem. ;;; @@ -384,7 +423,9 @@ namespace Services.Controllers endmethod - {ODataRoute("OrderItems(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})")} + {ODataRoute("(OrderNumber={aOrderNumber},ItemNumber={aItemNumber})")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Delete a orderItem. ;;; diff --git a/Services.Controllers/OrdersController.dbl b/Services.Controllers/OrdersController.dbl index b47a0fa9..67d21915 100644 --- a/Services.Controllers/OrdersController.dbl +++ b/Services.Controllers/OrdersController.dbl @@ -10,6 +10,8 @@ ;; Any changes you make will be lost of the file is re-generated. ;;***************************************************************************** +import Microsoft.AspNetCore.Http +import Microsoft.OData import Microsoft.AspNetCore.JsonPatch import Microsoft.AspNetCore.Mvc import Microsoft.AspNet.OData @@ -17,6 +19,7 @@ import Microsoft.AspNet.OData.Routing import Microsoft.EntityFrameworkCore import Microsoft.EntityFrameworkCore.Infrastructure import Microsoft.Extensions.Options +import System.Collections.Generic import System.ComponentModel.DataAnnotations import Harmony.Core.EF.Extensions import Harmony.Core.Interface @@ -27,6 +30,7 @@ import Services.Models namespace Services.Controllers {ApiVersion("1")} + {ODataRoutePrefix("Orders")} ;;; ;;; OData controller for Orders ;;; @@ -53,7 +57,9 @@ namespace Services.Controllers this._AppSettings = aAppSettings endmethod - {ODataRoute("Orders")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get all Orders @@ -64,7 +70,10 @@ namespace Services.Controllers mreturn Ok(_DbContext.Orders.AsNoTracking()) endmethod - {ODataRoute("Orders(OrderNumber={aOrderNumber})")} + {ODataRoute("(OrderNumber={aOrderNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(Order),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get a single Order by primary key. @@ -78,7 +87,10 @@ namespace Services.Controllers mreturn new SingleResult(_DbContext.Orders.AsNoTracking().FindQuery(_DbContext, aOrderNumber)) endmethod - {ODataRoute("Orders(CustomerNumber={aCustomerNumber})")} + {ODataRoute("(CustomerNumber={aCustomerNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get orders by alternate key key CustomerNumber. @@ -95,7 +107,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Orders(DateOrdered={aDateOrdered})")} + {ODataRoute("(DateOrdered={aDateOrdered})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get orders by alternate key key DateOrdered. @@ -112,7 +127,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Orders(DateCompleted={aDateCompleted})")} + {ODataRoute("(DateCompleted={aDateCompleted})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get orders by alternate key key DateCompleted. @@ -130,7 +148,9 @@ namespace Services.Controllers endmethod - {ODataRoute("Orders({key})/CustomerNumber")} + {ODataRoute("({key})/CustomerNumber")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the CustomerNumber property of a single Order, by primary key. ;;; @@ -148,7 +168,9 @@ namespace Services.Controllers mreturn OK(result.CustomerNumber) endmethod - {ODataRoute("Orders({key})/PlacedBy")} + {ODataRoute("({key})/PlacedBy")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the PlacedBy property of a single Order, by primary key. ;;; @@ -166,7 +188,9 @@ namespace Services.Controllers mreturn OK(result.PlacedBy) endmethod - {ODataRoute("Orders({key})/CustomerReference")} + {ODataRoute("({key})/CustomerReference")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the CustomerReference property of a single Order, by primary key. ;;; @@ -184,7 +208,9 @@ namespace Services.Controllers mreturn OK(result.CustomerReference) endmethod - {ODataRoute("Orders({key})/PaymentTermsCode")} + {ODataRoute("({key})/PaymentTermsCode")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the PaymentTermsCode property of a single Order, by primary key. ;;; @@ -202,7 +228,9 @@ namespace Services.Controllers mreturn OK(result.PaymentTermsCode) endmethod - {ODataRoute("Orders({key})/DateOrdered")} + {ODataRoute("({key})/DateOrdered")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the DateOrdered property of a single Order, by primary key. ;;; @@ -220,7 +248,9 @@ namespace Services.Controllers mreturn OK(result.DateOrdered) endmethod - {ODataRoute("Orders({key})/DateCompleted")} + {ODataRoute("({key})/DateCompleted")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the DateCompleted property of a single Order, by primary key. ;;; @@ -238,7 +268,10 @@ namespace Services.Controllers mreturn OK(result.DateCompleted) endmethod - {ODataRoute("Orders")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(Order),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} ;;; ;;; Create a new order (automatically assigned primary key). ;;; @@ -275,7 +308,11 @@ namespace Services.Controllers endmethod - {ODataRoute("Orders(OrderNumber={aOrderNumber})")} + {ODataRoute("(OrderNumber={aOrderNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status201Created)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Create (with a client-supplied primary key) or replace a order. ;;; @@ -324,7 +361,11 @@ namespace Services.Controllers endmethod - {ODataRoute("Orders(OrderNumber={aOrderNumber})")} + {ODataRoute("(OrderNumber={aOrderNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Patch (partial update) a order. ;;; @@ -375,7 +416,9 @@ namespace Services.Controllers endmethod - {ODataRoute("Orders(OrderNumber={aOrderNumber})")} + {ODataRoute("(OrderNumber={aOrderNumber})")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Delete a order. ;;; diff --git a/Services.Controllers/Services.Controllers.synproj b/Services.Controllers/Services.Controllers.synproj index 34a1b580..96e679fb 100644 --- a/Services.Controllers/Services.Controllers.synproj +++ b/Services.Controllers/Services.Controllers.synproj @@ -11,6 +11,9 @@ 2.7.0 + + 2.2.0 + 2.2.0 @@ -23,6 +26,9 @@ 7.2.2 + + 4.0.0 + 1.1.0 diff --git a/Services.Controllers/VendorsController.dbl b/Services.Controllers/VendorsController.dbl index 9c63b7f2..a6a1c662 100644 --- a/Services.Controllers/VendorsController.dbl +++ b/Services.Controllers/VendorsController.dbl @@ -10,6 +10,8 @@ ;; Any changes you make will be lost of the file is re-generated. ;;***************************************************************************** +import Microsoft.AspNetCore.Http +import Microsoft.OData import Microsoft.AspNetCore.JsonPatch import Microsoft.AspNetCore.Mvc import Microsoft.AspNet.OData @@ -17,6 +19,7 @@ import Microsoft.AspNet.OData.Routing import Microsoft.EntityFrameworkCore import Microsoft.EntityFrameworkCore.Infrastructure import Microsoft.Extensions.Options +import System.Collections.Generic import System.ComponentModel.DataAnnotations import Harmony.Core.EF.Extensions import Harmony.Core.Interface @@ -27,6 +30,7 @@ import Services.Models namespace Services.Controllers {ApiVersion("1")} + {ODataRoutePrefix("Vendors")} ;;; ;;; OData controller for Vendors ;;; @@ -53,7 +57,9 @@ namespace Services.Controllers this._AppSettings = aAppSettings endmethod - {ODataRoute("Vendors")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get all Vendors @@ -64,7 +70,10 @@ namespace Services.Controllers mreturn Ok(_DbContext.Vendors.AsNoTracking()) endmethod - {ODataRoute("Vendors(VendorNumber={aVendorNumber})")} + {ODataRoute("(VendorNumber={aVendorNumber})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(Vendor),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get a single Vendor by primary key. @@ -78,7 +87,10 @@ namespace Services.Controllers mreturn new SingleResult(_DbContext.Vendors.AsNoTracking().FindQuery(_DbContext, aVendorNumber)) endmethod - {ODataRoute("Vendors(State={aState})")} + {ODataRoute("(State={aState})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get vendors by alternate key key State. @@ -95,7 +107,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Vendors(ZipCode={aZipCode})")} + {ODataRoute("(ZipCode={aZipCode})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get vendors by alternate key key Zip. @@ -112,7 +127,10 @@ namespace Services.Controllers mreturn Ok(result) endmethod - {ODataRoute("Vendors(PaymentTermsCode={aPaymentTermsCode})")} + {ODataRoute("(PaymentTermsCode={aPaymentTermsCode})")} + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} {EnableQuery(MaxExpansionDepth=4)} ;;; ;;; Get vendors by alternate key key PaymentTerms. @@ -130,7 +148,9 @@ namespace Services.Controllers endmethod - {ODataRoute("Vendors({key})/Name")} + {ODataRoute("({key})/Name")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Name property of a single Vendor, by primary key. ;;; @@ -148,7 +168,9 @@ namespace Services.Controllers mreturn OK(result.Name) endmethod - {ODataRoute("Vendors({key})/Street")} + {ODataRoute("({key})/Street")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Street property of a single Vendor, by primary key. ;;; @@ -166,7 +188,9 @@ namespace Services.Controllers mreturn OK(result.Street) endmethod - {ODataRoute("Vendors({key})/City")} + {ODataRoute("({key})/City")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the City property of a single Vendor, by primary key. ;;; @@ -184,7 +208,9 @@ namespace Services.Controllers mreturn OK(result.City) endmethod - {ODataRoute("Vendors({key})/State")} + {ODataRoute("({key})/State")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the State property of a single Vendor, by primary key. ;;; @@ -202,7 +228,9 @@ namespace Services.Controllers mreturn OK(result.State) endmethod - {ODataRoute("Vendors({key})/ZipCode")} + {ODataRoute("({key})/ZipCode")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the ZipCode property of a single Vendor, by primary key. ;;; @@ -220,7 +248,9 @@ namespace Services.Controllers mreturn OK(result.ZipCode) endmethod - {ODataRoute("Vendors({key})/Contact")} + {ODataRoute("({key})/Contact")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Contact property of a single Vendor, by primary key. ;;; @@ -238,7 +268,9 @@ namespace Services.Controllers mreturn OK(result.Contact) endmethod - {ODataRoute("Vendors({key})/Phone")} + {ODataRoute("({key})/Phone")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Phone property of a single Vendor, by primary key. ;;; @@ -256,7 +288,9 @@ namespace Services.Controllers mreturn OK(result.Phone) endmethod - {ODataRoute("Vendors({key})/Fax")} + {ODataRoute("({key})/Fax")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the Fax property of a single Vendor, by primary key. ;;; @@ -274,7 +308,9 @@ namespace Services.Controllers mreturn OK(result.Fax) endmethod - {ODataRoute("Vendors({key})/PaymentTermsCode")} + {ODataRoute("({key})/PaymentTermsCode")} + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Get the PaymentTermsCode property of a single Vendor, by primary key. ;;; @@ -292,7 +328,10 @@ namespace Services.Controllers mreturn OK(result.PaymentTermsCode) endmethod - {ODataRoute("Vendors")} + {ODataRoute} + {Produces("application/json")} + {ProducesResponseType(^typeof(Vendor),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} ;;; ;;; Create a new vendor (automatically assigned primary key). ;;; @@ -329,7 +368,11 @@ namespace Services.Controllers endmethod - {ODataRoute("Vendors(VendorNumber={aVendorNumber})")} + {ODataRoute("(VendorNumber={aVendorNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status201Created)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Create (with a client-supplied primary key) or replace a vendor. ;;; @@ -378,7 +421,11 @@ namespace Services.Controllers endmethod - {ODataRoute("Vendors(VendorNumber={aVendorNumber})")} + {ODataRoute("(VendorNumber={aVendorNumber})")} + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Patch (partial update) a vendor. ;;; @@ -429,7 +476,9 @@ namespace Services.Controllers endmethod - {ODataRoute("Vendors(VendorNumber={aVendorNumber})")} + {ODataRoute("(VendorNumber={aVendorNumber})")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status404NotFound)} ;;; ;;; Delete a vendor. ;;; diff --git a/Services.Models/CustomerMetaData.dbl b/Services.Models/CustomerMetaData.dbl index 0d617d0c..f069eeea 100644 --- a/Services.Models/CustomerMetaData.dbl +++ b/Services.Models/CustomerMetaData.dbl @@ -169,25 +169,25 @@ namespace Services.Models using keyNumber select (0), begin - if((segValueLength=KeyValueHelper(key0.CustomerNumber, "CustomerNumber", parts))<6) + if((segValueLength=KeyValueHelper(key0.CustomerNumber, "CustomerNumber", parts))<6 && segValueLength>0) mreturn key0(1:startPos+segValueLength) mreturn key0 end (1), begin - if((segValueLength=KeyValueHelper(key1.State, "State", parts))<2) + if((segValueLength=KeyValueHelper(key1.State, "State", parts))<2 && segValueLength>0) mreturn key1(1:startPos+segValueLength) mreturn key1 end (2), begin - if((segValueLength=KeyValueHelper(key2.ZipCode, "ZipCode", parts))<9) + if((segValueLength=KeyValueHelper(key2.ZipCode, "ZipCode", parts))<9 && segValueLength>0) mreturn key2(1:startPos+segValueLength) mreturn key2 end (3), begin - if((segValueLength=KeyValueHelper(key3.PaymentTermsCode, "PaymentTermsCode", parts))<2) + if((segValueLength=KeyValueHelper(key3.PaymentTermsCode, "PaymentTermsCode", parts))<2 && segValueLength>0) mreturn key3(1:startPos+segValueLength) mreturn key3 end diff --git a/Services.Models/CustomerNoteMetaData.dbl b/Services.Models/CustomerNoteMetaData.dbl index 75fafd2c..bb0abd82 100644 --- a/Services.Models/CustomerNoteMetaData.dbl +++ b/Services.Models/CustomerNoteMetaData.dbl @@ -122,7 +122,7 @@ namespace Services.Models using keyNumber select (0), begin - if((segValueLength=KeyValueHelper(key0.CustomerNumber, "CustomerNumber", parts))<6) + if((segValueLength=KeyValueHelper(key0.CustomerNumber, "CustomerNumber", parts))<6 && segValueLength>0) mreturn key0(1:startPos+segValueLength) mreturn key0 end diff --git a/Services.Models/ItemMetaData.dbl b/Services.Models/ItemMetaData.dbl index d6967910..b26f4220 100644 --- a/Services.Models/ItemMetaData.dbl +++ b/Services.Models/ItemMetaData.dbl @@ -175,31 +175,31 @@ namespace Services.Models using keyNumber select (0), begin - if((segValueLength=KeyValueHelper(key0.ItemNumber, "ItemNumber", parts))<6) + if((segValueLength=KeyValueHelper(key0.ItemNumber, "ItemNumber", parts))<6 && segValueLength>0) mreturn key0(1:startPos+segValueLength) mreturn key0 end (1), begin - if((segValueLength=KeyValueHelper(key1.VendorNumber, "VendorNumber", parts))<6) + if((segValueLength=KeyValueHelper(key1.VendorNumber, "VendorNumber", parts))<6 && segValueLength>0) mreturn key1(1:startPos+segValueLength) mreturn key1 end (2), begin - if((segValueLength=KeyValueHelper(key2.FlowerColor, "FlowerColor", parts))<6) + if((segValueLength=KeyValueHelper(key2.FlowerColor, "FlowerColor", parts))<6 && segValueLength>0) mreturn key2(1:startPos+segValueLength) mreturn key2 end (3), begin - if((segValueLength=KeyValueHelper(key3.Size, "Size", parts))<3) + if((segValueLength=KeyValueHelper(key3.Size, "Size", parts))<3 && segValueLength>0) mreturn key3(1:startPos+segValueLength) mreturn key3 end (4), begin - if((segValueLength=KeyValueHelper(key4.CommonName, "CommonName", parts))<30) + if((segValueLength=KeyValueHelper(key4.CommonName, "CommonName", parts))<30 && segValueLength>0) mreturn key4(1:startPos+segValueLength) mreturn key4 end diff --git a/Services.Models/OrderItemMetaData.dbl b/Services.Models/OrderItemMetaData.dbl index 0f02e8f8..31f1c482 100644 --- a/Services.Models/OrderItemMetaData.dbl +++ b/Services.Models/OrderItemMetaData.dbl @@ -157,28 +157,28 @@ namespace Services.Models using keyNumber select (0), begin - if((segValueLength=KeyValueHelper(key0.OrderNumber, "OrderNumber", parts))<6) + if((segValueLength=KeyValueHelper(key0.OrderNumber, "OrderNumber", parts))<6 && segValueLength>0) mreturn key0(1:startPos+segValueLength) startPos += 6 - if((segValueLength=KeyValueHelper(key0.ItemNumber, "ItemNumber", parts))<2) + if((segValueLength=KeyValueHelper(key0.ItemNumber, "ItemNumber", parts))<2 && segValueLength>0) mreturn key0(1:startPos+segValueLength) mreturn key0 end (1), begin - if((segValueLength=KeyValueHelper(key1.ItemOrdered, "ItemOrdered", parts))<6) + if((segValueLength=KeyValueHelper(key1.ItemOrdered, "ItemOrdered", parts))<6 && segValueLength>0) mreturn key1(1:startPos+segValueLength) mreturn key1 end (2), begin - if((segValueLength=KeyValueHelper(key2.DateShipped, "DateShipped", parts, mDateShippedFormatter))<8) + if((segValueLength=KeyValueHelper(key2.DateShipped, "DateShipped", parts, mDateShippedFormatter))<8 && segValueLength>0) mreturn key2(1:startPos+segValueLength) mreturn key2 end (3), begin - if((segValueLength=KeyValueHelper(key3.InvoiceNumber, "InvoiceNumber", parts))<7) + if((segValueLength=KeyValueHelper(key3.InvoiceNumber, "InvoiceNumber", parts))<7 && segValueLength>0) mreturn key3(1:startPos+segValueLength) mreturn key3 end diff --git a/Services.Models/OrderMetaData.dbl b/Services.Models/OrderMetaData.dbl index 35d16d43..fd84fba5 100644 --- a/Services.Models/OrderMetaData.dbl +++ b/Services.Models/OrderMetaData.dbl @@ -155,25 +155,25 @@ namespace Services.Models using keyNumber select (0), begin - if((segValueLength=KeyValueHelper(key0.OrderNumber, "OrderNumber", parts))<6) + if((segValueLength=KeyValueHelper(key0.OrderNumber, "OrderNumber", parts))<6 && segValueLength>0) mreturn key0(1:startPos+segValueLength) mreturn key0 end (1), begin - if((segValueLength=KeyValueHelper(key1.CustomerNumber, "CustomerNumber", parts))<6) + if((segValueLength=KeyValueHelper(key1.CustomerNumber, "CustomerNumber", parts))<6 && segValueLength>0) mreturn key1(1:startPos+segValueLength) mreturn key1 end (2), begin - if((segValueLength=KeyValueHelper(key2.DateOrdered, "DateOrdered", parts, mDateOrderedFormatter))<8) + if((segValueLength=KeyValueHelper(key2.DateOrdered, "DateOrdered", parts, mDateOrderedFormatter))<8 && segValueLength>0) mreturn key2(1:startPos+segValueLength) mreturn key2 end (3), begin - if((segValueLength=KeyValueHelper(key3.DateCompleted, "DateCompleted", parts, mDateCompletedFormatter))<8) + if((segValueLength=KeyValueHelper(key3.DateCompleted, "DateCompleted", parts, mDateCompletedFormatter))<8 && segValueLength>0) mreturn key3(1:startPos+segValueLength) mreturn key3 end diff --git a/Services.Models/VendorMetaData.dbl b/Services.Models/VendorMetaData.dbl index d612fff8..ae7a0b61 100644 --- a/Services.Models/VendorMetaData.dbl +++ b/Services.Models/VendorMetaData.dbl @@ -155,25 +155,25 @@ namespace Services.Models using keyNumber select (0), begin - if((segValueLength=KeyValueHelper(key0.VendorNumber, "VendorNumber", parts))<6) + if((segValueLength=KeyValueHelper(key0.VendorNumber, "VendorNumber", parts))<6 && segValueLength>0) mreturn key0(1:startPos+segValueLength) mreturn key0 end (1), begin - if((segValueLength=KeyValueHelper(key1.State, "State", parts))<2) + if((segValueLength=KeyValueHelper(key1.State, "State", parts))<2 && segValueLength>0) mreturn key1(1:startPos+segValueLength) mreturn key1 end (2), begin - if((segValueLength=KeyValueHelper(key2.ZipCode, "ZipCode", parts))<5) + if((segValueLength=KeyValueHelper(key2.ZipCode, "ZipCode", parts))<5 && segValueLength>0) mreturn key2(1:startPos+segValueLength) mreturn key2 end (3), begin - if((segValueLength=KeyValueHelper(key3.PaymentTermsCode, "PaymentTermsCode", parts))<2) + if((segValueLength=KeyValueHelper(key3.PaymentTermsCode, "PaymentTermsCode", parts))<2 && segValueLength>0) mreturn key3(1:startPos+segValueLength) mreturn key3 end diff --git a/Services.Test/UnitTests/CustomerTests.dbl b/Services.Test/UnitTests/CustomerTests.dbl index 4a9e4ead..a61b19b5 100644 --- a/Services.Test/UnitTests/CustomerTests.dbl +++ b/Services.Test/UnitTests/CustomerTests.dbl @@ -69,16 +69,16 @@ namespace Services.Test.UnitTests ;;------------------------------------------------------------ ;;Get all Customers and expand relation REL_CustomerNotes -; {TestMethod} -; {TestCategory("Customer Tests - Read All")} -; public method GetCustomers_Expand_REL_CustomerNotes, void -; proc -; data uri = "/odata/v1/Customers?$expand=REL_CustomerNotes" -; disposable data client = UnitTestEnvironment.Server.CreateClient() -; disposable data response = client.GetAsync(uri).Result -; data result = response.Content.ReadAsStringAsync().Result -; response.EnsureSuccessStatusCode() -; endmethod + {TestMethod} + {TestCategory("Customer Tests - Read All")} + public method GetCustomers_Expand_REL_CustomerNotes, void + proc + data uri = "/odata/v1/Customers?$expand=REL_CustomerNotes" + disposable data client = UnitTestEnvironment.Server.CreateClient() + disposable data response = client.GetAsync(uri).Result + data result = response.Content.ReadAsStringAsync().Result + response.EnsureSuccessStatusCode() + endmethod ;;------------------------------------------------------------ ;;Get all Customers and expand all relations @@ -142,17 +142,17 @@ namespace Services.Test.UnitTests ;;------------------------------------------------------------ ;;Get a single Customer by primary key and expand relation REL_CustomerNotes -; {TestMethod} -; {TestCategory("Customer Tests - Read by Primary Key")} -; public method GetCustomer_Expand_REL_CustomerNotes, void -; proc -; data client = UnitTestEnvironment.Server.CreateClient() -; data request = String.Format("/odata/v1/Customers(CustomerNumber={1})?$expand=REL_CustomerNotes","",TestConstants.GetCustomer_Expand_REL_CustomerNotes_CustomerNumber) -; data response = client.GetAsync(request).Result -; data result = response.Content.ReadAsStringAsync().Result -; response.EnsureSuccessStatusCode() -; data customer, @ODataCustomer, JsonConvert.DeserializeObject(result) -; endmethod + {TestMethod} + {TestCategory("Customer Tests - Read by Primary Key")} + public method GetCustomer_Expand_REL_CustomerNotes, void + proc + data client = UnitTestEnvironment.Server.CreateClient() + data request = String.Format("/odata/v1/Customers(CustomerNumber={1})?$expand=REL_CustomerNotes","",TestConstants.GetCustomer_Expand_REL_CustomerNotes_CustomerNumber) + data response = client.GetAsync(request).Result + data result = response.Content.ReadAsStringAsync().Result + response.EnsureSuccessStatusCode() + data customer, @ODataCustomer, JsonConvert.DeserializeObject(result) + endmethod ;;------------------------------------------------------------ ;;Get a single Customer by primary key and expand all relations diff --git a/Services/Startup.dbl b/Services/Startup.dbl index aa0b9c0d..8173624d 100644 --- a/Services/Startup.dbl +++ b/Services/Startup.dbl @@ -49,6 +49,8 @@ import Services.Controllers import Services.Models import Microsoft.AspNetCore.Mvc.ApiExplorer import Swashbuckle.AspNetCore.Swagger +import Microsoft.AspNet.OData.Formatter +import Microsoft.Net.Http.Headers namespace Services @@ -204,10 +206,22 @@ namespace Services end services.AddSwaggerGen(SwaggerGenConfig) - - lambda MvcCoreConfig(options) + + lambda MvcCoreConfig(op) begin - options.EnableEndpointRouting = false + data formatter, @ODataOutputFormatter + data iformatter, @ODataInputFormatter + data mediaTypeName, @string, "application/prs.mock-odata" + data sseg = new StringSegment(mediaTypeName) + op.EnableEndpointRouting = false + foreach formatter in op.OutputFormatters.OfType().Where(lambda(it) { !it.SupportedMediaTypes.Any() }) + begin + formatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(sseg)); + end + foreach iformatter in op.InputFormatters.OfType().Where(lambda(it) { !it.SupportedMediaTypes.Any() }) + begin + iformatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(sseg)); + end end data mvcBuilder = services.AddMvcCore(MvcCoreConfig) diff --git a/Templates/HarmonyCoreCustomization.tpl b/Templates/HarmonyCoreCustomization.tpl new file mode 100644 index 00000000..2a6d0129 --- /dev/null +++ b/Templates/HarmonyCoreCustomization.tpl @@ -0,0 +1,26 @@ +HarmonyCoreCustomization.json +{ + "CustomRelations": [ +;// +;//Count all relations + + + + + + +;// + + + + { + "FromStructure": "", + "FromKey": "", + "ToStructure": "", + "ToKey": "", + "RequiresMatch": true + }, + + + ] +} diff --git a/Templates/ODataController.tpl b/Templates/ODataController.tpl index eba644b1..11d66d12 100644 --- a/Templates/ODataController.tpl +++ b/Templates/ODataController.tpl @@ -50,6 +50,10 @@ import Microsoft.AspNetCore.Authorization + +import Microsoft.AspNetCore.Http +import Microsoft.OData + import Microsoft.AspNetCore.JsonPatch import Microsoft.AspNetCore.Mvc import Microsoft.AspNet.OData @@ -57,6 +61,7 @@ import Microsoft.AspNet.OData.Routing import Microsoft.EntityFrameworkCore import Microsoft.EntityFrameworkCore.Infrastructure import Microsoft.Extensions.Options +import System.Collections.Generic import System.ComponentModel.DataAnnotations import Harmony.Core.EF.Extensions import Harmony.Core.Interface @@ -72,6 +77,7 @@ namespace {ApiVersion("")} + {ODataRoutePrefix("")} ;;; ;;; OData controller for ;;; @@ -103,7 +109,11 @@ namespace ;// - {ODataRoute("")} + {ODataRoute} + + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>>),StatusCodes.Status200OK)} + {Authorize(Roles="")} @@ -130,7 +140,12 @@ namespace ;// - {ODataRoute("(={a}<,>aRecordNumber)")} + {ODataRoute("(={a}<,>aRecordNumber)")} + + {Produces("application/json")} + {ProducesResponseType(^typeof(),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} + {Authorize(Roles="")} @@ -193,7 +208,12 @@ namespace - {ODataRoute("(={a}<,>)")} + {ODataRoute("(={a}<,>)")} + + {Produces("application/json")} + {ProducesResponseType(^typeof(ODataValue>>),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} + {Authorize(Roles="")} @@ -233,7 +253,12 @@ namespace mreturn Ok(result) endmethod - {ODataRoute("(={a}<,>)")} + {ODataRoute("(={a}<,>)")} + + {Produces("application/json")} + {ProducesResponseType(^typeof(),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} + {Authorize(Roles="")} @@ -294,7 +319,11 @@ namespace - {ODataRoute("({key}={a}<,>)/")} + {ODataRoute("({key}={a}<,>)/")} + + {ProducesResponseType(StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status404NotFound)} + {Authorize(Roles="")} @@ -350,7 +379,7 @@ namespace ;// RELATIVE ;// - {ODataRoute("({key})} + {ODataRoute("({key})} {Authorize(Roles="")} @@ -389,7 +418,12 @@ namespace {Authorize(Roles="")} - {ODataRoute("")} + {ODataRoute} + + {Produces("application/json")} + {ProducesResponseType(^typeof(),StatusCodes.Status200OK)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + ;;; ;;; Create a new (automatically assigned primary key). ;;; @@ -456,7 +490,13 @@ namespace {Authorize(Roles="")} - {ODataRoute("(={a}<,>aRecordNumber)")} + {ODataRoute("(={a}<,>aRecordNumber)")} + + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status201Created)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} + ;;; ;;; Create (with a client-supplied primary key) or replace a . ;;; @@ -559,7 +599,13 @@ namespace {Authorize(Roles="")} - {ODataRoute("(={a}<,>RecordNumber={aRecordNumber})")} + {ODataRoute("(={a}<,>RecordNumber={aRecordNumber})")} + + {Produces("application/json")} + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status400BadRequest)} + {ProducesResponseType(StatusCodes.Status404NotFound)} + ;;; ;;; Patch (partial update) a . ;;; @@ -651,7 +697,11 @@ namespace {Authorize(Roles="")} - {ODataRoute("(={a}<,>RecordNumber={aRecordNumber})")} + {ODataRoute("(={a}<,>RecordNumber={aRecordNumber})")} + + {ProducesResponseType(StatusCodes.Status204NoContent)} + {ProducesResponseType(StatusCodes.Status404NotFound)} + ;;; ;;; Delete a . ;;; diff --git a/Templates/ODataMetaData.tpl b/Templates/ODataMetaData.tpl index e8719ab6..ed6e48dd 100644 --- a/Templates/ODataMetaData.tpl +++ b/Templates/ODataMetaData.tpl @@ -368,14 +368,14 @@ namespace begin - if((segValueLength=KeyValueHelper(key., "", parts, mFormatter))<) + if((segValueLength=KeyValueHelper(key., "", parts, mFormatter))< && segValueLength>0) mreturn key(1:startPos+segValueLength) - if((segValueLength=KeyValueHelper(key., "", parts, mFormatter))<) + if((segValueLength=KeyValueHelper(key., "", parts, mFormatter))< && segValueLength>0) mreturn key(1:startPos+segValueLength) - if((segValueLength=KeyValueHelper(key., "", parts))<) + if((segValueLength=KeyValueHelper(key., "", parts))< && segValueLength>0) mreturn key(1:startPos+segValueLength) diff --git a/Templates/ODataStartup.tpl b/Templates/ODataStartup.tpl index 12728bbb..8cbb220c 100644 --- a/Templates/ODataStartup.tpl +++ b/Templates/ODataStartup.tpl @@ -102,6 +102,8 @@ import import Microsoft.AspNetCore.Mvc.ApiExplorer import Swashbuckle.AspNetCore.Swagger +import Microsoft.AspNet.OData.Formatter +import Microsoft.Net.Http.Headers namespace @@ -274,10 +276,22 @@ namespace services.AddSwaggerGen() - - lambda MvcCoreConfig(options) + + lambda MvcCoreConfig(op) begin - options.EnableEndpointRouting = false + data formatter, @ODataOutputFormatter + data iformatter, @ODataInputFormatter + data mediaTypeName, @string, "application/prs.mock-odata" + data sseg = new StringSegment(mediaTypeName) + op.EnableEndpointRouting = false + foreach formatter in op.OutputFormatters.OfType().Where(lambda(it) { !it.SupportedMediaTypes.Any() }) + begin + formatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(sseg)); + end + foreach iformatter in op.InputFormatters.OfType().Where(lambda(it) { !it.SupportedMediaTypes.Any() }) + begin + iformatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(sseg)); + end end data mvcBuilder = services.AddMvcCore(MvcCoreConfig)