Added measurements, and devices statsh

Added stats endpoints
This commit is contained in:
Nedim
2023-10-20 12:03:59 +02:00
parent 6892c56c1e
commit d40b225e4e
12 changed files with 1120 additions and 5 deletions

View File

@@ -11,7 +11,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/dashboard/map/contract/devices?contract_id=1",
"raw": "{{URL}}/dashboard/map/contract/devices?contract_id=2",
"host": [
"{{URL}}"
],
@@ -24,7 +24,7 @@
"query": [
{
"key": "contract_id",
"value": "1"
"value": "2"
}
]
}
@@ -611,7 +611,7 @@
]
},
{
"name": "Get Notifications",
"name": "Get notifications",
"request": {
"method": "GET",
"header": [],
@@ -699,6 +699,589 @@
}
]
},
{
"name": "Stats measurements",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/notifications?user_id=1&time=1656192796",
"host": [
"{{URL}}"
],
"path": [
"notifications"
],
"query": [
{
"key": "user_id",
"value": "1"
},
{
"key": "time",
"value": "1656192796"
}
]
}
},
"response": [
{
"name": "Stats devices",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/measurements?company_id=1",
"host": [
"{{URL}}"
],
"path": [
"stats",
"measurements"
],
"query": [
{
"key": "company_id",
"value": "1"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Access-Control-Allow-Credentials",
"value": "true"
},
{
"key": "Access-Control-Allow-Headers",
"value": "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With"
},
{
"key": "Access-Control-Allow-Methods",
"value": "POST, OPTIONS, GET, PUT"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"key": "Date",
"value": "Mon, 23 Oct 2023 16:19:08 GMT"
},
{
"key": "Content-Length",
"value": "11"
}
],
"cookie": [],
"body": "{\n \"data\": 19\n}"
}
]
},
{
"name": "Stats Devices",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/devices?company_id=1&start_time=1648155072000&end_time=1698155072000",
"host": [
"{{URL}}"
],
"path": [
"stats",
"devices"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "1648155072000"
},
{
"key": "end_time",
"value": "1698155072000"
}
]
}
},
"response": [
{
"name": "Stats Devices",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/devices?company_id=1&start_time=1689955072&end_time=1699155072",
"host": [
"{{URL}}"
],
"path": [
"stats",
"devices"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "1689955072"
},
{
"key": "end_time",
"value": "1699155072"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Access-Control-Allow-Credentials",
"value": "true"
},
{
"key": "Access-Control-Allow-Headers",
"value": "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With"
},
{
"key": "Access-Control-Allow-Methods",
"value": "POST, OPTIONS, GET, PUT"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"key": "Date",
"value": "Tue, 24 Oct 2023 16:03:51 GMT"
},
{
"key": "Content-Length",
"value": "209"
}
],
"cookie": [],
"body": "{\n \"data\": {\n \"breached\": 5,\n \"normal\": 1,\n \"monthly_counts\": {\n \"2023-07\": {\n \"inRange\": 0,\n \"outOfRange\": 0\n },\n \"2023-08\": {\n \"inRange\": 1,\n \"outOfRange\": 5\n },\n \"2023-09\": {\n \"inRange\": 0,\n \"outOfRange\": 0\n },\n \"2023-10\": {\n \"inRange\": 0,\n \"outOfRange\": 0\n }\n }\n }\n}"
}
]
},
{
"name": "Stats contracts",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/contracts?company_id=1&start_time=1&end_time=9999999999",
"host": [
"{{URL}}"
],
"path": [
"stats",
"contracts"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "1"
},
{
"key": "end_time",
"value": "9999999999"
}
]
}
},
"response": [
{
"name": "Stats contracts",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/contracts?company_id=1&start_time=1689955072&end_time=1699155072",
"host": [
"{{URL}}"
],
"path": [
"stats",
"contracts"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "1689955072"
},
{
"key": "end_time",
"value": "1699155072"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Access-Control-Allow-Credentials",
"value": "true"
},
{
"key": "Access-Control-Allow-Headers",
"value": "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With"
},
{
"key": "Access-Control-Allow-Methods",
"value": "POST, OPTIONS, GET, PUT"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"key": "Date",
"value": "Tue, 24 Oct 2023 16:03:34 GMT"
},
{
"key": "Content-Length",
"value": "230"
}
],
"cookie": [],
"body": "{\n \"data\": {\n \"active\": 1,\n \"executed\": 1,\n \"monthly\": {\n \"2023-07\": {\n \"active\": 0,\n \"executed\": 0,\n \"total\": 0\n },\n \"2023-08\": {\n \"active\": 1,\n \"executed\": 1,\n \"total\": 2\n },\n \"2023-09\": {\n \"active\": 0,\n \"executed\": 0,\n \"total\": 0\n },\n \"2023-10\": {\n \"active\": 0,\n \"executed\": 0,\n \"total\": 0\n }\n }\n }\n}"
}
]
},
{
"name": "Milestones",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/milestones?company_id=1&start_time=1689955072&end_time=1699155072",
"host": [
"{{URL}}"
],
"path": [
"stats",
"milestones"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "1689955072"
},
{
"key": "end_time",
"value": "1699155072"
}
]
}
},
"response": [
{
"name": "Milestones",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/milestones?company_id=1&start_time=1&end_time=9999999999",
"host": [
"{{URL}}"
],
"path": [
"stats",
"milestones"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "1"
},
{
"key": "end_time",
"value": "9999999999"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Access-Control-Allow-Credentials",
"value": "true"
},
{
"key": "Access-Control-Allow-Headers",
"value": "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With"
},
{
"key": "Access-Control-Allow-Methods",
"value": "POST, OPTIONS, GET, PUT"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"key": "Date",
"value": "Mon, 23 Oct 2023 16:13:13 GMT"
},
{
"key": "Content-Length",
"value": "10"
}
],
"cookie": [],
"body": "{\n \"data\": 5\n}"
}
]
},
{
"name": "Stats contracts total",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/contracts/total?company_id=1&start_time=0&end_time=999999999999",
"host": [
"{{URL}}"
],
"path": [
"stats",
"contracts",
"total"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "0"
},
{
"key": "end_time",
"value": "999999999999"
}
]
}
},
"response": [
{
"name": "Stats contracts total",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/contracts/total?company_id=1&start_time=0&end_time=999999999999",
"host": [
"{{URL}}"
],
"path": [
"stats",
"contracts",
"total"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "0"
},
{
"key": "end_time",
"value": "999999999999"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Access-Control-Allow-Credentials",
"value": "true"
},
{
"key": "Access-Control-Allow-Headers",
"value": "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With"
},
{
"key": "Access-Control-Allow-Methods",
"value": "POST, OPTIONS, GET, PUT"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"key": "Date",
"value": "Mon, 23 Oct 2023 16:19:15 GMT"
},
{
"key": "Content-Length",
"value": "10"
}
],
"cookie": [],
"body": "{\n \"data\": 2\n}"
}
]
},
{
"name": "Invoices",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/invoices?company_id=1&start_time=1689955072&end_time=1699155072",
"host": [
"{{URL}}"
],
"path": [
"stats",
"invoices"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "1689955072"
},
{
"key": "end_time",
"value": "1699155072"
}
]
}
},
"response": [
{
"name": "Invoices",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/stats/invoices?company_id=1&start_time=1689955072&end_time=1699155072",
"host": [
"{{URL}}"
],
"path": [
"stats",
"invoices"
],
"query": [
{
"key": "company_id",
"value": "1"
},
{
"key": "start_time",
"value": "1689955072"
},
{
"key": "end_time",
"value": "1699155072"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Access-Control-Allow-Credentials",
"value": "true"
},
{
"key": "Access-Control-Allow-Headers",
"value": "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With"
},
{
"key": "Access-Control-Allow-Methods",
"value": "POST, OPTIONS, GET, PUT"
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"key": "Date",
"value": "Tue, 24 Oct 2023 16:02:48 GMT"
},
{
"key": "Content-Length",
"value": "257"
}
],
"cookie": [],
"body": "{\n \"data\": {\n \"issued\": 1,\n \"claimed\": 1,\n \"monthly\": {\n \"2023-07\": {\n \"insurance_claimed\": 0,\n \"invoice_issued\": 0\n },\n \"2023-08\": {\n \"insurance_claimed\": 1,\n \"invoice_issued\": 1\n },\n \"2023-09\": {\n \"insurance_claimed\": 0,\n \"invoice_issued\": 0\n },\n \"2023-10\": {\n \"insurance_claimed\": 0,\n \"invoice_issued\": 0\n }\n }\n }\n}"
}
]
},
{
"name": "Save device info",
"request": {