From 7ac5565aeac7a4958e3f02002d43510b9d71f23e Mon Sep 17 00:00:00 2001 From: Artemy <109195690+stalcker2288969@users.noreply.github.com> Date: Thu, 24 Jul 2025 20:36:45 +0700 Subject: [PATCH] re --- endpoints/friendshipcontroller.md | 114 --------------------- endpoints/friendsrequestquerycontroller.md | 109 -------------------- 2 files changed, 223 deletions(-) delete mode 100644 endpoints/friendshipcontroller.md delete mode 100644 endpoints/friendsrequestquerycontroller.md diff --git a/endpoints/friendshipcontroller.md b/endpoints/friendshipcontroller.md deleted file mode 100644 index bb878cf..0000000 --- a/endpoints/friendshipcontroller.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -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/endpoints/friendsrequestquerycontroller.md b/endpoints/friendsrequestquerycontroller.md deleted file mode 100644 index 8db54ed..0000000 --- a/endpoints/friendsrequestquerycontroller.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -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.