How csc929/ims_api_server works
Main Components
• API Server (Django Application):
• This is the core of the system. It is represented by the Django project (the solution file IMS_API_Server.sln and the main project folder).
• Django Apps:
• Accounts: Handles user management, authentication, permissions, and tests. Files include views.py, models.py, serializers.py, and custom logic (custom_permissions.py, custom_validators.py, stock_taker.py).
• IMS_Control: Manages inventory operations (add, edit, delete, view, search, pagination, etc.). Like Accounts, it contains models, views, serializers, and tests.
• App: Contains the static assets (CSS, JavaScript) and templates (HTML) for the frontend server-rendered pages (even though a separate frontend exists, this core project provides UI elements).
• Project Configuration:
• Includes common configuration files such as settings.py, urls.py (both global and per-app), and the WSGI entry point.
• Database:
• Although the README mentions options, the project is configured to use MySQL (but may also work with SQLite/PostgreSQL).
• External Dependencies:
• The RESTful API is consumed by the separate IMS_Frontend repository.
• Tools like API testing (Postman) and management tools (DBeaver) assist in development and troubleshooting.
Relationships & Interactions
• Incoming HTTP requests are routed via Django’s URL routing:
• Requests hit the project-level urls.py, which then delegates to the Accounts and IMS_Control apps’ urls.py.
• The Accounts app:
• Manages user authentication, permissions, and account-related operations.
• Contains custom validations and permission checks.
• The IMS_Control app:
• Implements the business logic for managing inventory, including CRUD operations.
• The “app” folder:
• Provides static content and HTML templates, ensuring that user interface components are rendered properly.
• The Database:
• Acts as the backend store where models from both Accounts and IMS_Control interact via Django’s ORM.
• Flow:
• Users interact via the frontend, which makes API calls to the Django REST endpoints.
• The Django server processes these API requests, executes business logic in the apps, and communicates with the database for persistence.
Architectural Patterns & Design Principles
• Django’s MVC (or MTV) pattern:
• Models represent the database structure.
• Templates (in the “app” folder) render data.
• Views process incoming requests and return responses.
• RESTful API design:
• Exposes endpoints for login, password changes, user management, and inventory operations.
• Emphasizes stateless communication between the frontend and backend.
• Separation of concerns:
• Clearly separated Django apps handle different aspects of functionality (Accounts for user management, IMS_Control for inventory operations).
Technologies & Frameworks to Highlight
• Python and Django, including Django REST framework.
• MySQL as the database backend (as configured in settings.py).
• Static assets management through Django’s templating system.
• Optional developer tools mentioned in the README (Visual Studio Code, PyCharm) that might integrate with the project structure.