From 1cc6381e9b379b339ae54c30c424032e250fea9a Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Fri, 10 Apr 2026 08:36:16 -0600 Subject: [PATCH] Sync postman --- backend/petshop-api.postman_collection.json | 628 +++++++++++++++++++- 1 file changed, 627 insertions(+), 1 deletion(-) diff --git a/backend/petshop-api.postman_collection.json b/backend/petshop-api.postman_collection.json index e3418fff..4ba7b5c6 100644 --- a/backend/petshop-api.postman_collection.json +++ b/backend/petshop-api.postman_collection.json @@ -137,6 +137,22 @@ { "key": "adoptionPetId", "value": "" + }, + { + "key": "couponId", + "value": "" + }, + { + "key": "cartItemId", + "value": "" + }, + { + "key": "messageId", + "value": "" + }, + { + "key": "paymentIntentId", + "value": "" } ], "item": [ @@ -1732,6 +1748,541 @@ } ] }, + { + "name": "Cart", + "item": [ + { + "name": "Get Active Cart", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/cart?storeId={{storeId}}", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200 or 204', function () {", + " pm.expect([200, 204]).to.include(pm.response.code);", + "});" + ] + } + } + ] + }, + { + "name": "Add Cart Item", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/cart/add", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"prodId\": {{productId}},\n \"storeId\": {{storeId}},\n \"quantity\": 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": "Update Cart Item", + "request": { + "method": "PUT", + "url": "{{baseUrl}}/api/v1/cart/update", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"cartItemId\": {{cartItemId}},\n \"quantity\": 2\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": "Remove Cart Item", + "request": { + "method": "DELETE", + "url": "{{baseUrl}}/api/v1/cart/remove/{{cartItemId}}", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 200', function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Clear Cart", + "request": { + "method": "DELETE", + "url": "{{baseUrl}}/api/v1/cart/clear?storeId={{storeId}}", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Apply Coupon", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/cart/apply-coupon?storeId={{storeId}}", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"couponCode\": \"SAVE10\"\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": "Checkout Cart", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/cart/checkout", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"storeId\": {{storeId}}\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": "Complete Checkout", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/cart/checkout/complete?paymentIntentId={{paymentIntentId}}", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ] + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + } + ] + }, + { + "name": "Coupons", + "item": [ + { + "name": "Get All Coupons", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/coupons?q=&active=true", + "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": "Get Coupon by ID", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/coupons/{{couponId}}", + "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": "Get Coupon by Code", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/coupons/code/SAVE10", + "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": "Create Coupon", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/coupons", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"couponCode\": \"SAVE10\",\n \"discountType\": \"PERCENTAGE\",\n \"discountValue\": 10,\n \"minOrderAmount\": 50,\n \"active\": true,\n \"startsAt\": \"2026-01-01T00:00:00\",\n \"endsAt\": \"2026-12-31T23:59:59\",\n \"usageLimit\": 100\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.couponId !== undefined) pm.collectionVariables.set('couponId', jsonData.couponId);" + ] + } + } + ] + }, + { + "name": "Update Coupon", + "request": { + "method": "PUT", + "url": "{{baseUrl}}/api/v1/coupons/{{couponId}}", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"couponCode\": \"SAVE10\",\n \"discountType\": \"PERCENTAGE\",\n \"discountValue\": 15,\n \"minOrderAmount\": 50,\n \"active\": true,\n \"startsAt\": \"2026-01-01T00:00:00\",\n \"endsAt\": \"2026-12-31T23:59:59\",\n \"usageLimit\": 100\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 Coupon", + "request": { + "method": "DELETE", + "url": "{{baseUrl}}/api/v1/coupons/{{couponId}}", + "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 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + }, + { + "name": "Bulk Delete Coupons", + "request": { + "method": "DELETE", + "url": "{{baseUrl}}/api/v1/coupons", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{staffToken}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"ids\": [\n {{couponId}}\n ]\n}" + } + }, + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test('Status code is 204', function () {", + " pm.response.to.have.status(204);", + "});" + ] + } + } + ] + } + ] + }, { "name": "Services", "item": [ @@ -3413,6 +3964,81 @@ } ] }, + { + "name": "Send Message With Attachment", + "request": { + "method": "POST", + "url": "{{baseUrl}}/api/v1/chat/conversations/{{conversationId}}/attachments", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "{{avatarFile}}" + }, + { + "key": "content", + "value": "Attachment from Postman", + "type": "text" + } + ] + } + }, + "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('messageId', jsonData.id);" + ] + } + } + ] + }, + { + "name": "Get Message Attachment", + "request": { + "method": "GET", + "url": "{{baseUrl}}/api/v1/chat/messages/{{messageId}}/attachment", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer {{customerToken}}", + "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 Conversation", "request": { @@ -6047,4 +6673,4 @@ ] } ] -} \ No newline at end of file +}