Co-authored-by: pdf114514 <57948770+pdf114514@users.noreply.github.com> Agent-Logs-Url: https://github.com/pdf114514/CarReservation/sessions/cd194ca1-b339-4f2f-b717-31a0ba193964
87 lines
2.3 KiB
Markdown
87 lines
2.3 KiB
Markdown
# CarReservation
|
|
|
|
代車スケジュール管理システム — Car Rental Schedule Management System
|
|
|
|
## Overview
|
|
|
|
A web application for managing loaner car (代車) schedules at an auto shop.
|
|
|
|
- **Frontend**: React + Vite
|
|
- **Backend**: Express + SQLite (better-sqlite3)
|
|
|
|
## Features
|
|
|
|
- **Schedule View**: Table with cars as rows and dates as columns (21 days)
|
|
- **Drag to Create**: Click and drag horizontally on empty cells to create a reservation
|
|
- **Drag to Move**: Drag existing reservation blocks to move them to a new date/car
|
|
- **Reservation Modal**: Create or edit reservations with car, dates, customer name, and notes
|
|
- **Car Management**: Add, edit, and delete loaner cars
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Node.js 18+
|
|
|
|
### Setup
|
|
|
|
```bash
|
|
# Install root dependencies (concurrently for dev)
|
|
npm install
|
|
|
|
# Install backend dependencies
|
|
cd backend && npm install && cd ..
|
|
|
|
# Install frontend dependencies
|
|
cd frontend && npm install && cd ..
|
|
```
|
|
|
|
### Running
|
|
|
|
```bash
|
|
# Start backend (port 3001)
|
|
npm run dev:backend
|
|
|
|
# Start frontend (port 5173) in another terminal
|
|
npm run dev:frontend
|
|
|
|
# Or start both concurrently
|
|
npm run dev
|
|
```
|
|
|
|
Open http://localhost:5173 in your browser.
|
|
|
|
### Configuration
|
|
|
|
#### Backend URL (development proxy)
|
|
|
|
By default the Vite dev server proxies `/api` requests to `http://localhost:3001`.
|
|
To point to a different backend server, set the `BACKEND_URL` environment variable when starting the frontend:
|
|
|
|
```bash
|
|
BACKEND_URL=http://192.168.1.10:3001 npm run dev:frontend
|
|
```
|
|
|
|
#### Backend URL (production build)
|
|
|
|
When the frontend is deployed separately from the backend, set `VITE_API_BASE_URL` to the backend server's origin before building:
|
|
|
|
```bash
|
|
VITE_API_BASE_URL=https://api.example.com npm run build
|
|
```
|
|
|
|
This makes the built frontend send API requests to `https://api.example.com/api`.
|
|
|
|
### API Endpoints
|
|
|
|
| Method | Path | Description |
|
|
|--------|------|-------------|
|
|
| GET | /api/cars | List all cars |
|
|
| POST | /api/cars | Create a car |
|
|
| PUT | /api/cars/:id | Update a car |
|
|
| DELETE | /api/cars/:id | Delete a car (cascades to reservations) |
|
|
| GET | /api/reservations | List all reservations |
|
|
| POST | /api/reservations | Create a reservation |
|
|
| PUT | /api/reservations/:id | Update a reservation |
|
|
| DELETE | /api/reservations/:id | Delete a reservation |
|