diff --git a/petshop-api.postman_collection.json b/petshop-api.postman_collection.json index 4418bb47..b0b9d60d 100644 --- a/petshop-api.postman_collection.json +++ b/petshop-api.postman_collection.json @@ -21,6 +21,102 @@ { "key": "adminToken", "value": "" + }, + { + "key": "petId", + "value": "" + }, + { + "key": "productId", + "value": "" + }, + { + "key": "saleId", + "value": "" + }, + { + "key": "customerSaleId", + "value": "" + }, + { + "key": "serviceId", + "value": "1" + }, + { + "key": "categoryId", + "value": "1" + }, + { + "key": "appointmentId", + "value": "" + }, + { + "key": "adoptionId", + "value": "" + }, + { + "key": "refundId", + "value": "" + }, + { + "key": "conversationId", + "value": "" + }, + { + "key": "customerId", + "value": "1" + }, + { + "key": "disposableCustomerId", + "value": "" + }, + { + "key": "userId", + "value": "" + }, + { + "key": "storeId", + "value": "1" + }, + { + "key": "inventoryId", + "value": "1" + }, + { + "key": "supplierId", + "value": "1" + }, + { + "key": "avatarFile", + "value": "/tmp/petshop-avatar.png" + }, + { + "key": "bulkPetId", + "value": "" + }, + { + "key": "bulkServiceId", + "value": "" + }, + { + "key": "bulkCategoryId", + "value": "" + }, + { + "key": "bulkCustomerId", + "value": "" + }, + { + "key": "bulkUserId", + "value": "" + }, + { + "key": "bulkStoreId", + "value": "" + }, + { + "key": "bulkInventoryId", + "value": "" } ], "item": [ @@ -38,7 +134,20 @@ "value": "application/json" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -58,9 +167,24 @@ ], "body": { "mode": "raw", - "raw": "{\n \"username\": \"newcustomer\",\n \"password\": \"password123\",\n \"email\": \"new@example.com\",\n \"fullName\": \"New Customer\"\n}" + "raw": "{\n \"username\": \"newcustomer{{$timestamp}}\",\n \"password\": \"password123\",\n \"email\": \"new{{$timestamp}}@example.com\",\n \"fullName\": \"New Customer\"\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.token) pm.collectionVariables.set('customerToken', jsonData.token);" + ] + } + } + ] }, { "name": "Login as Customer", @@ -82,15 +206,13 @@ { "listen": "test", "script": { + "type": "text/javascript", "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", - "", "var jsonData = pm.response.json();", - "if (jsonData.token) {", - " pm.collectionVariables.set('customerToken', jsonData.token);", - "}" + "if (jsonData.token) pm.collectionVariables.set('customerToken', jsonData.token);" ] } } @@ -116,15 +238,13 @@ { "listen": "test", "script": { + "type": "text/javascript", "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", - "", "var jsonData = pm.response.json();", - "if (jsonData.token) {", - " pm.collectionVariables.set('staffToken', jsonData.token);", - "}" + "if (jsonData.token) pm.collectionVariables.set('staffToken', jsonData.token);" ] } } @@ -150,15 +270,13 @@ { "listen": "test", "script": { + "type": "text/javascript", "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", - "", "var jsonData = pm.response.json();", - "if (jsonData.token) {", - " pm.collectionVariables.set('adminToken', jsonData.token);", - "}" + "if (jsonData.token) pm.collectionVariables.set('adminToken', jsonData.token);" ] } } @@ -180,7 +298,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Update My Profile", @@ -202,7 +333,20 @@ "mode": "raw", "raw": "{\n \"fullName\": \"Updated Name\",\n \"email\": \"updated@example.com\"\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Upload Avatar", @@ -222,11 +366,26 @@ { "key": "avatar", "type": "file", - "src": [] + "src": "{{avatarFile}}" } ] } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});", + "var jsonData = pm.response.json();", + "pm.expect(jsonData.avatarUrl).to.be.a('string');" + ] + } + } + ] }, { "name": "Get Avatar", @@ -244,7 +403,22 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});", + "var jsonData = pm.response.json();", + "pm.expect(jsonData.avatarUrl).to.be.a('string');" + ] + } + } + ] }, { "name": "Delete Avatar", @@ -262,7 +436,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Logout", @@ -280,7 +467,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -296,9 +496,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Pet by ID", @@ -309,9 +527,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Pets Dropdown", @@ -322,9 +558,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Pet", @@ -344,15 +598,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"petName\": \"Buddy\",\n \"petSpecies\": \"Dog\",\n \"petBreed\": \"Labrador\",\n \"petAge\": 2,\n \"petStatus\": \"Available\",\n \"petPrice\": 500.0\n}" + "raw": "{\n \"petName\": \"Postman Pet\",\n \"petSpecies\": \"Dog\",\n \"petBreed\": \"Mixed\",\n \"petAge\": 2,\n \"petStatus\": \"Available\",\n \"petPrice\": 350.00\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.petId !== undefined) pm.collectionVariables.set('petId', jsonData.petId);" + ] + } + } + ] }, { "name": "Update Pet", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/pets/1", + "url": "{{baseUrl}}/api/v1/pets/{{petId}}", "header": [ { "key": "Content-Type", @@ -366,15 +640,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"petName\": \"Buddy\",\n \"petSpecies\": \"Dog\",\n \"petBreed\": \"Labrador\",\n \"petAge\": 3,\n \"petStatus\": \"Available\",\n \"petPrice\": 500.0\n}" + "raw": "{\n \"petName\": \"Postman Pet Updated\",\n \"petSpecies\": \"Dog\",\n \"petBreed\": \"Mixed\",\n \"petAge\": 3,\n \"petStatus\": \"Available\",\n \"petPrice\": 375.00\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Pet", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/pets/1", + "url": "{{baseUrl}}/api/v1/pets/{{petId}}", "header": [ { "key": "Content-Type", @@ -386,7 +678,62 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Create Pet For Bulk Delete", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/pets", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"petName\": \"Postman Pet\",\n \"petSpecies\": \"Dog\",\n \"petBreed\": \"Mixed\",\n \"petAge\": 2,\n \"petStatus\": \"Available\",\n \"petPrice\": 350.00\n}", + "options": { + "raw": { + "language": "json" + } + } + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.petId !== undefined) pm.collectionVariables.set('bulkPetId', jsonData.petId);" + ] + } + } + ] }, { "name": "Bulk Delete Pets", @@ -406,9 +753,22 @@ ], "body": { "mode": "raw", - "raw": "{\n \"ids\": [\n 1,\n 2\n ]\n}" + "raw": "{\n \"ids\": [\n {{bulkPetId}}\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -424,9 +784,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Product by ID", @@ -437,9 +815,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Products Dropdown", @@ -450,9 +846,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Product", @@ -472,15 +886,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"prodName\": \"Dog Food\",\n \"categoryId\": 1,\n \"prodDesc\": \"Premium\",\n \"prodPrice\": 50.0\n}" + "raw": "{\n \"prodName\": \"Postman Product\",\n \"categoryId\": {{categoryId}},\n \"prodDesc\": \"Created from Postman\",\n \"prodPrice\": 19.99\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.prodId !== undefined) pm.collectionVariables.set('productId', jsonData.prodId);" + ] + } + } + ] }, { "name": "Update Product", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/products/1", + "url": "{{baseUrl}}/api/v1/products/{{productId}}", "header": [ { "key": "Content-Type", @@ -494,15 +928,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"prodName\": \"Dog Food\",\n \"categoryId\": 1,\n \"prodDesc\": \"Premium\",\n \"prodPrice\": 55.0\n}" + "raw": "{\n \"prodName\": \"Postman Product Updated\",\n \"categoryId\": {{categoryId}},\n \"prodDesc\": \"Updated from Postman\",\n \"prodPrice\": 24.99\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Product", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/products/1", + "url": "{{baseUrl}}/api/v1/products/{{productId}}", "header": [ { "key": "Content-Type", @@ -510,11 +962,24 @@ }, { "key": "Authorization", - "value": "Bearer {{adminToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 403', function () {", + " pm.response.to.have.status(403);", + "});" + ] + } + } + ] }, { "name": "Bulk Delete Products", @@ -528,7 +993,7 @@ }, { "key": "Authorization", - "value": "Bearer {{adminToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ], @@ -536,7 +1001,20 @@ "mode": "raw", "raw": "{\n \"ids\": [\n 1\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 403', function () {", + " pm.response.to.have.status(403);", + "});" + ] + } + } + ] } ] }, @@ -552,9 +1030,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Sale by ID", @@ -565,9 +1061,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Sale", @@ -589,7 +1103,25 @@ "mode": "raw", "raw": "{\n \"storeId\": 1,\n \"paymentMethod\": \"Card\",\n \"customerId\": 1,\n \"items\": [\n {\n \"prodId\": 1,\n \"quantity\": 2\n },\n {\n \"prodId\": 2,\n \"quantity\": 1\n }\n ],\n \"isRefund\": false\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.saleId !== undefined) {", + " pm.collectionVariables.set('saleId', jsonData.saleId);", + " pm.collectionVariables.set('customerSaleId', jsonData.saleId);", + "}" + ] + } + } + ] } ] }, @@ -605,9 +1137,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Service by ID", @@ -618,9 +1168,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Services Dropdown", @@ -631,9 +1199,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Service", @@ -653,15 +1239,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"serviceName\": \"Grooming\",\n \"serviceDesc\": \"Full grooming\",\n \"servicePrice\": 75.0\n}" + "raw": "{\n \"serviceName\": \"Postman Service\",\n \"serviceDesc\": \"Created from Postman\",\n \"serviceDuration\": 30,\n \"servicePrice\": 25.00\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.serviceId !== undefined) pm.collectionVariables.set('serviceId', jsonData.serviceId);" + ] + } + } + ] }, { "name": "Update Service", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/services/1", + "url": "{{baseUrl}}/api/v1/services/{{serviceId}}", "header": [ { "key": "Content-Type", @@ -675,15 +1281,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"serviceName\": \"Grooming\",\n \"serviceDesc\": \"Full grooming\",\n \"servicePrice\": 80.0\n}" + "raw": "{\n \"serviceName\": \"Postman Service Updated\",\n \"serviceDesc\": \"Updated from Postman\",\n \"serviceDuration\": 30,\n \"servicePrice\": 30.00\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Service", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/services/1", + "url": "{{baseUrl}}/api/v1/services/{{serviceId}}", "header": [ { "key": "Content-Type", @@ -695,7 +1319,62 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Create Service For Bulk Delete", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/services", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"serviceName\": \"Postman Service\",\n \"serviceDesc\": \"Created from Postman\",\n \"serviceDuration\": 30,\n \"servicePrice\": 25.00\n}", + "options": { + "raw": { + "language": "json" + } + } + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.serviceId !== undefined) pm.collectionVariables.set('bulkServiceId', jsonData.serviceId);" + ] + } + } + ] }, { "name": "Bulk Delete Services", @@ -715,9 +1394,22 @@ ], "body": { "mode": "raw", - "raw": "{\n \"ids\": [\n 1\n ]\n}" + "raw": "{\n \"ids\": [\n {{bulkServiceId}}\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -733,9 +1425,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Category by ID", @@ -746,9 +1456,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Categories Dropdown", @@ -759,9 +1487,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Category", @@ -781,15 +1527,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"categoryName\": \"Dog Supplies\"\n}" + "raw": "{\n \"categoryName\": \"Postman Category\",\n \"categoryType\": \"Product\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.categoryId !== undefined) pm.collectionVariables.set('categoryId', jsonData.categoryId);" + ] + } + } + ] }, { "name": "Update Category", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/categories/1", + "url": "{{baseUrl}}/api/v1/categories/{{categoryId}}", "header": [ { "key": "Content-Type", @@ -803,15 +1569,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"categoryName\": \"Dog Supplies\"\n}" + "raw": "{\n \"categoryName\": \"Postman Category Updated\",\n \"categoryType\": \"Product\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Category", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/categories/1", + "url": "{{baseUrl}}/api/v1/categories/{{categoryId}}", "header": [ { "key": "Content-Type", @@ -823,7 +1607,62 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Create Category For Bulk Delete", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/categories", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"categoryName\": \"Postman Category\",\n \"categoryType\": \"Product\"\n}", + "options": { + "raw": { + "language": "json" + } + } + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.categoryId !== undefined) pm.collectionVariables.set('bulkCategoryId', jsonData.categoryId);" + ] + } + } + ] }, { "name": "Bulk Delete Categories", @@ -843,9 +1682,22 @@ ], "body": { "mode": "raw", - "raw": "{\n \"ids\": [\n 1\n ]\n}" + "raw": "{\n \"ids\": [\n {{bulkCategoryId}}\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -856,14 +1708,32 @@ "name": "Check Appointment Availability", "request": { "method": "GET", - "url": "{{baseUrl}}/api/v1/appointments/availability?storeId=1&serviceId=1&date=2026-03-15", + "url": "{{baseUrl}}/api/v1/appointments/availability?storeId=1&serviceId=1&date=2026-12-20", "header": [ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "List Appointments", @@ -877,11 +1747,24 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Appointment", @@ -895,11 +1778,24 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Appointment", @@ -913,21 +1809,41 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ], "body": { "mode": "raw", - "raw": "{\n \"customerId\": 1,\n \"serviceId\": 1,\n \"appointmentDate\": \"2026-03-15\",\n \"appointmentTime\": \"10:30:00\",\n \"appointmentStatus\": \"Booked\",\n \"petIds\": [1, 2]\n}" + "raw": "{\n \"customerId\": 1,\n \"storeId\": 1,\n \"serviceId\": 1,\n \"appointmentDate\": \"2026-12-20\",\n \"appointmentTime\": \"10:00:00\",\n \"appointmentStatus\": \"Booked\",\n \"petIds\": [1]\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.appointmentId !== undefined) pm.collectionVariables.set('appointmentId', jsonData.appointmentId);" + ] + } + } + ] }, { "name": "Update Appointment", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/appointments/1", + "url": "{{baseUrl}}/api/v1/appointments/{{appointmentId}}", "header": [ { "key": "Content-Type", @@ -941,15 +1857,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"customerId\": 1,\n \"serviceId\": 2,\n \"appointmentDate\": \"2026-03-20\",\n \"appointmentTime\": \"14:00:00\",\n \"appointmentStatus\": \"Completed\",\n \"petIds\": [1]\n}" + "raw": "{\n \"customerId\": 1,\n \"storeId\": 1,\n \"serviceId\": 1,\n \"appointmentDate\": \"2026-12-20\",\n \"appointmentTime\": \"11:00:00\",\n \"appointmentStatus\": \"Booked\",\n \"petIds\": [1]\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Appointment", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/appointments/1", + "url": "{{baseUrl}}/api/v1/appointments/{{appointmentId}}", "header": [ { "key": "Content-Type", @@ -961,7 +1895,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] }, { "name": "Bulk Delete Appointments", @@ -975,7 +1922,7 @@ }, { "key": "Authorization", - "value": "Bearer {{adminToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ], @@ -983,7 +1930,20 @@ "mode": "raw", "raw": "{\n \"ids\": [\n 1\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 403', function () {", + " pm.response.to.have.status(403);", + "});" + ] + } + } + ] } ] }, @@ -1002,11 +1962,24 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Adoption", @@ -1020,11 +1993,24 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Adoption", @@ -1038,21 +2024,41 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ], "body": { "mode": "raw", - "raw": "{\n \"petId\": 1,\n \"customerId\": 1,\n \"adoptionDate\": \"2026-03-10\",\n \"adoptionStatus\": \"Pending\"\n}" + "raw": "{\n \"petId\": 3,\n \"customerId\": 1,\n \"adoptionDate\": \"2026-12-21\",\n \"adoptionStatus\": \"Pending\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.adoptionId !== undefined) pm.collectionVariables.set('adoptionId', jsonData.adoptionId);" + ] + } + } + ] }, { "name": "Update Adoption", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/adoptions/1", + "url": "{{baseUrl}}/api/v1/adoptions/{{adoptionId}}", "header": [ { "key": "Content-Type", @@ -1066,15 +2072,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"petId\": 1,\n \"customerId\": 1,\n \"adoptionDate\": \"2026-03-10\",\n \"adoptionStatus\": \"Completed\"\n}" + "raw": "{\n \"petId\": 3,\n \"customerId\": 1,\n \"adoptionDate\": \"2026-12-22\",\n \"adoptionStatus\": \"Completed\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Adoption", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/adoptions/1", + "url": "{{baseUrl}}/api/v1/adoptions/{{adoptionId}}", "header": [ { "key": "Content-Type", @@ -1086,7 +2110,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] }, { "name": "Bulk Delete Adoptions", @@ -1100,7 +2137,7 @@ }, { "key": "Authorization", - "value": "Bearer {{adminToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ], @@ -1108,7 +2145,20 @@ "mode": "raw", "raw": "{\n \"ids\": [\n 1\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 403', function () {", + " pm.response.to.have.status(403);", + "});" + ] + } + } + ] } ] }, @@ -1127,15 +2177,35 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ], "body": { "mode": "raw", - "raw": "{\n \"saleId\": 1,\n \"reason\": \"Defective product\"\n}" + "raw": "{\n \"saleId\": 1,\n \"reason\": \"Defective product\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.id !== undefined) pm.collectionVariables.set('refundId', jsonData.id);" + ] + } + } + ] }, { "name": "List Refunds", @@ -1149,17 +2219,30 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Refund", "request": { "method": "GET", - "url": "{{baseUrl}}/api/v1/refunds/1", + "url": "{{baseUrl}}/api/v1/refunds/{{refundId}}", "header": [ { "key": "Content-Type", @@ -1167,17 +2250,30 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Update Refund", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/refunds/1", + "url": "{{baseUrl}}/api/v1/refunds/{{refundId}}", "header": [ { "key": "Content-Type", @@ -1191,15 +2287,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"status\": \"APPROVED\"\n}" + "raw": "{\n \"status\": \"APPROVED\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Refund", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/refunds/1", + "url": "{{baseUrl}}/api/v1/refunds/{{refundId}}", "header": [ { "key": "Content-Type", @@ -1207,11 +2321,24 @@ }, { "key": "Authorization", - "value": "Bearer {{adminToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 403', function () {", + " pm.response.to.have.status(403);", + "});" + ] + } + } + ] } ] }, @@ -1238,7 +2365,22 @@ "mode": "raw", "raw": "{\n \"message\": \"I need help\"\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.id !== undefined) pm.collectionVariables.set('conversationId', jsonData.id);" + ] + } + } + ] }, { "name": "List Conversations", @@ -1252,17 +2394,30 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Conversation", "request": { "method": "GET", - "url": "{{baseUrl}}/api/v1/chat/conversations/1", + "url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}", "header": [ { "key": "Content-Type", @@ -1274,13 +2429,26 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Send Message", "request": { "method": "POST", - "url": "{{baseUrl}}/api/v1/chat/conversations/1/messages", + "url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/messages", "header": [ { "key": "Content-Type", @@ -1288,21 +2456,39 @@ }, { "key": "Authorization", - "value": "Bearer {{customerToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ], "body": { "mode": "raw", - "raw": "{\n \"content\": \"Hello\"\n}" + "raw": "{\n \"content\": \"Reply from Postman\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});" + ] + } + } + ] }, { "name": "Get Messages", "request": { "method": "GET", - "url": "{{baseUrl}}/api/v1/chat/conversations/1/messages", + "url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/messages", "header": [ { "key": "Content-Type", @@ -1314,7 +2500,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -1330,9 +2529,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "List Customers", @@ -1350,13 +2567,26 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Customer", "request": { "method": "GET", - "url": "{{baseUrl}}/api/v1/customers/1", + "url": "{{baseUrl}}/api/v1/customers/{{customerId}}", "header": [ { "key": "Content-Type", @@ -1368,7 +2598,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Customer", @@ -1388,15 +2631,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"phone\": \"555-123-4567\"\n}" + "raw": "{\n \"firstName\": \"Postman\",\n \"lastName\": \"Customer\",\n \"email\": \"postman.customer.{{$guid}}@example.com\",\n \"phone\": \"555-100-2000\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.customerId !== undefined) pm.collectionVariables.set('customerId', jsonData.customerId);" + ] + } + } + ] }, { "name": "Update Customer", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/customers/1", + "url": "{{baseUrl}}/api/v1/customers/{{customerId}}", "header": [ { "key": "Content-Type", @@ -1410,15 +2673,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"email\": \"jane.doe@example.com\",\n \"phone\": \"555-987-6543\"\n}" + "raw": "{\n \"firstName\": \"Postman\",\n \"lastName\": \"Customer Updated\",\n \"email\": \"postman.customer.updated.{{$timestamp}}@example.com\",\n \"phone\": \"555-100-2001\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Customer", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/customers/1", + "url": "{{baseUrl}}/api/v1/customers/{{customerId}}", "header": [ { "key": "Content-Type", @@ -1430,7 +2711,62 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Create Customer For Bulk Delete", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/customers", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"firstName\": \"Postman\",\n \"lastName\": \"Customer\",\n \"email\": \"postman.customer.{{$guid}}@example.com\",\n \"phone\": \"555-100-2000\"\n}", + "options": { + "raw": { + "language": "json" + } + } + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.customerId !== undefined) pm.collectionVariables.set('bulkCustomerId', jsonData.customerId);" + ] + } + } + ] }, { "name": "Bulk Delete Customers", @@ -1450,9 +2786,22 @@ ], "body": { "mode": "raw", - "raw": "{\n \"ids\": [\n 1\n ]\n}" + "raw": "{\n \"ids\": [\n {{bulkCustomerId}}\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -1475,7 +2824,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get User", @@ -1493,7 +2855,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create User", @@ -1513,15 +2888,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"username\": \"newuser\",\n \"password\": \"password123\",\n \"fullName\": \"New User\",\n \"email\": \"newuser@petshop.com\",\n \"role\": \"STAFF\",\n \"active\": true\n}" + "raw": "{\n \"username\": \"postman_user_{{$guid}}\",\n \"password\": \"secret123\",\n \"fullName\": \"Postman User\",\n \"email\": \"postman.user.{{$guid}}@example.com\",\n \"role\": \"STAFF\",\n \"active\": true\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.id !== undefined) pm.collectionVariables.set('userId', jsonData.id);" + ] + } + } + ] }, { "name": "Update User", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/users/1", + "url": "{{baseUrl}}/api/v1/users/{{userId}}", "header": [ { "key": "Content-Type", @@ -1535,15 +2930,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"username\": \"user1\",\n \"password\": \"newpassword123\",\n \"fullName\": \"Updated User\",\n \"email\": \"user1@petshop.com\",\n \"role\": \"STAFF\",\n \"active\": true\n}" + "raw": "{\n \"username\": \"postman_user_{{$timestamp}}\",\n \"password\": \"secret123\",\n \"fullName\": \"Postman User Updated\",\n \"email\": \"postman.user.updated.{{$timestamp}}@example.com\",\n \"role\": \"STAFF\",\n \"active\": true\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete User", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/users/1", + "url": "{{baseUrl}}/api/v1/users/{{userId}}", "header": [ { "key": "Content-Type", @@ -1555,7 +2968,62 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Create User For Bulk Delete", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/users", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"postman_user_{{$guid}}\",\n \"password\": \"secret123\",\n \"fullName\": \"Postman User\",\n \"email\": \"postman.user.{{$guid}}@example.com\",\n \"role\": \"STAFF\",\n \"active\": true\n}", + "options": { + "raw": { + "language": "json" + } + } + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.id !== undefined) pm.collectionVariables.set('bulkUserId', jsonData.id);" + ] + } + } + ] }, { "name": "Bulk Delete Users", @@ -1575,9 +3043,27 @@ ], "body": { "mode": "raw", - "raw": "{\n \"ids\": [\n 1\n ]\n}" + "raw": "{\n \"ids\": [\n {{bulkUserId}}\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -1593,9 +3079,27 @@ { "key": "Content-Type", "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}", + "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "List Stores", @@ -1613,13 +3117,26 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Store", "request": { "method": "GET", - "url": "{{baseUrl}}/api/v1/stores/1", + "url": "{{baseUrl}}/api/v1/stores/{{storeId}}", "header": [ { "key": "Content-Type", @@ -1631,7 +3148,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Store", @@ -1651,15 +3181,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"storeName\": \"New Pet Shop\",\n \"address\": \"123 Main Street\",\n \"phone\": \"555-111-2222\",\n \"email\": \"newstore@petshop.com\"\n}" + "raw": "{\n \"storeName\": \"Postman Store {{$timestamp}}\",\n \"address\": \"100 Postman Ave\",\n \"phone\": \"555-200-3000\",\n \"email\": \"postman.store.{{$guid}}@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.storeId !== undefined) pm.collectionVariables.set('storeId', jsonData.storeId);" + ] + } + } + ] }, { "name": "Update Store", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/stores/1", + "url": "{{baseUrl}}/api/v1/stores/{{storeId}}", "header": [ { "key": "Content-Type", @@ -1673,15 +3223,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"storeName\": \"Updated Pet Shop\",\n \"address\": \"456 Oak Avenue\",\n \"phone\": \"555-333-4444\",\n \"email\": \"updated@petshop.com\"\n}" + "raw": "{\n \"storeName\": \"Postman Store Updated\",\n \"address\": \"101 Postman Ave\",\n \"phone\": \"555-200-3001\",\n \"email\": \"postman.store.updated@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Store", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/stores/1", + "url": "{{baseUrl}}/api/v1/stores/{{storeId}}", "header": [ { "key": "Content-Type", @@ -1693,7 +3261,62 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Create Store For Bulk Delete", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/stores", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"storeName\": \"Postman Store {{$timestamp}}\",\n \"address\": \"100 Postman Ave\",\n \"phone\": \"555-200-3000\",\n \"email\": \"postman.store.{{$guid}}@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.storeId !== undefined) pm.collectionVariables.set('bulkStoreId', jsonData.storeId);" + ] + } + } + ] }, { "name": "Bulk Delete Stores", @@ -1713,9 +3336,22 @@ ], "body": { "mode": "raw", - "raw": "{\n \"ids\": [\n 1\n ]\n}" + "raw": "{\n \"ids\": [\n {{bulkStoreId}}\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -1738,7 +3374,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Inventory Item", @@ -1756,7 +3405,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Inventory", @@ -1776,15 +3438,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"prodId\": 1,\n \"quantity\": 100\n}" + "raw": "{\n \"prodId\": {{productId}},\n \"quantity\": 10\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.inventoryId !== undefined) pm.collectionVariables.set('inventoryId', jsonData.inventoryId);" + ] + } + } + ] }, { "name": "Update Inventory", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/inventory/1", + "url": "{{baseUrl}}/api/v1/inventory/{{inventoryId}}", "header": [ { "key": "Content-Type", @@ -1798,15 +3480,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"prodId\": 1,\n \"quantity\": 150\n}" + "raw": "{\n \"prodId\": {{productId}},\n \"quantity\": 12\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Inventory", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/inventory/1", + "url": "{{baseUrl}}/api/v1/inventory/{{inventoryId}}", "header": [ { "key": "Content-Type", @@ -1818,7 +3518,62 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Create Inventory For Bulk Delete", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/inventory", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"prodId\": {{productId}},\n \"quantity\": 10\n}", + "options": { + "raw": { + "language": "json" + } + } + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.inventoryId !== undefined) pm.collectionVariables.set('bulkInventoryId', jsonData.inventoryId);" + ] + } + } + ] }, { "name": "Bulk Delete Inventory", @@ -1838,9 +3593,22 @@ ], "body": { "mode": "raw", - "raw": "{\n \"ids\": [\n 1\n ]\n}" + "raw": "{\n \"ids\": [\n {{bulkInventoryId}}\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -1863,13 +3631,26 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Supplier", "request": { "method": "GET", - "url": "{{baseUrl}}/api/v1/suppliers/1", + "url": "{{baseUrl}}/api/v1/suppliers/{{supplierId}}", "header": [ { "key": "Content-Type", @@ -1881,7 +3662,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Supplier", @@ -1901,15 +3695,35 @@ ], "body": { "mode": "raw", - "raw": "{\n \"supCompany\": \"New Supplier Inc\",\n \"supContactFirstName\": \"John\",\n \"supContactLastName\": \"Smith\",\n \"supEmail\": \"john@newsupplier.com\",\n \"supPhone\": \"555-555-5555\"\n}" + "raw": "{\n \"supCompany\": \"Postman Supplier {{$timestamp}}\",\n \"supContactFirstName\": \"Post\",\n \"supContactLastName\": \"Man\",\n \"supEmail\": \"postman.supplier.{{$guid}}@example.com\",\n \"supPhone\": \"555-300-4000\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});", + "var jsonData = pm.response.json();", + "if (jsonData.supId !== undefined) pm.collectionVariables.set('supplierId', jsonData.supId);" + ] + } + } + ] }, { "name": "Update Supplier", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/suppliers/1", + "url": "{{baseUrl}}/api/v1/suppliers/{{supplierId}}", "header": [ { "key": "Content-Type", @@ -1923,15 +3737,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"supCompany\": \"Updated Supplier Co\",\n \"supContactFirstName\": \"Jane\",\n \"supContactLastName\": \"Doe\",\n \"supEmail\": \"jane@updatedsupplier.com\",\n \"supPhone\": \"555-666-7777\"\n}" + "raw": "{\n \"supCompany\": \"Postman Supplier Updated {{$timestamp}}\",\n \"supContactFirstName\": \"Post\",\n \"supContactLastName\": \"Man\",\n \"supEmail\": \"postman.supplier.updated.{{$timestamp}}@example.com\",\n \"supPhone\": \"555-300-4001\"\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Supplier", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/suppliers/1", + "url": "{{baseUrl}}/api/v1/suppliers/{{supplierId}}", "header": [ { "key": "Content-Type", @@ -1939,11 +3771,24 @@ }, { "key": "Authorization", - "value": "Bearer {{adminToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 403', function () {", + " pm.response.to.have.status(403);", + "});" + ] + } + } + ] }, { "name": "Bulk Delete Suppliers", @@ -1957,7 +3802,7 @@ }, { "key": "Authorization", - "value": "Bearer {{adminToken}}", + "value": "Bearer {{staffToken}}", "type": "text" } ], @@ -1965,7 +3810,20 @@ "mode": "raw", "raw": "{\n \"ids\": [\n 1\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 403', function () {", + " pm.response.to.have.status(403);", + "});" + ] + } + } + ] }, { "name": "Get Suppliers Dropdown", @@ -1983,7 +3841,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -2006,7 +3877,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Purchase Order", @@ -2024,7 +3908,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -2047,7 +3944,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Get Product Supplier", @@ -2065,7 +3975,20 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Create Product Supplier", @@ -2085,15 +4008,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"productId\": 1,\n \"supplierId\": 2,\n \"cost\": 35.00\n}" + "raw": "{\n \"productId\": {{productId}},\n \"supplierId\": {{supplierId}},\n \"cost\": 7.50\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});" + ] + } + } + ] }, { "name": "Update Product Supplier", "request": { "method": "PUT", - "url": "{{baseUrl}}/api/v1/product-suppliers/1/1", + "url": "{{baseUrl}}/api/v1/product-suppliers/{{productId}}/{{supplierId}}", "header": [ { "key": "Content-Type", @@ -2107,15 +4048,33 @@ ], "body": { "mode": "raw", - "raw": "{\n \"productId\": 1,\n \"supplierId\": 2,\n \"cost\": 40.00\n}" + "raw": "{\n \"productId\": {{productId}},\n \"supplierId\": {{supplierId}},\n \"cost\": 7.75\n}", + "options": { + "raw": { + "language": "json" + } + } } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] }, { "name": "Delete Product Supplier", "request": { "method": "DELETE", - "url": "{{baseUrl}}/api/v1/product-suppliers/1/1", + "url": "{{baseUrl}}/api/v1/product-suppliers/{{productId}}/{{supplierId}}", "header": [ { "key": "Content-Type", @@ -2127,7 +4086,60 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Create Product Supplier For Bulk Delete", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/product-suppliers", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"productId\": {{productId}},\n \"supplierId\": {{supplierId}},\n \"cost\": 7.50\n}", + "options": { + "raw": { + "language": "json" + } + } + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});" + ] + } + } + ] }, { "name": "Bulk Delete Product Suppliers", @@ -2147,9 +4159,22 @@ ], "body": { "mode": "raw", - "raw": "{\n \"keys\": [\n {\"productId\": 1, \"supplierId\": 2},\n {\"productId\": 3, \"supplierId\": 4}\n ]\n}" + "raw": "{\n \"keys\": [\n {\"productId\": {{productId}}, \"supplierId\": {{supplierId}}}\n ]\n}" } - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -2172,9 +4197,22 @@ "type": "text" } ] - } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] } ] -} \ No newline at end of file +}