openapi: 3.0.0 info: title: API version: 1.0.0 description: Documentation Template for API paths: /auth/register: post: summary: Register tags: - Auth description: Create a new user requestBody: required: true content: application/json: schema: type: object properties: username: type: string email: type: string password: type: string responses: 201: description: User created content: application/json: schema: $ref: "#/components/schemas/Profile" 400: description: Bad request /auth/change-password: post: summary: Change user password tags: - Auth security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ChangePasswordRequest" responses: "200": description: Password changed successfully content: application/json: schema: type: object properties: message: type: string "401": description: Unauthorized "400": description: Invalid request /auth/login: post: summary: Login tags: - Auth description: Authenticate a user requestBody: required: true content: application/json: schema: type: object properties: email: type: string password: type: string responses: 200: description: Successful login content: application/json: schema: type: object properties: token: type: string refreshToken: type: string 401: description: Unauthorized /auth/logout: post: summary: Logout tags: - Auth requestBody: required: true content: application/json: schema: type: object properties: token: type: string responses: "200": description: Logged out successfully "400": description: Token is required /auth/refresh: post: summary: Refresh token tags: - Auth requestBody: required: true content: application/json: schema: type: object properties: token: type: string responses: "200": description: Token refreshed content: application/json: schema: type: object properties: accessToken: type: string "401": description: Token is required "403": description: Invalid refresh token /profiles/me: get: summary: Get current user's profile tags: - My Profile security: - bearerAuth: [] responses: "200": description: Successful response content: application/json: schema: $ref: "#/components/schemas/UserProfileDto" "401": description: Unauthorized /profiles/me/followers: get: summary: Get followers of the current user tags: - My Profile security: - bearerAuth: [] responses: "200": description: Followers retrieved successfully content: application/json: schema: type: array items: $ref: "#/components/schemas/Profile" "401": description: Unauthorized /profiles/me/following: get: summary: Get users followed by the current user tags: - My Profile security: - bearerAuth: [] responses: "200": description: Following users retrieved successfully content: application/json: schema: type: array items: $ref: "#/components/schemas/Profile" "401": description: Unauthorized /profiles/me/settings: patch: summary: Update profile settings tags: - My Profile description: Update settings for the authenticated user's profile security: - bearerAuth: [] requestBody: required: true content: application/json: schema: type: object properties: approveFollowers: type: boolean allowEmailSearch: type: boolean responses: 200: description: Profile settings updated content: application/json: schema: $ref: "#/components/schemas/Profile" 400: description: Bad request 401: description: Unauthorized /profiles/all: get: summary: Get all profiles (admin only) tags: - Profile (Admin) description: Retrieve a list of all profiles security: - bearerAuth: [] responses: 200: description: List of profiles content: application/json: schema: type: array items: $ref: "#/components/schemas/Profile" 401: description: Unauthorized 403: description: Forbidden /profiles/search: get: summary: Search profiles tags: - Profile description: Search for profiles by username or email security: - bearerAuth: [] parameters: - in: query name: text schema: type: string required: true description: Search text responses: 200: description: List of matching profiles content: application/json: schema: type: array items: $ref: "#/components/schemas/Profile" 400: description: Bad request 401: description: Unauthorized /profiles/{username}: get: summary: Get profile by username tags: - Profile parameters: - name: username in: path required: true description: username of the profile to retrieve schema: type: string security: - bearerAuth: [] responses: "200": description: Successful response content: application/json: schema: $ref: "#/components/schemas/Profile" "400": description: Invalid username supplied "404": description: Profile not found /profiles/{username}/followers: get: summary: Get followers of a specific user tags: - Profile security: - bearerAuth: [] parameters: - name: username in: path required: true description: username of the user to retrieve followers for schema: type: string responses: "200": description: Followers retrieved successfully content: application/json: schema: type: array items: $ref: "#/components/schemas/Profile" "400": description: Invalid username supplied "401": description: Unauthorized /profiles/{username}/following: get: summary: Get users followed by a specific user tags: - Profile security: - bearerAuth: [] parameters: - name: username in: path required: true description: username of the user to retrieve following users for schema: type: string responses: "200": description: Following users retrieved successfully content: application/json: schema: type: array items: $ref: "#/components/schemas/Profile" "400": description: Invalid ID supplied "401": description: Unauthorized /profiles/{username}/follow: post: summary: Follow a user tags: - Profile security: - bearerAuth: [] parameters: - name: username in: path required: true description: username of the user to follow schema: type: string responses: "200": description: Followed user successfully content: application/json: schema: $ref: "#/components/schemas/Profile" "400": description: Invalid input "401": description: Unauthorized /profiles/{username}/unfollow: delete: summary: Unfollow a user tags: - Profile security: - bearerAuth: [] parameters: - name: username in: path required: true description: username of the user to unfollow schema: type: string responses: "200": description: Unfollowed user successfully content: application/json: schema: $ref: "#/components/schemas/Profile" "400": description: Invalid input "401": description: Unauthorized /followRequests/respond: post: summary: Respond to follow request tags: - Follow Requests description: Accept or reject a follow request security: - bearerAuth: [] requestBody: required: true content: application/json: schema: type: object properties: requestId: type: integer accept: type: boolean responses: 200: description: Follow request response content: application/json: schema: type: object properties: status: type: string 400: description: Bad request 401: description: Unauthorized /posts/feed: get: summary: Get posts feed tags: - Post description: Get posts from users the current user is following security: - bearerAuth: [] responses: 200: description: List of posts content: application/json: schema: type: array items: $ref: "#/components/schemas/Post" 401: description: Unauthorized /posts/new: post: summary: Create a new post tags: - Post security: - bearerAuth: [] requestBody: required: true content: multipart/form-data: schema: type: object properties: file: type: string format: binary description: "Image file to upload" responses: "201": description: Post created successfully content: application/json: schema: $ref: "#/components/schemas/Post" "400": description: Invalid input "401": description: Unauthorized /posts/{postId}/view: post: summary: Mark a post as viewed by the current user tags: - Post Interactions security: - bearerAuth: [] parameters: - name: postId in: path required: true description: ID of the post to mark as viewed schema: type: integer responses: "200": description: Post marked as viewed successfully content: application/json: schema: $ref: "#/components/schemas/Post" "400": description: Invalid input "401": description: Unauthorized "404": description: Post not found /posts/{postId}/comments/new: post: summary: Add a comment to a post tags: - Post Interactions security: - bearerAuth: [] parameters: - name: postId in: path required: true description: ID of the post to comment on schema: type: integer requestBody: required: true content: application/json: schema: type: object properties: content: type: string responses: "201": description: Comment added successfully content: application/json: schema: $ref: "#/components/schemas/Comment" "400": description: Invalid input "401": description: Unauthorized components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT schemas: ChangePasswordRequest: type: object properties: oldPassword: type: string newPassword: type: string Profile: type: object properties: id: type: integer username: type: string email: type: string picture: type: string isAdmin: type: boolean subscriptionEnd: type: string format: date-time UserProfileDto: type: object properties: username: type: string email: type: string picture: type: string isVerified: type: boolean Post: type: object properties: id: type: integer picture: type: string author: $ref: "#/components/schemas/Profile" comments: type: array items: $ref: "#/components/schemas/Comment" createdAt: type: string format: date-time updatedAt: type: string format: date-time Comment: type: object properties: id: type: integer postId: type: integer userId: type: integer content: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time