{"id":22190987,"url":"https://github.com/yuhexiong/library-api-python-django","last_synced_at":"2026-05-01T10:32:29.197Z","repository":{"id":199106510,"uuid":"701752854","full_name":"yuhexiong/library-api-python-django","owner":"yuhexiong","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-14T06:26:19.000Z","size":94,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T20:43:13.246Z","etag":null,"topics":["api","backend","django","python","restful-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuhexiong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-07T13:06:33.000Z","updated_at":"2025-02-14T06:26:22.000Z","dependencies_parsed_at":"2024-12-15T14:27:41.178Z","dependency_job_id":"7e431232-d26c-4e0f-8b41-465450795828","html_url":"https://github.com/yuhexiong/library-api-python-django","commit_stats":null,"previous_names":["yuhexiong/library-api-python-django"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yuhexiong/library-api-python-django","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Flibrary-api-python-django","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Flibrary-api-python-django/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Flibrary-api-python-django/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Flibrary-api-python-django/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuhexiong","download_url":"https://codeload.github.com/yuhexiong/library-api-python-django/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Flibrary-api-python-django/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32494270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","backend","django","python","restful-api"],"created_at":"2024-12-02T12:13:49.385Z","updated_at":"2026-05-01T10:32:29.173Z","avatar_url":"https://github.com/yuhexiong.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library API\n\n## Overview\n\n- Language: Python v3.9.15\n- Web FrameWork: Django v4.2.6\n\n## ENV\n\ncopy `.env.example` as `.env`\n\n```\nDB_HOST=\"127.0.0.1\"\nDB_PORT=\"3306\"\nDB_USER=\"root\"\nDB_PASSWORD=\"password\"\nDB_NAME=\"database\"\n\nSECRET_KEY=\"django123456789#@?-key\"\nDEBUG=\"True\"\n```\n\n## Run\n\n### migration\n\n```\npython manage.py migrate\n```\n\n### server\n\n```\npython manage.py runserver\n```\n\n## ER Diagram\n![image](./schema.png)\n\n## API\n\n### user\n\n- POST /user : 新增使用者\n- GET /user : 取得所有生效的使用者\n- DELETE /user/{user_id} : 停用使用者\n\n### author\n\n- POST /author : 新增作者，不帶使用者 id 時則一併新增使用者\n- GET /author : 取得所有生效的作者\n- DELETE /author/{author_id} : 停用作者\n\n### reader\n\n- POST /reader : 新增讀者，不帶使用者 id 時則一併新增使用者\n- GET /reader : 取得所有生效的讀者\n- DELETE /reader/{reader_id} : 停用讀者\n\n### book_type\n\n- POST /book_type : 新增書本類型\n- GET /book_type : 取得所有生效的書本類型\n- DELETE /book_type/{book_type_id} : 停用書本類型\n\n### book\n\n- POST /book : 新增書本\n- GET /book : 取得所有生效的書本\n- DELETE /book/{book_id} : 停用書本\n\n### borrow, renew, return\n\n- POST /borrow/{book_id}/{reader_id} : 借書, 書本的狀態改為停用, 一次借書30天\n- POST /renew/{book_id}/{reader_id} : 續借, 最多續借2次\n- POST /return/{book_id}/{reader_id} : 還書, 超時會被記錄違規次數\n\n### report\n\n- POST /report : 新增心得\n- GET /report : 取得所有生效的心得\n- PATCH /report : 更新心得內文\n- DELETE /report/{report_id} : 停用心得\n\n### rank\n\n- POST /rank/borrow_times : 取得讀者借書次數排名\n- POST /rank/violation_times : 取得讀者違規次數排名\n- POST /rank/publish_times : 取得作者出版次數排名\n\n## Custom Error Code\n\nIn bookapp/responses\n\n```\nINVALID_API = 1001\nINVALID_PARAMETER = 1002\nINSUFFICIENT_PARAMETER = 1003\nOVER_BORROW_TIMES_LIMIT = 1004\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuhexiong%2Flibrary-api-python-django","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuhexiong%2Flibrary-api-python-django","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuhexiong%2Flibrary-api-python-django/lists"}