Initial commit

This commit is contained in:
2025-09-08 16:24:41 +08:00
commit 9142055732
4 changed files with 331 additions and 0 deletions

35
20250908_AI Prompt.txt Normal file
View File

@@ -0,0 +1,35 @@
請執行hw3_Products_lowMargin.md prompt 內容
您一是資深程式設計師,請根據以下需求幫我產生一段 Python 程式碼,能夠連線到資料庫一個 pizzas table及新增10筆資料。
資料庫資訊請參考Z:\E\AI\AI_Coding\DB>.env。
需求:
1.create pizzas TABLEpizzas table 的欄位有name(名稱)、size(尺寸)、price(價格)
2.請您在產生10筆模擬資料新增到 pizzas table。
3.執行成功後印出「pizzas 的模擬資料!」。
4.請將產生出的 Python 儲存於 Z:\E\AI\AI_Coding\20250908> 路徑下。
--------------------------------------------------------------------------------------------------------------------------
請產生一支可直接執行的 Flask API 伺服器,需求:
- 使用 mysql.connector 連線
資料庫資訊請參考Z:\E\AI\AI_Coding\DB>.env。
TABLE = users
- 路由:
- GET /v1/users支援 ?min_age、?max_age、?page、?limit要多回傳 {meta}
- GET /v1/users/<id>:找不到回 404
- POST /v1/users接收 JSON {name,email,age},欄位驗證,成功回 201 並回新資料
- PATCH /v1/users/<id>可更新任一欄位name/email/age成功回 200 回更新後資料
- DELETE /v1/users/<id>:成功回 204
- 所有寫入請用參數化查詢避免 SQL 注入
- 統一格式 { status,code,message,data }
- 統一錯誤格式 {status:"error", code, message}
- 啟用 CORS允許本機前端