{"openapi":"3.1.0","info":{"title":"CSE Platform","version":"0.1.0"},"paths":{"/auth/login":{"post":{"tags":["auth"],"summary":"Login","operationId":"login_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/refresh":{"post":{"tags":["auth"],"summary":"Refresh","operationId":"refresh_auth_refresh_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/logout":{"post":{"tags":["auth"],"summary":"Logout","operationId":"logout_auth_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/login":{"get":{"summary":"Login Page","operationId":"login_page_login_get","parameters":[{"name":"error","in":"query","required":false,"schema":{"type":"string","default":"","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Login Submit","description":"HTML form submission — uses the same logic as the JSON /auth/login.","operationId":"login_submit_login_post","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_submit_login_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/logout":{"get":{"summary":"Logout Page","operationId":"logout_page_logout_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/":{"get":{"summary":"Dashboard","operationId":"dashboard__get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/stock/{symbol}":{"get":{"summary":"Stock Detail","operationId":"stock_detail_stock__symbol__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/health":{"get":{"summary":"Api Health","description":"Public health check returning JSON. No auth required.","operationId":"api_health_api_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/auth/login":{"post":{"summary":"Api Login","description":"JSON login endpoint. Sets cookies on success, returns JSON either way.","operationId":"api_login_api_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/me":{"get":{"summary":"Api Me","description":"Returns current user info if logged in, 401 if not.","operationId":"api_me_api_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/auth/logout":{"post":{"summary":"Api Logout","description":"Clear auth cookies.","operationId":"api_logout_api_auth_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/auth/refresh":{"post":{"summary":"Api Refresh","description":"Mint fresh access+refresh cookies from a valid refresh cookie. 401 if invalid/expired.","operationId":"api_refresh_api_auth_refresh_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/stocks":{"get":{"summary":"Api List Stocks","description":"List all stocks. Requires authentication.","operationId":"api_list_stocks_api_stocks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"summary":"Api Create Stock","description":"Add a new stock to the registry.","operationId":"api_create_stock_api_stocks_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/stocks/{symbol}":{"patch":{"summary":"Api Update Stock","description":"Update a stock's fields. Send only the fields you want to change.","operationId":"api_update_stock_api_stocks__symbol__patch","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Api Delete Stock","description":"Soft-delete: sets active=0. Doesn't actually remove the row (preserves FK integrity).","operationId":"api_delete_stock_api_stocks__symbol__delete","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"Api Stock Detail","description":"Single stock metadata + computed stats.","operationId":"api_stock_detail_api_stocks__symbol__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ingestion/status":{"get":{"summary":"Api Ingestion Status","description":"Summary: last run, count of stale stocks, count of fresh stocks.","operationId":"api_ingestion_status_api_ingestion_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/ingestion/freshness":{"get":{"summary":"Api Ingestion Freshness","description":"Per-stock: last trade date, days old, fresh/stale flag.","operationId":"api_ingestion_freshness_api_ingestion_freshness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/ingestion/history":{"get":{"summary":"Api Ingestion History","description":"Recent ingestion runs from run_log table.","operationId":"api_ingestion_history_api_ingestion_history_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/stocks/{symbol}/upload-preview":{"post":{"summary":"Api Upload Preview","description":"Parse and validate CSV. Returns preview, does NOT write.","operationId":"api_upload_preview_api_stocks__symbol__upload_preview_post","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_upload_preview_api_stocks__symbol__upload_preview_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/stocks/{symbol}/upload-commit":{"post":{"summary":"Api Upload Commit","description":"Parse, validate, AND write to price_history. Returns count of rows inserted/updated.","operationId":"api_upload_commit_api_stocks__symbol__upload_commit_post","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_upload_commit_api_stocks__symbol__upload_commit_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/stocks/{symbol}/prices":{"get":{"summary":"Api Stock Prices","description":"Date-range price history. Defaults to last 90 days if no params.","operationId":"api_stock_prices_api_stocks__symbol__prices_get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"To Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"Body_api_upload_commit_api_stocks__symbol__upload_commit_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_api_upload_commit_api_stocks__symbol__upload_commit_post"},"Body_api_upload_preview_api_stocks__symbol__upload_preview_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_api_upload_preview_api_stocks__symbol__upload_preview_post"},"Body_login_submit_login_post":{"properties":{"username":{"type":"string","title":"Username"},"password":{"type":"string","title":"Password"},"totp":{"type":"string","title":"Totp"}},"type":"object","required":["username","password","totp"],"title":"Body_login_submit_login_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LoginIn":{"properties":{"username":{"type":"string","title":"Username"},"password":{"type":"string","title":"Password"},"totp":{"type":"string","title":"Totp"}},"type":"object","required":["username","password","totp"],"title":"LoginIn"},"LoginRequest":{"properties":{"username":{"type":"string","title":"Username"},"password":{"type":"string","title":"Password"},"totp":{"type":"string","title":"Totp"}},"type":"object","required":["username","password","totp"],"title":"LoginRequest"},"StockCreate":{"properties":{"symbol":{"type":"string","title":"Symbol"},"company":{"type":"string","title":"Company","default":""},"sector":{"type":"string","title":"Sector","default":""},"stage":{"type":"string","title":"Stage","default":"watchlist"}},"type":"object","required":["symbol"],"title":"StockCreate"},"StockPatch":{"properties":{"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector"},"stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Active"}},"type":"object","title":"StockPatch"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}