{"id":30746938,"url":"https://github.com/coderj001/lms","last_synced_at":"2025-09-04T04:31:04.938Z","repository":{"id":47102428,"uuid":"388173751","full_name":"coderj001/LMS","owner":"coderj001","description":"Loan Management System","archived":false,"fork":false,"pushed_at":"2021-09-13T14:10:24.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-04T02:26:55.888Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/coderj001.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}},"created_at":"2021-07-21T16:07:20.000Z","updated_at":"2021-09-13T14:10:27.000Z","dependencies_parsed_at":"2022-09-23T11:30:35.558Z","dependency_job_id":null,"html_url":"https://github.com/coderj001/LMS","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/coderj001/LMS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderj001%2FLMS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderj001%2FLMS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderj001%2FLMS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderj001%2FLMS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderj001","download_url":"https://codeload.github.com/coderj001/LMS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderj001%2FLMS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273550643,"owners_count":25125541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"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":[],"created_at":"2025-09-04T04:30:27.483Z","updated_at":"2025-09-04T04:31:04.911Z","avatar_url":"https://github.com/coderj001.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Loan Management System\n\n\u003e Django, Djangorestframwork, Postgresql, Docker\n\n## BACKEND\n\n### Library Used\n\n- Django\n- djangorestframework\n- psycopg2-binary\n- djangorestframework-simplejwt\n\n### Why choose Django and Postgresql (For Backend)?\n\n**Django** is the one of the most popular web framework for python, Django takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel. As for Postgresql it works well with Django and also preferable for the assignment as mentioned [here](./read.md).\n\n### INSTALLATION \u0026\u0026 USAGE\n\nNo need to worry about installation, if docker and docker-compose is not installed in your system please install and follow along the step(s).\n\n- Git Clone this repo and enter into the LMS directory.\n- Create\n    - a file 'backend-env' with content\n        ```\n        debug=\u003c\u003e\n        secret_key=\u003c\u003e\n        postgres=\u003c\u003e\n        DB_HOST=\u003c\u003e\n        DB_NAME=\u003c\u003e\n        DB_USER=\u003c\u003e\n        DB_PASS=\u003c\u003e\n        DB_PORT=\u003c\u003e\n        ```\n        reffer this file [here](./backend-env-sample).\n    - a file 'pgdb-env' with content\n        ```\n        POSTGRES_DB=\u003c\u003e\n        POSTGRES_USER=\u003c\u003e\n        POSTGRES_PASSWORD=\u003c\u003e\n        ```\n        reffer this file [here](./pgdb-env-sample).\n\n- Run the command ` docker-compose up --build `. And it should be up and running. Checkout the endpoints mentioned below. Note test case and  will be run and created.\n- To run test case, `docker-compose exec backend python manage.py test`. Note test case automatically run during execution of previous command ` docker-compose up --build `.\n- To create admin user, `docker-compose exec backend python manage.py createsuperuser`.\n\n### Admin Panel\n\nDjango provide built-in admin panel can be access from `localhost:8000/admin` url. If you used `docker-compose up --build` then admin user will be created by  `docker-compose exec backend python manage.py createsuperuser`. Otherwise create using `python manage.py createsuperuser`\n\n### API ENDPOINTS\n\n#### **BASE_URL**: /api/users\n\n### To get Login\n\n#### Request\n\n`POST \u003cBASE_URL\u003e/login/`\n\u003cbr /\u003e\nBody: `{'email': 'user@mail.com', 'password':'passwd123'}`\n\n#### Response\n\n```json\n{\n    \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYyNTI4NDIzMiwianRpIjoiMTQ0Y2E0MzkzZjNmNDM5NWI1MDhiM2VmNjA0MjUxYTIiLCJ1c2VyX2lkIjoiMmY4Mzc5NzMtNmYwOC00ZmYwLThkMTgtMTJmNzkxZDMwNTA0In0.iIm7aLCUyMCO9yvll00HRxIH5fAdlVD_5yeCKYEQIGw\",\n    \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjI3Nzg5ODMyLCJqdGkiOiJhNmM4MGM5Y2QzNTI0ZjQ3ODhjMmI0ZTE1OWVjOGZiZiIsInVzZXJfaWQiOiIyZjgzNzk3My02ZjA4LTRmZjAtOGQxOC0xMmY3OTFkMzA1MDQifQ.mEN1MwdGrYLRHharSoTzc3zbj8QEqlv1_H8-wWfVgdw\",\n    \"id\": \"2f837973-6f08-4ff0-8d18-12f791d30504\",\n    \"email\": \"customer2@mail.com\",\n    \"username\": \"customer2\",\n    \"user_type\": \"customer\",\n    \"date_joined\": \"2021-06-27T15:26:04.635540Z\",\n    \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjI3Nzg5ODMyLCJqdGkiOiJkYTI3YTc0NzI3NDc0NmQ3ODAxNjE4OGY5ZDk1YmUyMCIsInVzZXJfaWQiOiIyZjgzNzk3My02ZjA4LTRmZjAtOGQxOC0xMmY3OTFkMzA1MDQifQ.hhz7n6W46mgVIBAWLIu3zMd-XolT7VRZjaCZPclDwHQ\"\n}\n```\n\n### To get register agent\n\n#### Request\n\n`POST \u003cBASE_URL\u003e/register/agent/`\n\u003cbr /\u003e\nBody: `{\n    \"username\":\"agent_1\",\n    \"email\":\"agent_1@mail.com\",\n    \"password\":\"agent_1\"\n}`\n\n#### Response\n\n```json\n{\n    \"id\": \"fca6b3b4-2645-4852-948a-7f51efd1dc87\",\n    \"email\": \"agent_1@mail.com\",\n    \"username\": \"agent_1\",\n    \"user_type\": \"agent\",\n    \"date_joined\": \"2021-06-29T17:21:48.585464Z\",\n    \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjI3NTc5MzA5LCJqdGkiOiI5ZGY4NDkzMGE3ZGI0YzZhYjg2MTVlZGM3MmY3ZmQ3YyIsInVzZXJfaWQiOiJmY2E2YjNiNC0yNjQ1LTQ4NTItOTQ4YS03ZjUxZWZkMWRjODcifQ.7cee-lCqquKTHDl0MXK0i9tFjG0FQp6oFVl8l1e5QeU\"\n}\n```\n\n### To get register customer\n\n#### Request\n\n`POST \u003cBASE_URL\u003e/register/customer/`\n\u003cbr /\u003e\nBody: `{\n    \"username\":\"customer3\",\n    \"email\":\"customer3@mail.com\",\n    \"password\":\"customer3\"\n}`\n\n#### Response\n\n```json\n{\n    \"id\": \"0d1739ea-ba36-4d1b-add5-e34045a76be5\",\n    \"email\": \"customer3@mail.com\",\n    \"username\": \"customer3\",\n    \"user_type\": \"customer\",\n    \"date_joined\": \"2021-06-29T17:24:43.532383Z\",\n    \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjI3NTc5NDgzLCJqdGkiOiI1MTBhMzRlNjIwNTc0ZTg5YTZkYmIzOWFkYjY2MjliNCIsInVzZXJfaWQiOiIwZDE3MzllYS1iYTM2LTRkMWItYWRkNS1lMzQwNDVhNzZiZTUifQ.OwrAsVp9CuMzGOG0GMNejlYI6I-WEj5FQkjGSuhGEF4\"\n}\n```\n\n### To get list of user\n\n#### Request\n\n`GET \u003cBASE_URL\u003e/list/`\n\u003cbr /\u003e\nHeader: `{ 'Authorization':'\u003cTOKEN\u003e' }`\n\n#### Response\n\nResponse will be different for different user base on token.\n```json\n[\n    {\n        \"id\": \"2f837973-6f08-4ff0-8d18-12f791d30504\",\n        \"email\": \"customer2@mail.com\",\n        \"username\": \"customer2\",\n        \"first_name\": \"customer2\",\n        \"last_name\": \"customer last\",\n        \"user_type\": \"customer\",\n        \"date_joined\": \"2021-06-27T15:26:04.635540Z\"\n    },\n    {\n        \"id\": \"f3f5bdac-6bad-496a-adea-b750c821c20d\",\n        \"email\": \"user5@mail.com\",\n        \"username\": \"user5\",\n        \"first_name\": null,\n        \"last_name\": null,\n        \"user_type\": \"agent\",\n        \"date_joined\": \"2021-06-27T13:58:26.966191Z\"\n    }\n]\n```\n\n### To get user\n\n#### Request\n\n`GET \u003cBASE_URL\u003e/\u003cuuid:id\u003e/`\n\u003cbr /\u003e\nHeader: `{ 'Authorization':'\u003cTOKEN\u003e' }`\n\n#### Response\n\n```json\n{\n    \"id\": \"2f837973-6f08-4ff0-8d18-12f791d30504\",\n    \"email\": \"customer2@mail.com\",\n    \"username\": \"customer2\",\n    \"first_name\": \"customer2\",\n    \"last_name\": \"customer last\",\n    \"user_type\": \"customer\",\n    \"date_joined\": \"2021-06-27T15:26:04.635540Z\"\n}\n```\n\n### To edit user\n\n#### Request\n\n`PUT \u003cBASE_URL\u003e/\u003cuuid:id\u003e/`\n\u003cbr /\u003e\nBody: `\n{\n    \"username\":\"customer2\",\n    \"email\":\"customer2@mail.com\",\n    \"password\":\"customer2\",\n    \"first_name\":\"customer2 update\",\n    \"last_name\":\"customer last\"\n}\n`\n\u003cbr /\u003e\nHeader: `{ 'Authorization':'\u003cTOKEN\u003e' }`\n\n#### Response\n\n```json\n{\n    \"id\": \"2f837973-6f08-4ff0-8d18-12f791d30504\",\n    \"email\": \"customer2@mail.com\",\n    \"username\": \"customer2\",\n    \"first_name\": \"customer2 update\",\n    \"last_name\": \"customer last\",\n    \"user_type\": \"customer\",\n    \"date_joined\": \"2021-06-27T15:26:04.635540Z\"\n}\n```\n\n#### **BASE_URL**: /api/loan\n\n### To create loan\n\n#### Request\n\n`POST \u003cBASE_URL\u003e/create/`\n\u003cbr /\u003e\nHeader: `{ 'Authorization':'\u003cTOKEN\u003e' }`\n\u003cbr /\u003e\nBody: `{\n    'amount': 100000,\n    'interest_rate': 10,\n    'start_date':'2021/10/12',\n    'customer': 'customer2',\n    duration: 25\n}`\n\n#### Response\nOnly agent type user is allowed\n\n```json\n{\n    \"id\": 23,\n    \"amount\": 10000,\n    \"interest_rate\": 10.0,\n    \"start_date\": \"2021-10-12T00:00:00Z\",\n    \"duration\": 25,\n    \"status\": \"new\",\n    \"emi\": \"90.87\",\n    \"agent\": \"user3\",\n    \"customer\": \"customer2\"\n}\n```\n\n### To get list of loan\n\n#### Request\n\n`POST \u003cBASE_URL\u003e/list/?status=\u003cnew|approved|rejected\u003e\u0026created_at='yyyy/mm/dd'\u0026updated_at='yyyy/mm/dd'`\n\u003cbr /\u003e\nHeader: `{ 'Authorization':'\u003cTOKEN\u003e' }`\n\n#### Response\nResponse result different for different user.\n\n```json\n[\n    {\n        \"id\": 17,\n        \"amount\": 10000,\n        \"interest_rate\": 10.0,\n        \"start_date\": \"2022-10-12T00:00:00Z\",\n        \"duration\": 9,\n        \"status\": \"new\",\n        \"emi\": \"140.79\",\n        \"agent\": \"user3\",\n        \"customer\": \"customer2\"\n    },\n    {\n        \"id\": 18,\n        \"amount\": 1200,\n        \"interest_rate\": 12.0,\n        \"start_date\": \"2021-06-30T05:50:50Z\",\n        \"duration\": 6,\n        \"status\": \"new\",\n        \"emi\": \"23.46\",\n        \"agent\": \"user3\",\n        \"customer\": \"customer2\"\n    },\n]\n```\n\n### To edit loan\n\n#### Request\n\n`POST \u003cBASE_URL\u003e/edit/\u003cint:id\u003e`\n\u003cbr /\u003e\nHeader: `{ 'Authorization':'\u003cTOKEN\u003e' }`\n\u003cbr /\u003e\nBody: `{\n    \"amount\": 10000,\n    \"interest_rate\": 10.6,\n    \"start_date\": \"2022/10/12\",\n    \"duration\": 19,\n    \"agent\": \"user3\",\n    \"customer\": \"customer1\"\n}`\n\n#### Response\nOnly agent type use can edit\n\n```json\n{\n    \"id\": 20,\n    \"amount\": 10000,\n    \"interest_rate\": 10.6,\n    \"start_date\": \"2022-10-12T00:00:00Z\",\n    \"duration\": 19,\n    \"status\": \"new\",\n    \"emi\": \"102.08\",\n    \"agent\": \"user3\",\n    \"customer\": \"customer1\"\n}\n```\n\n### To approved loan\n\n#### Request\n\n`POST \u003cBASE_URL\u003e/\u003cint:id\u003e/approved/`\n\u003cbr /\u003e\nHeader: `{ 'Authorization':'\u003cTOKEN\u003e' }`\n\n#### Response\nOnly admin allowed\n\n```json\n{\n    \"success\": \"Loan is approved.\"\n}\n```\n\n### To rejected loan\n\n#### Request\n\n`POST \u003cBASE_URL\u003e/\u003cint:id\u003e/rejected/`\n\u003cbr /\u003e\nHeader: `{ 'Authorization':'\u003cTOKEN\u003e' }`\n\n#### Response\nOnly admin allowed\n\n```json\n{\n    \"success\": \"Loan is rejected.\"\n}\n```\n\n## Postman\n\nUse Postman for testing api. Import [lms.postman_collection.json](./lms.postman_collection.json) file on postman to use. As default parameter are set.\nBefore making any request on postman. First register user of agent and customer type. Then get tokens for admin, agent and customer type uses from login endpoint and paste to environment variable accordingly.\n\n### Status (Incomplete)\n\nReact For Front End will be added shortly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderj001%2Flms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderj001%2Flms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderj001%2Flms/lists"}