{ "openapi": "3.0.0", "info": { "title": "API Task Manager", "version": "1.0.0", "description": "API for managing tasks with Google OAuth" }, "servers": [ { "url": "https://task-manager-api-9tji.onrender.com" }, { "url": "http://localhost:5000" } ], "tags": [ { "name": "Auth", "description": "Authentication endpoints" }, { "name": "Tasks", "description": "Task management endpoints" }, { "name": "Users", "description": "User management endpoints" } ], "components": { "securitySchemes": { "OAuth2": { "type": "oauth2", "flows": { "authorizationCode": { "authorizationUrl": "/auth/google", "tokenUrl": "https://oauth2.googleapis.com/token", "scopes": { "profile": "Access user profile", "email": "Access user email" } } } } }, "schemas": { "Task": { "type": "object", "required": ["title", "userId"], "properties": { "_id": { "type": "string", "description": "Task ID" }, "title": { "type": "string", "description": "Task title" }, "description": { "type": "string", "description": "Task description" }, "status": { "type": "string", "enum": ["pending", "in-progress", "completed"], "description": "Task status" }, "dueDate": { "type": "string", "format": "date", "description": "Due date (YYYY-MM-DD)" }, "userId": { "type": "string", "description": "User ID" }, "createdAt": { "type": "string", "format": "date-time", "description": "Creation date" }, "updatedAt": { "type": "string", "format": "date-time", "description": "Update date" } }, "example": { "title": "Complete Lesson 8", "description": "Finish Task Manager API", "status": "pending", "dueDate": "2025-06-15", "userId": "68449debbc2284bf49a38ed3" } }, "User": { "type": "object", "required": ["username", "email"], "properties": { "_id": { "type": "string" }, "username": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" }, "googleId": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" } }, "example": { "username": "Kim Miner", "email": "kimah72@gmail.com", "password": "securepass123" } } } }, "paths": { "/auth/google": { "get": { "tags": ["Auth"], "summary": "Initiate Google OAuth login", "responses": { "200": { "description": "Redirect URL for OAuth", "content": { "application/json": { "schema": { "type": "object", "properties": { "redirect": { "type": "string" } } } } } } } } }, "/auth/profile": { "get": { "tags": ["Auth"], "summary": "Get authenticated user profile", "security": [{ "OAuth2": ["profile", "email"] }], "responses": { "200": { "description": "User profile", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Not authenticated" } } } }, "/auth/logout": { "get": { "tags": ["Auth"], "summary": "Log out user", "security": [{ "OAuth2": ["profile", "email"] }], "responses": { "200": { "description": "Logged out", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } } }, "/api/tasks": { "get": { "tags": ["Tasks"], "summary": "Get all tasks for user", "security": [{ "OAuth2": ["profile", "email"] }], "responses": { "200": { "description": "List of tasks", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Task" } } } } } } }, "post": { "tags": ["Tasks"], "summary": "Create a task", "security": [{ "OAuth2": ["profile", "email"] }], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task" } } } }, "responses": { "201": { "description": "Task created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task" } } } }, "422": { "description": "Validation error" } } } }, "/api/tasks/{id}": { "get": { "tags": ["Tasks"], "summary": "Get a task by ID", "security": [{ "OAuth2": ["profile", "email"] }], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Task details", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task" } } } }, "404": { "description": "Task not found" } } }, "put": { "tags": ["Tasks"], "summary": "Update a task", "security": [{ "OAuth2": ["profile", "email"] }], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task" } } } }, "responses": { "200": { "description": "Task updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Task" } } } }, "404": { "description": "Task not found" }, "422": { "description": "Validation error" } } }, "delete": { "tags": ["Tasks"], "summary": "Delete a task", "security": [{ "OAuth2": ["profile", "email"] }], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Task deleted" }, "404": { "description": "Task not found" } } } }, "/api/users": { "get": { "tags": ["Users"], "summary": "Get all users", "responses": { "200": { "description": "List of users", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/User" } } } } }, "500": { "description": "Server error" } } }, "post": { "tags": ["Users"], "summary": "Create a new user", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "responses": { "201": { "description": "User created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "422": { "description": "Validation error" }, "400": { "description": "Bad request" } } } } } }