diff --git a/.github/workflows/build-backend.yml b/.github/workflows/build-backend.yml new file mode 100644 index 0000000..dad51a5 --- /dev/null +++ b/.github/workflows/build-backend.yml @@ -0,0 +1,35 @@ +name: Build Backend + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + + - name: Set up Maven + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + cache: 'maven' + + - name: Build with Maven + run: mvn spring-boot:run + working-directory: ./OrariAperti/backend diff --git a/OrariAperti/backend/README.md b/OrariAperti/backend/README.md index 1da1163..fafb84e 100644 --- a/OrariAperti/backend/README.md +++ b/OrariAperti/backend/README.md @@ -4,15 +4,12 @@ OrariAperti is a room reservation system built with Spring Boot and React. ## Project Structure -- `src/main/java` - Java backend code -- `src/main/resources` - Backend resources -- `frontend` - React frontend code +- `./src/main/java` - Java backend code ## Prerequisites - Java 21 - Maven -- Node.js and npm (optional, as they will be installed by Maven) ## Development @@ -24,33 +21,7 @@ To run the backend only: mvn spring-boot:run ``` -### Frontend Development - -To run the frontend in development mode: - -```bash -cd frontend -npm install -npm run dev -``` - -This will start the Vite development server with hot reloading. - -## Building and Running the Application - -To build the entire application (both backend and frontend): - -```bash -mvn clean install -``` - -This will: -1. Install Node.js and npm (if not already installed) -2. Install frontend dependencies -3. Build the React frontend -4. Package everything into a Spring Boot JAR - -To run the built application: +and then: ```bash java -jar target/OrariAperti-0.0.1-SNAPSHOT.jar @@ -58,22 +29,33 @@ java -jar target/OrariAperti-0.0.1-SNAPSHOT.jar ## Accessing the Application -Once running, the application can be accessed at: +Once running, the backend application can be accessed at: + +- http://localhost:8080/ -- http://localhost:8080 +> [!NOTE] +> If you are visiting an invalid URL, the backend will redirect you to the frontend application. ## API Endpoints +Please check out the [OpenAPI documentation](./backend-openapi.yaml) for a more detailed view of the API. + +## In short + The backend provides the following REST API endpoints: - `GET /api/reservation` - Get a reservation using a private or public key - `POST /api/reservation` - Create a new reservation - `PUT /api/reservation/{id}` - Update an existing reservation - `DELETE /api/reservation/{id}` - Delete a reservation +- `GET /api/room` - Get all rooms ## Features - Create, view, update, and delete room reservations - Private and public keys for accessing reservations - Validation for overlapping reservations -- Responsive UI \ No newline at end of file + +## License + +This project is licensed under the [GNU General Public License v3.0](../../LICENSE). Refer to the LICENSE file for more details. diff --git a/OrariAperti/backend/pom.xml b/OrariAperti/backend/pom.xml index 687c170..73fd559 100644 --- a/OrariAperti/backend/pom.xml +++ b/OrariAperti/backend/pom.xml @@ -72,45 +72,6 @@ org.springframework.boot spring-boot-maven-plugin - - com.github.eirslett - frontend-maven-plugin - 1.12.1 - - frontend - target - - - - install node and npm - - install-node-and-npm - - - v18.16.0 - 9.5.1 - - - - npm install - - npm - - - install - - - - npm run build - - npm - - - run build - - - - diff --git a/OrariAperti/frontend/README.md b/OrariAperti/frontend/README.md index da98444..92b02a5 100644 --- a/OrariAperti/frontend/README.md +++ b/OrariAperti/frontend/README.md @@ -1,54 +1,54 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: - -```js -export default tseslint.config({ - extends: [ - // Remove ...tseslint.configs.recommended and replace with this - ...tseslint.configs.recommendedTypeChecked, - // Alternatively, use this for stricter rules - ...tseslint.configs.strictTypeChecked, - // Optionally, add this for stylistic rules - ...tseslint.configs.stylisticTypeChecked, - ], - languageOptions: { - // other options... - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - }, -}) +# OrariAperti Frontend + +This is the frontend for OrariAperti, built with React, TypeScript, and Vite. + +## Getting Started + +### Prerequisites + +- Node.js +- npm + +### Development + +To start the frontend in development mode: + +```bash +cd OrariAperti/frontend +mv .env.example .env +# Modify .env as needed. Check out the .env.example file for available options. +npm install +npm run dev ``` -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: - -```js -// eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' - -export default tseslint.config({ - plugins: { - // Add the react-x and react-dom plugins - 'react-x': reactX, - 'react-dom': reactDom, - }, - rules: { - // other rules... - // Enable its recommended typescript rules - ...reactX.configs['recommended-typescript'].rules, - ...reactDom.configs.recommended.rules, - }, -}) +This will start the Vite development server at [http://localhost:3000](http://localhost:3000) (default). + +### Building for Production + +```bash +npm run build ``` + +The production build will be output to the `dist` directory. + +## Features + +- Modern React + TypeScript codebase +- Tailwind CSS for styling +- UI components by ui/Shadcn +- Responsive design +- Connects to the OrariAperti backend REST API + +## Project Structure + +- `src/` — React components and app code +- `index.html` — Main HTML entry point +- `index.css` — Global styles + +## Linting & Formatting + +- ESLint for code quality + +## License + +This project is licensed under the [GNU General Public License v3.0](../../LICENSE). Refer to the LICENSE file for more details. diff --git a/README.md b/README.md index 1a72aaa..e2a2c15 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ -# M223 -Source Code Repository of M223 +# OrariAperti + +OrariAperti is a multi-user room reservation system built with Spring Boot (Java) for the backend and React (TypeScript, Vite) for the frontend. + +## Project Structure + +- [`backend`](./OrariAperti/backend): Spring Boot backend REST API and static resources +- [`frontend`](./OrariAperti/frontend): React + TypeScript + Vite + Tailwind + Shadcn/ui frontend app + +## Getting Started + +See the [backend README](./OrariAperti/backend/README.md) and [frontend README](./OrariAperti/frontend/README.md) for setup and usage instructions. + +## Features + +- Create, view, update, and delete room reservations +- Private and public keys for secure reservation access +- Responsive UI +- Validation for overlapping reservations +- and many more + +## License + +This project is licensed under the [GNU General Public License v3.0](./LICENSE). Refer to the license file for more details.