diff --git a/code-docs/hubresult-less-than-t-greater-than.md b/docs/code-docs/hubresult-less-than-t-greater-than.md similarity index 100% rename from code-docs/hubresult-less-than-t-greater-than.md rename to docs/code-docs/hubresult-less-than-t-greater-than.md diff --git a/endpoints/authentication/README.md b/docs/endpoints/authentication/README.md similarity index 100% rename from endpoints/authentication/README.md rename to docs/endpoints/authentication/README.md diff --git a/endpoints/authentication/authcontroller.md b/docs/endpoints/authentication/authcontroller.md similarity index 100% rename from endpoints/authentication/authcontroller.md rename to docs/endpoints/authentication/authcontroller.md diff --git a/endpoints/authentication/refreshcontroller.md b/docs/endpoints/authentication/refreshcontroller.md similarity index 100% rename from endpoints/authentication/refreshcontroller.md rename to docs/endpoints/authentication/refreshcontroller.md diff --git a/endpoints/chatloadcontroller.md b/docs/endpoints/chatloadcontroller.md similarity index 100% rename from endpoints/chatloadcontroller.md rename to docs/endpoints/chatloadcontroller.md diff --git a/docs/endpoints/friendshipcontroller.md b/docs/endpoints/friendshipcontroller.md new file mode 100644 index 0000000..4ba6894 --- /dev/null +++ b/docs/endpoints/friendshipcontroller.md @@ -0,0 +1,114 @@ +--- +description: >- + Description: Controller for managing friendship-related operations, including + searching for users and retrieving the list of friends for the current user. +--- + +# FriendshipController + +### Controller Description + +* **Route**: `api/friends` +* **Authorize**: Requires authenticated user (`[Authorize]`). + +### Endpoints + +#### Search + +* **Description**: Searches for users based on a query string. +* **Route**: `[GET] api/friends/search?query=` +* **HTTP Method**: `GET` +* **Request**: + * **Query Parameter**: `query` (string, required) +* **Responses**: + * **200 OK**: Returns a list of matching users. + + ```json + [ + { + "id": "Guid", + "username": "string", + "description": "string", + "wasOnline": "DateTime", + "iconId": "Guid" + } + ] + ``` + * **400 Bad Request**: If the query is empty. + + ```json + "Query cannot be empty" + ``` + * **403 Forbidden**: If user lacks authorization. + + ```json + "string" + ``` + * **500 Internal Server Error**: Indicates an unexpected error. + + ```json + { + "error": "Internal error during user search." + } + ``` + +#### GetFriends + +* **Description**: Retrieves the list of friends for the authenticated user. +* **Route**: `[GET] api/friends` +* **HTTP Method**: `GET` +* **Request**: None +* **Responses**: + * **200 OK**: Returns a list of the user's friends or an empty list if none. + + ```json + [ + { + "id": "Guid", + "username": "string", + "description": "string", + "wasOnline": "DateTime", + "iconId": "Guid" + } + ] + ``` + * **403 Forbidden**: If user lacks authorization. + + ```json + "string" + ``` + * **500 Internal Server Error**: Indicates an unexpected error. + + ```json + { + "error": "Internal server error." + } + ``` + +### Data Models + +#### UserDto + +* **Description**: Data transfer object for user information. +* **Structure**: + + ```json + { + "id": "Guid", + "username": "string", + "description": "string", + "wasOnline": "DateTime", + "iconId": "Guid" + } + ``` + +### Error Handling + +* **Invalid User ID**: Handled by `ICurrentUserService`, aborts if invalid. +* **Invalid Operations**: Returns `400 Bad Request` for empty query. +* **Unexpected Errors**: Caught and returned as `500 Internal Server Error`. + +### Logging + +* Logs warnings for `SearchUsersException`. +* Logs errors for unexpected exceptions and `InvalidOperationException`. diff --git a/docs/endpoints/friendsrequestquerycontroller.md b/docs/endpoints/friendsrequestquerycontroller.md new file mode 100644 index 0000000..0af2473 --- /dev/null +++ b/docs/endpoints/friendsrequestquerycontroller.md @@ -0,0 +1,109 @@ +--- +description: >- + Description: Controller for querying friend request-related data, including + incoming friend requests and responses to sent friend requests. +--- + +# FriendsRequestQueryController + +### Controller Description + +* **Route**: `api/friends` +* **Authorize**: Requires authenticated user (`[Authorize]`). + +### Endpoints + +#### GetIncomingRequests + +* **Description**: Retrieves a list of incoming friend requests for the authenticated user. +* **Route**: `[GET] api/friends/requests` +* **HTTP Method**: `GET` +* **Request**: None +* **Responses**: + * **200 OK**: Returns a list of incoming friend requests or an empty list if none. + + ```json + [ + { + "id": "Guid", + "senderId": "Guid", + "receiverId": "Guid", + "status": "string", + "createdAt": "DateTime" + } + ] + ``` + * **403 Forbidden**: If user lacks authorization. + + ```json + "string" + ``` + * **500 Internal Server Error**: Indicates an unexpected error. + + ```json + { + "error": "Internal server error." + } + ``` + +#### GetResponses + +* **Description**: Retrieves a list of responses to the authenticated user's sent friend requests. +* **Route**: `[GET] api/friends/responses` +* **HTTP Method**: `GET` +* **Request**: None +* **Responses**: + * **200 OK**: Returns a list of friend request responses or an empty list if none. + + ```json + [ + { + "id": "Guid", + "senderId": "Guid", + "receiverId": "Guid", + "status": "string", + "createdAt": "DateTime" + } + ] + ``` + * **403 Forbidden**: If user lacks authorization. + + ```json + "string" + ``` + * **500 Internal Server Error**: Indicates an unexpected error. + + ```json + { + "error": "Internal server error." + } + ``` + +### Data Models + +#### FriendshipDto + +* **Description**: Data transfer object for friend request information. +* **Structure**: + + ```json + { + "id": "Guid", + "senderId": "Guid", + "receiverId": "Guid", + "status": "string", + "createdAt": "DateTime" + } + ``` + +### Error Handling + +* **Invalid User ID**: Handled by `ICurrentUserService`, aborts if invalid. +* **Invalid Operations**: Returns `200 OK` with an empty list for `InvalidOperationException`. +* **Unexpected Errors**: Caught and returned as `500 Internal Server Error`. + +### Logging + +* Logs warnings for `InvalidOperationException`. +* Logs information for successful response retrieval. +* Logs errors for unexpected exceptions. diff --git a/endpoints/mediacontroller.md b/docs/endpoints/mediacontroller.md similarity index 100% rename from endpoints/mediacontroller.md rename to docs/endpoints/mediacontroller.md diff --git a/endpoints/onlinepingingcontroller-ne-rabotaet.md b/docs/endpoints/onlinepingingcontroller-ne-rabotaet.md similarity index 100% rename from endpoints/onlinepingingcontroller-ne-rabotaet.md rename to docs/endpoints/onlinepingingcontroller-ne-rabotaet.md diff --git a/friendshub/README.md b/docs/friendshub/README.md similarity index 100% rename from friendshub/README.md rename to docs/friendshub/README.md diff --git a/friendshub/friendshub-client-java.md b/docs/friendshub/friendshub-client-java.md similarity index 100% rename from friendshub/friendshub-client-java.md rename to docs/friendshub/friendshub-client-java.md diff --git a/signalr/chathub.md b/docs/signalr/chathub.md similarity index 100% rename from signalr/chathub.md rename to docs/signalr/chathub.md diff --git a/signalr/presencehub.md b/docs/signalr/presencehub.md similarity index 100% rename from signalr/presencehub.md rename to docs/signalr/presencehub.md