File size: 4,340 Bytes
3fcb6ea 1248c60 3fcb6ea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # API ๊ฒฝ๋ก ๋์กฐ (๋ฐฑ์๋ main.py โ ํ๋ก ํธ์๋ fetch/apiGet)
๋ฐฑ์๋(FastAPI) ๋ผ์ฐํธ์ ํ๋ก ํธ์๋ ํธ์ถ ๊ฒฝ๋ก๊ฐ ์ฒ ์๊น์ง ์ผ์นํ๋์ง ์ ๋ฆฌํฉ๋๋ค.
## rewrites (next.config.js)
- `source: '/api/:path*'` โ `destination: \`${backendUrl}/api/:path*\``
- backendUrl: `BACKEND_URL` ๋๋ `NEXT_PUBLIC_API_URL` ๋๋ ํ๋ก๋์
์ **`lib/backend-url.js`** ์ `PRODUCTION_BACKEND_URL` (๋จ์ผ ์์ค).
- **vercel.json** ์ rewrites destination URL์ ์์ ๋์ผํ๊ฒ ์ ์ง (JSON์ด๋ผ import ๋ถ๊ฐ, ์๋ ๋๊ธฐํ).
## ๋ฐฑ์๋ ๋ผ์ฐํธ โ ํ๋ก ํธ ํธ์ถ
| ๋ฐฑ์๋ (main.py) | ํ๋ก ํธ ํธ์ถ | ๋น๊ณ |
|------------------|-------------|------|
| GET /api/health | /api/health | page.tsx ํฌ์ค์ฒดํฌ |
| GET /api/apple-data | /api/apple-data | page.tsx fetchData |
| GET /api/city-category-pie | /api/city-category-pie | page.tsx |
| GET /api/store-markers | /api/store-markers | page.tsx |
| GET /api/continent-category-pie | /api/continent-category-pie | page.tsx |
| GET /api/store-category-pie | /api/store-category-pie?store_id= | page.tsx |
| GET /api/country-category-pie | /api/country-category-pie?country= | page.tsx |
| GET /api/safety-stock | /api/safety-stock | page.tsx |
| GET /api/safety-stock-forecast-chart | /api/safety-stock-forecast-chart, ?product_name= | page.tsx |
| GET /api/safety-stock-kpi | /api/safety-stock-kpi | page.tsx |
| GET /api/inventory-comments | /api/inventory-comments | page.tsx (GET/fetch) |
| POST /api/inventory-comments | POST /api/inventory-comments | page.tsx |
| GET /api/safety-stock-inventory-list | /api/safety-stock-inventory-list?status_filter= ๋ฑ | page.tsx |
| GET /api/safety-stock-sales-by-store-period | /api/safety-stock-sales-by-store-period? | page.tsx |
| GET /api/safety-stock-sales-by-product | /api/safety-stock-sales-by-product? | page.tsx |
| GET /api/sales-quantity-forecast | /api/sales-quantity-forecast | page.tsx |
| GET /api/sales-box | /api/sales-box | page.tsx |
| GET /api/demand-dashboard | /api/demand-dashboard? | page.tsx, recommendation |
| GET /api/data-source | /api/data-source | page.tsx |
| GET /api/quick-status | /api/quick-status | page.tsx |
| GET /api/integration-status | /api/integration-status | page.tsx |
| GET /api/last-updated | /api/last-updated | page.tsx |
| GET /api/sales-summary | /api/sales-summary | sales/page, recommendation |
| GET /api/store-performance-grade | /api/store-performance-grade | sales/page |
| GET /api/sales-by-country-category | /api/sales-by-country-category?country= | sales/page |
| GET /api/sales-by-store | /api/sales-by-store?country= | sales/page |
| GET /api/sales-by-store-quarterly | /api/sales-by-store-quarterly? (route.ts ํ๋ก์) | sales/page |
| GET /api/sales-by-store-quarterly-by-category | /api/sales-by-store-quarterly-by-category? | sales/page |
| GET /api/recommendation-summary | /api/recommendation-summary | recommendation |
| GET /api/store-list | /api/store-list | recommendation (fetch) |
| GET /api/store-recommendations/{store_id} | /api/store-recommendations/${id} | recommendation |
| GET /api/store-sales-forecast/{store_id} | /api/store-sales-forecast/${id} | recommendation |
| GET /api/user-personalized-recommendations | /api/user-personalized-recommendations?store_id= | recommendation |
| GET /api/collab-filter-recommendations | /api/collab-filter-recommendations?store_id= | recommendation |
| POST /api/recommendation-feedback | /api/recommendation-feedback | recommendation apiPost |
| GET /api/region-category-pivot | /api/region-category-pivot | recommendation |
| GET /api/price-demand-correlation | /api/price-demand-correlation?product_name= | recommendation |
| GET /api/inventory-critical-alerts | /api/inventory-critical-alerts?limit=50 | recommendation |
| GET /api/customer-journey-funnel | /api/customer-journey-funnel | recommendation |
| GET /api/funnel-stage-weight | /api/funnel-stage-weight | recommendation |
| GET /api/predicted-demand-by-product | /api/predicted-demand-by-product | page.tsx |
## ๋ฐฑ์๋๋ง ์กด์ฌ (ํ๋ก ํธ ๋ฏธํธ์ถ)
- GET /api/sale-id-pie
- GET /api/country-stores-pie
- GET /api/continent-countries-pie
- GET /api/store-product-quantity-barchart
์ ๊ฒฝ๋ก๋ ํ๋ก ํธ์์ ํธ์ถํ์ง ์์. ์ ๊ท ํ๋ฉด ์ฐ๋ ์ ์ด ๋ฌธ์์ ๊ฒฝ๋ก๋ฅผ ๋ง์ถ ๊ฒ.
|