{"id":23500051,"url":"https://github.com/tien4112004/bistro-q-api","last_synced_at":"2025-08-09T17:15:55.787Z","repository":{"id":268422925,"uuid":"872818864","full_name":"tien4112004/bistro-q-api","owner":"tien4112004","description":"RESTAPI project for BistroQ - A POS app for restaurants. Developed as a project for CSC13001 - Windows Development course at HCMUS.","archived":false,"fork":false,"pushed_at":"2025-03-11T11:55:57.000Z","size":501,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T23:58:32.346Z","etag":null,"topics":["asp-net-core","rest-api","server"],"latest_commit_sha":null,"homepage":"","language":"C#","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/tien4112004.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":"2024-10-15T06:09:49.000Z","updated_at":"2025-03-11T11:56:39.000Z","dependencies_parsed_at":"2024-12-16T17:41:40.409Z","dependency_job_id":"06ccbd44-bb0e-44a8-9360-af79bfcb3f53","html_url":"https://github.com/tien4112004/bistro-q-api","commit_stats":null,"previous_names":["tien4112004/bistro-q-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tien4112004%2Fbistro-q-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tien4112004%2Fbistro-q-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tien4112004%2Fbistro-q-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tien4112004%2Fbistro-q-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tien4112004","download_url":"https://codeload.github.com/tien4112004/bistro-q-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535030,"owners_count":21446506,"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","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":["asp-net-core","rest-api","server"],"created_at":"2024-12-25T06:34:25.742Z","updated_at":"2025-04-23T23:58:36.068Z","avatar_url":"https://github.com/tien4112004.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BistroQ API\n\nA comprehensive backend API for a restaurant management system, serving a WinUI client application.\n\n## Links\n\n- Milestone 1 Report: [https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/](https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/)\n- Milestone 2 Report: [https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/HkhqJdrz1g](https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/HkhqJdrz1g)\n- Milestone 3 Report: [https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/SywYnZt81l](https://hackmd.io/@CXS0caWySWi1obKmwFzL-Q/SywYnZt81l)\n\n## 📋 Overview\n\nBistroQ API is a RESTful backend service designed to handle all operations for a modern restaurant management system. It provides endpoints for order management, product catalog, user authentication, and more. This project was developed as part of the CSC13001 Windows Development course at HCMUS.\n\n## 🔍 Features\n\n### 🔐 Authentication \u0026 Authorization\n- JWT-based authentication with access and refresh tokens\n- Role-based access control (Admin, Kitchen, Cashier, Client)\n- User account management\n\n### 🍽️ Restaurant Management\n- **Zone \u0026 Table Management**: Create and manage dining zones and tables\n- **Product Catalog**: Manage menu items with nutritional information\n- **Category Management**: Organize products into categories\n- **Order Processing**: Handle order creation, updates, and status tracking\n\n### 💼 Order Lifecycle\n- **Client Orders**: Customers can create orders, add/remove items\n- **Kitchen Management**: Kitchen staff can view and update order item status\n- **Cashier Operations**: Process payments and handle checkouts\n- **Real-time Updates**: SignalR hubs for real-time notifications\n\n### 📊 Smart Features\n- **Nutritional Analysis**: Track nutritional information of ordered items\n- **Product Recommendations**: AI-based recommendations based on nutritional balance\n- **Image Management**: Upload and serve product images via AWS S3/CloudFront\n\n## 🏗️ Architecture\n\n### Clean Architecture\n\nBistroQ API implements Clean Architecture principles to create a maintainable, testable, and scalable system with clear separation of concerns:\n\n#### Core/Domain Layer (BistroQ.Core)\n- Contains business entities, domain logic, and interfaces\n- Defines the core business rules and entities\n- Includes DTOs, interfaces, exceptions, and domain models\n- Has no dependencies on other layers or external frameworks\n- Defines contracts that outer layers must implement\n\n#### Application/Service Layer (BistroQ.Services)\n- Contains business logic and use cases\n- Implements service interfaces defined in the Core layer\n- Orchestrates the flow of data between entities\n- Contains validation, business rules, and transaction management\n- Depends only on the Core layer (domain interfaces)\n\n#### Infrastructure Layer (BistroQ.Infrastructure)\n- Provides implementations for interfaces defined in the Core layer\n- Contains database access (Entity Framework Core), external services\n- Implements repositories, data access, and persistence logic\n- Contains AWS S3 integration for image storage\n- Implements the Unit of Work pattern for transaction management\n\n#### Presentation Layer (BistroQ.API)\n- Contains controllers, middleware, and API endpoints\n- Handles HTTP requests and responses\n- Configures dependency injection and routes\n- Maps external requests to internal commands/queries\n- Forms the entry point to the application\n\n#### Dependency Flow\n- Dependencies flow inward, with the Core layer having no external dependencies\n- Outer layers depend on inner layers through interfaces\n- Dependency Injection is used to implement Inversion of Control\n- All layers communicate via defined interfaces, ensuring loose coupling\n\n### Project Structure\n- **BistroQ.API**: API endpoints, controllers, middleware, and configurations\n- **BistroQ.Core**: Domain entities, DTOs, interfaces, and exceptions\n- **BistroQ.Infrastructure**: Database context, repositories, and data access\n- **BistroQ.Services**: Business logic, services implementation\n- **BistroQ.Tests**: Unit tests for controllers and services\n\n### Design Patterns\n- **Repository Pattern**: Abstracts data access logic\n- **Unit of Work**: Manages transactions and data persistence\n- **Dependency Injection**: For loose coupling and testability\n- **Builder Pattern**: For constructing complex queries\n- **Specification Pattern**: For encapsulating query logic\n\n### Technology Stack\n- **Framework**: ASP.NET Core 8.0\n- **Database**: MySQL with Entity Framework Core\n- **Authentication**: JWT with Identity\n- **Real-time Communication**: SignalR\n- **Cloud Services**: AWS S3 for storage, CloudFront for CDN\n- **Testing**: MSTest\n\n## 🚀 Getting Started\n\n### Prerequisites\n- .NET 8.0 SDK\n- MySQL Server\n- AWS Account (for image storage)\n- Git\n\n### Setup Instructions\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/your-username/bistro-q-api.git\n   cd bistro-q-api\n   ```\n\n2. **Configure environment variables**\n   Copy the `.env.sample` file to `.env` and update the values:\n   ```bash\n   cp BistroQ.API/.env.sample .env\n   ```\n\n   The following environment variables need to be configured:\n   - Database connection string\n   - JWT settings\n   - AWS credentials (for image storage)\n   - Payment gateway credentials\n\n3. **Apply database migrations**\n   ```bash\n   dotnet ef database update --project BistroQ.Infrastructure --startup-project BistroQ.API --context BistroQ.Infrastructure.Data.BistroQContext\n   ```\n\n4. **Run the application**\n   ```bash\n   cd BistroQ.API\n   dotnet run\n   ```\n\n5. **Access the API documentation**\n   Navigate to `https://localhost:7034/swagger` in your browser to view the API documentation.\n\n## 📊 API Endpoints\n\nThe API is structured around the following main controllers:\n\n### Authentication\n- `POST /api/Auth/login`: Login with username and password\n- `POST /api/Auth/refresh`: Refresh access token\n\n### Client Operations\n- `GET /api/Client/Order`: View current order\n- `POST /api/Client/Order`: Create a new order\n- `PATCH /api/Client/Order/PeopleCount`: Update people count\n- `POST /api/Client/Order/Items`: Add items to order\n- `DELETE /api/Client/Order/Items`: Remove items from order\n\n### Kitchen Operations\n- `GET /api/Kitchen/Order`: View pending orders\n- `PATCH /api/Kitchen/Order/Status`: Update order item status\n\n### Cashier Operations\n- `GET /api/Cashier/Order`: View all current orders\n- `GET /api/Cashier/Order/{tableId}`: Get order by table\n- `PATCH /api/Cashier/Order/Status`: Update order status\n- `GET /api/Cashier/Zones`: Get zones with checkout status\n\n### Admin Operations\n- `GET /api/Admin/Category`: Manage product categories\n- `GET /api/Admin/Product`: Manage menu items\n- `GET /api/Admin/Zone`: Manage dining zones\n- `GET /api/Admin/Table`: Manage tables\n- `GET /api/Admin/Account`: User account management\n\n## 🔄 Data Synchronization\n\nThe system uses a combination of RESTful APIs and SignalR hubs to maintain real-time data synchronization between clients:\n\n- `CheckoutHub`: Real-time notifications for checkout operations\n\n## 🌟 Smart Features\n\n### Nutritional Analysis\nThe system tracks nutritional information (calories, protein, fat, fiber, carbohydrates) for all menu items and calculates the total nutritional content of orders.\n\n### Product Recommendations\nThe API includes a recommendation engine that analyzes the nutritional content of a customer's current order and suggests complementary items to achieve a balanced meal.\n\n## 🧪 Testing\n\nRun the test suite with:\n\n```bash\ndotnet test\n```\n\n## 📝 License\n\nThis project is part of an academic course and may be subject to specific licensing requirements of HCMUS.\n\n## 🙏 Acknowledgements\n\n- CSC13001 course instructors and teaching assistants\n- [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/)\n- [ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/)\n- [AWS SDK for .NET](https://aws.amazon.com/sdk-for-net/)\n\n---\n\nDeveloped as a project for CSC13001 Windows Development course at HCMUS.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftien4112004%2Fbistro-q-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftien4112004%2Fbistro-q-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftien4112004%2Fbistro-q-api/lists"}