feat: add notification badge counts

هذا الالتزام موجود في:
boutmoun123
2026-06-07 14:25:24 +03:00
الأصل 48dc3861cf
التزام 22550055d3
8 ملفات معدلة مع 2477 إضافات و3 حذوفات

عرض الملف

@@ -4255,6 +4255,235 @@
}
]
},
{
"name": "Get Unread Notifications Count By Category",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/notifications/unread-count?category={{notificationCategory}}"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
"const json = pm.response.json();",
"pm.expect(json).to.have.property('unreadCount');",
"pm.expect(json).to.have.property('category');",
"pm.environment.set('notificationUnreadCount', json.unreadCount);"
]
}
}
]
},
{
"name": "Get Grouped Unread Notification Counts",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/notifications/unread-counts"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
"const json = pm.response.json();",
"pm.expect(json).to.have.property('total');",
"pm.expect(json).to.have.property('interactions');",
"pm.expect(json).to.have.property('messages');",
"pm.expect(json).to.have.property('follows');",
"pm.expect(json).to.have.property('followRequests');",
"pm.expect(json).to.have.property('collaboration');",
"pm.expect(json).to.have.property('system');",
"pm.environment.set('notificationUnreadCount', json.total);"
]
}
}
]
},
{
"name": "Badge Count - Interactions",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/notifications/unread-count?category=interactions"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
"const json = pm.response.json();",
"pm.expect(json).to.have.property('unreadCount');",
"pm.expect(json).to.have.property('category', 'interactions');",
"pm.environment.set('notificationUnreadCount', json.unreadCount);"
]
}
}
]
},
{
"name": "Badge Count - Messages",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/notifications/unread-count?category=messages"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
"const json = pm.response.json();",
"pm.expect(json).to.have.property('unreadCount');",
"pm.expect(json).to.have.property('category', 'messages');",
"pm.environment.set('notificationUnreadCount', json.unreadCount);"
]
}
}
]
},
{
"name": "Badge Count - Follows",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/notifications/unread-count?category=follows"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
"const json = pm.response.json();",
"pm.expect(json).to.have.property('unreadCount');",
"pm.expect(json).to.have.property('category', 'follows');",
"pm.environment.set('notificationUnreadCount', json.unreadCount);"
]
}
}
]
},
{
"name": "Badge Count - Follow Requests",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/notifications/unread-count?category=follow_requests"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
"const json = pm.response.json();",
"pm.expect(json).to.have.property('unreadCount');",
"pm.expect(json).to.have.property('category', 'follow_requests');",
"pm.environment.set('notificationUnreadCount', json.unreadCount);"
]
}
}
]
},
{
"name": "Badge Count - Collaboration",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/notifications/unread-count?category=collaboration"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
"const json = pm.response.json();",
"pm.expect(json).to.have.property('unreadCount');",
"pm.expect(json).to.have.property('category', 'collaboration');",
"pm.environment.set('notificationUnreadCount', json.unreadCount);"
]
}
}
]
},
{
"name": "Badge Count - System",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/notifications/unread-count?category=system"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
"const json = pm.response.json();",
"pm.expect(json).to.have.property('unreadCount');",
"pm.expect(json).to.have.property('category', 'system');",
"pm.environment.set('notificationUnreadCount', json.unreadCount);"
]
}
}
]
},
{
"name": "Mark Notification Read",
"request": {
@@ -5823,6 +6052,281 @@
}
]
},
{
"name": "Support",
"item": [
{
"name": "Create Support Ticket",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/support/tickets",
"body": {
"mode": "formdata",
"formdata": [
{
"key": "subject",
"value": "{{supportSubject}}",
"type": "text"
},
{
"key": "message",
"value": "{{supportMessage}}",
"type": "text"
},
{
"key": "category",
"value": "{{supportCategory}}",
"type": "text"
},
{
"key": "priority",
"value": "{{supportPriority}}",
"type": "text"
}
]
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Request succeeded', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
"const json = pm.response.json();",
"const item = json.item || json.ticket || (json.items && json.items[0]);",
"if (item) pm.environment.set('supportTicketId', item._id || item.id);",
"pm.test('Ticket created', function () { const json = pm.response.json(); pm.expect(json.item).to.have.property('status', 'open'); });"
]
}
}
]
},
{
"name": "Create Support Ticket With Image",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/support/tickets",
"body": {
"mode": "formdata",
"formdata": [
{
"key": "subject",
"value": "{{supportSubject}}",
"type": "text"
},
{
"key": "message",
"value": "{{supportMessage}}",
"type": "text"
},
{
"key": "category",
"value": "{{supportCategory}}",
"type": "text"
},
{
"key": "priority",
"value": "{{supportPriority}}",
"type": "text"
},
{
"key": "image",
"type": "file",
"src": "{{supportImagePath}}"
}
]
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Request succeeded', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
"const json = pm.response.json();",
"const item = json.item || json.ticket || (json.items && json.items[0]);",
"if (item) pm.environment.set('supportTicketId', item._id || item.id);",
"pm.test('Ticket created', function () { const json = pm.response.json(); pm.expect(json.item).to.have.property('status', 'open'); });"
]
}
}
]
},
{
"name": "List My Support Tickets",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/support/tickets?page=1&limit=20&sortOrder={{listSortOrder}}"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Request succeeded', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
"const json = pm.response.json();",
"if (json.items && json.items[0]) pm.environment.set('supportTicketId', json.items[0]._id || json.items[0].id);",
"pm.expect(json.items).to.be.an('array');"
]
}
}
]
},
{
"name": "Get My Support Ticket",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/support/tickets/{{supportTicketId}}"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Request succeeded', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
"const json = pm.response.json();",
"pm.expect(json.ticket).to.exist;",
"pm.expect(json.messages).to.be.an('array');"
]
}
}
]
},
{
"name": "Add Support Message",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/support/tickets/{{supportTicketId}}/messages",
"body": {
"mode": "formdata",
"formdata": [
{
"key": "message",
"value": "{{supportMessage}}",
"type": "text"
}
]
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Request succeeded', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
"const json = pm.response.json();",
"const item = json.item || (json.messages && json.messages[0]);",
"if (item) pm.environment.set('supportMessageId', item._id || item.id);"
]
}
}
]
},
{
"name": "Add Support Message With Image",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/support/tickets/{{supportTicketId}}/messages",
"body": {
"mode": "formdata",
"formdata": [
{
"key": "message",
"value": "{{supportMessage}}",
"type": "text"
},
{
"key": "image",
"type": "file",
"src": "{{supportImagePath}}"
}
]
}
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Request succeeded', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
"const json = pm.response.json();",
"const item = json.item || (json.messages && json.messages[0]);",
"if (item) pm.environment.set('supportMessageId', item._id || item.id);"
]
}
}
]
},
{
"name": "Close My Support Ticket",
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": "{{baseUrl}}/support/tickets/{{supportTicketId}}/close"
},
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test('Request succeeded', function () { pm.expect(pm.response.code).to.be.oneOf([200, 201]); });",
"const json = pm.response.json();",
"pm.expect(json.item).to.have.property('status', 'closed');"
]
}
}
]
}
]
},
{
"name": "Health",
"item": [
@@ -6450,6 +6954,50 @@
"key": "deviceId",
"value": "postman-device-android",
"type": "string"
},
{
"key": "supportTicketId",
"value": ""
},
{
"key": "supportMessageId",
"value": ""
},
{
"key": "supportSubject",
"value": "????? ?? ????? ??? ??? MP3"
},
{
"key": "supportMessage",
"value": "????? ??? ????? ???? ?? ??? ??? ????"
},
{
"key": "supportReplyMessage",
"value": "?? ?????? ??????? ????? ??? ???????."
},
{
"key": "supportCategory",
"value": "technical"
},
{
"key": "supportPriority",
"value": "normal"
},
{
"key": "supportStatus",
"value": "in_progress"
},
{
"key": "supportImagePath",
"value": ""
},
{
"key": "supportAdminId",
"value": ""
},
{
"key": "notificationCategory",
"value": "interactions"
}
]
}