diff --git a/README.md b/README.md index 91b76fd..9058195 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,17 @@ Reddit Clone REST API with Microservices Architecture Using gRPC ## 🚀 Overview *Threadit* is cloud native application that offers a set of services that provide users the ability to connect, share and engage in discussions within communities through a REST API. -Its architecture will follow a microservices model with gRPC communication and be deployed on Google Cloud Platform (GCP) with Kubernetes. +Its architecture follows a microservices model with gRPC communication and will be deployed on Google Cloud Platform (GCP) with Kubernetes. + +## 🌐 API Description + +Threadit provides a set of endpoints to interact with communities, threads, comments and more. A detailed documentation of all endpoints can be found [here](./docs/openapi). + +We also make available a [collection](https://grupo-8-0813.postman.co/workspace/f8d9d9ba-0d5a-42e6-851c-c4c77649f095/collection/34079154-e136d7b1-05c1-4e8f-bcf9-00d6b3f6b65c) in postman to make it easier to test the API. + +## 📦 Application Architecture + +![application architecture](./docs/images/architecture.png) ## 🔍 Development Phases @@ -37,8 +47,4 @@ Its architecture will follow a microservices model with gRPC communication and b - [Phase 7 - Implementation and Scripted Deployment of Previous Phase](./docs/phases/phase7.md) - [Phase 8 - Automation with CI/CD](./docs/phases/phase8.md) - [Phase 9 - System Testing](./docs/phases/phase9.md) -- [Phase 10 - Final Report](./docs/phases/phase10.md) - -## 📦 Application Architecture - -![application architecture](./docs/images/architecture.png) \ No newline at end of file +- [Phase 10 - Final Report](./docs/phases/phase10.md) \ No newline at end of file diff --git a/code/generate-openapi.sh b/code/generate-openapi.sh index 7df290d..746515e 100644 --- a/code/generate-openapi.sh +++ b/code/generate-openapi.sh @@ -19,7 +19,7 @@ generate_openapi_for_service() { PROTO_DIR="$SCRIPT_DIR/proto" GOOGLE_API_DIR="$PROTO_DIR/google/api" PROTO_FILE="$PROTO_DIR/${SERVICE_NAME}.proto" - OUT_DIR="$SCRIPT_DIR/../docs/openapi/gen" + OUT_DIR="$SCRIPT_DIR/../docs/openapi" # check if the .proto file exists if [ ! -f "$PROTO_FILE" ]; then @@ -32,9 +32,6 @@ generate_openapi_for_service() { # create output directory if it doesn't exist mkdir -p "$OUT_DIR" - # clean up existing generated OpenAPI file - rm -f "$OUT_DIR/${SERVICE_NAME}.swagger.json" - # run protoc with grpc-gateway's OpenAPI plugin (Swagger 2.0) protoc \ --openapiv2_out="$OUT_DIR" \ @@ -46,8 +43,8 @@ generate_openapi_for_service() { # Convert Swagger 2.0 JSON to OpenAPI 3.1.0 YAML using swagger2openapi swagger2openapi -o "$OUT_DIR/${SERVICE_NAME}.yaml" "$OUT_DIR/${SERVICE_NAME}.swagger.json" - # Optionally, remove the JSON file if it's no longer needed - rm "$OUT_DIR/${SERVICE_NAME}.swagger.json" + # Remove the JSON file + rm -f "$OUT_DIR/${SERVICE_NAME}.swagger.json" echo "✅ OpenAPI spec generated at docs/openapi/gen/${SERVICE_NAME}.yaml" } diff --git a/docs/openapi/README.md b/docs/openapi/README.md new file mode 100644 index 0000000..f2fd2b6 --- /dev/null +++ b/docs/openapi/README.md @@ -0,0 +1,282 @@ +## 🌐 API Description + +#### `GET /communities` + +Retrieves a list of communities. Supports optional filtering and pagination. + +**Query Parameters**: +- `name` (string, optional): Filter communities by name. +- `offset` (int32, optional): Number of items to skip (for pagination). +- `limit` (int32, optional): Maximum number of communities to return. + +--- + +#### `POST /communities` + +Creates a new community with the given name. + +**Request Body** (JSON): +- `name` (string): Name of the new community. + +--- + +#### `GET /communities/{id}` + +Retrieves details of a specific community by ID. + +**Path Parameters**: +- `id` (string, required): ID of the community. + +--- + +#### `DELETE /communities/{id}` + +Deletes a community by ID. + +**Path Parameters**: +- `id` (string, required): ID of the community. + +--- + +#### `PATCH /communities/{id}` + +Updates a community's name or thread count offset. + +**Path Parameters**: +- `id` (string, required): ID of the community. + +**Request Body** (JSON): +- `name` (string, optional): New name of the community. +- `numThreadsOffset` (int32, optional): Change in number of threads. + +--- + +#### `GET /threads` + +Retrieves a list of threads. Supports filtering and pagination. + +**Query Parameters**: +- `communityId` (string, optional): Filter threads by community ID. +- `title` (string, optional): Filter threads by title. +- `offset` (int32, optional): Number of items to skip. +- `limit` (int32, optional): Maximum number of threads to return. +- `sortBy` (string, optional): Sorting criteria. + +--- + +#### `POST /threads` + +Creates a new thread. + +**Request Body** (JSON): +- `communityId` (string): ID of the community the thread belongs to. +- `title` (string): Title of the thread. +- `content` (string): Content of the thread. + +--- + +#### `GET /threads/{id}` + +Retrieves details of a specific thread by ID. + +**Path Parameters**: +- `id` (string, required): ID of the thread. + +--- + +#### `DELETE /threads/{id}` + +Deletes a thread by ID. + +**Path Parameters**: +- `id` (string, required): ID of the thread. + +--- + +#### `PATCH /threads/{id}` + +Updates fields of a thread. + +**Path Parameters**: +- `id` (string, required): ID of the thread. + +**Request Body** (JSON): +- `title` (string, optional): New title. +- `content` (string, optional): New content. +- `voteOffset` (int32, optional): Change in up/down votes. +- `numCommentsOffset` (int32, optional): Change in number of comments. + +--- + +#### `GET /comments` + +Retrieve a list of comments filtered by optional query parameters. + +**Query Parameters:** + +- `threadId` (string, optional): Filter comments by thread ID. +- `offset` (integer, optional): Pagination offset. +- `limit` (integer, optional): Pagination limit. +- `sortBy` (string, optional): Sort order or field. + +--- + +#### `POST /comments` + +Create a new comment. + +**Request Body** (JSON): + +- `content` (string): The text content of the comment. +- `parentId` (string, optional): The ID of the parent comment or thread. +- `parentType` (enum: `THREAD`, `COMMENT`): Type of the parent entity. + +--- + +#### `GET /comments/{id}` + +Retrieve a specific comment by its ID. + +**Path Parameters:** + +- `id` (string, required): The comment ID. + +--- + +#### `DELETE /comments/{id}` + +Delete a specific comment by its ID. + +**Path Parameters:** + +- `id` (string, required): The comment ID. + +--- + +#### `PATCH /comments/{id}` + +Update fields of a specific comment. + +**Path Parameters:** + +- `id` (string, required): The comment ID. + +**Request Body:** + +- `content` (string, optional): New content for the comment. +- `voteOffset` (integer, optional): Change in up/down votes. +- `numCommentsOffset` (integer, optional): Change in number of comments. + +--- + +#### `POST /votes/comment/{commentId}/down` + +Downvote a comment by its ID. + +**Path Parameters:** + +- `commentId` (string, required): The ID of the comment to downvote. + +**Request Body** (JSON): + +- Empty object (no fields required). + +--- + +#### `POST /votes/comment/{commentId}/up` + +Upvote a comment by its ID. + +**Path Parameters:** + +- `commentId` (string, required): The ID of the comment to upvote. + +**Request Body** (JSON): + +- Empty object (no fields required). + +--- + +#### `POST /votes/thread/{threadId}/down` + +Downvote a thread by its ID. + +**Path Parameters:** + +- `threadId` (string, required): The ID of the thread to downvote. + +**Request Body** (JSON): + +- Empty object (no fields required). + +--- + +#### `POST /votes/thread/{threadId}/up` + +Upvote a thread by its ID. + +**Path Parameters:** + +- `threadId` (string, required): The ID of the thread to upvote. + +**Request Body** (JSON): + +- Empty object (no fields required). + +--- + +#### `GET /search` + +Search across threads and communities globally. + +**Query Parameters:** + +- `query` (string, optional): Search keyword or phrase. +- `offset` (integer, optional): Pagination offset. +- `limit` (integer, optional): Maximum number of results to return. + +--- + +#### `GET /search/community` + +Search for communities matching the query. + +**Query Parameters:** + +- `query` (string, optional): Search keyword or phrase for communities. +- `offset` (integer, optional): Pagination offset. +- `limit` (integer, optional): Maximum number of results to return. + +--- + +#### `GET /search/thread` + +Search for threads matching the query. + +**Query Parameters:** + +- `query` (string, optional): Search keyword or phrase for threads. +- `offset` (integer, optional): Pagination offset. +- `limit` (integer, optional): Maximum number of results to return. + +--- + +#### `GET /popular/comments` + +Retrieve a list of popular comments. + +**Query Parameters:** + +- `offset` (integer, optional): Pagination offset for the results. +- `limit` (integer, optional): Maximum number of comments to return. + +--- + +#### `GET /popular/threads` + +Retrieve a list of popular threads. + +**Query Parameters:** + +- `offset` (integer, optional): Pagination offset for the results. +- `limit` (integer, optional): Maximum number of threads to return. \ No newline at end of file diff --git a/docs/openapi/archive/comment-service.yaml b/docs/openapi/archive/comment-service.yaml deleted file mode 100644 index 616813e..0000000 --- a/docs/openapi/archive/comment-service.yaml +++ /dev/null @@ -1,207 +0,0 @@ -openapi: 3.1.0 -info: - title: CommentService API - description: API for managing comments and replies in the Threadit application. - version: 1.0.0 -servers: - - url: https://api.example.com/v1 - description: Production server - - url: http://localhost:8000 - description: Local server -tags: - - name: Comments - description: Operations related to comments -paths: - /comments: - get: - summary: Retrieve multiple comments - operationId: listComments - tags: - - Comments - parameters: - - name: post_id - in: query - description: Retrieve comments for a specific post ID - required: true - schema: - type: string - format: uuid - - name: offset - in: query - description: Number of items to skip - required: false - schema: - type: integer - minimum: 0 - default: 0 - - name: limit - in: query - description: Maximum number of items to retrieve - required: false - schema: - type: integer - minimum: 1 - default: 10 - responses: - "200": - description: List of comments - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Comment" - "400": - description: Invalid request format - post: - summary: Create a new comment on a post - operationId: createComment - tags: - - Comments - security: - - bearerAuth: [] - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/CommentCreate" - responses: - "201": - description: Comment created - content: - application/json: - schema: - $ref: "#/components/schemas/Comment" - "400": - description: Invalid request format - "401": - description: Unauthorized access - /comments/{id}: - get: - summary: Retrieve a specific comment - operationId: getComment - tags: - - Comments - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - responses: - "200": - description: Comment details - content: - application/json: - schema: - $ref: "#/components/schemas/Comment" - "404": - description: Comment not found - put: - summary: Update a comment - operationId: updateComment - tags: - - Comments - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/CommentUpdate" - responses: - "200": - description: Comment updated - content: - application/json: - schema: - $ref: "#/components/schemas/Comment" - "400": - description: Invalid request format - "401": - description: Unauthorized access - "404": - description: Comment not found - delete: - summary: Delete a comment - operationId: deleteComment - tags: - - Comments - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - responses: - "204": - description: Comment deleted - "400": - description: Invalid request format - "401": - description: Unauthorized access - "404": - description: Comment not found - -components: - schemas: - Comment: - type: object - properties: - id: - type: string - format: uuid - post_id: - type: string - format: uuid - content: - type: string - parent_id: - type: string - format: uuid - nullable: true - created_at: - type: string - format: date-time - CommentCreate: - type: object - required: - - post_id - - content - properties: - post_id: - type: string - format: uuid - content: - type: string - maxLength: 500 - parent_id: - type: string - format: uuid - nullable: true - CommentUpdate: - type: object - required: - - content - properties: - content: - type: string - maxLength: 500 - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT \ No newline at end of file diff --git a/docs/openapi/archive/community-service.yaml b/docs/openapi/archive/community-service.yaml deleted file mode 100644 index beacea4..0000000 --- a/docs/openapi/archive/community-service.yaml +++ /dev/null @@ -1,413 +0,0 @@ -openapi: 3.1.0 -info: - title: CommunityService API - description: API for managing communities in the Threadit application. - version: 1.0.0 -servers: - - url: https://api.example.com/v1 - description: Production server - - url: http://localhost:8000 - description: Local server -tags: - - name: Communities - description: Operations related to communities -paths: - /communities: - get: - summary: Get a paginated list of communities - operationId: listCommunities - tags: - - Communities - parameters: - - name: page - in: query - description: Page number - required: false - schema: - type: integer - default: 1 - - name: page_size - in: query - description: Number of items per page - required: false - schema: - type: integer - default: 10 - - name: owner_id - in: query - description: Filter by owner ID - required: false - schema: - type: string - format: uuid - - name: search - in: query - description: Search by name or description - required: false - schema: - type: string - - name: sort - in: query - description: Sort by field - required: false - schema: - type: string - enum: [created_at, updated_at] - default: created_at - - name: order - in: query - description: Sort order - required: false - schema: - type: string - enum: [asc, desc] - default: desc - responses: - "200": - description: List of communities - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - $ref: "#/components/schemas/Community" - pagination: - $ref: "#/components/schemas/Pagination" - post: - summary: Create a new community - operationId: createCommunity - tags: - - Communities - security: - - bearerAuth: [] - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/CommunityCreate" - responses: - "201": - description: Community created - content: - application/json: - schema: - $ref: "#/components/schemas/Community" - "400": - description: Request syntax is invalid - "401": - description: Token missing or invalid - "409": - description: Community name already exists - "422": - description: Data validation failed - /communities/{id}: - get: - summary: Get details of a specific community - operationId: getCommunity - tags: - - Communities - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - responses: - "200": - description: Community details - content: - application/json: - schema: - $ref: "#/components/schemas/Community" - "404": - description: Community not found - put: - summary: Update an existing community - operationId: updateCommunity - tags: - - Communities - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/CommunityUpdate" - responses: - "200": - description: Community updated - content: - application/json: - schema: - $ref: "#/components/schemas/Community" - "400": - description: Request syntax is invalid - "401": - description: Token missing or invalid - "403": - description: Action forbidden for user - "404": - description: Community not found - "422": - description: Data validation failed - delete: - summary: Delete a community - operationId: deleteCommunity - tags: - - Communities - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - responses: - "204": - description: Community deleted - "401": - description: Token missing or invalid - "403": - description: Action forbidden for user - "404": - description: Community not found - /communities/{id}/icon: - post: - summary: Upload an icon for a community - operationId: uploadCommunityIcon - tags: - - Communities - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - requestBody: - required: true - content: - multipart/form-data: - schema: - type: object - properties: - icon: - type: string - format: binary - responses: - "200": - description: Community icon uploaded - content: - application/json: - schema: - $ref: "#/components/schemas/Community" - "400": - description: Request syntax is invalid - "401": - description: Token missing or invalid - "403": - description: Action forbidden for user - "404": - description: Community not found - "422": - description: Data validation failed - /communities/{id}/join: - post: - summary: Join a community - operationId: joinCommunity - tags: - - Communities - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - responses: - "200": - description: User joined community - content: - application/json: - schema: - $ref: "#/components/schemas/Community" - "401": - description: Token missing or invalid - "403": - description: Action forbidden for user - "404": - description: Community not found - "409": - description: User already in community - /communities/{id}/leave: - post: - summary: Leave a community - operationId: leaveCommunity - tags: - - Communities - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - responses: - "200": - description: User left community - content: - application/json: - schema: - $ref: "#/components/schemas/Community" - "401": - description: Token missing or invalid - "403": - description: Action forbidden for user - "404": - description: Community not found or user not in community - "409": - description: User is the owner of the community - /communities/{id}/members: - get: - summary: Get a paginated list of community members - operationId: listCommunityMembers - tags: - - Communities - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - - name: page - in: query - description: Page number - required: false - schema: - type: integer - default: 1 - - name: page_size - in: query - description: Number of items per page - required: false - schema: - type: integer - default: 10 - responses: - "200": - description: List of community members - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - $ref: "#/components/schemas/Member" - pagination: - $ref: "#/components/schemas/Pagination" - "401": - description: Token missing or invalid - "403": - description: Action forbidden for user - "404": - description: Community not found -components: - schemas: - Pagination: - type: object - properties: - current_page: - type: integer - per_page: - type: integer - total_items: - type: integer - total_pages: - type: integer - Community: - type: object - properties: - id: - type: string - format: uuid - owner_id: - type: string - format: uuid - name: - type: string - description: - type: string - icon_url: - type: string - format: uri - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - CommunityCreate: - type: object - required: - - name - - description - properties: - name: - type: string - description: - type: string - CommunityUpdate: - type: object - properties: - name: - type: string - description: - type: string - Member: - type: object - properties: - id: - type: string - format: uuid - username: - type: string - avatar_url: - type: string - format: uri - joined_at: - type: string - format: date-time - created_at: - type: string - format: date-time - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT diff --git a/docs/openapi/archive/popular-service.yaml b/docs/openapi/archive/popular-service.yaml deleted file mode 100644 index 3618f11..0000000 --- a/docs/openapi/archive/popular-service.yaml +++ /dev/null @@ -1,111 +0,0 @@ -openapi: 3.1.0 -info: - title: PopularService API - description: API for retrieving popular threads and comments in the Threadit application. - version: 1.0.0 -servers: - - url: https://api.example.com/v1 - description: Production server - - url: http://localhost:8000 - description: Local server -tags: - - name: Popular - description: Operations related to popular threads and comments -paths: - /popular/threads: - get: - summary: Retrieve popular threads - operationId: getPopularThreads - tags: - - Popular - parameters: - - name: offset - in: query - description: Number of items to skip - required: false - schema: - type: integer - minimum: 0 - default: 0 - - name: limit - in: query - description: Maximum number of items to retrieve - required: false - schema: - type: integer - minimum: 1 - default: 10 - responses: - "200": - description: List of popular threads - content: - application/json: - schema: - type: object - properties: - threads: - type: array - items: - $ref: "#/components/schemas/Thread" - "400": - description: Invalid request format - /popular/comments: - get: - summary: Retrieve popular comments - operationId: getPopularComments - tags: - - Popular - parameters: - - name: offset - in: query - description: Number of items to skip - required: false - schema: - type: integer - minimum: 0 - default: 0 - - name: limit - in: query - description: Maximum number of items to retrieve - required: false - schema: - type: integer - minimum: 1 - default: 10 - responses: - "200": - description: List of popular comments - content: - application/json: - schema: - type: object - properties: - comments: - type: array - items: - $ref: "#/components/schemas/Comment" - "400": - description: Invalid request format - -components: - schemas: - Thread: - type: object - properties: - id: - type: string - format: uuid - title: - type: string - votes: - type: integer - Comment: - type: object - properties: - id: - type: string - format: uuid - content: - type: string - votes: - type: integer \ No newline at end of file diff --git a/docs/openapi/archive/search-service.yaml b/docs/openapi/archive/search-service.yaml deleted file mode 100644 index c148168..0000000 --- a/docs/openapi/archive/search-service.yaml +++ /dev/null @@ -1,227 +0,0 @@ -openapi: 3.1.0 -info: - title: SearchService API - description: API for searching in the Threadit application. - version: 1.0.0 -servers: - - url: https://api.example.com/v1 - description: Production server - - url: http://localhost:8000 - description: Local server -tags: - - name: Search - description: Operations related to searching -paths: - /search: - get: - operationId: globalSearch - tags: - - search-service - summary: "Global Search" - responses: - "200": - description: The request was successful, and the server has returned the - requested resource in the response body. - content: - application/json: - schema: - $ref: "#/components/schemas/GlobalSearchResponse" - "400": - $ref: "#/components/responses/BadRequest" - parameters: - - in: query - name: q - required: true - style: form - description: Query - explode: true - schema: - type: string - allowReserved: false - /search/users: - get: - operationId: searchUsers - tags: - - search-service - summary: Search Users - responses: - "200": - description: The request was successful, and the server has returned the - requested resource in the response body. - content: - application/json: - schema: - $ref: "#/components/schemas/SearchResponse" - "400": - $ref: "#/components/responses/BadRequest" - parameters: - - in: query - name: q - required: true - style: form - description: Query - explode: true - schema: - type: string - allowReserved: false - /search/communities: - get: - operationId: searchCommunities - tags: - - search-service - summary: Search Communities - responses: - "200": - description: The request was successful, and the server has returned the - requested resource in the response body. - content: - application/json: - schema: - $ref: "#/components/schemas/SearchResponse" - "400": - $ref: "#/components/responses/BadRequest" - parameters: - - in: query - name: q - required: true - style: form - description: Query - explode: true - schema: - type: string - allowReserved: false - /search/threads: - get: - operationId: searchThreads - tags: - - search-service - summary: Search Threads - responses: - "200": - description: The request was successful, and the server has returned the - requested resource in the response body. - content: - application/json: - schema: - type: object - properties: - data: - $ref: "#/components/schemas/SearchResponse" - required: - - data - "400": - $ref: "#/components/responses/BadRequest" - parameters: - - in: query - name: q - required: true - style: form - description: Query - explode: true - schema: - type: string - allowReserved: false -components: - schemas: - GlobalSearchResponse: - type: object - properties: - users: - type: array - items: - type: string - communities: - type: array - items: - type: string - threads: - type: array - items: - type: string - required: - - users - - communities - - threads - description: Returns an object with search results of users, communities and threads - SearchResponse: - type: array - items: - type: string - description: Returns the search results - responses: - Conflict: - content: - application/json: - schema: - type: object - required: - - message - properties: - message: - type: string - description: The request could not be completed due to a conflict with the - current state of the resource. Resolve the conflict and try again. - BadRequest: - content: - application/json: - schema: - type: object - required: - - message - properties: - errors: - type: array - items: - type: object - required: - - message - properties: - message: - type: string - message: - type: string - description: The server could not understand the request due to invalid syntax. - The client should modify the request and try again. - Unauthorized: - content: - application/json: - schema: - type: object - required: - - message - properties: - message: - type: string - description: Authentication is required to access the requested resource. The - client must include the appropriate credentials. - NotFound: - description: The server cannot find the requested resource. The endpoint may be - invalid or the resource may no longer exist. - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - InternalServerErrror: - description: The server encountered an unexpected condition that prevented it - from fulfilling the request. Report the issue to the support team if it - persists. - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - securitySchemes: - bearerAuth: - type: http - scheme: bearer - description: Authentication Token - bearerFormat: JWT \ No newline at end of file diff --git a/docs/openapi/archive/thread-service.yaml b/docs/openapi/archive/thread-service.yaml deleted file mode 100644 index 2a5cc51..0000000 --- a/docs/openapi/archive/thread-service.yaml +++ /dev/null @@ -1,254 +0,0 @@ -openapi: 3.1.0 -info: - title: ThreadService API - description: API for managing threads in the Threadit application. - version: 1.0.0 -servers: - - url: https://api.example.com/v1 - description: Production server - - url: http://localhost:8000 - description: Local server -tags: - - name: Threads - description: Operations related to threads -paths: - /threads: - get: - summary: Get a pagination list of threads - operationId: listThreads - tags: - - Threads - parameters: - - name: page - in: query - description: Page number - required: false - schema: - type: integer - default: 1 - - name: page_size - in: query - description: Number of items per page - required: false - schema: - type: integer - default: 10 - - name: community_id - in: query - description: Filter by community ID - required: false - schema: - type: string - format: uuid - - name: author_id - in: query - description: Filter by author ID - required: false - schema: - type: string - format: uuid - - name: search - in: query - description: Search by title or content - required: false - schema: - type: string - - name: sort - in: query - description: Sort by field - required: false - schema: - type: string - enum: [created_at, updated_at] - default: created_at - - name: order - in: query - description: Sort order - required: false - schema: - type: string - enum: [asc, desc] - default: desc - responses: - "200": - description: List of threads - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - $ref: "#/components/schemas/Thread" - pagination: - $ref: "#/components/schemas/Pagination" - post: - summary: Create a new thread - operationId: createThread - tags: - - Threads - security: - - bearerAuth: [] - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/ThreadCreate" - responses: - "201": - description: Thread created - content: - application/json: - schema: - $ref: "#/components/schemas/Thread" - "400": - description: Request syntax is invalid - "401": - description: Token missing or invalid - "422": - description: Data validation failed - /threads/{id}: - get: - summary: Get details of a specific thread - operationId: getThread - tags: - - Threads - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - responses: - "200": - description: Thread details - content: - application/json: - schema: - $ref: "#/components/schemas/Thread" - "404": - description: Thread not found - put: - summary: Update an existing thread - operationId: updateThread - tags: - - Threads - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/ThreadUpdate" - responses: - "200": - description: Thread updated - content: - application/json: - schema: - $ref: "#/components/schemas/Thread" - "400": - description: Request syntax is invalid - "401": - description: Token missing or invalid - "403": - description: Action forbidden for user - "404": - description: Thread not found - "422": - description: Data validation failed - delete: - summary: Delete a thread - operationId: deleteThread - tags: - - Threads - security: - - bearerAuth: [] - parameters: - - name: id - in: path - required: true - schema: - type: string - format: uuid - responses: - "204": - description: Thread deleted - "401": - description: Token missing or invalid - "403": - description: Action forbidden for user - "404": - description: Thread not found -components: - schemas: - Pagination: - type: object - properties: - current_page: - type: integer - per_page: - type: integer - total_items: - type: integer - total_pages: - type: integer - Thread: - type: object - properties: - id: - type: string - format: uuid - communityId: - type: string - format: uuid - authorId: - type: string - format: uuid - title: - type: string - content: - type: string - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - ThreadCreate: - type: object - required: - - communityId - - title - - content - properties: - communityId: - type: string - format: uuid - title: - type: string - content: - type: string - ThreadUpdate: - type: object - properties: - title: - type: string - content: - type: string - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT diff --git a/docs/openapi/archive/vote-service.yaml b/docs/openapi/archive/vote-service.yaml deleted file mode 100644 index 414bc0b..0000000 --- a/docs/openapi/archive/vote-service.yaml +++ /dev/null @@ -1,245 +0,0 @@ -openapi: 3.1.0 -info: - title: VoteService API - description: API for managing votes in threads and comments in the Threadit application. - version: 1.0.0 -servers: - - url: https://api.example.com/v1 - description: Production server - - url: http://localhost:8000 - description: Local server -tags: - - name: Votes - description: Operations related to votes -paths: - /votes/thread/{thread_id}/up: - post: - operationId: upvoteThread - tags: - - vote-service - summary: Upvote Thread - parameters: - - $ref: "#/components/parameters/thread_id" - responses: - "200": - description: The logged user successfully upvoted the thread. - content: - application/json: - schema: - type: "null" - "400": - $ref: "#/components/responses/BadRequest" - "401": - description: Authentication is required to access the requested resource. The - client must include the appropriate credentials. - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - "404": - $ref: "#/components/responses/NotFound" - "409": - $ref: "#/components/responses/Conflict" - security: - - bearerAuth: [] - /votes/thread/{thread_id}/down: - post: - operationId: downvoteThread - tags: - - vote-service - summary: Downvote Thread - parameters: - - $ref: "#/components/parameters/thread_id" - responses: - "200": - description: The logged user successfully downvoted the thread. - content: - application/json: - schema: - type: "null" - "400": - $ref: "#/components/responses/BadRequest" - "401": - description: Authentication is required to access the requested resource. The - client must include the appropriate credentials. - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - "404": - $ref: "#/components/responses/NotFound" - "409": - $ref: "#/components/responses/Conflict" - security: - - bearerAuth: [] - /votes/comment/{comment_id}/up: - post: - operationId: upvoteComment - tags: - - vote-service - summary: Upvote Comment - parameters: - - $ref: "#/components/parameters/comment_id" - responses: - "200": - description: The logged user sucessfully upvoted the comment. - content: - application/json: - schema: - type: "null" - "400": - $ref: "#/components/responses/BadRequest" - "401": - description: Authentication is required to access the requested resource. The - client must include the appropriate credentials. - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - "404": - $ref: "#/components/responses/NotFound" - "409": - $ref: "#/components/responses/Conflict" - security: - - bearerAuth: [] - /votes/comment/{comment_id}/down: - post: - operationId: downvoteComment - tags: - - vote-service - summary: Downvote Comment - parameters: - - $ref: "#/components/parameters/comment_id" - responses: - "200": - description: The user successfully downvoted the comment. - content: - application/json: - schema: - type: "null" - "400": - $ref: "#/components/responses/BadRequest" - "401": - description: Authentication is required to access the requested resource. The - client must include the appropriate credentials. - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - "404": - $ref: "#/components/responses/NotFound" - "409": - $ref: "#/components/responses/Conflict" - security: - - bearerAuth: [] -components: - responses: - Conflict: - content: - application/json: - schema: - type: object - required: - - message - properties: - message: - type: string - description: The request could not be completed due to a conflict with the - current state of the resource. Resolve the conflict and try again. - BadRequest: - content: - application/json: - schema: - type: object - required: - - message - properties: - errors: - type: array - items: - type: object - required: - - message - properties: - message: - type: string - message: - type: string - description: The server could not understand the request due to invalid syntax. - The client should modify the request and try again. - Unauthorized: - content: - application/json: - schema: - type: object - required: - - message - properties: - message: - type: string - description: Authentication is required to access the requested resource. The - client must include the appropriate credentials. - NotFound: - description: The server cannot find the requested resource. The endpoint may be - invalid or the resource may no longer exist. - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - InternalServerErrror: - description: The server encountered an unexpected condition that prevented it - from fulfilling the request. Report the issue to the support team if it - persists. - content: - application/json: - schema: - type: object - properties: - message: - type: string - required: - - message - securitySchemes: - bearerAuth: - type: http - scheme: bearer - description: Authentication Token - bearerFormat: JWT - parameters: - thread_id: - name: thread_id - in: path - required: true - schema: - type: string - comment_id: - name: comment_id - in: path - required: true - schema: - type: string \ No newline at end of file diff --git a/docs/openapi/gen/comment-service.yaml b/docs/openapi/comment-service.yaml similarity index 100% rename from docs/openapi/gen/comment-service.yaml rename to docs/openapi/comment-service.yaml diff --git a/docs/openapi/gen/community-service.yaml b/docs/openapi/community-service.yaml similarity index 100% rename from docs/openapi/gen/community-service.yaml rename to docs/openapi/community-service.yaml diff --git a/docs/openapi/gen/popular-service.yaml b/docs/openapi/popular-service.yaml similarity index 100% rename from docs/openapi/gen/popular-service.yaml rename to docs/openapi/popular-service.yaml diff --git a/docs/openapi/gen/search-service.yaml b/docs/openapi/search-service.yaml similarity index 100% rename from docs/openapi/gen/search-service.yaml rename to docs/openapi/search-service.yaml diff --git a/docs/openapi/gen/thread-service.yaml b/docs/openapi/thread-service.yaml similarity index 100% rename from docs/openapi/gen/thread-service.yaml rename to docs/openapi/thread-service.yaml diff --git a/docs/openapi/gen/vote-service.yaml b/docs/openapi/vote-service.yaml similarity index 100% rename from docs/openapi/gen/vote-service.yaml rename to docs/openapi/vote-service.yaml