From e2ad89c10da4636fa373360b4352c83e648c47a5 Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Sat, 18 Apr 2026 14:15:00 -0600 Subject: [PATCH] fix postman collection --- backend/petshop-api.postman_collection.json | 559 +++++++++++++++++++- 1 file changed, 548 insertions(+), 11 deletions(-) diff --git a/backend/petshop-api.postman_collection.json b/backend/petshop-api.postman_collection.json index 37b5245f..d11713f7 100644 --- a/backend/petshop-api.postman_collection.json +++ b/backend/petshop-api.postman_collection.json @@ -203,7 +203,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"username\": \"newcustomer{{$timestamp}}\",\n \"password\": \"password123\",\n \"email\": \"new{{$timestamp}}@example.com\",\n \"phone\": \"+1-555-01{{$randomInt}}\",\n \"fullName\": \"New Customer\"\n}" + "raw": "{\n \"username\": \"newcustomer{{$timestamp}}\",\n \"password\": \"password123\",\n \"email\": \"new{{$timestamp}}@example.com\",\n \"phone\": \"+1-555-01{{$randomInt}}\",\n \"firstName\": \"New\",\n \"lastName\": \"Customer\"\n}" } }, "event": [ @@ -248,8 +248,6 @@ " pm.response.to.have.status(200);", "});", "var jsonData = pm.response.json();", - "if (jsonData.id !== undefined) pm.collectionVariables.set('userId', jsonData.id);", - "if (jsonData.id !== undefined) pm.collectionVariables.set('customerId', jsonData.id);", "if (jsonData.token) pm.collectionVariables.set('customerToken', jsonData.token);" ] } @@ -583,6 +581,132 @@ } } ] + }, + { + "name": "Forgot Password", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/auth/forgot-password", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"usernameOrEmail\": \"admin\"\n}" + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Reset Password", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/auth/reset-password", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"token\": \"{{resetToken}}\",\n \"newPassword\": \"newpassword123\"\n}" + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Admin Upload User Avatar", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/users/{{userId}}/avatar", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{adminToken}}" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "avatar", + "type": "file", + "src": "{{avatarFile}}" + } + ] + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Admin Delete User Avatar", + "request": { + "method": "DELETE", + "url": "{{baseUrl}}/api/v1/users/{{userId}}/avatar", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -1117,13 +1241,35 @@ " pm.response.to.have.status(200);", "});", "var jsonData = pm.response.json();", - "var items = jsonData.items || [];", - "var productId = Number(pm.collectionVariables.get('productId'));", - "var cartItem = items.find(function (item) { return item.prodId === productId; }) || items[0];", - "pm.test('cart item is returned', function () {", - " pm.expect(cartItem).to.exist;", - "});", - "if (cartItem && cartItem.cartItemId !== undefined) pm.collectionVariables.set('cartItemId', cartItem.cartItemId);" + "pm.test('pet response returned', function () {", + " pm.expect(jsonData.petId).to.exist;", + "});" + ] + } + } + ] + }, + { + "name": "Dropdown: Pet Breeds", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/dropdowns/pet-breeds?species=Dog", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" ] } } @@ -1756,6 +1902,36 @@ } } ] + }, + { + "name": "Get My Orders", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/sales/my?page=0&size=10", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -2119,6 +2295,96 @@ } } ] + }, + { + "name": "Apply Loyalty Points", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/cart/apply-points?storeId={{storeId}}&useLoyaltyPoints=true", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Remove Coupon", + "request": { + "method": "DELETE", + "url": "{{baseUrl}}/api/v1/cart/coupon?storeId={{storeId}}", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Cancel Checkout", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/cart/checkout/cancel?storeId={{storeId}}", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -3305,6 +3571,66 @@ } } ] + }, + { + "name": "Cancel Appointment", + "request": { + "method": "PATCH", + "url": "{{baseUrl}}/api/v1/appointments/{{appointmentId}}/cancel", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Get Customer Pets Dropdown", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/dropdowns/customers/{{customerId}}/pets", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -3553,6 +3879,70 @@ } } ] + }, + { + "name": "Request Adoption", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/adoptions/request", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"petId\": 1,\n \"adoptionDate\": \"2026-05-01\"\n}" + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 201', function () {", + " pm.response.to.have.status(201);", + "});" + ] + } + } + ] + }, + { + "name": "Cancel Adoption", + "request": { + "method": "PATCH", + "url": "{{baseUrl}}/api/v1/adoptions/{{adoptionId}}/cancel", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] } ] }, @@ -4733,6 +5123,40 @@ } } ] + }, + { + "name": "Bulk Delete Customers", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/customers/bulk-delete", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"ids\": [\n 0\n ]\n}" + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] } ] }, @@ -6770,6 +7194,119 @@ ] } ] + }, + { + "name": "Activity Logs", + "item": [ + { + "name": "Get Activity Logs", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/activity-logs?limit=50", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{adminToken}}" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + } + ] + }, + { + "name": "Contact", + "item": [ + { + "name": "Send Contact Message", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/contact", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"subject\": \"Question about adoption\",\n \"body\": \"I would like to know more about the adoption process.\"\n}" + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + } + ] + }, + { + "name": "AI Chat", + "item": [ + { + "name": "Send AI Chat Message", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/ai-chat/message", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"message\": \"What services do you offer?\",\n \"history\": []\n}" + } + }, + "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