From 20ada6f8d2cd1ee051a67d78d02e44d8a0a4ce24 Mon Sep 17 00:00:00 2001 From: BaggerFast Date: Mon, 3 Jun 2024 01:03:40 +0300 Subject: [PATCH] UPDATE: complete docs for analytics --- doc-app/docs/api/admin/domains.md | 4 +-- doc-app/docs/api/anonymous/redirects.md | 2 +- doc-app/docs/api/index.md | 1 + doc-app/docs/api/misc/errors.md | 17 +++++++++ doc-app/docs/api/user/analytics.md | 47 +++++++++++++++++++++++-- doc-app/docs/api/user/links.md | 16 ++++++++- doc-app/docs/api/user/subdomains.md | 2 ++ 7 files changed, 83 insertions(+), 6 deletions(-) diff --git a/doc-app/docs/api/admin/domains.md b/doc-app/docs/api/admin/domains.md index f9cbbc6..f7ec1f0 100644 --- a/doc-app/docs/api/admin/domains.md +++ b/doc-app/docs/api/admin/domains.md @@ -1,5 +1,4 @@ # Domains - In our system, "domains" are a carefully selected list of short domain names used to create shortened links. Shorter domain names greatly enhance the efficiency and brevity of our service. @@ -45,8 +44,8 @@ Shorter domain names greatly enhance the efficiency and brevity of our service. - [Not valid](../misc/errors.md#notvalid) - [Too many records](../misc/errors.md#tomanyrecords) + ## GET -Get all domains - Method: `GET` - Url: `/api/v1/domains` @@ -67,6 +66,7 @@ Get all domains } ``` + ## DELETE / `{id}` - Method: `DELETE` - Url: `/api/v1/domains/{id}` diff --git a/doc-app/docs/api/anonymous/redirects.md b/doc-app/docs/api/anonymous/redirects.md index 45f9e24..18c8b81 100644 --- a/doc-app/docs/api/anonymous/redirects.md +++ b/doc-app/docs/api/anonymous/redirects.md @@ -73,7 +73,7 @@ This entity records all user interactions with shortened links, collecting infor ### Example ```http -GET {{url}}/api/v1/redirects/link?domain=sh0.su&path=ml6v1s +GET /api/v1/redirects/link?domain=sh0.su&path=ml6v1s ``` ### Errors diff --git a/doc-app/docs/api/index.md b/doc-app/docs/api/index.md index 0b3b2a1..9e94c74 100644 --- a/doc-app/docs/api/index.md +++ b/doc-app/docs/api/index.md @@ -24,4 +24,5 @@ are omitted from this documentation. ## Future soon - Postgres +- Redis - Easy deploy \ No newline at end of file diff --git a/doc-app/docs/api/misc/errors.md b/doc-app/docs/api/misc/errors.md index 6b39e01..1667b3a 100644 --- a/doc-app/docs/api/misc/errors.md +++ b/doc-app/docs/api/misc/errors.md @@ -14,6 +14,7 @@ Record by id not found } ``` + ## IsUsing The record cannot be deleted because it is referenced by other records. - HttpCode: `409` @@ -26,6 +27,7 @@ The record cannot be deleted because it is referenced by other records. } ``` + ## NotUnique The record cannot be created, because not unique - HttpCode: `409` @@ -38,6 +40,7 @@ The record cannot be created, because not unique } ``` + ## ToManyRecords The record cannot be created because the maximum count has been reached - HttpCode: `422` @@ -51,6 +54,7 @@ The record cannot be created because the maximum count has been reached } ``` + ## NotValid The record is invalid - HttpCode: `422` @@ -62,4 +66,17 @@ The record is invalid "error": "BODY_NOT_VALID", "invalidFields": ["field1", "field2"] } +``` + + +## FkNotFound +Foreign key record not found +- HttpCode: `404` +- On: `POST` `PUT` `GET` + +### Example +```json +{ + "error": "NESTED_RECORD_NOT_FOUND" +} ``` \ No newline at end of file diff --git a/doc-app/docs/api/user/analytics.md b/doc-app/docs/api/user/analytics.md index 1e8a3f6..a79634b 100644 --- a/doc-app/docs/api/user/analytics.md +++ b/doc-app/docs/api/user/analytics.md @@ -1,10 +1,53 @@ -# Analytics +# Link Analytics +Track metrics of links such as devices, os system, unique views and etc. ### Base requirements - Auth: `Bearer token` ## GET +- Url: `/api/v1/user/links/{id}/analytics` - Method: `GET` +### Response (200) + +```json +{ + "data": { + "statistics": { + "views": 2, + "uniqueViews": 1 + }, + "devicesData": { + "os": [ + { + "label": "windows", + "value": 2 + } + ], + "device": [ + { + "label": "Mobile", + "value": 2 + } + ] + }, + "viewsData": [ + { + "label": "2024-05-26", + "value": 2 + } + ] + } +} +``` + +### Errors +- [Not found](../misc/errors.md#errors) + + ## DELETE / `{id}` -- Method: `DELETE` \ No newline at end of file +- Method: `DELETE` +- Url: `/api/v1/user/links/{id}/analytics` + +### Errors +- [Not found](../misc/errors.md#errors) \ No newline at end of file diff --git a/doc-app/docs/api/user/links.md b/doc-app/docs/api/user/links.md index 1bf5a04..b90421b 100644 --- a/doc-app/docs/api/user/links.md +++ b/doc-app/docs/api/user/links.md @@ -9,14 +9,28 @@ The entire service operates around this core entity! - Method: `POST` - Max elements for user: `100` + ## GET - Method: `GET` + ## GET / `{id}` - Method: `GET` +### Errors +- [Not found](../misc/errors.md#errors) + + ## UPDATE / `{id}` - Method: `PUT` +### Errors +- [Not found](../misc/errors.md#errors) + + ## DELETE / `{id}` -- Method: `DELETE` \ No newline at end of file +- Method: `DELETE` +- Url: `/api/v1/user/links/{id}` + +### Errors +- [Not found](../misc/errors.md#errors) \ No newline at end of file diff --git a/doc-app/docs/api/user/subdomains.md b/doc-app/docs/api/user/subdomains.md index 023ee10..9e74642 100644 --- a/doc-app/docs/api/user/subdomains.md +++ b/doc-app/docs/api/user/subdomains.md @@ -45,6 +45,7 @@ Subdomains are important because all users interact with them directly, bypassin - [Not unique](../misc/errors.md#notunique) - [Not valid](../misc/errors.md#notvalid) - [Too many records](../misc/errors.md#tomanyrecords) +- [Nested record not found](../misc/errors.md#fknotfound) ## GET @@ -84,6 +85,7 @@ Get all user domains data } ``` + ## DELETE / `{id}` - Method: `DELETE` - Url: `/api/v1/user/subdomains`