diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1f806b9..5569045 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,9 +26,11 @@ repos: # Catches the same class of issue as ruff's W292 # ("no newline at end of file"), but for every text file in # the repo -- not only Python. + exclude: ^services/(py-genai-helper/generated|spring-.*/src/generated)/ - id: trailing-whitespace # Preserve intentional two-space line breaks in markdown. args: [--markdown-linebreak-ext=md] + exclude: ^services/(py-genai-helper/generated|spring-.*/src/generated)/ - id: check-yaml # --allow-multiple-documents is defensive for the planned # Helm charts under infra/; current YAML files are all @@ -54,9 +56,11 @@ repos: name: ruff (lint + autofix) args: [--fix] files: ^services/py-genai-helper/.*\.py$ + exclude: ^services/py-genai-helper/generated/ - id: ruff-format name: ruff-format files: ^services/py-genai-helper/.*\.py$ + exclude: ^services/py-genai-helper/generated/ # ------------------------------------------------------------------ # Local hooks -- delegate to the project's own toolchain (pnpm, @@ -95,3 +99,11 @@ repos: files: ^services/spring-.*/.*\.java$ pass_filenames: false stages: [pre-push] + + - id: openapi-codegen + name: openapi codegen (all services) + language: system + entry: scripts/hooks/run-codegen.sh + files: ^api/openapi\.yaml$ + pass_filenames: false + stages: [pre-commit] diff --git a/.spectral.yaml b/.spectral.yaml new file mode 100644 index 0000000..d47c47d --- /dev/null +++ b/.spectral.yaml @@ -0,0 +1 @@ +extends: ["spectral:oas"] diff --git a/README.md b/README.md index f020f2e..07893de 100644 --- a/README.md +++ b/README.md @@ -19,33 +19,66 @@ Club organizers get an all-in-one tool for managing members, automating billing, ``` repo/ ├── api/ # Single source of truth for API contracts -│ ├── openapi.yaml # Versioned OpenAPI spec -│ └── scripts/ # Code-gen helper scripts +│ ├── openapi.yaml # Versioned OpenAPI spec (OpenAPI 3.0.3) +│ └── scripts/ # Code-gen scripts (gen-all.sh, gen-spring.sh, …) ├── docs/ # Project documentation ├── services/ │ ├── spring-*/ # Java 21, Spring Boot 3 microservices -│ └── py-*/ # Python 3.12, Flask + LangChain GenAI service -├── web-client/ # React single-page application +│ │ └── src/generated/ # ⚠ Generated — do not edit by hand +│ └── py-genai-helper/ # Python 3.12, Flask + LangChain GenAI service +│ └── generated/ # ⚠ Generated — do not edit by hand +├── web-client/ # React SPA (Vite, TypeScript) +│ └── src/api.ts # ⚠ Generated — do not edit by hand ├── infra/ # docker-compose, Traefik config, Helm/Terraform └── .github/workflows/ # CI/CD pipelines ``` ## Architecture -All services sit behind a **Traefik** reverse proxy that handles routing and authentication (OAuth2). The Spring Boot services and the GenAI service share **PostgreSQL** databases. The web client communicates with the backend services via REST APIs defined in the OpenAPI spec. The GenAI service can call external LLM APIs (like OpenAI) or use local models to generate personalized feedback based on member data and trainer notes. - -| Service | Port | Stack | +All services run in Docker and are exposed through a single **Traefik** reverse +proxy on port **80**. Traefik routes requests by path prefix and strips the full +prefix before forwarding, so each service receives only the resource path (e.g. +`GET /api/v1/organization/sports` → organization-service receives `GET /sports`). +The Spring Boot services and the GenAI service share a **PostgreSQL** database. + +| Service | External route | Internal port | Stack | +|---|---|---|---| +| Organization Service | `/api/v1/organization/…` | 8080 | Java 21, Spring Boot 3 | +| Member Service | `/api/v1/members/…` | 8080 | Java 21, Spring Boot 3 | +| Event Service | `/api/v1/events/…` | 8080 | Java 21, Spring Boot 3 | +| Feedback Service | `/api/v1/feedback/…` | 8080 | Java 21, Spring Boot 3 | +| Finance Service | `/api/v1/finance/…` | 8080 | Java 21, Spring Boot 3 | +| Letter Service | `/api/v1/letters/…` | 8080 | Java 21, Spring Boot 3 | +| GenAI Service | `/api/v1/helper/…` | 5000 | Python 3.12, Flask, LangChain | +| Web Client | `/` | 8080 | React, Vite | +| Swagger UI | `/docs` | 8080 | swaggerapi/swagger-ui | +| Traefik dashboard | `http://localhost:8080` | — | Traefik v3 | +| PostgreSQL | internal only | 5432 | postgres:15 | + +## Code Generation + +`api/openapi.yaml` is the single source of truth. Three generators derive code +from it that **must never be edited by hand**: + +| Generator | Tool | Output | |---|---|---| -| Organization Service | 8001 | Java 21, Spring Boot 3 | -| Member Service | 8002 | Java 21, Spring Boot 3 | -| Event Service | 8003 | Java 21, Spring Boot 3 | -| Feedback Service | 8004 | Java 21, Spring Boot 3 | -| Finance Service | 8005 | Java 21, Spring Boot 3 | -| Letter Service | 8006 | Java 21, Spring Boot 3 | -| GenAI Service | 5000 | Python 3.12, Flask, LangChain | -| Web Client | 3000 | React, Vite | -| PostgreSQL | 5432 | — | -| Traefik | 80/443 | — | +| Spring Boot API interfaces + models | `openapitools/openapi-generator-cli:v7.14.0` (Docker) | `services/spring-*/src/generated/java/` | +| Pydantic v2 models | `datamodel-code-generator` (pip) | `services/py-genai-helper/generated/models.py` | +| TypeScript types | `openapi-typescript` (pnpm devDep) | `web-client/src/api.ts` | + +Run all generators at once: + +```bash +./api/scripts/gen-all.sh +``` + +The `openapi-codegen` pre-commit hook runs this automatically whenever +`api/openapi.yaml` is staged. If any generated file changes, the hook re-stages +the output and aborts so you can review the diff before re-committing. + +Prerequisites: **Docker** (Spring generator), **`datamodel-code-generator`** +(`pip install datamodel-code-generator`), **`pnpm`** (already a devDependency +in `web-client/`). ## Developer Setup @@ -54,21 +87,22 @@ checks locally that CI gates on (ruff, eslint, end-of-file fixer, pnpm lockfile sync, etc.). One-time setup per developer: ```bash -pip install pre-commit # or: pipx install pre-commit -pre-commit install # installs the pre-commit git hook -pre-commit install --hook-type pre-push # installs the pre-push hook -pre-commit run --all-files # optional one-time clean-up pass +pip install pre-commit datamodel-code-generator # or: pipx install pre-commit +pre-commit install # installs the pre-commit git hook +pre-commit install --hook-type pre-push # installs the pre-push hook +pre-commit run --all-files # optional one-time clean-up pass ``` What runs when: | Stage | Hooks | |---|---| -| `pre-commit` (every commit) | end-of-file-fixer, trailing-whitespace, check-yaml/json, merge-conflict guard, large-file guard, **ruff** (lint + format, py-genai-helper), **eslint --fix** (web-client), **pnpm-lock-sync** (regenerates `web-client/pnpm-lock.yaml` when `package.json` changes) | +| `pre-commit` (every commit) | end-of-file-fixer, trailing-whitespace, check-yaml/json, merge-conflict guard, large-file guard, **ruff** (lint + format, py-genai-helper), **eslint --fix** (web-client), **pnpm-lock-sync** (regenerates `web-client/pnpm-lock.yaml` when `package.json` changes), **openapi-codegen** (regenerates all generated sources when `api/openapi.yaml` changes) | | `pre-push` (only on push) | **Spectral** lint of `api/openapi.yaml` (if changed), **Checkstyle** for all Spring services (if Java sources changed) | -Auto-fixing hooks (ruff, eslint, npm-lock-sync, end-of-file-fixer, etc.) will -modify files and **abort the commit** so you can re-stage and re-commit. +Auto-fixing hooks (ruff, eslint, pnpm-lock-sync, openapi-codegen, +end-of-file-fixer, etc.) will modify files and **abort the commit** so you can +re-stage and re-commit. Bypass (emergencies only -- CI will still gate): diff --git a/api/openapi.yaml b/api/openapi.yaml index e69de29..eace1e7 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -0,0 +1,1571 @@ +openapi: 3.0.3 +info: + title: Club Management System API + description: This is the API definition of the Club Management System. + version: 0.0.0 + contact: + name: team-devoops +servers: + - url: /api/v1 + description: Base URL for all API endpoints +paths: + /organization/sports: + get: + operationId: getAllSports + tags: + - organization + summary: Get all sports + description: Returns a list of all sports registered in the organization. If the caller is not an admin, only sports that the caller is a member of will be returned. + responses: + "200": + description: The request was successful, and the server has returned the requested resource in the response body. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Sport" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + parameters: [] + post: + operationId: createSport + tags: + - organization + summary: Create sport + description: Creates a new sport in the organization. Only admins are allowed to create new sports. + responses: + "201": + description: The request was successful, and a new resource was created. + content: + application/json: + schema: + $ref: "#/components/schemas/Sport" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "409": + $ref: "#/components/responses/Conflict" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for creating a new sport. + content: + application/json: + schema: + $ref: "#/components/schemas/SportCreate" + /organization/sports/{sport_name}: + patch: + operationId: updateSport + tags: + - organization + summary: Update sport + parameters: + - $ref: "#/components/parameters/sport_name" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Sport" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + requestBody: + required: true + description: The request body for partially updating a sport. + content: + application/json: + schema: + $ref: "#/components/schemas/SportPartialUpdate" + security: + - BearerJwt: [] + delete: + operationId: deleteSport + tags: + - organization + summary: Delete sport + parameters: + - $ref: "#/components/parameters/sport_name" + responses: + "204": + description: The request was successful, but there is no content to return in + the response. + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + get: + operationId: getSport + tags: + - organization + summary: Get sport + parameters: + - $ref: "#/components/parameters/sport_name" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Sport" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + /organization/teams: + get: + operationId: getAllTeams + tags: + - organization + summary: Get all teams + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Team" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + post: + operationId: createTeam + tags: + - organization + summary: Create team + responses: + "201": + description: The request was successful, and a new resource was created. + content: + application/json: + schema: + $ref: "#/components/schemas/Team" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "409": + $ref: "#/components/responses/Conflict" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for creating a new team. + content: + application/json: + schema: + $ref: "#/components/schemas/TeamCreate" + /organization/teams/{team_id}: + get: + operationId: getTeam + tags: + - organization + summary: Get team + parameters: + - $ref: "#/components/parameters/team_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Team" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + patch: + operationId: updateTeam + tags: + - organization + summary: Update team + parameters: + - $ref: "#/components/parameters/team_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Team" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for partially updating a team. + content: + application/json: + schema: + $ref: "#/components/schemas/TeamPartialUpdate" + delete: + operationId: deleteTeam + tags: + - organization + summary: Delete team + parameters: + - $ref: "#/components/parameters/team_id" + responses: + "204": + description: The request was successful, but there is no content to return in + the response. + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + /members: + get: + operationId: getAllMembers + tags: + - members + summary: Get all members + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/MemberSummary" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + post: + operationId: createMember + tags: + - members + summary: Create member + responses: + "201": + description: The request was successful, and a new resource was created. + content: + application/json: + schema: + $ref: "#/components/schemas/Member" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "409": + $ref: "#/components/responses/Conflict" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for creating a new member. + content: + application/json: + schema: + $ref: "#/components/schemas/MemberCreate" + /members/{member_id}: + get: + operationId: getMemberDetails + tags: + - members + summary: Get member details + parameters: + - $ref: "#/components/parameters/member_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Member" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + patch: + operationId: updateMemberDetails + tags: + - members + summary: Update member details + parameters: + - $ref: "#/components/parameters/member_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Member" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for partially updating a member. + content: + application/json: + schema: + $ref: "#/components/schemas/MemberPartialUpdate" + delete: + operationId: deleteMember + tags: + - members + summary: Delete member + parameters: + - $ref: "#/components/parameters/member_id" + responses: + "204": + description: The request was successful, but there is no content to return in + the response. + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + /events: + get: + operationId: getAllEvents + tags: + - events + summary: Get all events + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/EventSummary" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + post: + operationId: createEvent + tags: + - events + summary: Create event + responses: + "201": + description: The request was successful, and a new resource was created. + content: + application/json: + schema: + $ref: "#/components/schemas/Event" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "409": + $ref: "#/components/responses/Conflict" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for creating a new event. + content: + application/json: + schema: + $ref: "#/components/schemas/EventCreate" + /events/{event_id}: + get: + operationId: getEventDetails + tags: + - events + summary: Get event details + parameters: + - $ref: "#/components/parameters/event_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Event" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + patch: + operationId: updateEventDetails + tags: + - events + summary: Update event details + parameters: + - $ref: "#/components/parameters/event_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Event" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for partially updating an event. + content: + application/json: + schema: + $ref: "#/components/schemas/EventPartialUpdate" + delete: + operationId: deleteEvent + tags: + - events + summary: Delete event + parameters: + - $ref: "#/components/parameters/event_id" + responses: + "204": + description: The request was successful, but there is no content to return in + the response. + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + /feedback: + get: + operationId: getAllFeedback + tags: + - feedback + summary: Get all feedback + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/FeedbackSummary" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + post: + operationId: createFeedback + tags: + - feedback + summary: Create feedback + responses: + "201": + description: The request was successful, and a new resource was created. + content: + application/json: + schema: + $ref: "#/components/schemas/Feedback" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "409": + $ref: "#/components/responses/Conflict" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for creating new feedback. + content: + application/json: + schema: + $ref: "#/components/schemas/FeedbackCreate" + /feedback/{feedback_id}: + get: + operationId: getFeedbackDetails + tags: + - feedback + summary: Get feedback details + parameters: + - $ref: "#/components/parameters/feedback_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Feedback" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + delete: + operationId: deleteFeedback + tags: + - feedback + summary: Delete feedback + parameters: + - $ref: "#/components/parameters/feedback_id" + responses: + "204": + description: The request was successful, but there is no content to return in + the response. + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + patch: + operationId: updateFeedbackDetails + tags: + - feedback + summary: Update feedback details + parameters: + - $ref: "#/components/parameters/feedback_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Feedback" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for partially updating a specific feedback. + content: + application/json: + schema: + $ref: "#/components/schemas/FeedbackPartialUpdate" + /finance/balances: + get: + operationId: getAllBalances + tags: + - finance + summary: Get all balances + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Balance" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + /finance/balances/{member_id}: + get: + operationId: getMemberBalance + tags: + - finance + summary: Get member balance + parameters: + - $ref: "#/components/parameters/member_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Balance" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + /finance/transactions: + get: + operationId: getAllTransactions + tags: + - finance + summary: Get all transactions + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Transaction" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + post: + operationId: createTransaction + tags: + - finance + summary: Create transaction + responses: + "201": + description: The request was successful, and a new resource was created. + content: + application/json: + schema: + $ref: "#/components/schemas/Transaction" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "409": + $ref: "#/components/responses/Conflict" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for creating a new transaction. + content: + application/json: + schema: + $ref: "#/components/schemas/TransactionCreate" + /finance/transactions/{transaction_id}: + get: + operationId: getTransaction + tags: + - finance + summary: Get transaction + parameters: + - $ref: "#/components/parameters/transaction_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Transaction" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + patch: + operationId: updateTransaction + tags: + - finance + summary: Update transaction + parameters: + - $ref: "#/components/parameters/transaction_id" + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/json: + schema: + $ref: "#/components/schemas/Transaction" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for partially updating a transaction. + content: + application/json: + schema: + $ref: "#/components/schemas/TransactionPartialUpdate" + delete: + operationId: deleteTransaction + tags: + - finance + summary: Delete transaction + parameters: + - $ref: "#/components/parameters/transaction_id" + responses: + "204": + description: The request was successful, but there is no content to return in + the response. + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "404": + $ref: "#/components/responses/NotFound" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + /letters/mail: + post: + operationId: sendMail + tags: + - letters + summary: Send mail + responses: + "204": + $ref: "#/components/responses/NoContent" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + requestBody: + required: true + description: The request body for sending mail. It will be used in the email content. It must be a valid HTML string using the template format with placeholders for dynamic content. + content: + text/html: + schema: + type: string + parameters: [] + /letters/pdf: + post: + operationId: getPdf + tags: + - letters + summary: Get pdf + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + application/pdf: + schema: + type: string + format: binary + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + security: + - BearerJwt: [] + parameters: [] + requestBody: + required: true + description: The request body for generating a pdf from a template. It must be a valid HTML string using the template format with placeholders for dynamic content. + content: + text/html: + schema: + type: string + /helper/report/{member_id}: + get: + operationId: generateReport + tags: + - helper + summary: Generate report + responses: + "200": + description: The request was successful, and the server has returned the + requested resource in the response body. + content: + text/plain: + schema: + type: string + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/InternalServerError" + parameters: + - $ref: "#/components/parameters/member_id" + security: + - BearerJwt: [] +components: + responses: + InternalServerError: + description: The server encountered an unexpected condition that prevented it + from fulfilling the request. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + NotFound: + description: The server cannot find the requested resource. The endpoint may be + invalid or the resource may no longer exist. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + BadRequest: + description: The server could not understand the request due to invalid syntax. + The client should modify the request and try again. + content: + application/json: + schema: + $ref: "#/components/schemas/BadRequestResponse" + Conflict: + description: The request could not be completed due to a conflict with the + current state of the resource. Resolve the conflict and try again. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + NoContent: + description: The request was successful, but there is no content to return in + the response. + Unauthorized: + description: Authentication is required to access the requested resource. The + client must include the appropriate credentials. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + Forbidden: + description: The server understood the request, but refuses to authorize it. + Ensure the client has appropriate permissions. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + securitySchemes: + BearerJwt: + type: http + scheme: bearer + bearerFormat: Json Web Token (JWT) + description: "Jwt Auth: Authenticated requests contain a valid Json Web Token + (JWT) as part of the `Authorization: Bearer ` header." + parameters: + sport_name: + name: sport_name + in: path + required: true + schema: + type: string + team_id: + name: team_id + in: path + required: true + schema: + type: string + format: uuid + member_id: + name: member_id + in: path + required: true + schema: + type: string + format: uuid + event_id: + name: event_id + in: path + required: true + schema: + type: string + format: uuid + feedback_id: + name: feedback_id + in: path + required: true + schema: + type: string + format: uuid + transaction_id: + name: transaction_id + in: path + required: true + schema: + type: string + format: uuid + schemas: + ErrorResponse: + type: object + properties: + message: + type: string + required: + - message + BadRequestResponse: + type: object + properties: + message: + type: string + errors: + type: array + items: + $ref: "#/components/schemas/ErrorResponse" + required: + - message + Sport: + type: object + properties: + name: + type: string + description: + type: string + created_at: + type: string + format: date + directors: + type: array + items: + type: string + required: + - name + - description + - created_at + - directors + description: The object representation of a Sport within the organization. + SportCreate: + type: object + properties: + name: + type: string + description: + type: string + directors: + type: array + items: + type: string + required: + - name + description: Data transfer object for creating a new Sport. + SportPartialUpdate: + type: object + properties: + name: + type: string + description: + type: string + directors: + type: array + items: + type: string + description: Data transfer object for partially updating an existing Sport + (PATCH operation). + Team: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + description: + type: string + created_at: + type: string + format: date + address: + type: string + sport: + type: string + trainers: + type: array + items: + type: string + trainees: + type: array + items: + type: string + required: + - id + - name + - description + - created_at + - address + - sport + - trainers + - trainees + description: The object representation of a Team that belongs to a specific Sport. + TeamCreate: + type: object + properties: + name: + type: string + description: + type: string + address: + type: string + sport: + type: string + trainers: + type: array + items: + type: string + trainees: + type: array + items: + type: string + required: + - name + - sport + description: Data transfer object for creating a new Team. + TeamPartialUpdate: + type: object + properties: + name: + type: string + description: + type: string + address: + type: string + sport: + type: string + trainers: + type: array + items: + type: string + trainees: + type: array + items: + type: string + description: Data transfer object for partially updating an existing Team (PATCH + operation). + Member: + type: object + properties: + id: + type: string + format: uuid + first_name: + type: string + last_name: + type: string + email: + type: string + birthday: + type: string + format: date + phone_number: + type: string + address: + type: string + joining_date: + type: string + format: date + information: + type: string + required: + - id + - first_name + - last_name + - email + - birthday + - phone_number + - address + - joining_date + - information + description: The object representation of a Member. All users are represented as a member. + MemberSummary: + type: object + properties: + id: + type: string + format: uuid + first_name: + type: string + last_name: + type: string + email: + type: string + required: + - id + - first_name + - last_name + - email + description: A simplified representation of a Member, typically used in list views. + MemberPartialUpdate: + type: object + properties: + first_name: + type: string + last_name: + type: string + email: + type: string + birthday: + type: string + format: date + phone_number: + type: string + address: + type: string + information: + type: string + description: Data transfer object for partially updating an existing Member + (PATCH operation). + MemberCreate: + type: object + properties: + first_name: + type: string + last_name: + type: string + email: + type: string + birthday: + type: string + format: date + phone_number: + type: string + address: + type: string + information: + type: string + required: + - first_name + - last_name + description: Data transfer object for creating a new Member. + Event: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + description: + type: string + start_time: + type: string + format: date-time + end_time: + type: string + format: date-time + attendees: + type: array + items: + type: string + sports_linked: + type: array + items: + type: string + description: Names of the sports associated with this event. + teams_linked: + type: array + items: + type: string + description: IDs of the teams associated with this event. + creator: + type: string + required: + - id + - name + - description + - start_time + - end_time + - creator + description: The object representation of an Event (e.g., a training session or a match). + EventSummary: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + start_time: + type: string + format: date-time + end_time: + type: string + format: date-time + required: + - id + - name + - start_time + - end_time + description: A simplified representation of a Event, typically used in list views. + EventPartialUpdate: + type: object + properties: + name: + type: string + description: + type: string + start_time: + type: string + format: date-time + end_time: + type: string + format: date-time + attendees: + type: array + items: + type: string + sports_linked: + type: array + items: + type: string + teams_linked: + type: array + items: + type: string + description: Data transfer object for partially updating an existing Event + (PATCH operation). + EventCreate: + type: object + properties: + name: + type: string + description: + type: string + start_time: + type: string + format: date-time + end_time: + type: string + format: date-time + attendees: + type: array + items: + type: string + sports_linked: + type: array + items: + type: string + teams_linked: + type: array + items: + type: string + required: + - name + - start_time + - end_time + description: Data transfer object for creating a new Event. + Feedback: + type: object + properties: + id: + type: string + format: uuid + event: + type: string + member: + type: string + creator: + type: string + created_at: + type: string + format: date-time + feedback: + type: string + required: + - id + - event + - member + - creator + - created_at + - feedback + description: The object representation of Feedback, which is associated with a specific Event and Member. + FeedbackSummary: + type: object + properties: + id: + type: string + format: uuid + event: + type: string + member: + type: string + creator: + type: string + created_at: + type: string + format: date-time + required: + - id + - event + - member + - creator + - created_at + description: A simplified representation of a Feedback, typically used in list views. + FeedbackPartialUpdate: + type: object + properties: + event: + type: string + member: + type: string + feedback: + type: string + description: Data transfer object for partially updating an existing Feedback + (PATCH operation). + FeedbackCreate: + type: object + properties: + event: + type: string + member: + type: string + feedback: + type: string + required: + - event + - member + - feedback + description: Data transfer object for creating a new Feedback. + Transaction: + type: object + properties: + id: + type: string + format: uuid + member: + type: string + creator: + type: string + amount_cents: + type: integer + created_at: + type: string + format: date-time + title: + type: string + description: + type: string + required: + - id + - member + - creator + - amount_cents + - created_at + - title + - description + description: The object representation of a Transaction, which includes details such as the member, creator, amount, and timestamps. + TransactionPartialUpdate: + type: object + properties: + member: + type: string + amount_cents: + type: integer + title: + type: string + description: + type: string + description: Data transfer object for partially updating an existing Transaction + (PATCH operation). + TransactionCreate: + type: object + properties: + member: + type: string + amount_cents: + type: integer + title: + type: string + description: + type: string + required: + - member + - amount_cents + - title + description: Data transfer object for creating a new Transaction. + Balance: + type: object + properties: + member: + type: string + balance_cents: + type: integer + required: + - member + - balance_cents + description: The object representation of a Member's Balance, which includes the total balance in cents. +tags: + - name: organization + description: Endpoints related to managing the overall organization, including sports and teams. + - name: members + description: Endpoints related to managing members of the organization (which represent all users). + - name: events + description: Endpoints related to managing events such as training sessions and matches. + - name: feedback + description: Endpoints related to managing feedback provided by trainers to members for events. + - name: finance + description: Endpoints related to managing financial transactions and balances for members. + - name: letters + description: Endpoints related to generating and sending letters from templates, such as emails and PDFs. + - name: helper + description: Endpoints related to the genai helper functions, such as generating reports based on member data. diff --git a/api/scripts/gen-all.sh b/api/scripts/gen-all.sh new file mode 100755 index 0000000..bde5a12 --- /dev/null +++ b/api/scripts/gen-all.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Run all OpenAPI code generators for every service. +# Called by scripts/hooks/run-codegen.sh (pre-commit) and can be run standalone. +# +# Prerequisites: +# - Docker running (Spring generator) +# - datamodel-code-generator (pip install datamodel-code-generator) +# - openapi-typescript (pnpm devDependency in web-client) +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +echo "Running OpenAPI code generation..." + +# Spring services — each receives only its own tag's API interface + relevant models +"$SCRIPT_DIR/gen-spring.sh" spring-organization organization organizationservice "Sport:SportCreate:SportPartialUpdate:Team:TeamCreate:TeamPartialUpdate:ErrorResponse:BadRequestResponse" +"$SCRIPT_DIR/gen-spring.sh" spring-member members memberservice "Member:MemberSummary:MemberCreate:MemberPartialUpdate:ErrorResponse:BadRequestResponse" +"$SCRIPT_DIR/gen-spring.sh" spring-event events eventservice "Event:EventSummary:EventCreate:EventPartialUpdate:ErrorResponse:BadRequestResponse" +"$SCRIPT_DIR/gen-spring.sh" spring-feedback feedback feedbackservice "Feedback:FeedbackSummary:FeedbackCreate:FeedbackPartialUpdate:ErrorResponse:BadRequestResponse" +"$SCRIPT_DIR/gen-spring.sh" spring-finance finance financeservice "Balance:Transaction:TransactionCreate:TransactionPartialUpdate:ErrorResponse:BadRequestResponse" +"$SCRIPT_DIR/gen-spring.sh" spring-letter letters letterservice "ErrorResponse:BadRequestResponse" + +# Pydantic models for py-genai-helper +"$SCRIPT_DIR/gen-python-models.sh" + +# TypeScript SDK for web-client +"$SCRIPT_DIR/gen-typescript.sh" + +echo "Code generation complete." diff --git a/api/scripts/gen-python-models.sh b/api/scripts/gen-python-models.sh new file mode 100755 index 0000000..10d851f --- /dev/null +++ b/api/scripts/gen-python-models.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Generate Pydantic v2 models for py-genai-helper from the OpenAPI spec. +# Mirrors what the Spring generator produces for Java services: typed +# request/response models derived directly from the spec. +# Requires: datamodel-code-generator (pip install datamodel-code-generator) +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" +OUT_FILE="$REPO_ROOT/services/py-genai-helper/generated/models.py" + +echo " Generating Python models (py-genai-helper)..." + +mkdir -p "$(dirname "$OUT_FILE")" + +cd "$REPO_ROOT" +python -m datamodel_code_generator \ + --input api/openapi.yaml \ + --input-file-type openapi \ + --output "$OUT_FILE" \ + --output-model-type pydantic_v2.BaseModel \ + --target-python-version 3.12 \ + --use-annotated \ + --field-constraints \ + --formatters black diff --git a/api/scripts/gen-spring.sh b/api/scripts/gen-spring.sh new file mode 100755 index 0000000..74b4c11 --- /dev/null +++ b/api/scripts/gen-spring.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Generate Spring Boot API interfaces and model classes for a single service. +# Usage: gen-spring.sh +# e.g.: gen-spring.sh spring-member members memberservice "Member:MemberSummary:MemberCreate:MemberPartialUpdate" +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" +SERVICE="$1" +TAG="$2" +PKG="$3" +MODELS="$4" + +# Capitalise first letter so it matches the generator's API class name (e.g. members → Members) +TAG_CAP="$(echo "${TAG:0:1}" | tr '[:lower:]' '[:upper:]')${TAG:1}" + +OUT_DIR="$REPO_ROOT/services/$SERVICE/src/generated/java" + +echo " Generating Spring stubs: $SERVICE (tag=$TAG)..." + +# Remove previous output so renamed/deleted schemas don't linger +rm -rf "$OUT_DIR" + +docker run --rm \ + --user "$(id -u):$(id -g)" \ + -v "$REPO_ROOT:/local" \ + openapitools/openapi-generator-cli:v7.14.0 generate \ + -i /local/api/openapi.yaml \ + -g spring \ + -o /local/services/"$SERVICE"/src/generated/java \ + --skip-validate-spec \ + --global-property "apis=$TAG_CAP,models=$MODELS,supportingFiles=ApiUtil.java" \ + --additional-properties "useSpringBoot3=true,interfaceOnly=true,openApiNullable=false,useTags=true,sourceFolder=,apiPackage=tum.devoops.$PKG.api,modelPackage=tum.devoops.$PKG.model,hideGenerationTimestamp=true" diff --git a/api/scripts/gen-typescript.sh b/api/scripts/gen-typescript.sh new file mode 100755 index 0000000..55c64f9 --- /dev/null +++ b/api/scripts/gen-typescript.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Generate TypeScript types for the web-client SDK using openapi-typescript. +# Requires: openapi-typescript devDependency in web-client/package.json +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" + +echo " Generating TypeScript types..." + +cd "$REPO_ROOT" +pnpm --prefix web-client exec openapi-typescript \ + "$REPO_ROOT/api/openapi.yaml" \ + -o "$REPO_ROOT/web-client/src/api.ts" diff --git a/docker-compose.yml b/docker-compose.yml index 85fc028..1ed0c34 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,8 +8,10 @@ services: - 5000 labels: - "traefik.enable=true" - - "traefik.http.routers.py-genai-helper.entrypoints=py-genai-helper" - - "traefik.http.routers.py-genai-helper.rule=PathPrefix(`/`)" + - "traefik.http.routers.py-genai-helper.entrypoints=web" + - "traefik.http.routers.py-genai-helper.rule=PathPrefix(`/api/v1/helper`)" + - "traefik.http.middlewares.helper-stripprefix.stripprefix.prefixes=/api/v1/helper" + - "traefik.http.routers.py-genai-helper.middlewares=helper-stripprefix" - "traefik.http.services.py-genai-helper.loadbalancer.server.port=5000" networks: - proxy @@ -29,8 +31,10 @@ services: - SPRING_JPA_HIBERNATE_DDL_AUTO=update labels: - "traefik.enable=true" - - "traefik.http.routers.organization-service.entrypoints=organization-service" - - "traefik.http.routers.organization-service.rule=PathPrefix(`/`)" + - "traefik.http.routers.organization-service.entrypoints=web" + - "traefik.http.routers.organization-service.rule=PathPrefix(`/api/v1/organization`)" + - "traefik.http.middlewares.organization-stripprefix.stripprefix.prefixes=/api/v1/organization" + - "traefik.http.routers.organization-service.middlewares=organization-stripprefix" - "traefik.http.services.organization-service.loadbalancer.server.port=8080" networks: - proxy @@ -51,8 +55,10 @@ services: - SPRING_JPA_HIBERNATE_DDL_AUTO=update labels: - "traefik.enable=true" - - "traefik.http.routers.member-service.entrypoints=member-service" - - "traefik.http.routers.member-service.rule=PathPrefix(`/`)" + - "traefik.http.routers.member-service.entrypoints=web" + - "traefik.http.routers.member-service.rule=PathPrefix(`/api/v1/members`)" + - "traefik.http.middlewares.member-stripprefix.stripprefix.prefixes=/api/v1/members" + - "traefik.http.routers.member-service.middlewares=member-stripprefix" - "traefik.http.services.member-service.loadbalancer.server.port=8080" networks: - proxy @@ -73,8 +79,10 @@ services: - SPRING_JPA_HIBERNATE_DDL_AUTO=update labels: - "traefik.enable=true" - - "traefik.http.routers.event-service.entrypoints=event-service" - - "traefik.http.routers.event-service.rule=PathPrefix(`/`)" + - "traefik.http.routers.event-service.entrypoints=web" + - "traefik.http.routers.event-service.rule=PathPrefix(`/api/v1/events`)" + - "traefik.http.middlewares.event-stripprefix.stripprefix.prefixes=/api/v1/events" + - "traefik.http.routers.event-service.middlewares=event-stripprefix" - "traefik.http.services.event-service.loadbalancer.server.port=8080" networks: - proxy @@ -95,8 +103,10 @@ services: - SPRING_JPA_HIBERNATE_DDL_AUTO=update labels: - "traefik.enable=true" - - "traefik.http.routers.feedback-service.entrypoints=feedback-service" - - "traefik.http.routers.feedback-service.rule=PathPrefix(`/`)" + - "traefik.http.routers.feedback-service.entrypoints=web" + - "traefik.http.routers.feedback-service.rule=PathPrefix(`/api/v1/feedback`)" + - "traefik.http.middlewares.feedback-stripprefix.stripprefix.prefixes=/api/v1/feedback" + - "traefik.http.routers.feedback-service.middlewares=feedback-stripprefix" - "traefik.http.services.feedback-service.loadbalancer.server.port=8080" networks: - proxy @@ -117,8 +127,10 @@ services: - SPRING_JPA_HIBERNATE_DDL_AUTO=update labels: - "traefik.enable=true" - - "traefik.http.routers.finance-service.entrypoints=finance-service" - - "traefik.http.routers.finance-service.rule=PathPrefix(`/`)" + - "traefik.http.routers.finance-service.entrypoints=web" + - "traefik.http.routers.finance-service.rule=PathPrefix(`/api/v1/finance`)" + - "traefik.http.middlewares.finance-stripprefix.stripprefix.prefixes=/api/v1/finance" + - "traefik.http.routers.finance-service.middlewares=finance-stripprefix" - "traefik.http.services.finance-service.loadbalancer.server.port=8080" networks: - proxy @@ -139,13 +151,33 @@ services: - SPRING_JPA_HIBERNATE_DDL_AUTO=update labels: - "traefik.enable=true" - - "traefik.http.routers.letter-service.entrypoints=letter-service" - - "traefik.http.routers.letter-service.rule=PathPrefix(`/`)" + - "traefik.http.routers.letter-service.entrypoints=web" + - "traefik.http.routers.letter-service.rule=PathPrefix(`/api/v1/letters`)" + - "traefik.http.middlewares.letter-stripprefix.stripprefix.prefixes=/api/v1/letters" + - "traefik.http.routers.letter-service.middlewares=letter-stripprefix" - "traefik.http.services.letter-service.loadbalancer.server.port=8080" networks: - proxy - data + api-docs: + image: swaggerapi/swagger-ui + container_name: api-docs + expose: + - 8080 + environment: + - SWAGGER_JSON=/app/openapi.yaml + - BASE_URL=/docs + volumes: + - ./api/openapi.yaml:/app/openapi.yaml:ro + labels: + - "traefik.enable=true" + - "traefik.http.routers.api-docs.entrypoints=web" + - "traefik.http.routers.api-docs.rule=PathPrefix(`/docs`)" + - "traefik.http.services.api-docs.loadbalancer.server.port=8080" + networks: + - proxy + web-client: build: web-client/ container_name: web-client @@ -161,7 +193,7 @@ services: - py-genai-helper labels: - "traefik.enable=true" - - "traefik.http.routers.web-client.entrypoints=web-client" + - "traefik.http.routers.web-client.entrypoints=web" - "traefik.http.routers.web-client.rule=PathPrefix(`/`)" - "traefik.http.services.web-client.loadbalancer.server.port=8080" networks: @@ -175,23 +207,9 @@ services: - "--providers.docker=true" - "--providers.docker.exposedByDefault=false" - "--providers.docker.network=proxy" - - "--entrypoints.py-genai-helper.address=:5000" - - "--entrypoints.organization-service.address=:8001" - - "--entrypoints.member-service.address=:8002" - - "--entrypoints.event-service.address=:8003" - - "--entrypoints.feedback-service.address=:8004" - - "--entrypoints.finance-service.address=:8005" - - "--entrypoints.letter-service.address=:8006" - - "--entrypoints.web-client.address=:3000" + - "--entrypoints.web.address=:80" ports: - - "3000:3000" - - "5000:5000" - - "8001:8001" - - "8002:8002" - - "8003:8003" - - "8004:8004" - - "8005:8005" - - "8006:8006" + - "80:80" - "8080:8080" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro diff --git a/scripts/hooks/run-codegen.sh b/scripts/hooks/run-codegen.sh new file mode 100755 index 0000000..d51c456 --- /dev/null +++ b/scripts/hooks/run-codegen.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Pre-commit hook: regenerate all service code whenever api/openapi.yaml changes. +# Mirrors the run-spectral.sh pattern; runs gen-all.sh and stages generated output. +set -euo pipefail + +if [ ! -s api/openapi.yaml ]; then + echo "api/openapi.yaml is empty -- skipping codegen." + exit 0 +fi + +./api/scripts/gen-all.sh + +# Stage all generated output so it's included in the commit +git add \ + services/spring-*/src/generated/ \ + services/py-genai-helper/generated/ \ + web-client/src/api.ts diff --git a/scripts/hooks/run-spectral.sh b/scripts/hooks/run-spectral.sh index c3c53e6..4e8bff0 100755 --- a/scripts/hooks/run-spectral.sh +++ b/scripts/hooks/run-spectral.sh @@ -8,4 +8,4 @@ if [ ! -s api/openapi.yaml ]; then exit 0 fi -exec npx --yes @stoplight/spectral-cli lint api/openapi.yaml +exec npx --yes @stoplight/spectral-cli lint api/openapi.yaml --fail-severity error diff --git a/scripts/hooks/sync-pnpm-lock.sh b/scripts/hooks/sync-pnpm-lock.sh old mode 100644 new mode 100755 index dc079b3..e5d8ae3 --- a/scripts/hooks/sync-pnpm-lock.sh +++ b/scripts/hooks/sync-pnpm-lock.sh @@ -4,23 +4,27 @@ # CI by keeping the lockfile in the SAME commit as the manifest. # # Behavior: -# 1. Regenerate pnpm-lock.yaml from package.json (no install, no scripts). -# 2. Stage the (possibly updated) lockfile. -# 3. If the lockfile actually changed, abort the commit so the developer -# can review and re-commit. If it didn't change, allow the commit. +# 1. Capture the currently-staged lockfile content. +# 2. Regenerate pnpm-lock.yaml from package.json (no install, no scripts). +# 3. If the lockfile changed from what was staged, stage the new version +# and abort so the developer can review and re-commit. +# If it didn't change, the lockfile is already correct -- allow the commit. set -euo pipefail -cd web-client +LOCK_FILE="web-client/pnpm-lock.yaml" + +# Snapshot the staged (or committed) lockfile before we touch anything. +before="$(git show ":$LOCK_FILE" 2>/dev/null || cat "$LOCK_FILE" 2>/dev/null || true)" + echo "package.json changed -- regenerating pnpm-lock.yaml..." +cd web-client pnpm install --lockfile-only --ignore-scripts cd .. -git add web-client/pnpm-lock.yaml +after="$(cat "$LOCK_FILE")" -if ! git diff --cached --quiet -- web-client/pnpm-lock.yaml; then - # The lockfile was either newly staged or its staged contents changed - # as a result of this regeneration. Force the developer to re-commit - # so they see the diff that's about to land. +if [ "$before" != "$after" ]; then + git add "$LOCK_FILE" cat <<'EOF' pnpm-lock.yaml was regenerated and staged. diff --git a/services/py-genai-helper/generated/models.py b/services/py-genai-helper/generated/models.py new file mode 100644 index 0000000..78490bb --- /dev/null +++ b/services/py-genai-helper/generated/models.py @@ -0,0 +1,208 @@ +# generated by datamodel-codegen: +# filename: openapi.yaml +# timestamp: 2026-05-26T18:08:16+00:00 + +from __future__ import annotations +from pydantic import AwareDatetime, BaseModel, Field +from datetime import date +from uuid import UUID +from typing import Annotated + + +class ErrorResponse(BaseModel): + message: str + + +class BadRequestResponse(BaseModel): + message: str + errors: list[ErrorResponse] | None = None + + +class Sport(BaseModel): + name: str + description: str + created_at: date + directors: list[str] + + +class SportCreate(BaseModel): + name: str + description: str | None = None + directors: list[str] | None = None + + +class SportPartialUpdate(BaseModel): + name: str | None = None + description: str | None = None + directors: list[str] | None = None + + +class Team(BaseModel): + id: UUID + name: str + description: str + created_at: date + address: str + sport: str + trainers: list[str] + trainees: list[str] + + +class TeamCreate(BaseModel): + name: str + description: str | None = None + address: str | None = None + sport: str + trainers: list[str] | None = None + trainees: list[str] | None = None + + +class TeamPartialUpdate(BaseModel): + name: str | None = None + description: str | None = None + address: str | None = None + sport: str | None = None + trainers: list[str] | None = None + trainees: list[str] | None = None + + +class Member(BaseModel): + id: UUID + first_name: str + last_name: str + email: str + birthday: date + phone_number: str + address: str + joining_date: date + information: str + + +class MemberSummary(BaseModel): + id: UUID + first_name: str + last_name: str + email: str + + +class MemberPartialUpdate(BaseModel): + first_name: str | None = None + last_name: str | None = None + email: str | None = None + birthday: date | None = None + phone_number: str | None = None + address: str | None = None + information: str | None = None + + +class MemberCreate(BaseModel): + first_name: str + last_name: str + email: str | None = None + birthday: date | None = None + phone_number: str | None = None + address: str | None = None + information: str | None = None + + +class Event(BaseModel): + id: UUID + name: str + description: str + start_time: AwareDatetime + end_time: AwareDatetime + attendees: list[str] | None = None + sports_linked: Annotated[ + list[str] | None, + Field(description='Names of the sports associated with this event.'), + ] = None + teams_linked: Annotated[ + list[str] | None, + Field(description='IDs of the teams associated with this event.'), + ] = None + creator: str + + +class EventSummary(BaseModel): + id: UUID + name: str + start_time: AwareDatetime + end_time: AwareDatetime + + +class EventPartialUpdate(BaseModel): + name: str | None = None + description: str | None = None + start_time: AwareDatetime | None = None + end_time: AwareDatetime | None = None + attendees: list[str] | None = None + sports_linked: list[str] | None = None + teams_linked: list[str] | None = None + + +class EventCreate(BaseModel): + name: str + description: str | None = None + start_time: AwareDatetime + end_time: AwareDatetime + attendees: list[str] | None = None + sports_linked: list[str] | None = None + teams_linked: list[str] | None = None + + +class Feedback(BaseModel): + id: UUID + event: str + member: str + creator: str + created_at: AwareDatetime + feedback: str + + +class FeedbackSummary(BaseModel): + id: UUID + event: str + member: str + creator: str + created_at: AwareDatetime + + +class FeedbackPartialUpdate(BaseModel): + event: str | None = None + member: str | None = None + feedback: str | None = None + + +class FeedbackCreate(BaseModel): + event: str + member: str + feedback: str + + +class Transaction(BaseModel): + id: UUID + member: str + creator: str + amount_cents: int + created_at: AwareDatetime + title: str + description: str + + +class TransactionPartialUpdate(BaseModel): + member: str | None = None + amount_cents: int | None = None + title: str | None = None + description: str | None = None + + +class TransactionCreate(BaseModel): + member: str + amount_cents: int + title: str + description: str | None = None + + +class Balance(BaseModel): + member: str + balance_cents: int diff --git a/services/py-genai-helper/requirements-dev.txt b/services/py-genai-helper/requirements-dev.txt index 57aa3eb..5d45333 100644 --- a/services/py-genai-helper/requirements-dev.txt +++ b/services/py-genai-helper/requirements-dev.txt @@ -1,3 +1,4 @@ # Dev-only tooling: testing and linting. pytest>=8.0 ruff>=0.6 +datamodel-code-generator>=0.25 diff --git a/services/py-genai-helper/ruff.toml b/services/py-genai-helper/ruff.toml index 0873f2f..4ab4bb9 100644 --- a/services/py-genai-helper/ruff.toml +++ b/services/py-genai-helper/ruff.toml @@ -7,6 +7,7 @@ extend-exclude = [ ".venv", "build", "dist", + "generated", ] [lint] diff --git a/services/spring-event/build.gradle b/services/spring-event/build.gradle index c501b2e..1e34f4b 100644 --- a/services/spring-event/build.gradle +++ b/services/spring-event/build.gradle @@ -29,6 +29,14 @@ java { } } +sourceSets { + main { + java { + srcDirs 'src/main/java', 'src/generated/java' + } + } +} + repositories { mavenCentral() } @@ -36,7 +44,9 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.0' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' runtimeOnly 'org.postgresql:postgresql' diff --git a/services/spring-event/config/checkstyle/checkstyle.xml b/services/spring-event/config/checkstyle/checkstyle.xml index 5cc515b..580dda9 100644 --- a/services/spring-event/config/checkstyle/checkstyle.xml +++ b/services/spring-event/config/checkstyle/checkstyle.xml @@ -10,6 +10,11 @@ --> + + + + + diff --git a/services/spring-event/src/generated/java/.openapi-generator/FILES b/services/spring-event/src/generated/java/.openapi-generator/FILES new file mode 100644 index 0000000..799d838 --- /dev/null +++ b/services/spring-event/src/generated/java/.openapi-generator/FILES @@ -0,0 +1,8 @@ +tum/devoops/eventservice/api/ApiUtil.java +tum/devoops/eventservice/api/EventsApi.java +tum/devoops/eventservice/model/BadRequestResponse.java +tum/devoops/eventservice/model/ErrorResponse.java +tum/devoops/eventservice/model/Event.java +tum/devoops/eventservice/model/EventCreate.java +tum/devoops/eventservice/model/EventPartialUpdate.java +tum/devoops/eventservice/model/EventSummary.java diff --git a/services/spring-event/src/generated/java/.openapi-generator/VERSION b/services/spring-event/src/generated/java/.openapi-generator/VERSION new file mode 100644 index 0000000..e465da4 --- /dev/null +++ b/services/spring-event/src/generated/java/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0 diff --git a/services/spring-event/src/generated/java/tum/devoops/eventservice/api/ApiUtil.java b/services/spring-event/src/generated/java/tum/devoops/eventservice/api/ApiUtil.java new file mode 100644 index 0000000..3cd1356 --- /dev/null +++ b/services/spring-event/src/generated/java/tum/devoops/eventservice/api/ApiUtil.java @@ -0,0 +1,19 @@ +package tum.devoops.eventservice.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/services/spring-event/src/generated/java/tum/devoops/eventservice/api/EventsApi.java b/services/spring-event/src/generated/java/tum/devoops/eventservice/api/EventsApi.java new file mode 100644 index 0000000..ed7d69c --- /dev/null +++ b/services/spring-event/src/generated/java/tum/devoops/eventservice/api/EventsApi.java @@ -0,0 +1,446 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.14.0). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package tum.devoops.eventservice.api; + +import tum.devoops.eventservice.model.BadRequestResponse; +import tum.devoops.eventservice.model.ErrorResponse; +import tum.devoops.eventservice.model.Event; +import tum.devoops.eventservice.model.EventCreate; +import tum.devoops.eventservice.model.EventPartialUpdate; +import tum.devoops.eventservice.model.EventSummary; +import java.util.UUID; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.lang.Nullable; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +@Validated +@Tag(name = "events", description = "Endpoints related to managing events such as training sessions and matches.") +public interface EventsApi { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * POST /events : Create event + * + * @param eventCreate The request body for creating a new event. (required) + * @return The request was successful, and a new resource was created. (status code 201) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again. (status code 409) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "createEvent", + summary = "Create event", + tags = { "events" }, + responses = { + @ApiResponse(responseCode = "201", description = "The request was successful, and a new resource was created.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Event.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/events", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createEvent( + @Parameter(name = "EventCreate", description = "The request body for creating a new event.", required = true) @Valid @RequestBody EventCreate eventCreate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"start_time\" : \"2000-01-23T04:56:07.000+00:00\", \"creator\" : \"creator\", \"attendees\" : [ \"attendees\", \"attendees\" ], \"name\" : \"name\", \"end_time\" : \"2000-01-23T04:56:07.000+00:00\", \"description\" : \"description\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"sports_linked\" : [ \"sports_linked\", \"sports_linked\" ], \"teams_linked\" : [ \"teams_linked\", \"teams_linked\" ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /events/{event_id} : Delete event + * + * @param eventId (required) + * @return The request was successful, but there is no content to return in the response. (status code 204) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "deleteEvent", + summary = "Delete event", + tags = { "events" }, + responses = { + @ApiResponse(responseCode = "204", description = "The request was successful, but there is no content to return in the response."), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/events/{event_id}", + produces = { "application/json" } + ) + + default ResponseEntity deleteEvent( + @Parameter(name = "event_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("event_id") UUID eventId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /events : Get all events + * + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getAllEvents", + summary = "Get all events", + tags = { "events" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = EventSummary.class))) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/events", + produces = { "application/json" } + ) + + default ResponseEntity> getAllEvents( + + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"start_time\" : \"2000-01-23T04:56:07.000+00:00\", \"name\" : \"name\", \"end_time\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\" }, { \"start_time\" : \"2000-01-23T04:56:07.000+00:00\", \"name\" : \"name\", \"end_time\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /events/{event_id} : Get event details + * + * @param eventId (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getEventDetails", + summary = "Get event details", + tags = { "events" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Event.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/events/{event_id}", + produces = { "application/json" } + ) + + default ResponseEntity getEventDetails( + @Parameter(name = "event_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("event_id") UUID eventId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"start_time\" : \"2000-01-23T04:56:07.000+00:00\", \"creator\" : \"creator\", \"attendees\" : [ \"attendees\", \"attendees\" ], \"name\" : \"name\", \"end_time\" : \"2000-01-23T04:56:07.000+00:00\", \"description\" : \"description\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"sports_linked\" : [ \"sports_linked\", \"sports_linked\" ], \"teams_linked\" : [ \"teams_linked\", \"teams_linked\" ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /events/{event_id} : Update event details + * + * @param eventId (required) + * @param eventPartialUpdate The request body for partially updating an event. (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "updateEventDetails", + summary = "Update event details", + tags = { "events" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Event.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/events/{event_id}", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity updateEventDetails( + @Parameter(name = "event_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("event_id") UUID eventId, + @Parameter(name = "EventPartialUpdate", description = "The request body for partially updating an event.", required = true) @Valid @RequestBody EventPartialUpdate eventPartialUpdate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"start_time\" : \"2000-01-23T04:56:07.000+00:00\", \"creator\" : \"creator\", \"attendees\" : [ \"attendees\", \"attendees\" ], \"name\" : \"name\", \"end_time\" : \"2000-01-23T04:56:07.000+00:00\", \"description\" : \"description\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"sports_linked\" : [ \"sports_linked\", \"sports_linked\" ], \"teams_linked\" : [ \"teams_linked\", \"teams_linked\" ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/services/spring-event/src/generated/java/tum/devoops/eventservice/model/BadRequestResponse.java b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/BadRequestResponse.java new file mode 100644 index 0000000..89a3218 --- /dev/null +++ b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/BadRequestResponse.java @@ -0,0 +1,131 @@ +package tum.devoops.eventservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import tum.devoops.eventservice.model.ErrorResponse; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * BadRequestResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class BadRequestResponse { + + private String message; + + @Valid + private List<@Valid ErrorResponse> errors = new ArrayList<>(); + + public BadRequestResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public BadRequestResponse(String message) { + this.message = message; + } + + public BadRequestResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public BadRequestResponse errors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + return this; + } + + public BadRequestResponse addErrorsItem(ErrorResponse errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @Valid + @Schema(name = "errors", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("errors") + public List<@Valid ErrorResponse> getErrors() { + return errors; + } + + public void setErrors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadRequestResponse badRequestResponse = (BadRequestResponse) o; + return Objects.equals(this.message, badRequestResponse.message) && + Objects.equals(this.errors, badRequestResponse.errors); + } + + @Override + public int hashCode() { + return Objects.hash(message, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadRequestResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-event/src/generated/java/tum/devoops/eventservice/model/ErrorResponse.java b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/ErrorResponse.java new file mode 100644 index 0000000..7d358dc --- /dev/null +++ b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/ErrorResponse.java @@ -0,0 +1,94 @@ +package tum.devoops.eventservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * ErrorResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class ErrorResponse { + + private String message; + + public ErrorResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public ErrorResponse(String message) { + this.message = message; + } + + public ErrorResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.message, errorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-event/src/generated/java/tum/devoops/eventservice/model/Event.java b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/Event.java new file mode 100644 index 0000000..dea140e --- /dev/null +++ b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/Event.java @@ -0,0 +1,327 @@ +package tum.devoops.eventservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * The object representation of an Event (e.g., a training session or a match). + */ + +@Schema(name = "Event", description = "The object representation of an Event (e.g., a training session or a match).") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class Event { + + private UUID id; + + private String name; + + private String description; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime startTime; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime endTime; + + @Valid + private List attendees = new ArrayList<>(); + + @Valid + private List sportsLinked = new ArrayList<>(); + + @Valid + private List teamsLinked = new ArrayList<>(); + + private String creator; + + public Event() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Event(UUID id, String name, String description, OffsetDateTime startTime, OffsetDateTime endTime, String creator) { + this.id = id; + this.name = name; + this.description = description; + this.startTime = startTime; + this.endTime = endTime; + this.creator = creator; + } + + public Event id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @NotNull @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("id") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public Event name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Event description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @NotNull + @Schema(name = "description", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Event startTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * @return startTime + */ + @NotNull @Valid + @Schema(name = "start_time", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("start_time") + public OffsetDateTime getStartTime() { + return startTime; + } + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + public Event endTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get endTime + * @return endTime + */ + @NotNull @Valid + @Schema(name = "end_time", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("end_time") + public OffsetDateTime getEndTime() { + return endTime; + } + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + public Event attendees(List attendees) { + this.attendees = attendees; + return this; + } + + public Event addAttendeesItem(String attendeesItem) { + if (this.attendees == null) { + this.attendees = new ArrayList<>(); + } + this.attendees.add(attendeesItem); + return this; + } + + /** + * Get attendees + * @return attendees + */ + + @Schema(name = "attendees", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("attendees") + public List getAttendees() { + return attendees; + } + + public void setAttendees(List attendees) { + this.attendees = attendees; + } + + public Event sportsLinked(List sportsLinked) { + this.sportsLinked = sportsLinked; + return this; + } + + public Event addSportsLinkedItem(String sportsLinkedItem) { + if (this.sportsLinked == null) { + this.sportsLinked = new ArrayList<>(); + } + this.sportsLinked.add(sportsLinkedItem); + return this; + } + + /** + * Names of the sports associated with this event. + * @return sportsLinked + */ + + @Schema(name = "sports_linked", description = "Names of the sports associated with this event.", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("sports_linked") + public List getSportsLinked() { + return sportsLinked; + } + + public void setSportsLinked(List sportsLinked) { + this.sportsLinked = sportsLinked; + } + + public Event teamsLinked(List teamsLinked) { + this.teamsLinked = teamsLinked; + return this; + } + + public Event addTeamsLinkedItem(String teamsLinkedItem) { + if (this.teamsLinked == null) { + this.teamsLinked = new ArrayList<>(); + } + this.teamsLinked.add(teamsLinkedItem); + return this; + } + + /** + * IDs of the teams associated with this event. + * @return teamsLinked + */ + + @Schema(name = "teams_linked", description = "IDs of the teams associated with this event.", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("teams_linked") + public List getTeamsLinked() { + return teamsLinked; + } + + public void setTeamsLinked(List teamsLinked) { + this.teamsLinked = teamsLinked; + } + + public Event creator(String creator) { + this.creator = creator; + return this; + } + + /** + * Get creator + * @return creator + */ + @NotNull + @Schema(name = "creator", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("creator") + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Event event = (Event) o; + return Objects.equals(this.id, event.id) && + Objects.equals(this.name, event.name) && + Objects.equals(this.description, event.description) && + Objects.equals(this.startTime, event.startTime) && + Objects.equals(this.endTime, event.endTime) && + Objects.equals(this.attendees, event.attendees) && + Objects.equals(this.sportsLinked, event.sportsLinked) && + Objects.equals(this.teamsLinked, event.teamsLinked) && + Objects.equals(this.creator, event.creator); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, startTime, endTime, attendees, sportsLinked, teamsLinked, creator); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Event {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" attendees: ").append(toIndentedString(attendees)).append("\n"); + sb.append(" sportsLinked: ").append(toIndentedString(sportsLinked)).append("\n"); + sb.append(" teamsLinked: ").append(toIndentedString(teamsLinked)).append("\n"); + sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventCreate.java b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventCreate.java new file mode 100644 index 0000000..d15ce42 --- /dev/null +++ b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventCreate.java @@ -0,0 +1,275 @@ +package tum.devoops.eventservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for creating a new Event. + */ + +@Schema(name = "EventCreate", description = "Data transfer object for creating a new Event.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class EventCreate { + + private String name; + + private @Nullable String description; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime startTime; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime endTime; + + @Valid + private List attendees = new ArrayList<>(); + + @Valid + private List sportsLinked = new ArrayList<>(); + + @Valid + private List teamsLinked = new ArrayList<>(); + + public EventCreate() { + super(); + } + + /** + * Constructor with only required parameters + */ + public EventCreate(String name, OffsetDateTime startTime, OffsetDateTime endTime) { + this.name = name; + this.startTime = startTime; + this.endTime = endTime; + } + + public EventCreate name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EventCreate description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + + @Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("description") + public @Nullable String getDescription() { + return description; + } + + public void setDescription(@Nullable String description) { + this.description = description; + } + + public EventCreate startTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * @return startTime + */ + @NotNull @Valid + @Schema(name = "start_time", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("start_time") + public OffsetDateTime getStartTime() { + return startTime; + } + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + public EventCreate endTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get endTime + * @return endTime + */ + @NotNull @Valid + @Schema(name = "end_time", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("end_time") + public OffsetDateTime getEndTime() { + return endTime; + } + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + public EventCreate attendees(List attendees) { + this.attendees = attendees; + return this; + } + + public EventCreate addAttendeesItem(String attendeesItem) { + if (this.attendees == null) { + this.attendees = new ArrayList<>(); + } + this.attendees.add(attendeesItem); + return this; + } + + /** + * Get attendees + * @return attendees + */ + + @Schema(name = "attendees", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("attendees") + public List getAttendees() { + return attendees; + } + + public void setAttendees(List attendees) { + this.attendees = attendees; + } + + public EventCreate sportsLinked(List sportsLinked) { + this.sportsLinked = sportsLinked; + return this; + } + + public EventCreate addSportsLinkedItem(String sportsLinkedItem) { + if (this.sportsLinked == null) { + this.sportsLinked = new ArrayList<>(); + } + this.sportsLinked.add(sportsLinkedItem); + return this; + } + + /** + * Get sportsLinked + * @return sportsLinked + */ + + @Schema(name = "sports_linked", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("sports_linked") + public List getSportsLinked() { + return sportsLinked; + } + + public void setSportsLinked(List sportsLinked) { + this.sportsLinked = sportsLinked; + } + + public EventCreate teamsLinked(List teamsLinked) { + this.teamsLinked = teamsLinked; + return this; + } + + public EventCreate addTeamsLinkedItem(String teamsLinkedItem) { + if (this.teamsLinked == null) { + this.teamsLinked = new ArrayList<>(); + } + this.teamsLinked.add(teamsLinkedItem); + return this; + } + + /** + * Get teamsLinked + * @return teamsLinked + */ + + @Schema(name = "teams_linked", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("teams_linked") + public List getTeamsLinked() { + return teamsLinked; + } + + public void setTeamsLinked(List teamsLinked) { + this.teamsLinked = teamsLinked; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventCreate eventCreate = (EventCreate) o; + return Objects.equals(this.name, eventCreate.name) && + Objects.equals(this.description, eventCreate.description) && + Objects.equals(this.startTime, eventCreate.startTime) && + Objects.equals(this.endTime, eventCreate.endTime) && + Objects.equals(this.attendees, eventCreate.attendees) && + Objects.equals(this.sportsLinked, eventCreate.sportsLinked) && + Objects.equals(this.teamsLinked, eventCreate.teamsLinked); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, startTime, endTime, attendees, sportsLinked, teamsLinked); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventCreate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" attendees: ").append(toIndentedString(attendees)).append("\n"); + sb.append(" sportsLinked: ").append(toIndentedString(sportsLinked)).append("\n"); + sb.append(" teamsLinked: ").append(toIndentedString(teamsLinked)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventPartialUpdate.java b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventPartialUpdate.java new file mode 100644 index 0000000..1546b4e --- /dev/null +++ b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventPartialUpdate.java @@ -0,0 +1,262 @@ +package tum.devoops.eventservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for partially updating an existing Event (PATCH operation). + */ + +@Schema(name = "EventPartialUpdate", description = "Data transfer object for partially updating an existing Event (PATCH operation).") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class EventPartialUpdate { + + private @Nullable String name; + + private @Nullable String description; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private @Nullable OffsetDateTime startTime; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private @Nullable OffsetDateTime endTime; + + @Valid + private List attendees = new ArrayList<>(); + + @Valid + private List sportsLinked = new ArrayList<>(); + + @Valid + private List teamsLinked = new ArrayList<>(); + + public EventPartialUpdate name(@Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + + @Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("name") + public @Nullable String getName() { + return name; + } + + public void setName(@Nullable String name) { + this.name = name; + } + + public EventPartialUpdate description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + + @Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("description") + public @Nullable String getDescription() { + return description; + } + + public void setDescription(@Nullable String description) { + this.description = description; + } + + public EventPartialUpdate startTime(@Nullable OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * @return startTime + */ + @Valid + @Schema(name = "start_time", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("start_time") + public @Nullable OffsetDateTime getStartTime() { + return startTime; + } + + public void setStartTime(@Nullable OffsetDateTime startTime) { + this.startTime = startTime; + } + + public EventPartialUpdate endTime(@Nullable OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get endTime + * @return endTime + */ + @Valid + @Schema(name = "end_time", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("end_time") + public @Nullable OffsetDateTime getEndTime() { + return endTime; + } + + public void setEndTime(@Nullable OffsetDateTime endTime) { + this.endTime = endTime; + } + + public EventPartialUpdate attendees(List attendees) { + this.attendees = attendees; + return this; + } + + public EventPartialUpdate addAttendeesItem(String attendeesItem) { + if (this.attendees == null) { + this.attendees = new ArrayList<>(); + } + this.attendees.add(attendeesItem); + return this; + } + + /** + * Get attendees + * @return attendees + */ + + @Schema(name = "attendees", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("attendees") + public List getAttendees() { + return attendees; + } + + public void setAttendees(List attendees) { + this.attendees = attendees; + } + + public EventPartialUpdate sportsLinked(List sportsLinked) { + this.sportsLinked = sportsLinked; + return this; + } + + public EventPartialUpdate addSportsLinkedItem(String sportsLinkedItem) { + if (this.sportsLinked == null) { + this.sportsLinked = new ArrayList<>(); + } + this.sportsLinked.add(sportsLinkedItem); + return this; + } + + /** + * Get sportsLinked + * @return sportsLinked + */ + + @Schema(name = "sports_linked", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("sports_linked") + public List getSportsLinked() { + return sportsLinked; + } + + public void setSportsLinked(List sportsLinked) { + this.sportsLinked = sportsLinked; + } + + public EventPartialUpdate teamsLinked(List teamsLinked) { + this.teamsLinked = teamsLinked; + return this; + } + + public EventPartialUpdate addTeamsLinkedItem(String teamsLinkedItem) { + if (this.teamsLinked == null) { + this.teamsLinked = new ArrayList<>(); + } + this.teamsLinked.add(teamsLinkedItem); + return this; + } + + /** + * Get teamsLinked + * @return teamsLinked + */ + + @Schema(name = "teams_linked", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("teams_linked") + public List getTeamsLinked() { + return teamsLinked; + } + + public void setTeamsLinked(List teamsLinked) { + this.teamsLinked = teamsLinked; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventPartialUpdate eventPartialUpdate = (EventPartialUpdate) o; + return Objects.equals(this.name, eventPartialUpdate.name) && + Objects.equals(this.description, eventPartialUpdate.description) && + Objects.equals(this.startTime, eventPartialUpdate.startTime) && + Objects.equals(this.endTime, eventPartialUpdate.endTime) && + Objects.equals(this.attendees, eventPartialUpdate.attendees) && + Objects.equals(this.sportsLinked, eventPartialUpdate.sportsLinked) && + Objects.equals(this.teamsLinked, eventPartialUpdate.teamsLinked); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, startTime, endTime, attendees, sportsLinked, teamsLinked); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventPartialUpdate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" attendees: ").append(toIndentedString(attendees)).append("\n"); + sb.append(" sportsLinked: ").append(toIndentedString(sportsLinked)).append("\n"); + sb.append(" teamsLinked: ").append(toIndentedString(teamsLinked)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventSummary.java b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventSummary.java new file mode 100644 index 0000000..e8c205b --- /dev/null +++ b/services/spring-event/src/generated/java/tum/devoops/eventservice/model/EventSummary.java @@ -0,0 +1,175 @@ +package tum.devoops.eventservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * A simplified representation of a Event, typically used in list views. + */ + +@Schema(name = "EventSummary", description = "A simplified representation of a Event, typically used in list views.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class EventSummary { + + private UUID id; + + private String name; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime startTime; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime endTime; + + public EventSummary() { + super(); + } + + /** + * Constructor with only required parameters + */ + public EventSummary(UUID id, String name, OffsetDateTime startTime, OffsetDateTime endTime) { + this.id = id; + this.name = name; + this.startTime = startTime; + this.endTime = endTime; + } + + public EventSummary id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @NotNull @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("id") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public EventSummary name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EventSummary startTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * @return startTime + */ + @NotNull @Valid + @Schema(name = "start_time", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("start_time") + public OffsetDateTime getStartTime() { + return startTime; + } + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + public EventSummary endTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get endTime + * @return endTime + */ + @NotNull @Valid + @Schema(name = "end_time", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("end_time") + public OffsetDateTime getEndTime() { + return endTime; + } + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventSummary eventSummary = (EventSummary) o; + return Objects.equals(this.id, eventSummary.id) && + Objects.equals(this.name, eventSummary.name) && + Objects.equals(this.startTime, eventSummary.startTime) && + Objects.equals(this.endTime, eventSummary.endTime); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, startTime, endTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventSummary {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-feedback/build.gradle b/services/spring-feedback/build.gradle index a8fffac..41f642c 100644 --- a/services/spring-feedback/build.gradle +++ b/services/spring-feedback/build.gradle @@ -29,6 +29,14 @@ java { } } +sourceSets { + main { + java { + srcDirs 'src/main/java', 'src/generated/java' + } + } +} + repositories { mavenCentral() } @@ -36,7 +44,9 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.0' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' runtimeOnly 'org.postgresql:postgresql' diff --git a/services/spring-feedback/config/checkstyle/checkstyle.xml b/services/spring-feedback/config/checkstyle/checkstyle.xml index 5cc515b..580dda9 100644 --- a/services/spring-feedback/config/checkstyle/checkstyle.xml +++ b/services/spring-feedback/config/checkstyle/checkstyle.xml @@ -10,6 +10,11 @@ --> + + + + + diff --git a/services/spring-feedback/src/generated/java/.openapi-generator/FILES b/services/spring-feedback/src/generated/java/.openapi-generator/FILES new file mode 100644 index 0000000..7dd59c2 --- /dev/null +++ b/services/spring-feedback/src/generated/java/.openapi-generator/FILES @@ -0,0 +1,8 @@ +tum/devoops/feedbackservice/api/ApiUtil.java +tum/devoops/feedbackservice/api/FeedbackApi.java +tum/devoops/feedbackservice/model/BadRequestResponse.java +tum/devoops/feedbackservice/model/ErrorResponse.java +tum/devoops/feedbackservice/model/Feedback.java +tum/devoops/feedbackservice/model/FeedbackCreate.java +tum/devoops/feedbackservice/model/FeedbackPartialUpdate.java +tum/devoops/feedbackservice/model/FeedbackSummary.java diff --git a/services/spring-feedback/src/generated/java/.openapi-generator/VERSION b/services/spring-feedback/src/generated/java/.openapi-generator/VERSION new file mode 100644 index 0000000..e465da4 --- /dev/null +++ b/services/spring-feedback/src/generated/java/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0 diff --git a/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/api/ApiUtil.java b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/api/ApiUtil.java new file mode 100644 index 0000000..7fb8b07 --- /dev/null +++ b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/api/ApiUtil.java @@ -0,0 +1,19 @@ +package tum.devoops.feedbackservice.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/api/FeedbackApi.java b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/api/FeedbackApi.java new file mode 100644 index 0000000..8b87aef --- /dev/null +++ b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/api/FeedbackApi.java @@ -0,0 +1,446 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.14.0). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package tum.devoops.feedbackservice.api; + +import tum.devoops.feedbackservice.model.BadRequestResponse; +import tum.devoops.feedbackservice.model.ErrorResponse; +import tum.devoops.feedbackservice.model.Feedback; +import tum.devoops.feedbackservice.model.FeedbackCreate; +import tum.devoops.feedbackservice.model.FeedbackPartialUpdate; +import tum.devoops.feedbackservice.model.FeedbackSummary; +import java.util.UUID; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.lang.Nullable; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +@Validated +@Tag(name = "feedback", description = "Endpoints related to managing feedback provided by trainers to members for events.") +public interface FeedbackApi { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * POST /feedback : Create feedback + * + * @param feedbackCreate The request body for creating new feedback. (required) + * @return The request was successful, and a new resource was created. (status code 201) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again. (status code 409) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "createFeedback", + summary = "Create feedback", + tags = { "feedback" }, + responses = { + @ApiResponse(responseCode = "201", description = "The request was successful, and a new resource was created.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Feedback.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/feedback", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createFeedback( + @Parameter(name = "FeedbackCreate", description = "The request body for creating new feedback.", required = true) @Valid @RequestBody FeedbackCreate feedbackCreate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"feedback\" : \"feedback\", \"creator\" : \"creator\", \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"event\" : \"event\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /feedback/{feedback_id} : Delete feedback + * + * @param feedbackId (required) + * @return The request was successful, but there is no content to return in the response. (status code 204) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "deleteFeedback", + summary = "Delete feedback", + tags = { "feedback" }, + responses = { + @ApiResponse(responseCode = "204", description = "The request was successful, but there is no content to return in the response."), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/feedback/{feedback_id}", + produces = { "application/json" } + ) + + default ResponseEntity deleteFeedback( + @Parameter(name = "feedback_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("feedback_id") UUID feedbackId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /feedback : Get all feedback + * + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getAllFeedback", + summary = "Get all feedback", + tags = { "feedback" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = FeedbackSummary.class))) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/feedback", + produces = { "application/json" } + ) + + default ResponseEntity> getAllFeedback( + + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"creator\" : \"creator\", \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"event\" : \"event\" }, { \"creator\" : \"creator\", \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"event\" : \"event\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /feedback/{feedback_id} : Get feedback details + * + * @param feedbackId (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getFeedbackDetails", + summary = "Get feedback details", + tags = { "feedback" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Feedback.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/feedback/{feedback_id}", + produces = { "application/json" } + ) + + default ResponseEntity getFeedbackDetails( + @Parameter(name = "feedback_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("feedback_id") UUID feedbackId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"feedback\" : \"feedback\", \"creator\" : \"creator\", \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"event\" : \"event\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /feedback/{feedback_id} : Update feedback details + * + * @param feedbackId (required) + * @param feedbackPartialUpdate The request body for partially updating a specific feedback. (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "updateFeedbackDetails", + summary = "Update feedback details", + tags = { "feedback" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Feedback.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/feedback/{feedback_id}", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity updateFeedbackDetails( + @Parameter(name = "feedback_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("feedback_id") UUID feedbackId, + @Parameter(name = "FeedbackPartialUpdate", description = "The request body for partially updating a specific feedback.", required = true) @Valid @RequestBody FeedbackPartialUpdate feedbackPartialUpdate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"feedback\" : \"feedback\", \"creator\" : \"creator\", \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"event\" : \"event\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/BadRequestResponse.java b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/BadRequestResponse.java new file mode 100644 index 0000000..4f2c9e6 --- /dev/null +++ b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/BadRequestResponse.java @@ -0,0 +1,131 @@ +package tum.devoops.feedbackservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import tum.devoops.feedbackservice.model.ErrorResponse; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * BadRequestResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class BadRequestResponse { + + private String message; + + @Valid + private List<@Valid ErrorResponse> errors = new ArrayList<>(); + + public BadRequestResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public BadRequestResponse(String message) { + this.message = message; + } + + public BadRequestResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public BadRequestResponse errors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + return this; + } + + public BadRequestResponse addErrorsItem(ErrorResponse errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @Valid + @Schema(name = "errors", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("errors") + public List<@Valid ErrorResponse> getErrors() { + return errors; + } + + public void setErrors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadRequestResponse badRequestResponse = (BadRequestResponse) o; + return Objects.equals(this.message, badRequestResponse.message) && + Objects.equals(this.errors, badRequestResponse.errors); + } + + @Override + public int hashCode() { + return Objects.hash(message, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadRequestResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/ErrorResponse.java b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/ErrorResponse.java new file mode 100644 index 0000000..781a1cc --- /dev/null +++ b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/ErrorResponse.java @@ -0,0 +1,94 @@ +package tum.devoops.feedbackservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * ErrorResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class ErrorResponse { + + private String message; + + public ErrorResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public ErrorResponse(String message) { + this.message = message; + } + + public ErrorResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.message, errorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/Feedback.java b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/Feedback.java new file mode 100644 index 0000000..455b7a1 --- /dev/null +++ b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/Feedback.java @@ -0,0 +1,224 @@ +package tum.devoops.feedbackservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * The object representation of Feedback, which is associated with a specific Event and Member. + */ + +@Schema(name = "Feedback", description = "The object representation of Feedback, which is associated with a specific Event and Member.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class Feedback { + + private UUID id; + + private String event; + + private String member; + + private String creator; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime createdAt; + + private String feedback; + + public Feedback() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Feedback(UUID id, String event, String member, String creator, OffsetDateTime createdAt, String feedback) { + this.id = id; + this.event = event; + this.member = member; + this.creator = creator; + this.createdAt = createdAt; + this.feedback = feedback; + } + + public Feedback id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @NotNull @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("id") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public Feedback event(String event) { + this.event = event; + return this; + } + + /** + * Get event + * @return event + */ + @NotNull + @Schema(name = "event", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("event") + public String getEvent() { + return event; + } + + public void setEvent(String event) { + this.event = event; + } + + public Feedback member(String member) { + this.member = member; + return this; + } + + /** + * Get member + * @return member + */ + @NotNull + @Schema(name = "member", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("member") + public String getMember() { + return member; + } + + public void setMember(String member) { + this.member = member; + } + + public Feedback creator(String creator) { + this.creator = creator; + return this; + } + + /** + * Get creator + * @return creator + */ + @NotNull + @Schema(name = "creator", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("creator") + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public Feedback createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @NotNull @Valid + @Schema(name = "created_at", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public Feedback feedback(String feedback) { + this.feedback = feedback; + return this; + } + + /** + * Get feedback + * @return feedback + */ + @NotNull + @Schema(name = "feedback", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("feedback") + public String getFeedback() { + return feedback; + } + + public void setFeedback(String feedback) { + this.feedback = feedback; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Feedback feedback = (Feedback) o; + return Objects.equals(this.id, feedback.id) && + Objects.equals(this.event, feedback.event) && + Objects.equals(this.member, feedback.member) && + Objects.equals(this.creator, feedback.creator) && + Objects.equals(this.createdAt, feedback.createdAt) && + Objects.equals(this.feedback, feedback.feedback); + } + + @Override + public int hashCode() { + return Objects.hash(id, event, member, creator, createdAt, feedback); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Feedback {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" member: ").append(toIndentedString(member)).append("\n"); + sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" feedback: ").append(toIndentedString(feedback)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackCreate.java b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackCreate.java new file mode 100644 index 0000000..62118cd --- /dev/null +++ b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackCreate.java @@ -0,0 +1,145 @@ +package tum.devoops.feedbackservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for creating a new Feedback. + */ + +@Schema(name = "FeedbackCreate", description = "Data transfer object for creating a new Feedback.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class FeedbackCreate { + + private String event; + + private String member; + + private String feedback; + + public FeedbackCreate() { + super(); + } + + /** + * Constructor with only required parameters + */ + public FeedbackCreate(String event, String member, String feedback) { + this.event = event; + this.member = member; + this.feedback = feedback; + } + + public FeedbackCreate event(String event) { + this.event = event; + return this; + } + + /** + * Get event + * @return event + */ + @NotNull + @Schema(name = "event", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("event") + public String getEvent() { + return event; + } + + public void setEvent(String event) { + this.event = event; + } + + public FeedbackCreate member(String member) { + this.member = member; + return this; + } + + /** + * Get member + * @return member + */ + @NotNull + @Schema(name = "member", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("member") + public String getMember() { + return member; + } + + public void setMember(String member) { + this.member = member; + } + + public FeedbackCreate feedback(String feedback) { + this.feedback = feedback; + return this; + } + + /** + * Get feedback + * @return feedback + */ + @NotNull + @Schema(name = "feedback", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("feedback") + public String getFeedback() { + return feedback; + } + + public void setFeedback(String feedback) { + this.feedback = feedback; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeedbackCreate feedbackCreate = (FeedbackCreate) o; + return Objects.equals(this.event, feedbackCreate.event) && + Objects.equals(this.member, feedbackCreate.member) && + Objects.equals(this.feedback, feedbackCreate.feedback); + } + + @Override + public int hashCode() { + return Objects.hash(event, member, feedback); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeedbackCreate {\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" member: ").append(toIndentedString(member)).append("\n"); + sb.append(" feedback: ").append(toIndentedString(feedback)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackPartialUpdate.java b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackPartialUpdate.java new file mode 100644 index 0000000..9f74f19 --- /dev/null +++ b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackPartialUpdate.java @@ -0,0 +1,132 @@ +package tum.devoops.feedbackservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for partially updating an existing Feedback (PATCH operation). + */ + +@Schema(name = "FeedbackPartialUpdate", description = "Data transfer object for partially updating an existing Feedback (PATCH operation).") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class FeedbackPartialUpdate { + + private @Nullable String event; + + private @Nullable String member; + + private @Nullable String feedback; + + public FeedbackPartialUpdate event(@Nullable String event) { + this.event = event; + return this; + } + + /** + * Get event + * @return event + */ + + @Schema(name = "event", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("event") + public @Nullable String getEvent() { + return event; + } + + public void setEvent(@Nullable String event) { + this.event = event; + } + + public FeedbackPartialUpdate member(@Nullable String member) { + this.member = member; + return this; + } + + /** + * Get member + * @return member + */ + + @Schema(name = "member", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("member") + public @Nullable String getMember() { + return member; + } + + public void setMember(@Nullable String member) { + this.member = member; + } + + public FeedbackPartialUpdate feedback(@Nullable String feedback) { + this.feedback = feedback; + return this; + } + + /** + * Get feedback + * @return feedback + */ + + @Schema(name = "feedback", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("feedback") + public @Nullable String getFeedback() { + return feedback; + } + + public void setFeedback(@Nullable String feedback) { + this.feedback = feedback; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeedbackPartialUpdate feedbackPartialUpdate = (FeedbackPartialUpdate) o; + return Objects.equals(this.event, feedbackPartialUpdate.event) && + Objects.equals(this.member, feedbackPartialUpdate.member) && + Objects.equals(this.feedback, feedbackPartialUpdate.feedback); + } + + @Override + public int hashCode() { + return Objects.hash(event, member, feedback); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeedbackPartialUpdate {\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" member: ").append(toIndentedString(member)).append("\n"); + sb.append(" feedback: ").append(toIndentedString(feedback)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackSummary.java b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackSummary.java new file mode 100644 index 0000000..ab658d4 --- /dev/null +++ b/services/spring-feedback/src/generated/java/tum/devoops/feedbackservice/model/FeedbackSummary.java @@ -0,0 +1,199 @@ +package tum.devoops.feedbackservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * A simplified representation of a Feedback, typically used in list views. + */ + +@Schema(name = "FeedbackSummary", description = "A simplified representation of a Feedback, typically used in list views.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class FeedbackSummary { + + private UUID id; + + private String event; + + private String member; + + private String creator; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime createdAt; + + public FeedbackSummary() { + super(); + } + + /** + * Constructor with only required parameters + */ + public FeedbackSummary(UUID id, String event, String member, String creator, OffsetDateTime createdAt) { + this.id = id; + this.event = event; + this.member = member; + this.creator = creator; + this.createdAt = createdAt; + } + + public FeedbackSummary id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @NotNull @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("id") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public FeedbackSummary event(String event) { + this.event = event; + return this; + } + + /** + * Get event + * @return event + */ + @NotNull + @Schema(name = "event", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("event") + public String getEvent() { + return event; + } + + public void setEvent(String event) { + this.event = event; + } + + public FeedbackSummary member(String member) { + this.member = member; + return this; + } + + /** + * Get member + * @return member + */ + @NotNull + @Schema(name = "member", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("member") + public String getMember() { + return member; + } + + public void setMember(String member) { + this.member = member; + } + + public FeedbackSummary creator(String creator) { + this.creator = creator; + return this; + } + + /** + * Get creator + * @return creator + */ + @NotNull + @Schema(name = "creator", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("creator") + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public FeedbackSummary createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @NotNull @Valid + @Schema(name = "created_at", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeedbackSummary feedbackSummary = (FeedbackSummary) o; + return Objects.equals(this.id, feedbackSummary.id) && + Objects.equals(this.event, feedbackSummary.event) && + Objects.equals(this.member, feedbackSummary.member) && + Objects.equals(this.creator, feedbackSummary.creator) && + Objects.equals(this.createdAt, feedbackSummary.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, event, member, creator, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeedbackSummary {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" member: ").append(toIndentedString(member)).append("\n"); + sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-finance/build.gradle b/services/spring-finance/build.gradle index a3d97cf..b46afe9 100644 --- a/services/spring-finance/build.gradle +++ b/services/spring-finance/build.gradle @@ -29,6 +29,14 @@ java { } } +sourceSets { + main { + java { + srcDirs 'src/main/java', 'src/generated/java' + } + } +} + repositories { mavenCentral() } @@ -36,7 +44,9 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.0' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' runtimeOnly 'org.postgresql:postgresql' diff --git a/services/spring-finance/config/checkstyle/checkstyle.xml b/services/spring-finance/config/checkstyle/checkstyle.xml index 5cc515b..580dda9 100644 --- a/services/spring-finance/config/checkstyle/checkstyle.xml +++ b/services/spring-finance/config/checkstyle/checkstyle.xml @@ -10,6 +10,11 @@ --> + + + + + diff --git a/services/spring-finance/src/generated/java/.openapi-generator/FILES b/services/spring-finance/src/generated/java/.openapi-generator/FILES new file mode 100644 index 0000000..5e5593a --- /dev/null +++ b/services/spring-finance/src/generated/java/.openapi-generator/FILES @@ -0,0 +1,8 @@ +tum/devoops/financeservice/api/ApiUtil.java +tum/devoops/financeservice/api/FinanceApi.java +tum/devoops/financeservice/model/BadRequestResponse.java +tum/devoops/financeservice/model/Balance.java +tum/devoops/financeservice/model/ErrorResponse.java +tum/devoops/financeservice/model/Transaction.java +tum/devoops/financeservice/model/TransactionCreate.java +tum/devoops/financeservice/model/TransactionPartialUpdate.java diff --git a/services/spring-finance/src/generated/java/.openapi-generator/VERSION b/services/spring-finance/src/generated/java/.openapi-generator/VERSION new file mode 100644 index 0000000..e465da4 --- /dev/null +++ b/services/spring-finance/src/generated/java/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0 diff --git a/services/spring-finance/src/generated/java/tum/devoops/financeservice/api/ApiUtil.java b/services/spring-finance/src/generated/java/tum/devoops/financeservice/api/ApiUtil.java new file mode 100644 index 0000000..a217bae --- /dev/null +++ b/services/spring-finance/src/generated/java/tum/devoops/financeservice/api/ApiUtil.java @@ -0,0 +1,19 @@ +package tum.devoops.financeservice.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/services/spring-finance/src/generated/java/tum/devoops/financeservice/api/FinanceApi.java b/services/spring-finance/src/generated/java/tum/devoops/financeservice/api/FinanceApi.java new file mode 100644 index 0000000..14c0dda --- /dev/null +++ b/services/spring-finance/src/generated/java/tum/devoops/financeservice/api/FinanceApi.java @@ -0,0 +1,592 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.14.0). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package tum.devoops.financeservice.api; + +import tum.devoops.financeservice.model.BadRequestResponse; +import tum.devoops.financeservice.model.Balance; +import tum.devoops.financeservice.model.ErrorResponse; +import tum.devoops.financeservice.model.Transaction; +import tum.devoops.financeservice.model.TransactionCreate; +import tum.devoops.financeservice.model.TransactionPartialUpdate; +import java.util.UUID; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.lang.Nullable; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +@Validated +@Tag(name = "finance", description = "Endpoints related to managing financial transactions and balances for members.") +public interface FinanceApi { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * POST /finance/transactions : Create transaction + * + * @param transactionCreate The request body for creating a new transaction. (required) + * @return The request was successful, and a new resource was created. (status code 201) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again. (status code 409) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "createTransaction", + summary = "Create transaction", + tags = { "finance" }, + responses = { + @ApiResponse(responseCode = "201", description = "The request was successful, and a new resource was created.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Transaction.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/finance/transactions", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createTransaction( + @Parameter(name = "TransactionCreate", description = "The request body for creating a new transaction.", required = true) @Valid @RequestBody TransactionCreate transactionCreate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"creator\" : \"creator\", \"amount_cents\" : 0, \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"description\" : \"description\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"title\" : \"title\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /finance/transactions/{transaction_id} : Delete transaction + * + * @param transactionId (required) + * @return The request was successful, but there is no content to return in the response. (status code 204) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "deleteTransaction", + summary = "Delete transaction", + tags = { "finance" }, + responses = { + @ApiResponse(responseCode = "204", description = "The request was successful, but there is no content to return in the response."), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/finance/transactions/{transaction_id}", + produces = { "application/json" } + ) + + default ResponseEntity deleteTransaction( + @Parameter(name = "transaction_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("transaction_id") UUID transactionId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /finance/balances : Get all balances + * + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getAllBalances", + summary = "Get all balances", + tags = { "finance" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Balance.class))) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/finance/balances", + produces = { "application/json" } + ) + + default ResponseEntity> getAllBalances( + + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"member\" : \"member\", \"balance_cents\" : 0 }, { \"member\" : \"member\", \"balance_cents\" : 0 } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /finance/transactions : Get all transactions + * + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getAllTransactions", + summary = "Get all transactions", + tags = { "finance" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Transaction.class))) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/finance/transactions", + produces = { "application/json" } + ) + + default ResponseEntity> getAllTransactions( + + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"creator\" : \"creator\", \"amount_cents\" : 0, \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"description\" : \"description\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"title\" : \"title\" }, { \"creator\" : \"creator\", \"amount_cents\" : 0, \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"description\" : \"description\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"title\" : \"title\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /finance/balances/{member_id} : Get member balance + * + * @param memberId (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getMemberBalance", + summary = "Get member balance", + tags = { "finance" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Balance.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/finance/balances/{member_id}", + produces = { "application/json" } + ) + + default ResponseEntity getMemberBalance( + @Parameter(name = "member_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("member_id") UUID memberId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"member\" : \"member\", \"balance_cents\" : 0 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /finance/transactions/{transaction_id} : Get transaction + * + * @param transactionId (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getTransaction", + summary = "Get transaction", + tags = { "finance" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Transaction.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/finance/transactions/{transaction_id}", + produces = { "application/json" } + ) + + default ResponseEntity getTransaction( + @Parameter(name = "transaction_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("transaction_id") UUID transactionId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"creator\" : \"creator\", \"amount_cents\" : 0, \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"description\" : \"description\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"title\" : \"title\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /finance/transactions/{transaction_id} : Update transaction + * + * @param transactionId (required) + * @param transactionPartialUpdate The request body for partially updating a transaction. (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "updateTransaction", + summary = "Update transaction", + tags = { "finance" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Transaction.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/finance/transactions/{transaction_id}", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity updateTransaction( + @Parameter(name = "transaction_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("transaction_id") UUID transactionId, + @Parameter(name = "TransactionPartialUpdate", description = "The request body for partially updating a transaction.", required = true) @Valid @RequestBody TransactionPartialUpdate transactionPartialUpdate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"creator\" : \"creator\", \"amount_cents\" : 0, \"member\" : \"member\", \"created_at\" : \"2000-01-23T04:56:07.000+00:00\", \"description\" : \"description\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"title\" : \"title\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/BadRequestResponse.java b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/BadRequestResponse.java new file mode 100644 index 0000000..9906f25 --- /dev/null +++ b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/BadRequestResponse.java @@ -0,0 +1,131 @@ +package tum.devoops.financeservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import tum.devoops.financeservice.model.ErrorResponse; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * BadRequestResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class BadRequestResponse { + + private String message; + + @Valid + private List<@Valid ErrorResponse> errors = new ArrayList<>(); + + public BadRequestResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public BadRequestResponse(String message) { + this.message = message; + } + + public BadRequestResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public BadRequestResponse errors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + return this; + } + + public BadRequestResponse addErrorsItem(ErrorResponse errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @Valid + @Schema(name = "errors", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("errors") + public List<@Valid ErrorResponse> getErrors() { + return errors; + } + + public void setErrors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadRequestResponse badRequestResponse = (BadRequestResponse) o; + return Objects.equals(this.message, badRequestResponse.message) && + Objects.equals(this.errors, badRequestResponse.errors); + } + + @Override + public int hashCode() { + return Objects.hash(message, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadRequestResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/Balance.java b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/Balance.java new file mode 100644 index 0000000..453416d --- /dev/null +++ b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/Balance.java @@ -0,0 +1,120 @@ +package tum.devoops.financeservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * The object representation of a Member's Balance, which includes the total balance in cents. + */ + +@Schema(name = "Balance", description = "The object representation of a Member's Balance, which includes the total balance in cents.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class Balance { + + private String member; + + private Integer balanceCents; + + public Balance() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Balance(String member, Integer balanceCents) { + this.member = member; + this.balanceCents = balanceCents; + } + + public Balance member(String member) { + this.member = member; + return this; + } + + /** + * Get member + * @return member + */ + @NotNull + @Schema(name = "member", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("member") + public String getMember() { + return member; + } + + public void setMember(String member) { + this.member = member; + } + + public Balance balanceCents(Integer balanceCents) { + this.balanceCents = balanceCents; + return this; + } + + /** + * Get balanceCents + * @return balanceCents + */ + @NotNull + @Schema(name = "balance_cents", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("balance_cents") + public Integer getBalanceCents() { + return balanceCents; + } + + public void setBalanceCents(Integer balanceCents) { + this.balanceCents = balanceCents; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Balance balance = (Balance) o; + return Objects.equals(this.member, balance.member) && + Objects.equals(this.balanceCents, balance.balanceCents); + } + + @Override + public int hashCode() { + return Objects.hash(member, balanceCents); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Balance {\n"); + sb.append(" member: ").append(toIndentedString(member)).append("\n"); + sb.append(" balanceCents: ").append(toIndentedString(balanceCents)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/ErrorResponse.java b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/ErrorResponse.java new file mode 100644 index 0000000..1a9599a --- /dev/null +++ b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/ErrorResponse.java @@ -0,0 +1,94 @@ +package tum.devoops.financeservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * ErrorResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class ErrorResponse { + + private String message; + + public ErrorResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public ErrorResponse(String message) { + this.message = message; + } + + public ErrorResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.message, errorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/Transaction.java b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/Transaction.java new file mode 100644 index 0000000..23af174 --- /dev/null +++ b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/Transaction.java @@ -0,0 +1,249 @@ +package tum.devoops.financeservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * The object representation of a Transaction, which includes details such as the member, creator, amount, and timestamps. + */ + +@Schema(name = "Transaction", description = "The object representation of a Transaction, which includes details such as the member, creator, amount, and timestamps.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class Transaction { + + private UUID id; + + private String member; + + private String creator; + + private Integer amountCents; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime createdAt; + + private String title; + + private String description; + + public Transaction() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Transaction(UUID id, String member, String creator, Integer amountCents, OffsetDateTime createdAt, String title, String description) { + this.id = id; + this.member = member; + this.creator = creator; + this.amountCents = amountCents; + this.createdAt = createdAt; + this.title = title; + this.description = description; + } + + public Transaction id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @NotNull @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("id") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public Transaction member(String member) { + this.member = member; + return this; + } + + /** + * Get member + * @return member + */ + @NotNull + @Schema(name = "member", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("member") + public String getMember() { + return member; + } + + public void setMember(String member) { + this.member = member; + } + + public Transaction creator(String creator) { + this.creator = creator; + return this; + } + + /** + * Get creator + * @return creator + */ + @NotNull + @Schema(name = "creator", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("creator") + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public Transaction amountCents(Integer amountCents) { + this.amountCents = amountCents; + return this; + } + + /** + * Get amountCents + * @return amountCents + */ + @NotNull + @Schema(name = "amount_cents", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("amount_cents") + public Integer getAmountCents() { + return amountCents; + } + + public void setAmountCents(Integer amountCents) { + this.amountCents = amountCents; + } + + public Transaction createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @NotNull @Valid + @Schema(name = "created_at", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public Transaction title(String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @NotNull + @Schema(name = "title", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("title") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Transaction description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @NotNull + @Schema(name = "description", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Transaction transaction = (Transaction) o; + return Objects.equals(this.id, transaction.id) && + Objects.equals(this.member, transaction.member) && + Objects.equals(this.creator, transaction.creator) && + Objects.equals(this.amountCents, transaction.amountCents) && + Objects.equals(this.createdAt, transaction.createdAt) && + Objects.equals(this.title, transaction.title) && + Objects.equals(this.description, transaction.description); + } + + @Override + public int hashCode() { + return Objects.hash(id, member, creator, amountCents, createdAt, title, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Transaction {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" member: ").append(toIndentedString(member)).append("\n"); + sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); + sb.append(" amountCents: ").append(toIndentedString(amountCents)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/TransactionCreate.java b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/TransactionCreate.java new file mode 100644 index 0000000..6c4b2d0 --- /dev/null +++ b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/TransactionCreate.java @@ -0,0 +1,169 @@ +package tum.devoops.financeservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for creating a new Transaction. + */ + +@Schema(name = "TransactionCreate", description = "Data transfer object for creating a new Transaction.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class TransactionCreate { + + private String member; + + private Integer amountCents; + + private String title; + + private @Nullable String description; + + public TransactionCreate() { + super(); + } + + /** + * Constructor with only required parameters + */ + public TransactionCreate(String member, Integer amountCents, String title) { + this.member = member; + this.amountCents = amountCents; + this.title = title; + } + + public TransactionCreate member(String member) { + this.member = member; + return this; + } + + /** + * Get member + * @return member + */ + @NotNull + @Schema(name = "member", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("member") + public String getMember() { + return member; + } + + public void setMember(String member) { + this.member = member; + } + + public TransactionCreate amountCents(Integer amountCents) { + this.amountCents = amountCents; + return this; + } + + /** + * Get amountCents + * @return amountCents + */ + @NotNull + @Schema(name = "amount_cents", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("amount_cents") + public Integer getAmountCents() { + return amountCents; + } + + public void setAmountCents(Integer amountCents) { + this.amountCents = amountCents; + } + + public TransactionCreate title(String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @NotNull + @Schema(name = "title", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("title") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public TransactionCreate description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + + @Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("description") + public @Nullable String getDescription() { + return description; + } + + public void setDescription(@Nullable String description) { + this.description = description; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionCreate transactionCreate = (TransactionCreate) o; + return Objects.equals(this.member, transactionCreate.member) && + Objects.equals(this.amountCents, transactionCreate.amountCents) && + Objects.equals(this.title, transactionCreate.title) && + Objects.equals(this.description, transactionCreate.description); + } + + @Override + public int hashCode() { + return Objects.hash(member, amountCents, title, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransactionCreate {\n"); + sb.append(" member: ").append(toIndentedString(member)).append("\n"); + sb.append(" amountCents: ").append(toIndentedString(amountCents)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/TransactionPartialUpdate.java b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/TransactionPartialUpdate.java new file mode 100644 index 0000000..7e6a852 --- /dev/null +++ b/services/spring-finance/src/generated/java/tum/devoops/financeservice/model/TransactionPartialUpdate.java @@ -0,0 +1,156 @@ +package tum.devoops.financeservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for partially updating an existing Transaction (PATCH operation). + */ + +@Schema(name = "TransactionPartialUpdate", description = "Data transfer object for partially updating an existing Transaction (PATCH operation).") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class TransactionPartialUpdate { + + private @Nullable String member; + + private @Nullable Integer amountCents; + + private @Nullable String title; + + private @Nullable String description; + + public TransactionPartialUpdate member(@Nullable String member) { + this.member = member; + return this; + } + + /** + * Get member + * @return member + */ + + @Schema(name = "member", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("member") + public @Nullable String getMember() { + return member; + } + + public void setMember(@Nullable String member) { + this.member = member; + } + + public TransactionPartialUpdate amountCents(@Nullable Integer amountCents) { + this.amountCents = amountCents; + return this; + } + + /** + * Get amountCents + * @return amountCents + */ + + @Schema(name = "amount_cents", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("amount_cents") + public @Nullable Integer getAmountCents() { + return amountCents; + } + + public void setAmountCents(@Nullable Integer amountCents) { + this.amountCents = amountCents; + } + + public TransactionPartialUpdate title(@Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + + @Schema(name = "title", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("title") + public @Nullable String getTitle() { + return title; + } + + public void setTitle(@Nullable String title) { + this.title = title; + } + + public TransactionPartialUpdate description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + + @Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("description") + public @Nullable String getDescription() { + return description; + } + + public void setDescription(@Nullable String description) { + this.description = description; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionPartialUpdate transactionPartialUpdate = (TransactionPartialUpdate) o; + return Objects.equals(this.member, transactionPartialUpdate.member) && + Objects.equals(this.amountCents, transactionPartialUpdate.amountCents) && + Objects.equals(this.title, transactionPartialUpdate.title) && + Objects.equals(this.description, transactionPartialUpdate.description); + } + + @Override + public int hashCode() { + return Objects.hash(member, amountCents, title, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransactionPartialUpdate {\n"); + sb.append(" member: ").append(toIndentedString(member)).append("\n"); + sb.append(" amountCents: ").append(toIndentedString(amountCents)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-letter/build.gradle b/services/spring-letter/build.gradle index c5e9d91..80acb3d 100644 --- a/services/spring-letter/build.gradle +++ b/services/spring-letter/build.gradle @@ -29,6 +29,14 @@ java { } } +sourceSets { + main { + java { + srcDirs 'src/main/java', 'src/generated/java' + } + } +} + repositories { mavenCentral() } @@ -36,7 +44,9 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.0' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' runtimeOnly 'org.postgresql:postgresql' diff --git a/services/spring-letter/config/checkstyle/checkstyle.xml b/services/spring-letter/config/checkstyle/checkstyle.xml index 5cc515b..580dda9 100644 --- a/services/spring-letter/config/checkstyle/checkstyle.xml +++ b/services/spring-letter/config/checkstyle/checkstyle.xml @@ -10,6 +10,11 @@ --> + + + + + diff --git a/services/spring-letter/src/generated/java/.openapi-generator/FILES b/services/spring-letter/src/generated/java/.openapi-generator/FILES new file mode 100644 index 0000000..6518e73 --- /dev/null +++ b/services/spring-letter/src/generated/java/.openapi-generator/FILES @@ -0,0 +1,4 @@ +tum/devoops/letterservice/api/ApiUtil.java +tum/devoops/letterservice/api/LettersApi.java +tum/devoops/letterservice/model/BadRequestResponse.java +tum/devoops/letterservice/model/ErrorResponse.java diff --git a/services/spring-letter/src/generated/java/.openapi-generator/VERSION b/services/spring-letter/src/generated/java/.openapi-generator/VERSION new file mode 100644 index 0000000..e465da4 --- /dev/null +++ b/services/spring-letter/src/generated/java/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0 diff --git a/services/spring-letter/src/generated/java/tum/devoops/letterservice/api/ApiUtil.java b/services/spring-letter/src/generated/java/tum/devoops/letterservice/api/ApiUtil.java new file mode 100644 index 0000000..9e7bf42 --- /dev/null +++ b/services/spring-letter/src/generated/java/tum/devoops/letterservice/api/ApiUtil.java @@ -0,0 +1,19 @@ +package tum.devoops.letterservice.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/services/spring-letter/src/generated/java/tum/devoops/letterservice/api/LettersApi.java b/services/spring-letter/src/generated/java/tum/devoops/letterservice/api/LettersApi.java new file mode 100644 index 0000000..44886ba --- /dev/null +++ b/services/spring-letter/src/generated/java/tum/devoops/letterservice/api/LettersApi.java @@ -0,0 +1,197 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.14.0). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package tum.devoops.letterservice.api; + +import tum.devoops.letterservice.model.BadRequestResponse; +import tum.devoops.letterservice.model.ErrorResponse; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.lang.Nullable; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +@Validated +@Tag(name = "letters", description = "Endpoints related to generating and sending letters from templates, such as emails and PDFs.") +public interface LettersApi { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * POST /letters/pdf : Get pdf + * + * @param body The request body for generating a pdf from a template. It must be a valid HTML string using the template format with placeholders for dynamic content. (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getPdf", + summary = "Get pdf", + tags = { "letters" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/pdf", schema = @Schema(implementation = org.springframework.core.io.Resource.class)), + @Content(mediaType = "application/json", schema = @Schema(implementation = org.springframework.core.io.Resource.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/pdf", schema = @Schema(implementation = BadRequestResponse.class)), + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/pdf", schema = @Schema(implementation = ErrorResponse.class)), + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/pdf", schema = @Schema(implementation = ErrorResponse.class)), + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/pdf", schema = @Schema(implementation = ErrorResponse.class)), + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/letters/pdf", + produces = { "application/pdf", "application/json" }, + consumes = { "text/html" } + ) + + default ResponseEntity getPdf( + @Parameter(name = "body", description = "The request body for generating a pdf from a template. It must be a valid HTML string using the template format with placeholders for dynamic content.", required = true) @Valid @RequestBody String body + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /letters/mail : Send mail + * + * @param body The request body for sending mail. It will be used in the email content. It must be a valid HTML string using the template format with placeholders for dynamic content. (required) + * @return The request was successful, but there is no content to return in the response. (status code 204) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "sendMail", + summary = "Send mail", + tags = { "letters" }, + responses = { + @ApiResponse(responseCode = "204", description = "The request was successful, but there is no content to return in the response."), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/letters/mail", + produces = { "application/json" }, + consumes = { "text/html" } + ) + + default ResponseEntity sendMail( + @Parameter(name = "body", description = "The request body for sending mail. It will be used in the email content. It must be a valid HTML string using the template format with placeholders for dynamic content.", required = true) @Valid @RequestBody String body + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/services/spring-letter/src/generated/java/tum/devoops/letterservice/model/BadRequestResponse.java b/services/spring-letter/src/generated/java/tum/devoops/letterservice/model/BadRequestResponse.java new file mode 100644 index 0000000..ea3038a --- /dev/null +++ b/services/spring-letter/src/generated/java/tum/devoops/letterservice/model/BadRequestResponse.java @@ -0,0 +1,131 @@ +package tum.devoops.letterservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import tum.devoops.letterservice.model.ErrorResponse; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * BadRequestResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class BadRequestResponse { + + private String message; + + @Valid + private List<@Valid ErrorResponse> errors = new ArrayList<>(); + + public BadRequestResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public BadRequestResponse(String message) { + this.message = message; + } + + public BadRequestResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public BadRequestResponse errors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + return this; + } + + public BadRequestResponse addErrorsItem(ErrorResponse errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @Valid + @Schema(name = "errors", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("errors") + public List<@Valid ErrorResponse> getErrors() { + return errors; + } + + public void setErrors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadRequestResponse badRequestResponse = (BadRequestResponse) o; + return Objects.equals(this.message, badRequestResponse.message) && + Objects.equals(this.errors, badRequestResponse.errors); + } + + @Override + public int hashCode() { + return Objects.hash(message, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadRequestResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-letter/src/generated/java/tum/devoops/letterservice/model/ErrorResponse.java b/services/spring-letter/src/generated/java/tum/devoops/letterservice/model/ErrorResponse.java new file mode 100644 index 0000000..57c6871 --- /dev/null +++ b/services/spring-letter/src/generated/java/tum/devoops/letterservice/model/ErrorResponse.java @@ -0,0 +1,94 @@ +package tum.devoops.letterservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * ErrorResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class ErrorResponse { + + private String message; + + public ErrorResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public ErrorResponse(String message) { + this.message = message; + } + + public ErrorResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.message, errorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-member/build.gradle b/services/spring-member/build.gradle index 8983c7b..aa47b71 100644 --- a/services/spring-member/build.gradle +++ b/services/spring-member/build.gradle @@ -29,6 +29,14 @@ java { } } +sourceSets { + main { + java { + srcDirs 'src/main/java', 'src/generated/java' + } + } +} + repositories { mavenCentral() } @@ -36,7 +44,9 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.0' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' runtimeOnly 'org.postgresql:postgresql' diff --git a/services/spring-member/config/checkstyle/checkstyle.xml b/services/spring-member/config/checkstyle/checkstyle.xml index 5cc515b..580dda9 100644 --- a/services/spring-member/config/checkstyle/checkstyle.xml +++ b/services/spring-member/config/checkstyle/checkstyle.xml @@ -10,6 +10,11 @@ --> + + + + + diff --git a/services/spring-member/src/generated/java/.openapi-generator/FILES b/services/spring-member/src/generated/java/.openapi-generator/FILES new file mode 100644 index 0000000..1e3a676 --- /dev/null +++ b/services/spring-member/src/generated/java/.openapi-generator/FILES @@ -0,0 +1,8 @@ +tum/devoops/memberservice/api/ApiUtil.java +tum/devoops/memberservice/api/MembersApi.java +tum/devoops/memberservice/model/BadRequestResponse.java +tum/devoops/memberservice/model/ErrorResponse.java +tum/devoops/memberservice/model/Member.java +tum/devoops/memberservice/model/MemberCreate.java +tum/devoops/memberservice/model/MemberPartialUpdate.java +tum/devoops/memberservice/model/MemberSummary.java diff --git a/services/spring-member/src/generated/java/.openapi-generator/VERSION b/services/spring-member/src/generated/java/.openapi-generator/VERSION new file mode 100644 index 0000000..e465da4 --- /dev/null +++ b/services/spring-member/src/generated/java/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0 diff --git a/services/spring-member/src/generated/java/tum/devoops/memberservice/api/ApiUtil.java b/services/spring-member/src/generated/java/tum/devoops/memberservice/api/ApiUtil.java new file mode 100644 index 0000000..227748e --- /dev/null +++ b/services/spring-member/src/generated/java/tum/devoops/memberservice/api/ApiUtil.java @@ -0,0 +1,19 @@ +package tum.devoops.memberservice.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/services/spring-member/src/generated/java/tum/devoops/memberservice/api/MembersApi.java b/services/spring-member/src/generated/java/tum/devoops/memberservice/api/MembersApi.java new file mode 100644 index 0000000..cebbf57 --- /dev/null +++ b/services/spring-member/src/generated/java/tum/devoops/memberservice/api/MembersApi.java @@ -0,0 +1,446 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.14.0). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package tum.devoops.memberservice.api; + +import tum.devoops.memberservice.model.BadRequestResponse; +import tum.devoops.memberservice.model.ErrorResponse; +import tum.devoops.memberservice.model.Member; +import tum.devoops.memberservice.model.MemberCreate; +import tum.devoops.memberservice.model.MemberPartialUpdate; +import tum.devoops.memberservice.model.MemberSummary; +import java.util.UUID; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.lang.Nullable; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +@Validated +@Tag(name = "members", description = "Endpoints related to managing members of the organization (which represent all users).") +public interface MembersApi { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * POST /members : Create member + * + * @param memberCreate The request body for creating a new member. (required) + * @return The request was successful, and a new resource was created. (status code 201) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again. (status code 409) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "createMember", + summary = "Create member", + tags = { "members" }, + responses = { + @ApiResponse(responseCode = "201", description = "The request was successful, and a new resource was created.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Member.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/members", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createMember( + @Parameter(name = "MemberCreate", description = "The request body for creating a new member.", required = true) @Valid @RequestBody MemberCreate memberCreate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"birthday\" : \"2000-01-23\", \"joining_date\" : \"2000-01-23\", \"address\" : \"address\", \"last_name\" : \"last_name\", \"phone_number\" : \"phone_number\", \"information\" : \"information\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"first_name\" : \"first_name\", \"email\" : \"email\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /members/{member_id} : Delete member + * + * @param memberId (required) + * @return The request was successful, but there is no content to return in the response. (status code 204) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "deleteMember", + summary = "Delete member", + tags = { "members" }, + responses = { + @ApiResponse(responseCode = "204", description = "The request was successful, but there is no content to return in the response."), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/members/{member_id}", + produces = { "application/json" } + ) + + default ResponseEntity deleteMember( + @Parameter(name = "member_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("member_id") UUID memberId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /members : Get all members + * + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getAllMembers", + summary = "Get all members", + tags = { "members" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = MemberSummary.class))) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/members", + produces = { "application/json" } + ) + + default ResponseEntity> getAllMembers( + + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"last_name\" : \"last_name\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"first_name\" : \"first_name\", \"email\" : \"email\" }, { \"last_name\" : \"last_name\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"first_name\" : \"first_name\", \"email\" : \"email\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /members/{member_id} : Get member details + * + * @param memberId (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getMemberDetails", + summary = "Get member details", + tags = { "members" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Member.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/members/{member_id}", + produces = { "application/json" } + ) + + default ResponseEntity getMemberDetails( + @Parameter(name = "member_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("member_id") UUID memberId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"birthday\" : \"2000-01-23\", \"joining_date\" : \"2000-01-23\", \"address\" : \"address\", \"last_name\" : \"last_name\", \"phone_number\" : \"phone_number\", \"information\" : \"information\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"first_name\" : \"first_name\", \"email\" : \"email\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /members/{member_id} : Update member details + * + * @param memberId (required) + * @param memberPartialUpdate The request body for partially updating a member. (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "updateMemberDetails", + summary = "Update member details", + tags = { "members" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Member.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/members/{member_id}", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity updateMemberDetails( + @Parameter(name = "member_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("member_id") UUID memberId, + @Parameter(name = "MemberPartialUpdate", description = "The request body for partially updating a member.", required = true) @Valid @RequestBody MemberPartialUpdate memberPartialUpdate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"birthday\" : \"2000-01-23\", \"joining_date\" : \"2000-01-23\", \"address\" : \"address\", \"last_name\" : \"last_name\", \"phone_number\" : \"phone_number\", \"information\" : \"information\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"first_name\" : \"first_name\", \"email\" : \"email\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/services/spring-member/src/generated/java/tum/devoops/memberservice/model/BadRequestResponse.java b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/BadRequestResponse.java new file mode 100644 index 0000000..8d4f176 --- /dev/null +++ b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/BadRequestResponse.java @@ -0,0 +1,131 @@ +package tum.devoops.memberservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import tum.devoops.memberservice.model.ErrorResponse; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * BadRequestResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class BadRequestResponse { + + private String message; + + @Valid + private List<@Valid ErrorResponse> errors = new ArrayList<>(); + + public BadRequestResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public BadRequestResponse(String message) { + this.message = message; + } + + public BadRequestResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public BadRequestResponse errors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + return this; + } + + public BadRequestResponse addErrorsItem(ErrorResponse errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @Valid + @Schema(name = "errors", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("errors") + public List<@Valid ErrorResponse> getErrors() { + return errors; + } + + public void setErrors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadRequestResponse badRequestResponse = (BadRequestResponse) o; + return Objects.equals(this.message, badRequestResponse.message) && + Objects.equals(this.errors, badRequestResponse.errors); + } + + @Override + public int hashCode() { + return Objects.hash(message, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadRequestResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-member/src/generated/java/tum/devoops/memberservice/model/ErrorResponse.java b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/ErrorResponse.java new file mode 100644 index 0000000..3b9a3ae --- /dev/null +++ b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/ErrorResponse.java @@ -0,0 +1,94 @@ +package tum.devoops.memberservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * ErrorResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class ErrorResponse { + + private String message; + + public ErrorResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public ErrorResponse(String message) { + this.message = message; + } + + public ErrorResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.message, errorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-member/src/generated/java/tum/devoops/memberservice/model/Member.java b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/Member.java new file mode 100644 index 0000000..1045c46 --- /dev/null +++ b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/Member.java @@ -0,0 +1,300 @@ +package tum.devoops.memberservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.LocalDate; +import java.util.UUID; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * The object representation of a Member. All users are represented as a member. + */ + +@Schema(name = "Member", description = "The object representation of a Member. All users are represented as a member.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class Member { + + private UUID id; + + private String firstName; + + private String lastName; + + private String email; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) + private LocalDate birthday; + + private String phoneNumber; + + private String address; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) + private LocalDate joiningDate; + + private String information; + + public Member() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Member(UUID id, String firstName, String lastName, String email, LocalDate birthday, String phoneNumber, String address, LocalDate joiningDate, String information) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + this.email = email; + this.birthday = birthday; + this.phoneNumber = phoneNumber; + this.address = address; + this.joiningDate = joiningDate; + this.information = information; + } + + public Member id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @NotNull @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("id") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public Member firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @NotNull + @Schema(name = "first_name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("first_name") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public Member lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @NotNull + @Schema(name = "last_name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("last_name") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public Member email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @NotNull + @Schema(name = "email", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("email") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Member birthday(LocalDate birthday) { + this.birthday = birthday; + return this; + } + + /** + * Get birthday + * @return birthday + */ + @NotNull @Valid + @Schema(name = "birthday", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("birthday") + public LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(LocalDate birthday) { + this.birthday = birthday; + } + + public Member phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get phoneNumber + * @return phoneNumber + */ + @NotNull + @Schema(name = "phone_number", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("phone_number") + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public Member address(String address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @NotNull + @Schema(name = "address", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("address") + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Member joiningDate(LocalDate joiningDate) { + this.joiningDate = joiningDate; + return this; + } + + /** + * Get joiningDate + * @return joiningDate + */ + @NotNull @Valid + @Schema(name = "joining_date", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("joining_date") + public LocalDate getJoiningDate() { + return joiningDate; + } + + public void setJoiningDate(LocalDate joiningDate) { + this.joiningDate = joiningDate; + } + + public Member information(String information) { + this.information = information; + return this; + } + + /** + * Get information + * @return information + */ + @NotNull + @Schema(name = "information", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("information") + public String getInformation() { + return information; + } + + public void setInformation(String information) { + this.information = information; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Member member = (Member) o; + return Objects.equals(this.id, member.id) && + Objects.equals(this.firstName, member.firstName) && + Objects.equals(this.lastName, member.lastName) && + Objects.equals(this.email, member.email) && + Objects.equals(this.birthday, member.birthday) && + Objects.equals(this.phoneNumber, member.phoneNumber) && + Objects.equals(this.address, member.address) && + Objects.equals(this.joiningDate, member.joiningDate) && + Objects.equals(this.information, member.information); + } + + @Override + public int hashCode() { + return Objects.hash(id, firstName, lastName, email, birthday, phoneNumber, address, joiningDate, information); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Member {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" birthday: ").append(toIndentedString(birthday)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" joiningDate: ").append(toIndentedString(joiningDate)).append("\n"); + sb.append(" information: ").append(toIndentedString(information)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberCreate.java b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberCreate.java new file mode 100644 index 0000000..3504d27 --- /dev/null +++ b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberCreate.java @@ -0,0 +1,243 @@ +package tum.devoops.memberservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.LocalDate; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for creating a new Member. + */ + +@Schema(name = "MemberCreate", description = "Data transfer object for creating a new Member.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class MemberCreate { + + private String firstName; + + private String lastName; + + private @Nullable String email; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) + private @Nullable LocalDate birthday; + + private @Nullable String phoneNumber; + + private @Nullable String address; + + private @Nullable String information; + + public MemberCreate() { + super(); + } + + /** + * Constructor with only required parameters + */ + public MemberCreate(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public MemberCreate firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @NotNull + @Schema(name = "first_name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("first_name") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public MemberCreate lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @NotNull + @Schema(name = "last_name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("last_name") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public MemberCreate email(@Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + + @Schema(name = "email", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("email") + public @Nullable String getEmail() { + return email; + } + + public void setEmail(@Nullable String email) { + this.email = email; + } + + public MemberCreate birthday(@Nullable LocalDate birthday) { + this.birthday = birthday; + return this; + } + + /** + * Get birthday + * @return birthday + */ + @Valid + @Schema(name = "birthday", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("birthday") + public @Nullable LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(@Nullable LocalDate birthday) { + this.birthday = birthday; + } + + public MemberCreate phoneNumber(@Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get phoneNumber + * @return phoneNumber + */ + + @Schema(name = "phone_number", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("phone_number") + public @Nullable String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public MemberCreate address(@Nullable String address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + + @Schema(name = "address", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("address") + public @Nullable String getAddress() { + return address; + } + + public void setAddress(@Nullable String address) { + this.address = address; + } + + public MemberCreate information(@Nullable String information) { + this.information = information; + return this; + } + + /** + * Get information + * @return information + */ + + @Schema(name = "information", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("information") + public @Nullable String getInformation() { + return information; + } + + public void setInformation(@Nullable String information) { + this.information = information; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MemberCreate memberCreate = (MemberCreate) o; + return Objects.equals(this.firstName, memberCreate.firstName) && + Objects.equals(this.lastName, memberCreate.lastName) && + Objects.equals(this.email, memberCreate.email) && + Objects.equals(this.birthday, memberCreate.birthday) && + Objects.equals(this.phoneNumber, memberCreate.phoneNumber) && + Objects.equals(this.address, memberCreate.address) && + Objects.equals(this.information, memberCreate.information); + } + + @Override + public int hashCode() { + return Objects.hash(firstName, lastName, email, birthday, phoneNumber, address, information); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MemberCreate {\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" birthday: ").append(toIndentedString(birthday)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" information: ").append(toIndentedString(information)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberPartialUpdate.java b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberPartialUpdate.java new file mode 100644 index 0000000..e1caa67 --- /dev/null +++ b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberPartialUpdate.java @@ -0,0 +1,231 @@ +package tum.devoops.memberservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.LocalDate; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for partially updating an existing Member (PATCH operation). + */ + +@Schema(name = "MemberPartialUpdate", description = "Data transfer object for partially updating an existing Member (PATCH operation).") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class MemberPartialUpdate { + + private @Nullable String firstName; + + private @Nullable String lastName; + + private @Nullable String email; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) + private @Nullable LocalDate birthday; + + private @Nullable String phoneNumber; + + private @Nullable String address; + + private @Nullable String information; + + public MemberPartialUpdate firstName(@Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + + @Schema(name = "first_name", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("first_name") + public @Nullable String getFirstName() { + return firstName; + } + + public void setFirstName(@Nullable String firstName) { + this.firstName = firstName; + } + + public MemberPartialUpdate lastName(@Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + + @Schema(name = "last_name", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("last_name") + public @Nullable String getLastName() { + return lastName; + } + + public void setLastName(@Nullable String lastName) { + this.lastName = lastName; + } + + public MemberPartialUpdate email(@Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + + @Schema(name = "email", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("email") + public @Nullable String getEmail() { + return email; + } + + public void setEmail(@Nullable String email) { + this.email = email; + } + + public MemberPartialUpdate birthday(@Nullable LocalDate birthday) { + this.birthday = birthday; + return this; + } + + /** + * Get birthday + * @return birthday + */ + @Valid + @Schema(name = "birthday", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("birthday") + public @Nullable LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(@Nullable LocalDate birthday) { + this.birthday = birthday; + } + + public MemberPartialUpdate phoneNumber(@Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get phoneNumber + * @return phoneNumber + */ + + @Schema(name = "phone_number", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("phone_number") + public @Nullable String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public MemberPartialUpdate address(@Nullable String address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + + @Schema(name = "address", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("address") + public @Nullable String getAddress() { + return address; + } + + public void setAddress(@Nullable String address) { + this.address = address; + } + + public MemberPartialUpdate information(@Nullable String information) { + this.information = information; + return this; + } + + /** + * Get information + * @return information + */ + + @Schema(name = "information", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("information") + public @Nullable String getInformation() { + return information; + } + + public void setInformation(@Nullable String information) { + this.information = information; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MemberPartialUpdate memberPartialUpdate = (MemberPartialUpdate) o; + return Objects.equals(this.firstName, memberPartialUpdate.firstName) && + Objects.equals(this.lastName, memberPartialUpdate.lastName) && + Objects.equals(this.email, memberPartialUpdate.email) && + Objects.equals(this.birthday, memberPartialUpdate.birthday) && + Objects.equals(this.phoneNumber, memberPartialUpdate.phoneNumber) && + Objects.equals(this.address, memberPartialUpdate.address) && + Objects.equals(this.information, memberPartialUpdate.information); + } + + @Override + public int hashCode() { + return Objects.hash(firstName, lastName, email, birthday, phoneNumber, address, information); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MemberPartialUpdate {\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" birthday: ").append(toIndentedString(birthday)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" information: ").append(toIndentedString(information)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberSummary.java b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberSummary.java new file mode 100644 index 0000000..36c13c0 --- /dev/null +++ b/services/spring-member/src/generated/java/tum/devoops/memberservice/model/MemberSummary.java @@ -0,0 +1,171 @@ +package tum.devoops.memberservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.UUID; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * A simplified representation of a Member, typically used in list views. + */ + +@Schema(name = "MemberSummary", description = "A simplified representation of a Member, typically used in list views.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class MemberSummary { + + private UUID id; + + private String firstName; + + private String lastName; + + private String email; + + public MemberSummary() { + super(); + } + + /** + * Constructor with only required parameters + */ + public MemberSummary(UUID id, String firstName, String lastName, String email) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + this.email = email; + } + + public MemberSummary id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @NotNull @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("id") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public MemberSummary firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @NotNull + @Schema(name = "first_name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("first_name") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public MemberSummary lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @NotNull + @Schema(name = "last_name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("last_name") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public MemberSummary email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @NotNull + @Schema(name = "email", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("email") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MemberSummary memberSummary = (MemberSummary) o; + return Objects.equals(this.id, memberSummary.id) && + Objects.equals(this.firstName, memberSummary.firstName) && + Objects.equals(this.lastName, memberSummary.lastName) && + Objects.equals(this.email, memberSummary.email); + } + + @Override + public int hashCode() { + return Objects.hash(id, firstName, lastName, email); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MemberSummary {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-organization/build.gradle b/services/spring-organization/build.gradle index 2c4e2c8..437e4c8 100644 --- a/services/spring-organization/build.gradle +++ b/services/spring-organization/build.gradle @@ -29,6 +29,14 @@ java { } } +sourceSets { + main { + java { + srcDirs 'src/main/java', 'src/generated/java' + } + } +} + repositories { mavenCentral() } @@ -36,7 +44,9 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.0' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' runtimeOnly 'org.postgresql:postgresql' diff --git a/services/spring-organization/config/checkstyle/checkstyle.xml b/services/spring-organization/config/checkstyle/checkstyle.xml index 5cc515b..580dda9 100644 --- a/services/spring-organization/config/checkstyle/checkstyle.xml +++ b/services/spring-organization/config/checkstyle/checkstyle.xml @@ -10,6 +10,11 @@ --> + + + + + diff --git a/services/spring-organization/src/generated/java/.openapi-generator/FILES b/services/spring-organization/src/generated/java/.openapi-generator/FILES new file mode 100644 index 0000000..25bf6c3 --- /dev/null +++ b/services/spring-organization/src/generated/java/.openapi-generator/FILES @@ -0,0 +1,10 @@ +tum/devoops/organizationservice/api/ApiUtil.java +tum/devoops/organizationservice/api/OrganizationApi.java +tum/devoops/organizationservice/model/BadRequestResponse.java +tum/devoops/organizationservice/model/ErrorResponse.java +tum/devoops/organizationservice/model/Sport.java +tum/devoops/organizationservice/model/SportCreate.java +tum/devoops/organizationservice/model/SportPartialUpdate.java +tum/devoops/organizationservice/model/Team.java +tum/devoops/organizationservice/model/TeamCreate.java +tum/devoops/organizationservice/model/TeamPartialUpdate.java diff --git a/services/spring-organization/src/generated/java/.openapi-generator/VERSION b/services/spring-organization/src/generated/java/.openapi-generator/VERSION new file mode 100644 index 0000000..e465da4 --- /dev/null +++ b/services/spring-organization/src/generated/java/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0 diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/api/ApiUtil.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/api/ApiUtil.java new file mode 100644 index 0000000..e41faed --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/api/ApiUtil.java @@ -0,0 +1,19 @@ +package tum.devoops.organizationservice.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/api/OrganizationApi.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/api/OrganizationApi.java new file mode 100644 index 0000000..f1e864b --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/api/OrganizationApi.java @@ -0,0 +1,847 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.14.0). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package tum.devoops.organizationservice.api; + +import tum.devoops.organizationservice.model.BadRequestResponse; +import tum.devoops.organizationservice.model.ErrorResponse; +import tum.devoops.organizationservice.model.Sport; +import tum.devoops.organizationservice.model.SportCreate; +import tum.devoops.organizationservice.model.SportPartialUpdate; +import tum.devoops.organizationservice.model.Team; +import tum.devoops.organizationservice.model.TeamCreate; +import tum.devoops.organizationservice.model.TeamPartialUpdate; +import java.util.UUID; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.lang.Nullable; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +@Validated +@Tag(name = "organization", description = "Endpoints related to managing the overall organization, including sports and teams.") +public interface OrganizationApi { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * POST /organization/sports : Create sport + * Creates a new sport in the organization. Only admins are allowed to create new sports. + * + * @param sportCreate The request body for creating a new sport. (required) + * @return The request was successful, and a new resource was created. (status code 201) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again. (status code 409) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "createSport", + summary = "Create sport", + description = "Creates a new sport in the organization. Only admins are allowed to create new sports.", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "201", description = "The request was successful, and a new resource was created.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Sport.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/organization/sports", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createSport( + @Parameter(name = "SportCreate", description = "The request body for creating a new sport.", required = true) @Valid @RequestBody SportCreate sportCreate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"directors\" : [ \"directors\", \"directors\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /organization/teams : Create team + * + * @param teamCreate The request body for creating a new team. (required) + * @return The request was successful, and a new resource was created. (status code 201) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again. (status code 409) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "createTeam", + summary = "Create team", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "201", description = "The request was successful, and a new resource was created.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Team.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "409", description = "The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/organization/teams", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createTeam( + @Parameter(name = "TeamCreate", description = "The request body for creating a new team.", required = true) @Valid @RequestBody TeamCreate teamCreate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"trainers\" : [ \"trainers\", \"trainers\" ], \"address\" : \"address\", \"trainees\" : [ \"trainees\", \"trainees\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"sport\" : \"sport\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /organization/sports/{sport_name} : Delete sport + * + * @param sportName (required) + * @return The request was successful, but there is no content to return in the response. (status code 204) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "deleteSport", + summary = "Delete sport", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "204", description = "The request was successful, but there is no content to return in the response."), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/organization/sports/{sport_name}", + produces = { "application/json" } + ) + + default ResponseEntity deleteSport( + @Parameter(name = "sport_name", description = "", required = true, in = ParameterIn.PATH) @PathVariable("sport_name") String sportName + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /organization/teams/{team_id} : Delete team + * + * @param teamId (required) + * @return The request was successful, but there is no content to return in the response. (status code 204) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "deleteTeam", + summary = "Delete team", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "204", description = "The request was successful, but there is no content to return in the response."), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/organization/teams/{team_id}", + produces = { "application/json" } + ) + + default ResponseEntity deleteTeam( + @Parameter(name = "team_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("team_id") UUID teamId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /organization/sports : Get all sports + * Returns a list of all sports registered in the organization. If the caller is not an admin, only sports that the caller is a member of will be returned. + * + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getAllSports", + summary = "Get all sports", + description = "Returns a list of all sports registered in the organization. If the caller is not an admin, only sports that the caller is a member of will be returned.", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Sport.class))) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/organization/sports", + produces = { "application/json" } + ) + + default ResponseEntity> getAllSports( + + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"directors\" : [ \"directors\", \"directors\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\" }, { \"directors\" : [ \"directors\", \"directors\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /organization/teams : Get all teams + * + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getAllTeams", + summary = "Get all teams", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Team.class))) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/organization/teams", + produces = { "application/json" } + ) + + default ResponseEntity> getAllTeams( + + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"trainers\" : [ \"trainers\", \"trainers\" ], \"address\" : \"address\", \"trainees\" : [ \"trainees\", \"trainees\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"sport\" : \"sport\" }, { \"trainers\" : [ \"trainers\", \"trainers\" ], \"address\" : \"address\", \"trainees\" : [ \"trainees\", \"trainees\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"sport\" : \"sport\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /organization/sports/{sport_name} : Get sport + * + * @param sportName (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getSport", + summary = "Get sport", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Sport.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/organization/sports/{sport_name}", + produces = { "application/json" } + ) + + default ResponseEntity getSport( + @Parameter(name = "sport_name", description = "", required = true, in = ParameterIn.PATH) @PathVariable("sport_name") String sportName + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"directors\" : [ \"directors\", \"directors\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /organization/teams/{team_id} : Get team + * + * @param teamId (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "getTeam", + summary = "Get team", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Team.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/organization/teams/{team_id}", + produces = { "application/json" } + ) + + default ResponseEntity getTeam( + @Parameter(name = "team_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("team_id") UUID teamId + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"trainers\" : [ \"trainers\", \"trainers\" ], \"address\" : \"address\", \"trainees\" : [ \"trainees\", \"trainees\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"sport\" : \"sport\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /organization/sports/{sport_name} : Update sport + * + * @param sportName (required) + * @param sportPartialUpdate The request body for partially updating a sport. (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "updateSport", + summary = "Update sport", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Sport.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/organization/sports/{sport_name}", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity updateSport( + @Parameter(name = "sport_name", description = "", required = true, in = ParameterIn.PATH) @PathVariable("sport_name") String sportName, + @Parameter(name = "SportPartialUpdate", description = "The request body for partially updating a sport.", required = true) @Valid @RequestBody SportPartialUpdate sportPartialUpdate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"directors\" : [ \"directors\", \"directors\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /organization/teams/{team_id} : Update team + * + * @param teamId (required) + * @param teamPartialUpdate The request body for partially updating a team. (required) + * @return The request was successful, and the server has returned the requested resource in the response body. (status code 200) + * or The server could not understand the request due to invalid syntax. The client should modify the request and try again. (status code 400) + * or Authentication is required to access the requested resource. The client must include the appropriate credentials. (status code 401) + * or The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. (status code 403) + * or The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. (status code 404) + * or The server encountered an unexpected condition that prevented it from fulfilling the request. (status code 500) + */ + @Operation( + operationId = "updateTeam", + summary = "Update team", + tags = { "organization" }, + responses = { + @ApiResponse(responseCode = "200", description = "The request was successful, and the server has returned the requested resource in the response body.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Team.class)) + }), + @ApiResponse(responseCode = "400", description = "The server could not understand the request due to invalid syntax. The client should modify the request and try again.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = BadRequestResponse.class)) + }), + @ApiResponse(responseCode = "401", description = "Authentication is required to access the requested resource. The client must include the appropriate credentials.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "403", description = "The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "404", description = "The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }), + @ApiResponse(responseCode = "500", description = "The server encountered an unexpected condition that prevented it from fulfilling the request.", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)) + }) + }, + security = { + @SecurityRequirement(name = "BearerJwt") + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/organization/teams/{team_id}", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity updateTeam( + @Parameter(name = "team_id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("team_id") UUID teamId, + @Parameter(name = "TeamPartialUpdate", description = "The request body for partially updating a team.", required = true) @Valid @RequestBody TeamPartialUpdate teamPartialUpdate + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"trainers\" : [ \"trainers\", \"trainers\" ], \"address\" : \"address\", \"trainees\" : [ \"trainees\", \"trainees\" ], \"name\" : \"name\", \"description\" : \"description\", \"created_at\" : \"2000-01-23\", \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\", \"sport\" : \"sport\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\", \"errors\" : [ { \"message\" : \"message\" }, { \"message\" : \"message\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"message\" : \"message\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/BadRequestResponse.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/BadRequestResponse.java new file mode 100644 index 0000000..95d7598 --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/BadRequestResponse.java @@ -0,0 +1,131 @@ +package tum.devoops.organizationservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import tum.devoops.organizationservice.model.ErrorResponse; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * BadRequestResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class BadRequestResponse { + + private String message; + + @Valid + private List<@Valid ErrorResponse> errors = new ArrayList<>(); + + public BadRequestResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public BadRequestResponse(String message) { + this.message = message; + } + + public BadRequestResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public BadRequestResponse errors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + return this; + } + + public BadRequestResponse addErrorsItem(ErrorResponse errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @Valid + @Schema(name = "errors", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("errors") + public List<@Valid ErrorResponse> getErrors() { + return errors; + } + + public void setErrors(List<@Valid ErrorResponse> errors) { + this.errors = errors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadRequestResponse badRequestResponse = (BadRequestResponse) o; + return Objects.equals(this.message, badRequestResponse.message) && + Objects.equals(this.errors, badRequestResponse.errors); + } + + @Override + public int hashCode() { + return Objects.hash(message, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadRequestResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/ErrorResponse.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/ErrorResponse.java new file mode 100644 index 0000000..e454913 --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/ErrorResponse.java @@ -0,0 +1,94 @@ +package tum.devoops.organizationservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * ErrorResponse + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class ErrorResponse { + + private String message; + + public ErrorResponse() { + super(); + } + + /** + * Constructor with only required parameters + */ + public ErrorResponse(String message) { + this.message = message; + } + + public ErrorResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @NotNull + @Schema(name = "message", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.message, errorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/Sport.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/Sport.java new file mode 100644 index 0000000..248a6ef --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/Sport.java @@ -0,0 +1,185 @@ +package tum.devoops.organizationservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * The object representation of a Sport within the organization. + */ + +@Schema(name = "Sport", description = "The object representation of a Sport within the organization.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class Sport { + + private String name; + + private String description; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) + private LocalDate createdAt; + + @Valid + private List directors = new ArrayList<>(); + + public Sport() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Sport(String name, String description, LocalDate createdAt, List directors) { + this.name = name; + this.description = description; + this.createdAt = createdAt; + this.directors = directors; + } + + public Sport name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Sport description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @NotNull + @Schema(name = "description", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Sport createdAt(LocalDate createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @NotNull @Valid + @Schema(name = "created_at", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("created_at") + public LocalDate getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDate createdAt) { + this.createdAt = createdAt; + } + + public Sport directors(List directors) { + this.directors = directors; + return this; + } + + public Sport addDirectorsItem(String directorsItem) { + if (this.directors == null) { + this.directors = new ArrayList<>(); + } + this.directors.add(directorsItem); + return this; + } + + /** + * Get directors + * @return directors + */ + @NotNull + @Schema(name = "directors", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("directors") + public List getDirectors() { + return directors; + } + + public void setDirectors(List directors) { + this.directors = directors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Sport sport = (Sport) o; + return Objects.equals(this.name, sport.name) && + Objects.equals(this.description, sport.description) && + Objects.equals(this.createdAt, sport.createdAt) && + Objects.equals(this.directors, sport.directors); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, createdAt, directors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Sport {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" directors: ").append(toIndentedString(directors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/SportCreate.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/SportCreate.java new file mode 100644 index 0000000..1e1d4c4 --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/SportCreate.java @@ -0,0 +1,155 @@ +package tum.devoops.organizationservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for creating a new Sport. + */ + +@Schema(name = "SportCreate", description = "Data transfer object for creating a new Sport.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class SportCreate { + + private String name; + + private @Nullable String description; + + @Valid + private List directors = new ArrayList<>(); + + public SportCreate() { + super(); + } + + /** + * Constructor with only required parameters + */ + public SportCreate(String name) { + this.name = name; + } + + public SportCreate name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public SportCreate description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + + @Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("description") + public @Nullable String getDescription() { + return description; + } + + public void setDescription(@Nullable String description) { + this.description = description; + } + + public SportCreate directors(List directors) { + this.directors = directors; + return this; + } + + public SportCreate addDirectorsItem(String directorsItem) { + if (this.directors == null) { + this.directors = new ArrayList<>(); + } + this.directors.add(directorsItem); + return this; + } + + /** + * Get directors + * @return directors + */ + + @Schema(name = "directors", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("directors") + public List getDirectors() { + return directors; + } + + public void setDirectors(List directors) { + this.directors = directors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SportCreate sportCreate = (SportCreate) o; + return Objects.equals(this.name, sportCreate.name) && + Objects.equals(this.description, sportCreate.description) && + Objects.equals(this.directors, sportCreate.directors); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, directors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SportCreate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" directors: ").append(toIndentedString(directors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/SportPartialUpdate.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/SportPartialUpdate.java new file mode 100644 index 0000000..246ce3d --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/SportPartialUpdate.java @@ -0,0 +1,144 @@ +package tum.devoops.organizationservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for partially updating an existing Sport (PATCH operation). + */ + +@Schema(name = "SportPartialUpdate", description = "Data transfer object for partially updating an existing Sport (PATCH operation).") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class SportPartialUpdate { + + private @Nullable String name; + + private @Nullable String description; + + @Valid + private List directors = new ArrayList<>(); + + public SportPartialUpdate name(@Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + + @Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("name") + public @Nullable String getName() { + return name; + } + + public void setName(@Nullable String name) { + this.name = name; + } + + public SportPartialUpdate description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + + @Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("description") + public @Nullable String getDescription() { + return description; + } + + public void setDescription(@Nullable String description) { + this.description = description; + } + + public SportPartialUpdate directors(List directors) { + this.directors = directors; + return this; + } + + public SportPartialUpdate addDirectorsItem(String directorsItem) { + if (this.directors == null) { + this.directors = new ArrayList<>(); + } + this.directors.add(directorsItem); + return this; + } + + /** + * Get directors + * @return directors + */ + + @Schema(name = "directors", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("directors") + public List getDirectors() { + return directors; + } + + public void setDirectors(List directors) { + this.directors = directors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SportPartialUpdate sportPartialUpdate = (SportPartialUpdate) o; + return Objects.equals(this.name, sportPartialUpdate.name) && + Objects.equals(this.description, sportPartialUpdate.description) && + Objects.equals(this.directors, sportPartialUpdate.directors); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, directors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SportPartialUpdate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" directors: ").append(toIndentedString(directors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/Team.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/Team.java new file mode 100644 index 0000000..c0c6033 --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/Team.java @@ -0,0 +1,295 @@ +package tum.devoops.organizationservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * The object representation of a Team that belongs to a specific Sport. + */ + +@Schema(name = "Team", description = "The object representation of a Team that belongs to a specific Sport.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class Team { + + private UUID id; + + private String name; + + private String description; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) + private LocalDate createdAt; + + private String address; + + private String sport; + + @Valid + private List trainers = new ArrayList<>(); + + @Valid + private List trainees = new ArrayList<>(); + + public Team() { + super(); + } + + /** + * Constructor with only required parameters + */ + public Team(UUID id, String name, String description, LocalDate createdAt, String address, String sport, List trainers, List trainees) { + this.id = id; + this.name = name; + this.description = description; + this.createdAt = createdAt; + this.address = address; + this.sport = sport; + this.trainers = trainers; + this.trainees = trainees; + } + + public Team id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @NotNull @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("id") + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public Team name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Team description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @NotNull + @Schema(name = "description", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Team createdAt(LocalDate createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @NotNull @Valid + @Schema(name = "created_at", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("created_at") + public LocalDate getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDate createdAt) { + this.createdAt = createdAt; + } + + public Team address(String address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @NotNull + @Schema(name = "address", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("address") + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Team sport(String sport) { + this.sport = sport; + return this; + } + + /** + * Get sport + * @return sport + */ + @NotNull + @Schema(name = "sport", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("sport") + public String getSport() { + return sport; + } + + public void setSport(String sport) { + this.sport = sport; + } + + public Team trainers(List trainers) { + this.trainers = trainers; + return this; + } + + public Team addTrainersItem(String trainersItem) { + if (this.trainers == null) { + this.trainers = new ArrayList<>(); + } + this.trainers.add(trainersItem); + return this; + } + + /** + * Get trainers + * @return trainers + */ + @NotNull + @Schema(name = "trainers", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("trainers") + public List getTrainers() { + return trainers; + } + + public void setTrainers(List trainers) { + this.trainers = trainers; + } + + public Team trainees(List trainees) { + this.trainees = trainees; + return this; + } + + public Team addTraineesItem(String traineesItem) { + if (this.trainees == null) { + this.trainees = new ArrayList<>(); + } + this.trainees.add(traineesItem); + return this; + } + + /** + * Get trainees + * @return trainees + */ + @NotNull + @Schema(name = "trainees", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("trainees") + public List getTrainees() { + return trainees; + } + + public void setTrainees(List trainees) { + this.trainees = trainees; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Team team = (Team) o; + return Objects.equals(this.id, team.id) && + Objects.equals(this.name, team.name) && + Objects.equals(this.description, team.description) && + Objects.equals(this.createdAt, team.createdAt) && + Objects.equals(this.address, team.address) && + Objects.equals(this.sport, team.sport) && + Objects.equals(this.trainers, team.trainers) && + Objects.equals(this.trainees, team.trainees); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, createdAt, address, sport, trainers, trainees); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Team {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" sport: ").append(toIndentedString(sport)).append("\n"); + sb.append(" trainers: ").append(toIndentedString(trainers)).append("\n"); + sb.append(" trainees: ").append(toIndentedString(trainees)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/TeamCreate.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/TeamCreate.java new file mode 100644 index 0000000..b517a35 --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/TeamCreate.java @@ -0,0 +1,237 @@ +package tum.devoops.organizationservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for creating a new Team. + */ + +@Schema(name = "TeamCreate", description = "Data transfer object for creating a new Team.") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class TeamCreate { + + private String name; + + private @Nullable String description; + + private @Nullable String address; + + private String sport; + + @Valid + private List trainers = new ArrayList<>(); + + @Valid + private List trainees = new ArrayList<>(); + + public TeamCreate() { + super(); + } + + /** + * Constructor with only required parameters + */ + public TeamCreate(String name, String sport) { + this.name = name; + this.sport = sport; + } + + public TeamCreate name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public TeamCreate description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + + @Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("description") + public @Nullable String getDescription() { + return description; + } + + public void setDescription(@Nullable String description) { + this.description = description; + } + + public TeamCreate address(@Nullable String address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + + @Schema(name = "address", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("address") + public @Nullable String getAddress() { + return address; + } + + public void setAddress(@Nullable String address) { + this.address = address; + } + + public TeamCreate sport(String sport) { + this.sport = sport; + return this; + } + + /** + * Get sport + * @return sport + */ + @NotNull + @Schema(name = "sport", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("sport") + public String getSport() { + return sport; + } + + public void setSport(String sport) { + this.sport = sport; + } + + public TeamCreate trainers(List trainers) { + this.trainers = trainers; + return this; + } + + public TeamCreate addTrainersItem(String trainersItem) { + if (this.trainers == null) { + this.trainers = new ArrayList<>(); + } + this.trainers.add(trainersItem); + return this; + } + + /** + * Get trainers + * @return trainers + */ + + @Schema(name = "trainers", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("trainers") + public List getTrainers() { + return trainers; + } + + public void setTrainers(List trainers) { + this.trainers = trainers; + } + + public TeamCreate trainees(List trainees) { + this.trainees = trainees; + return this; + } + + public TeamCreate addTraineesItem(String traineesItem) { + if (this.trainees == null) { + this.trainees = new ArrayList<>(); + } + this.trainees.add(traineesItem); + return this; + } + + /** + * Get trainees + * @return trainees + */ + + @Schema(name = "trainees", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("trainees") + public List getTrainees() { + return trainees; + } + + public void setTrainees(List trainees) { + this.trainees = trainees; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamCreate teamCreate = (TeamCreate) o; + return Objects.equals(this.name, teamCreate.name) && + Objects.equals(this.description, teamCreate.description) && + Objects.equals(this.address, teamCreate.address) && + Objects.equals(this.sport, teamCreate.sport) && + Objects.equals(this.trainers, teamCreate.trainers) && + Objects.equals(this.trainees, teamCreate.trainees); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, address, sport, trainers, trainees); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamCreate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" sport: ").append(toIndentedString(sport)).append("\n"); + sb.append(" trainers: ").append(toIndentedString(trainers)).append("\n"); + sb.append(" trainees: ").append(toIndentedString(trainees)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/TeamPartialUpdate.java b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/TeamPartialUpdate.java new file mode 100644 index 0000000..fe880d3 --- /dev/null +++ b/services/spring-organization/src/generated/java/tum/devoops/organizationservice/model/TeamPartialUpdate.java @@ -0,0 +1,225 @@ +package tum.devoops.organizationservice.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.springframework.lang.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * Data transfer object for partially updating an existing Team (PATCH operation). + */ + +@Schema(name = "TeamPartialUpdate", description = "Data transfer object for partially updating an existing Team (PATCH operation).") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.14.0") +public class TeamPartialUpdate { + + private @Nullable String name; + + private @Nullable String description; + + private @Nullable String address; + + private @Nullable String sport; + + @Valid + private List trainers = new ArrayList<>(); + + @Valid + private List trainees = new ArrayList<>(); + + public TeamPartialUpdate name(@Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + + @Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("name") + public @Nullable String getName() { + return name; + } + + public void setName(@Nullable String name) { + this.name = name; + } + + public TeamPartialUpdate description(@Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + + @Schema(name = "description", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("description") + public @Nullable String getDescription() { + return description; + } + + public void setDescription(@Nullable String description) { + this.description = description; + } + + public TeamPartialUpdate address(@Nullable String address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + + @Schema(name = "address", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("address") + public @Nullable String getAddress() { + return address; + } + + public void setAddress(@Nullable String address) { + this.address = address; + } + + public TeamPartialUpdate sport(@Nullable String sport) { + this.sport = sport; + return this; + } + + /** + * Get sport + * @return sport + */ + + @Schema(name = "sport", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("sport") + public @Nullable String getSport() { + return sport; + } + + public void setSport(@Nullable String sport) { + this.sport = sport; + } + + public TeamPartialUpdate trainers(List trainers) { + this.trainers = trainers; + return this; + } + + public TeamPartialUpdate addTrainersItem(String trainersItem) { + if (this.trainers == null) { + this.trainers = new ArrayList<>(); + } + this.trainers.add(trainersItem); + return this; + } + + /** + * Get trainers + * @return trainers + */ + + @Schema(name = "trainers", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("trainers") + public List getTrainers() { + return trainers; + } + + public void setTrainers(List trainers) { + this.trainers = trainers; + } + + public TeamPartialUpdate trainees(List trainees) { + this.trainees = trainees; + return this; + } + + public TeamPartialUpdate addTraineesItem(String traineesItem) { + if (this.trainees == null) { + this.trainees = new ArrayList<>(); + } + this.trainees.add(traineesItem); + return this; + } + + /** + * Get trainees + * @return trainees + */ + + @Schema(name = "trainees", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("trainees") + public List getTrainees() { + return trainees; + } + + public void setTrainees(List trainees) { + this.trainees = trainees; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TeamPartialUpdate teamPartialUpdate = (TeamPartialUpdate) o; + return Objects.equals(this.name, teamPartialUpdate.name) && + Objects.equals(this.description, teamPartialUpdate.description) && + Objects.equals(this.address, teamPartialUpdate.address) && + Objects.equals(this.sport, teamPartialUpdate.sport) && + Objects.equals(this.trainers, teamPartialUpdate.trainers) && + Objects.equals(this.trainees, teamPartialUpdate.trainees); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, address, sport, trainers, trainees); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamPartialUpdate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" sport: ").append(toIndentedString(sport)).append("\n"); + sb.append(" trainers: ").append(toIndentedString(trainers)).append("\n"); + sb.append(" trainees: ").append(toIndentedString(trainees)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/web-client/eslint.config.js b/web-client/eslint.config.js index ef614d2..198223d 100644 --- a/web-client/eslint.config.js +++ b/web-client/eslint.config.js @@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint' import { defineConfig, globalIgnores } from 'eslint/config' export default defineConfig([ - globalIgnores(['dist']), + globalIgnores(['dist', 'src/api.ts']), { files: ['**/*.{ts,tsx}'], extends: [ diff --git a/web-client/package.json b/web-client/package.json index bf17149..5372315 100644 --- a/web-client/package.json +++ b/web-client/package.json @@ -5,7 +5,7 @@ "type": "module", "packageManager": "pnpm@9.15.9", "engines": { - "node": ">=24 <25" + "node": ">=22 <25" }, "scripts": { "dev": "vite", @@ -42,6 +42,7 @@ "typescript": "~6.0.2", "typescript-eslint": "^8.59.2", "vite": "^8.0.12", - "vitest": "^2.1.9" + "vitest": "^2.1.9", + "openapi-typescript": "^7.8.0" } } diff --git a/web-client/pnpm-lock.yaml b/web-client/pnpm-lock.yaml index 948bde5..ea2b315 100644 --- a/web-client/pnpm-lock.yaml +++ b/web-client/pnpm-lock.yaml @@ -63,6 +63,9 @@ importers: jsdom: specifier: ^25.0.1 version: 25.0.1 + openapi-typescript: + specifier: ^7.8.0 + version: 7.13.0(typescript@6.0.3) typescript: specifier: ~6.0.2 version: 6.0.3 @@ -410,6 +413,16 @@ packages: '@oxc-project/types@0.132.0': resolution: {integrity: sha512-FESMOxil5Se014ui/Eq8fT5uHJo6nIRwH0PfJrZJXs6Gek3ZVFOrpUv3YIZT20m+extU98Hg1Ym72U58rlsxUQ==} + '@redocly/ajv@8.11.2': + resolution: {integrity: sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==} + + '@redocly/config@0.22.0': + resolution: {integrity: sha512-gAy93Ddo01Z3bHuVdPWfCwzgfaYgMdaZPcfL7JZ7hWJoK9V0lXDbigTWkhiPFAaLWzbOJ+kbUQG1+XwIm0KRGQ==} + + '@redocly/openapi-core@1.34.15': + resolution: {integrity: sha512-HAwCnNyKcs5XGQqms+9t7OdAPM/5TDstmhF+0i7tdCFato2QKuYIlyWETwkXd8c5zbltr1oB+6y9NTeQLr2d6Q==} + engines: {node: '>=18.17.0', npm: '>=9.5.0'} + '@rolldown/binding-android-arm64@1.0.1': resolution: {integrity: sha512-fJI3I0r3C3Oj/zdBCpaCmBRZYf07xpaq4yCfDDoSFm+beWNzbIl26puW8RraUdugoJw/95zerNOn6jasAhzSmg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -954,6 +967,13 @@ packages: ajv@6.15.0: resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} + ansi-colors@4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} + engines: {node: '>=6'} + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + assertion-error@2.0.1: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} @@ -964,6 +984,9 @@ packages: axios@1.16.1: resolution: {integrity: sha512-caYkukvroVPO8KrzuJEb50Hm07KwfBZPEC3VeFHTsqWHvKTsy54hjJz9BS/cdaypROE2rH6xvm9mHX4fgWkr3A==} + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + balanced-match@4.0.4: resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} engines: {node: 18 || 20 || >=22} @@ -973,6 +996,9 @@ packages: engines: {node: '>=6.0.0'} hasBin: true + brace-expansion@2.1.1: + resolution: {integrity: sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==} + brace-expansion@5.0.6: resolution: {integrity: sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==} engines: {node: 18 || 20 || >=22} @@ -997,10 +1023,16 @@ packages: resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} engines: {node: '>=18'} + change-case@5.4.4: + resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} + check-error@2.1.3: resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==} engines: {node: '>= 16'} + colorette@1.4.0: + resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==} + combined-stream@1.0.8: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} @@ -1292,6 +1324,10 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} + index-to-position@1.2.0: + resolution: {integrity: sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==} + engines: {node: '>=18'} + is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -1310,9 +1346,17 @@ packages: resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==} hasBin: true + js-levenshtein@1.1.6: + resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==} + engines: {node: '>=0.10.0'} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + js-yaml@4.1.1: + resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} + hasBin: true + jsdom@25.0.1: resolution: {integrity: sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==} engines: {node: '>=18'} @@ -1333,6 +1377,9 @@ packages: json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} @@ -1450,6 +1497,10 @@ packages: resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==} engines: {node: 18 || 20 || >=22} + minimatch@5.1.9: + resolution: {integrity: sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==} + engines: {node: '>=10'} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -1467,6 +1518,12 @@ packages: nwsapi@2.2.23: resolution: {integrity: sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ==} + openapi-typescript@7.13.0: + resolution: {integrity: sha512-EFP392gcqXS7ntPvbhBzbF8TyBA+baIYEm791Hy5YkjDYKTnk/Tn5OQeKm5BIZvJihpp8Zzr4hzx0Irde1LNGQ==} + hasBin: true + peerDependencies: + typescript: ^5.x + optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -1479,6 +1536,10 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} + parse-json@8.3.0: + resolution: {integrity: sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==} + engines: {node: '>=18'} + parse5@7.3.0: resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==} @@ -1504,6 +1565,10 @@ packages: resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} engines: {node: '>=12'} + pluralize@8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + postcss@8.5.14: resolution: {integrity: sha512-SoSL4+OSEtR99LHFZQiJLkT59C5B1amGO1NzTwj7TT1qCUgUO6hxOvzkOYxD+vMrXBM3XJIKzokoERdqQq/Zmg==} engines: {node: ^10 || ^12 || >=14} @@ -1546,6 +1611,10 @@ packages: resolution: {integrity: sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==} engines: {node: '>=0.10.0'} + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + rolldown@1.0.1: resolution: {integrity: sha512-X0KQHljNnEkWNqqiz9zJrGunh1B0HgOxLXvnFpCOcadzcy5qohZ3tqMEUg00vncoRovXuK3ZqCT9KnnKzoInFQ==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1610,6 +1679,10 @@ packages: std-env@3.10.0: resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + supports-color@10.2.2: + resolution: {integrity: sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==} + engines: {node: '>=18'} + symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} @@ -1670,6 +1743,10 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} + engines: {node: '>=16'} + typescript-eslint@8.59.3: resolution: {integrity: sha512-KgusgyDgG4LI8Ih/sWaCtZ06tckLAS5CvT5A4D1Q7bYVoAAyzwiZvE4BmwDHkhRVkvhRBepKeASoFzQetha7Fg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1691,6 +1768,9 @@ packages: peerDependencies: browserslist: '>= 4.21.0' + uri-js-replace@1.0.1: + resolution: {integrity: sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==} + uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -1855,6 +1935,13 @@ packages: yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + yaml-ast-parser@0.0.43: + resolution: {integrity: sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==} + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -1899,7 +1986,7 @@ snapshots: '@babel/types': 7.29.0 '@jridgewell/remapping': 2.3.5 convert-source-map: 2.0.0 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -1969,7 +2056,7 @@ snapshots: '@babel/parser': 7.29.3 '@babel/template': 7.28.6 '@babel/types': 7.29.0 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -2093,7 +2180,7 @@ snapshots: '@eslint/config-array@0.23.5': dependencies: '@eslint/object-schema': 3.0.5 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) minimatch: 10.2.5 transitivePeerDependencies: - supports-color @@ -2163,6 +2250,29 @@ snapshots: '@oxc-project/types@0.132.0': {} + '@redocly/ajv@8.11.2': + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js-replace: 1.0.1 + + '@redocly/config@0.22.0': {} + + '@redocly/openapi-core@1.34.15(supports-color@10.2.2)': + dependencies: + '@redocly/ajv': 8.11.2 + '@redocly/config': 0.22.0 + colorette: 1.4.0 + https-proxy-agent: 7.0.6(supports-color@10.2.2) + js-levenshtein: 1.1.6 + js-yaml: 4.1.1 + minimatch: 5.1.9 + pluralize: 8.0.0 + yaml-ast-parser: 0.0.43 + transitivePeerDependencies: + - supports-color + '@rolldown/binding-android-arm64@1.0.1': optional: true @@ -2453,7 +2563,7 @@ snapshots: '@typescript-eslint/types': 8.59.3 '@typescript-eslint/typescript-estree': 8.59.3(typescript@6.0.3) '@typescript-eslint/visitor-keys': 8.59.3 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) eslint: 10.4.0(jiti@2.7.0) typescript: 6.0.3 transitivePeerDependencies: @@ -2463,7 +2573,7 @@ snapshots: dependencies: '@typescript-eslint/tsconfig-utils': 8.59.3(typescript@6.0.3) '@typescript-eslint/types': 8.59.3 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) typescript: 6.0.3 transitivePeerDependencies: - supports-color @@ -2482,7 +2592,7 @@ snapshots: '@typescript-eslint/types': 8.59.3 '@typescript-eslint/typescript-estree': 8.59.3(typescript@6.0.3) '@typescript-eslint/utils': 8.59.3(eslint@10.4.0(jiti@2.7.0))(typescript@6.0.3) - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) eslint: 10.4.0(jiti@2.7.0) ts-api-utils: 2.5.0(typescript@6.0.3) typescript: 6.0.3 @@ -2497,7 +2607,7 @@ snapshots: '@typescript-eslint/tsconfig-utils': 8.59.3(typescript@6.0.3) '@typescript-eslint/types': 8.59.3 '@typescript-eslint/visitor-keys': 8.59.3 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) minimatch: 10.2.5 semver: 7.8.0 tinyglobby: 0.2.16 @@ -2575,7 +2685,7 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -2588,6 +2698,10 @@ snapshots: json-schema-traverse: 0.4.1 uri-js: 4.4.1 + ansi-colors@4.1.3: {} + + argparse@2.0.1: {} + assertion-error@2.0.1: {} asynckit@0.4.0: {} @@ -2602,10 +2716,16 @@ snapshots: - debug - supports-color + balanced-match@1.0.2: {} + balanced-match@4.0.4: {} baseline-browser-mapping@2.10.29: {} + brace-expansion@2.1.1: + dependencies: + balanced-match: 1.0.2 + brace-expansion@5.0.6: dependencies: balanced-match: 4.0.4 @@ -2635,8 +2755,12 @@ snapshots: loupe: 3.2.1 pathval: 2.0.1 + change-case@5.4.4: {} + check-error@2.1.3: {} + colorette@1.4.0: {} + combined-stream@1.0.8: dependencies: delayed-stream: 1.0.0 @@ -2663,9 +2787,11 @@ snapshots: whatwg-mimetype: 4.0.0 whatwg-url: 14.2.0 - debug@4.4.3: + debug@4.4.3(supports-color@10.2.2): dependencies: ms: 2.1.3 + optionalDependencies: + supports-color: 10.2.2 decimal.js@10.6.0: {} @@ -2779,7 +2905,7 @@ snapshots: '@types/estree': 1.0.9 ajv: 6.15.0 cross-spawn: 7.0.6 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) escape-string-regexp: 4.0.0 eslint-scope: 9.1.2 eslint-visitor-keys: 5.0.1 @@ -2920,21 +3046,21 @@ snapshots: http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.4 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color - https-proxy-agent@7.0.6: + https-proxy-agent@7.0.6(supports-color@10.2.2): dependencies: agent-base: 7.1.4 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: - supports-color @@ -2948,6 +3074,8 @@ snapshots: imurmurhash@0.1.4: {} + index-to-position@1.2.0: {} + is-extglob@2.1.1: {} is-glob@4.0.3: @@ -2960,8 +3088,14 @@ snapshots: jiti@2.7.0: {} + js-levenshtein@1.1.6: {} + js-tokens@4.0.0: {} + js-yaml@4.1.1: + dependencies: + argparse: 2.0.1 + jsdom@25.0.1: dependencies: cssstyle: 4.6.0 @@ -2970,7 +3104,7 @@ snapshots: form-data: 4.0.5 html-encoding-sniffer: 4.0.0 http-proxy-agent: 7.0.2 - https-proxy-agent: 7.0.6 + https-proxy-agent: 7.0.6(supports-color@10.2.2) is-potential-custom-element-name: 1.0.1 nwsapi: 2.2.23 parse5: 7.3.0 @@ -2996,6 +3130,8 @@ snapshots: json-schema-traverse@0.4.1: {} + json-schema-traverse@1.0.0: {} + json-stable-stringify-without-jsonify@1.0.1: {} json5@2.2.3: {} @@ -3086,6 +3222,10 @@ snapshots: dependencies: brace-expansion: 5.0.6 + minimatch@5.1.9: + dependencies: + brace-expansion: 2.1.1 + ms@2.1.3: {} nanoid@3.3.12: {} @@ -3096,6 +3236,16 @@ snapshots: nwsapi@2.2.23: {} + openapi-typescript@7.13.0(typescript@6.0.3): + dependencies: + '@redocly/openapi-core': 1.34.15(supports-color@10.2.2) + ansi-colors: 4.1.3 + change-case: 5.4.4 + parse-json: 8.3.0 + supports-color: 10.2.2 + typescript: 6.0.3 + yargs-parser: 21.1.1 + optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -3113,6 +3263,12 @@ snapshots: dependencies: p-limit: 3.1.0 + parse-json@8.3.0: + dependencies: + '@babel/code-frame': 7.29.0 + index-to-position: 1.2.0 + type-fest: 4.41.0 + parse5@7.3.0: dependencies: entities: 6.0.1 @@ -3129,6 +3285,8 @@ snapshots: picomatch@4.0.4: {} + pluralize@8.0.0: {} + postcss@8.5.14: dependencies: nanoid: 3.3.12 @@ -3162,6 +3320,8 @@ snapshots: react@19.2.6: {} + require-from-string@2.0.2: {} + rolldown@1.0.1: dependencies: '@oxc-project/types': 0.130.0 @@ -3267,6 +3427,8 @@ snapshots: std-env@3.10.0: {} + supports-color@10.2.2: {} + symbol-tree@3.2.4: {} tailwindcss@4.3.0: {} @@ -3313,6 +3475,8 @@ snapshots: dependencies: prelude-ls: 1.2.1 + type-fest@4.41.0: {} + typescript-eslint@8.59.3(eslint@10.4.0(jiti@2.7.0))(typescript@6.0.3): dependencies: '@typescript-eslint/eslint-plugin': 8.59.3(@typescript-eslint/parser@8.59.3(eslint@10.4.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.4.0(jiti@2.7.0))(typescript@6.0.3) @@ -3334,6 +3498,8 @@ snapshots: escalade: 3.2.0 picocolors: 1.1.1 + uri-js-replace@1.0.1: {} + uri-js@4.4.1: dependencies: punycode: 2.3.1 @@ -3341,7 +3507,7 @@ snapshots: vite-node@2.1.9(@types/node@24.12.4)(lightningcss@1.32.0): dependencies: cac: 6.7.14 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) es-module-lexer: 1.7.0 pathe: 1.1.2 vite: 5.4.21(@types/node@24.12.4)(lightningcss@1.32.0) @@ -3388,7 +3554,7 @@ snapshots: '@vitest/spy': 2.1.9 '@vitest/utils': 2.1.9 chai: 5.3.3 - debug: 4.4.3 + debug: 4.4.3(supports-color@10.2.2) expect-type: 1.3.0 magic-string: 0.30.21 pathe: 1.1.2 @@ -3450,6 +3616,10 @@ snapshots: yallist@3.1.1: {} + yaml-ast-parser@0.0.43: {} + + yargs-parser@21.1.1: {} + yocto-queue@0.1.0: {} zod-validation-error@4.0.2(zod@4.4.3): diff --git a/web-client/src/api.ts b/web-client/src/api.ts new file mode 100644 index 0000000..878ff91 --- /dev/null +++ b/web-client/src/api.ts @@ -0,0 +1,1554 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/organization/sports": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get all sports + * @description Returns a list of all sports registered in the organization. If the caller is not an admin, only sports that the caller is a member of will be returned. + */ + get: operations["getAllSports"]; + put?: never; + /** + * Create sport + * @description Creates a new sport in the organization. Only admins are allowed to create new sports. + */ + post: operations["createSport"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/organization/sports/{sport_name}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get sport */ + get: operations["getSport"]; + put?: never; + post?: never; + /** Delete sport */ + delete: operations["deleteSport"]; + options?: never; + head?: never; + /** Update sport */ + patch: operations["updateSport"]; + trace?: never; + }; + "/organization/teams": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all teams */ + get: operations["getAllTeams"]; + put?: never; + /** Create team */ + post: operations["createTeam"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/organization/teams/{team_id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get team */ + get: operations["getTeam"]; + put?: never; + post?: never; + /** Delete team */ + delete: operations["deleteTeam"]; + options?: never; + head?: never; + /** Update team */ + patch: operations["updateTeam"]; + trace?: never; + }; + "/members": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all members */ + get: operations["getAllMembers"]; + put?: never; + /** Create member */ + post: operations["createMember"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/members/{member_id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get member details */ + get: operations["getMemberDetails"]; + put?: never; + post?: never; + /** Delete member */ + delete: operations["deleteMember"]; + options?: never; + head?: never; + /** Update member details */ + patch: operations["updateMemberDetails"]; + trace?: never; + }; + "/events": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all events */ + get: operations["getAllEvents"]; + put?: never; + /** Create event */ + post: operations["createEvent"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/events/{event_id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get event details */ + get: operations["getEventDetails"]; + put?: never; + post?: never; + /** Delete event */ + delete: operations["deleteEvent"]; + options?: never; + head?: never; + /** Update event details */ + patch: operations["updateEventDetails"]; + trace?: never; + }; + "/feedback": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all feedback */ + get: operations["getAllFeedback"]; + put?: never; + /** Create feedback */ + post: operations["createFeedback"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/feedback/{feedback_id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get feedback details */ + get: operations["getFeedbackDetails"]; + put?: never; + post?: never; + /** Delete feedback */ + delete: operations["deleteFeedback"]; + options?: never; + head?: never; + /** Update feedback details */ + patch: operations["updateFeedbackDetails"]; + trace?: never; + }; + "/finance/balances": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all balances */ + get: operations["getAllBalances"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/finance/balances/{member_id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get member balance */ + get: operations["getMemberBalance"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/finance/transactions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get all transactions */ + get: operations["getAllTransactions"]; + put?: never; + /** Create transaction */ + post: operations["createTransaction"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/finance/transactions/{transaction_id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get transaction */ + get: operations["getTransaction"]; + put?: never; + post?: never; + /** Delete transaction */ + delete: operations["deleteTransaction"]; + options?: never; + head?: never; + /** Update transaction */ + patch: operations["updateTransaction"]; + trace?: never; + }; + "/letters/mail": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Send mail */ + post: operations["sendMail"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/letters/pdf": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Get pdf */ + post: operations["getPdf"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/helper/report/{member_id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Generate report */ + get: operations["generateReport"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + ErrorResponse: { + message: string; + }; + BadRequestResponse: { + message: string; + errors?: components["schemas"]["ErrorResponse"][]; + }; + /** @description The object representation of a Sport within the organization. */ + Sport: { + name: string; + description: string; + /** Format: date */ + created_at: string; + directors: string[]; + }; + /** @description Data transfer object for creating a new Sport. */ + SportCreate: { + name: string; + description?: string; + directors?: string[]; + }; + /** @description Data transfer object for partially updating an existing Sport (PATCH operation). */ + SportPartialUpdate: { + name?: string; + description?: string; + directors?: string[]; + }; + /** @description The object representation of a Team that belongs to a specific Sport. */ + Team: { + /** Format: uuid */ + id: string; + name: string; + description: string; + /** Format: date */ + created_at: string; + address: string; + sport: string; + trainers: string[]; + trainees: string[]; + }; + /** @description Data transfer object for creating a new Team. */ + TeamCreate: { + name: string; + description?: string; + address?: string; + sport: string; + trainers?: string[]; + trainees?: string[]; + }; + /** @description Data transfer object for partially updating an existing Team (PATCH operation). */ + TeamPartialUpdate: { + name?: string; + description?: string; + address?: string; + sport?: string; + trainers?: string[]; + trainees?: string[]; + }; + /** @description The object representation of a Member. All users are represented as a member. */ + Member: { + /** Format: uuid */ + id: string; + first_name: string; + last_name: string; + email: string; + /** Format: date */ + birthday: string; + phone_number: string; + address: string; + /** Format: date */ + joining_date: string; + information: string; + }; + /** @description A simplified representation of a Member, typically used in list views. */ + MemberSummary: { + /** Format: uuid */ + id: string; + first_name: string; + last_name: string; + email: string; + }; + /** @description Data transfer object for partially updating an existing Member (PATCH operation). */ + MemberPartialUpdate: { + first_name?: string; + last_name?: string; + email?: string; + /** Format: date */ + birthday?: string; + phone_number?: string; + address?: string; + information?: string; + }; + /** @description Data transfer object for creating a new Member. */ + MemberCreate: { + first_name: string; + last_name: string; + email?: string; + /** Format: date */ + birthday?: string; + phone_number?: string; + address?: string; + information?: string; + }; + /** @description The object representation of an Event (e.g., a training session or a match). */ + Event: { + /** Format: uuid */ + id: string; + name: string; + description: string; + /** Format: date-time */ + start_time: string; + /** Format: date-time */ + end_time: string; + attendees?: string[]; + /** @description Names of the sports associated with this event. */ + sports_linked?: string[]; + /** @description IDs of the teams associated with this event. */ + teams_linked?: string[]; + creator: string; + }; + /** @description A simplified representation of a Event, typically used in list views. */ + EventSummary: { + /** Format: uuid */ + id: string; + name: string; + /** Format: date-time */ + start_time: string; + /** Format: date-time */ + end_time: string; + }; + /** @description Data transfer object for partially updating an existing Event (PATCH operation). */ + EventPartialUpdate: { + name?: string; + description?: string; + /** Format: date-time */ + start_time?: string; + /** Format: date-time */ + end_time?: string; + attendees?: string[]; + sports_linked?: string[]; + teams_linked?: string[]; + }; + /** @description Data transfer object for creating a new Event. */ + EventCreate: { + name: string; + description?: string; + /** Format: date-time */ + start_time: string; + /** Format: date-time */ + end_time: string; + attendees?: string[]; + sports_linked?: string[]; + teams_linked?: string[]; + }; + /** @description The object representation of Feedback, which is associated with a specific Event and Member. */ + Feedback: { + /** Format: uuid */ + id: string; + event: string; + member: string; + creator: string; + /** Format: date-time */ + created_at: string; + feedback: string; + }; + /** @description A simplified representation of a Feedback, typically used in list views. */ + FeedbackSummary: { + /** Format: uuid */ + id: string; + event: string; + member: string; + creator: string; + /** Format: date-time */ + created_at: string; + }; + /** @description Data transfer object for partially updating an existing Feedback (PATCH operation). */ + FeedbackPartialUpdate: { + event?: string; + member?: string; + feedback?: string; + }; + /** @description Data transfer object for creating a new Feedback. */ + FeedbackCreate: { + event: string; + member: string; + feedback: string; + }; + /** @description The object representation of a Transaction, which includes details such as the member, creator, amount, and timestamps. */ + Transaction: { + /** Format: uuid */ + id: string; + member: string; + creator: string; + amount_cents: number; + /** Format: date-time */ + created_at: string; + title: string; + description: string; + }; + /** @description Data transfer object for partially updating an existing Transaction (PATCH operation). */ + TransactionPartialUpdate: { + member?: string; + amount_cents?: number; + title?: string; + description?: string; + }; + /** @description Data transfer object for creating a new Transaction. */ + TransactionCreate: { + member: string; + amount_cents: number; + title: string; + description?: string; + }; + /** @description The object representation of a Member's Balance, which includes the total balance in cents. */ + Balance: { + member: string; + balance_cents: number; + }; + }; + responses: { + /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */ + InternalServerError: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description The server cannot find the requested resource. The endpoint may be invalid or the resource may no longer exist. */ + NotFound: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description The server could not understand the request due to invalid syntax. The client should modify the request and try again. */ + BadRequest: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BadRequestResponse"]; + }; + }; + /** @description The request could not be completed due to a conflict with the current state of the resource. Resolve the conflict and try again. */ + Conflict: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description The request was successful, but there is no content to return in the response. */ + NoContent: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Authentication is required to access the requested resource. The client must include the appropriate credentials. */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description The server understood the request, but refuses to authorize it. Ensure the client has appropriate permissions. */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + parameters: { + sport_name: string; + team_id: string; + member_id: string; + event_id: string; + feedback_id: string; + transaction_id: string; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + getAllSports: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Sport"][]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + createSport: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The request body for creating a new sport. */ + requestBody: { + content: { + "application/json": components["schemas"]["SportCreate"]; + }; + }; + responses: { + /** @description The request was successful, and a new resource was created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Sport"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getSport: { + parameters: { + query?: never; + header?: never; + path: { + sport_name: components["parameters"]["sport_name"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Sport"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + deleteSport: { + parameters: { + query?: never; + header?: never; + path: { + sport_name: components["parameters"]["sport_name"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, but there is no content to return in the response. */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + updateSport: { + parameters: { + query?: never; + header?: never; + path: { + sport_name: components["parameters"]["sport_name"]; + }; + cookie?: never; + }; + /** @description The request body for partially updating a sport. */ + requestBody: { + content: { + "application/json": components["schemas"]["SportPartialUpdate"]; + }; + }; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Sport"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getAllTeams: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Team"][]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + createTeam: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The request body for creating a new team. */ + requestBody: { + content: { + "application/json": components["schemas"]["TeamCreate"]; + }; + }; + responses: { + /** @description The request was successful, and a new resource was created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Team"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getTeam: { + parameters: { + query?: never; + header?: never; + path: { + team_id: components["parameters"]["team_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Team"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + deleteTeam: { + parameters: { + query?: never; + header?: never; + path: { + team_id: components["parameters"]["team_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, but there is no content to return in the response. */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + updateTeam: { + parameters: { + query?: never; + header?: never; + path: { + team_id: components["parameters"]["team_id"]; + }; + cookie?: never; + }; + /** @description The request body for partially updating a team. */ + requestBody: { + content: { + "application/json": components["schemas"]["TeamPartialUpdate"]; + }; + }; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Team"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getAllMembers: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MemberSummary"][]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + createMember: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The request body for creating a new member. */ + requestBody: { + content: { + "application/json": components["schemas"]["MemberCreate"]; + }; + }; + responses: { + /** @description The request was successful, and a new resource was created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Member"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getMemberDetails: { + parameters: { + query?: never; + header?: never; + path: { + member_id: components["parameters"]["member_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Member"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + deleteMember: { + parameters: { + query?: never; + header?: never; + path: { + member_id: components["parameters"]["member_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, but there is no content to return in the response. */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + updateMemberDetails: { + parameters: { + query?: never; + header?: never; + path: { + member_id: components["parameters"]["member_id"]; + }; + cookie?: never; + }; + /** @description The request body for partially updating a member. */ + requestBody: { + content: { + "application/json": components["schemas"]["MemberPartialUpdate"]; + }; + }; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Member"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getAllEvents: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["EventSummary"][]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + createEvent: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The request body for creating a new event. */ + requestBody: { + content: { + "application/json": components["schemas"]["EventCreate"]; + }; + }; + responses: { + /** @description The request was successful, and a new resource was created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Event"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getEventDetails: { + parameters: { + query?: never; + header?: never; + path: { + event_id: components["parameters"]["event_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Event"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + deleteEvent: { + parameters: { + query?: never; + header?: never; + path: { + event_id: components["parameters"]["event_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, but there is no content to return in the response. */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + updateEventDetails: { + parameters: { + query?: never; + header?: never; + path: { + event_id: components["parameters"]["event_id"]; + }; + cookie?: never; + }; + /** @description The request body for partially updating an event. */ + requestBody: { + content: { + "application/json": components["schemas"]["EventPartialUpdate"]; + }; + }; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Event"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getAllFeedback: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["FeedbackSummary"][]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + createFeedback: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The request body for creating new feedback. */ + requestBody: { + content: { + "application/json": components["schemas"]["FeedbackCreate"]; + }; + }; + responses: { + /** @description The request was successful, and a new resource was created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Feedback"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getFeedbackDetails: { + parameters: { + query?: never; + header?: never; + path: { + feedback_id: components["parameters"]["feedback_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Feedback"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + deleteFeedback: { + parameters: { + query?: never; + header?: never; + path: { + feedback_id: components["parameters"]["feedback_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, but there is no content to return in the response. */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + updateFeedbackDetails: { + parameters: { + query?: never; + header?: never; + path: { + feedback_id: components["parameters"]["feedback_id"]; + }; + cookie?: never; + }; + /** @description The request body for partially updating a specific feedback. */ + requestBody: { + content: { + "application/json": components["schemas"]["FeedbackPartialUpdate"]; + }; + }; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Feedback"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getAllBalances: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Balance"][]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getMemberBalance: { + parameters: { + query?: never; + header?: never; + path: { + member_id: components["parameters"]["member_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Balance"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getAllTransactions: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Transaction"][]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + createTransaction: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The request body for creating a new transaction. */ + requestBody: { + content: { + "application/json": components["schemas"]["TransactionCreate"]; + }; + }; + responses: { + /** @description The request was successful, and a new resource was created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Transaction"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getTransaction: { + parameters: { + query?: never; + header?: never; + path: { + transaction_id: components["parameters"]["transaction_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Transaction"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + deleteTransaction: { + parameters: { + query?: never; + header?: never; + path: { + transaction_id: components["parameters"]["transaction_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, but there is no content to return in the response. */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + updateTransaction: { + parameters: { + query?: never; + header?: never; + path: { + transaction_id: components["parameters"]["transaction_id"]; + }; + cookie?: never; + }; + /** @description The request body for partially updating a transaction. */ + requestBody: { + content: { + "application/json": components["schemas"]["TransactionPartialUpdate"]; + }; + }; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Transaction"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + sendMail: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The request body for sending mail. It will be used in the email content. It must be a valid HTML string using the template format with placeholders for dynamic content. */ + requestBody: { + content: { + "text/html": string; + }; + }; + responses: { + 204: components["responses"]["NoContent"]; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + getPdf: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The request body for generating a pdf from a template. It must be a valid HTML string using the template format with placeholders for dynamic content. */ + requestBody: { + content: { + "text/html": string; + }; + }; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/pdf": string; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; + generateReport: { + parameters: { + query?: never; + header?: never; + path: { + member_id: components["parameters"]["member_id"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The request was successful, and the server has returned the requested resource in the response body. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": string; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 500: components["responses"]["InternalServerError"]; + }; + }; +} diff --git a/web-client/src/app/router/AppRouter.tsx b/web-client/src/app/router/AppRouter.tsx index dfd26e3..8f4d482 100644 --- a/web-client/src/app/router/AppRouter.tsx +++ b/web-client/src/app/router/AppRouter.tsx @@ -1,8 +1,10 @@ import { NavLink, Navigate, Route, Routes } from 'react-router-dom' import { useEffect, useState } from 'react' import { getEventsHello } from '@/features/events/api' +import { getFeedbackHello } from '@/features/feedback/api' import { getLettersHello } from '@/features/letters/api' import { getMembersHello } from '@/features/members/api' +import { getOrganizationHello } from '@/features/organization/api' import { getPaymentsHello } from '@/features/payments/api' type ServicePlaceholderPageProps = { @@ -70,6 +72,8 @@ export function AppRouter() { Events Payments Letters + Organization + Feedback @@ -93,6 +97,14 @@ export function AppRouter() { path="/letters" element={} /> + } + /> + } + /> diff --git a/web-client/src/features/events/api.ts b/web-client/src/features/events/api.ts index 09b7d33..e308447 100644 --- a/web-client/src/features/events/api.ts +++ b/web-client/src/features/events/api.ts @@ -1,14 +1,6 @@ -import type { HelloResponse } from '@/features/events/types' - -function mockEventsHello(): Promise { - return Promise.resolve({ - service: 'event-service', - message: 'Hello from event-service (mock placeholder)', - }) -} +import { eventsClient } from '@/features/events/client' export async function getEventsHello(): Promise { - // TODO: Replace mock with real endpoint when backend is available. - const data = await mockEventsHello() - return `${data.service}: ${data.message}` + const res = await eventsClient.get('/hello') + return res.data } diff --git a/web-client/src/features/events/client.ts b/web-client/src/features/events/client.ts new file mode 100644 index 0000000..b9f66de --- /dev/null +++ b/web-client/src/features/events/client.ts @@ -0,0 +1,5 @@ +import axios from 'axios' + +export const eventsClient = axios.create({ + baseURL: '/api/v1/events', +}) diff --git a/web-client/src/features/events/types.ts b/web-client/src/features/events/types.ts deleted file mode 100644 index e1abb1a..0000000 --- a/web-client/src/features/events/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type HelloResponse = { - service: string - message: string -} diff --git a/web-client/src/features/feedback/api.ts b/web-client/src/features/feedback/api.ts new file mode 100644 index 0000000..80b939f --- /dev/null +++ b/web-client/src/features/feedback/api.ts @@ -0,0 +1,6 @@ +import { feedbackClient } from '@/features/feedback/client' + +export async function getFeedbackHello(): Promise { + const res = await feedbackClient.get('/hello') + return res.data +} diff --git a/web-client/src/features/feedback/client.ts b/web-client/src/features/feedback/client.ts new file mode 100644 index 0000000..4a77acc --- /dev/null +++ b/web-client/src/features/feedback/client.ts @@ -0,0 +1,5 @@ +import axios from 'axios' + +export const feedbackClient = axios.create({ + baseURL: '/api/v1/feedback', +}) diff --git a/web-client/src/features/letters/api.ts b/web-client/src/features/letters/api.ts index 831af2a..c6f1b69 100644 --- a/web-client/src/features/letters/api.ts +++ b/web-client/src/features/letters/api.ts @@ -1,14 +1,6 @@ -import type { HelloResponse } from '@/features/letters/types' - -function mockLettersHello(): Promise { - return Promise.resolve({ - service: 'letter-service', - message: 'Hello from letter-service (mock placeholder)', - }) -} +import { lettersClient } from '@/features/letters/client' export async function getLettersHello(): Promise { - // TODO: Replace mock with real endpoint when backend is available. - const data = await mockLettersHello() - return `${data.service}: ${data.message}` + const res = await lettersClient.get('/hello') + return res.data } diff --git a/web-client/src/features/letters/client.ts b/web-client/src/features/letters/client.ts new file mode 100644 index 0000000..d977eaa --- /dev/null +++ b/web-client/src/features/letters/client.ts @@ -0,0 +1,5 @@ +import axios from 'axios' + +export const lettersClient = axios.create({ + baseURL: '/api/v1/letters', +}) diff --git a/web-client/src/features/letters/types.ts b/web-client/src/features/letters/types.ts deleted file mode 100644 index e1abb1a..0000000 --- a/web-client/src/features/letters/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type HelloResponse = { - service: string - message: string -} diff --git a/web-client/src/features/members/api.ts b/web-client/src/features/members/api.ts index 0e47770..8ccde2c 100644 --- a/web-client/src/features/members/api.ts +++ b/web-client/src/features/members/api.ts @@ -1,14 +1,6 @@ -import type { HelloResponse } from '@/features/members/types' - -function mockMembersHello(): Promise { - return Promise.resolve({ - service: 'member-service', - message: 'Hello from member-service (mock placeholder)', - }) -} +import { membersClient } from '@/features/members/client' export async function getMembersHello(): Promise { - // TODO: Replace mock with real endpoint when backend is available. - const data = await mockMembersHello() - return `${data.service}: ${data.message}` + const res = await membersClient.get('/hello') + return res.data } diff --git a/web-client/src/features/members/client.ts b/web-client/src/features/members/client.ts new file mode 100644 index 0000000..303cb4d --- /dev/null +++ b/web-client/src/features/members/client.ts @@ -0,0 +1,5 @@ +import axios from 'axios' + +export const membersClient = axios.create({ + baseURL: '/api/v1/members', +}) diff --git a/web-client/src/features/members/types.ts b/web-client/src/features/members/types.ts deleted file mode 100644 index e1abb1a..0000000 --- a/web-client/src/features/members/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type HelloResponse = { - service: string - message: string -} diff --git a/web-client/src/features/organization/api.ts b/web-client/src/features/organization/api.ts new file mode 100644 index 0000000..76f6b0e --- /dev/null +++ b/web-client/src/features/organization/api.ts @@ -0,0 +1,6 @@ +import { organizationClient } from '@/features/organization/client' + +export async function getOrganizationHello(): Promise { + const res = await organizationClient.get('/hello') + return res.data +} diff --git a/web-client/src/features/organization/client.ts b/web-client/src/features/organization/client.ts new file mode 100644 index 0000000..7e8f941 --- /dev/null +++ b/web-client/src/features/organization/client.ts @@ -0,0 +1,5 @@ +import axios from 'axios' + +export const organizationClient = axios.create({ + baseURL: '/api/v1/organization', +}) diff --git a/web-client/src/features/payments/api.ts b/web-client/src/features/payments/api.ts index 8dc5323..bb6f870 100644 --- a/web-client/src/features/payments/api.ts +++ b/web-client/src/features/payments/api.ts @@ -1,14 +1,6 @@ -import type { HelloResponse } from '@/features/payments/types' - -function mockPaymentsHello(): Promise { - return Promise.resolve({ - service: 'payment-service', - message: 'Hello from payment-service (mock placeholder)', - }) -} +import { paymentsClient } from '@/features/payments/client' export async function getPaymentsHello(): Promise { - // TODO: Replace mock with real endpoint when backend is available. - const data = await mockPaymentsHello() - return `${data.service}: ${data.message}` + const res = await paymentsClient.get('/hello') + return res.data } diff --git a/web-client/src/features/payments/client.ts b/web-client/src/features/payments/client.ts new file mode 100644 index 0000000..29e2d1a --- /dev/null +++ b/web-client/src/features/payments/client.ts @@ -0,0 +1,5 @@ +import axios from 'axios' + +export const paymentsClient = axios.create({ + baseURL: '/api/v1/finances', +}) diff --git a/web-client/src/features/payments/types.ts b/web-client/src/features/payments/types.ts deleted file mode 100644 index e1abb1a..0000000 --- a/web-client/src/features/payments/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type HelloResponse = { - service: string - message: string -}