diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 288801633..d606408b4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -51,67 +51,7 @@ updates: interval: "daily" open-pull-requests-limit: 20 commit-message: - prefix: "gradle-root" - labels: - - "target: Dressca" - - "gradle" - - "dependencies" - - - package-ecosystem: "gradle" - directory: "/samples/web-csr/dressca-backend/application-core" - schedule: - interval: "daily" - open-pull-requests-limit: 20 - commit-message: - prefix: "gradle-application-core" - labels: - - "target: Dressca" - - "gradle" - - "dependencies" - - - package-ecosystem: "gradle" - directory: "/samples/web-csr/dressca-backend/batch" - schedule: - interval: "daily" - open-pull-requests-limit: 20 - commit-message: - prefix: "gradle-batch" - labels: - - "target: Dressca" - - "gradle" - - "dependencies" - - - package-ecosystem: "gradle" - directory: "/samples/web-csr/dressca-backend/infrastructure" - schedule: - interval: "daily" - open-pull-requests-limit: 20 - commit-message: - prefix: "gradle-infrastructure" - labels: - - "target: Dressca" - - "gradle" - - "dependencies" - - - package-ecosystem: "gradle" - directory: "/samples/web-csr/dressca-backend/system-common" - schedule: - interval: "daily" - open-pull-requests-limit: 20 - commit-message: - prefix: "gradle-system-common" - labels: - - "target: Dressca" - - "gradle" - - "dependencies" - - - package-ecosystem: "gradle" - directory: "/samples/web-csr/dressca-backend/web" - schedule: - interval: "daily" - open-pull-requests-limit: 20 - commit-message: - prefix: "gradle-web" + prefix: "gradle-dressca-backend" labels: - "target: Dressca" - "gradle" @@ -136,19 +76,7 @@ updates: interval: "daily" open-pull-requests-limit: 20 commit-message: - prefix: "gradle-auth-root" - labels: - - "target: Azure AD B2C Auth" - - "gradle" - - "dependencies" - - - package-ecosystem: "gradle" - directory: "/samples/azure-ad-b2c-sample/auth-backend/web" - schedule: - interval: "daily" - open-pull-requests-limit: 20 - commit-message: - prefix: "gradle-auth-web" + prefix: "gradle-auth-backend" labels: - "target: Azure AD B2C Auth" - "gradle" diff --git a/.github/workflows/check-openapi-generator-update.yml b/.github/workflows/check-openapi-generator-update.yml index 0caa07f43..3f3b5945a 100644 --- a/.github/workflows/check-openapi-generator-update.yml +++ b/.github/workflows/check-openapi-generator-update.yml @@ -38,27 +38,38 @@ jobs: - name: 現在のOpenAPI Generatorのバージョン取得 id: get-current-openapi-generator-version run: | - echo "current-version=$(jq -r '.["generator-cli"].version' ./samples/web-csr/dressca-frontend/consumer/openapitools.json)" >> $GITHUB_OUTPUT + echo "current-version-consumer=$(jq -r '.["generator-cli"].version' ./samples/web-csr/dressca-frontend/consumer/openapitools.json)" >> $GITHUB_OUTPUT + echo "current-version-admin=$(jq -r '.["generator-cli"].version' ./samples/web-csr/dressca-frontend/admin/openapitools.json)" >> $GITHUB_OUTPUT - name: アップデート要否を判定 id: check-version-update run: | - if [[ ${{ steps.get-latest-openapi-generator-version.outputs.latest-version }} == ${{ steps.get-current-openapi-generator-version.outputs.current-version }} ]]; then - echo "update-required=false" >> $GITHUB_OUTPUT + if [[ ${{ steps.get-latest-openapi-generator-version.outputs.latest-version }} == ${{ steps.get-current-openapi-generator-version.outputs.current-version-consumer }} ]]; then + echo "update-required-consumer=false" >> $GITHUB_OUTPUT else - echo "update-required=true" >> $GITHUB_OUTPUT + echo "update-required-consumer=true" >> $GITHUB_OUTPUT + fi + if [[ ${{ steps.get-latest-openapi-generator-version.outputs.latest-version }} == ${{ steps.get-current-openapi-generator-version.outputs.current-version-admin }} ]]; then + echo "update-required-admin=false" >> $GITHUB_OUTPUT + else + echo "update-required-admin=true" >> $GITHUB_OUTPUT fi - name: サマリに出力 run: | echo "# 確認結果" >> $GITHUB_STEP_SUMMARY echo "openapi-generator のバージョンは ${{ steps.get-latest-openapi-generator-version.outputs.latest-version }} です。" >> $GITHUB_STEP_SUMMARY - echo "openapitools.json の openapi-generator のバージョンは ${{ steps.get-current-openapi-generator-version.outputs.current-version }} です。" >> $GITHUB_STEP_SUMMARY - echo "アップデート要否の判定結果は ${{ steps.check-version-update.outputs.update-required }} です。">> $GITHUB_STEP_SUMMARY + echo "## Dressca-Consumer" >> $GITHUB_STEP_SUMMARY + echo "openapitools.json の openapi-generator のバージョンは ${{ steps.get-current-openapi-generator-version.outputs.current-version-consumer }} です。" >> $GITHUB_STEP_SUMMARY + echo "アップデート要否の判定結果は ${{ steps.check-version-update.outputs.update-required-consumer }} です。">> $GITHUB_STEP_SUMMARY + echo "## Dressca-Admin" >> $GITHUB_STEP_SUMMARY + echo "openapitools.json の openapi-generator のバージョンは ${{ steps.get-current-openapi-generator-version.outputs.current-version-admin }} です。" >> $GITHUB_STEP_SUMMARY + echo "アップデート要否の判定結果は ${{ steps.check-version-update.outputs.update-required-admin }} です。">> $GITHUB_STEP_SUMMARY - - name: issue を作成 - id: create-issue - if: ${{ steps.check-version-update.outputs.update-required == 'true' }} + + - name: issue を作成(Dressca-Consumer) + id: create-issue-consumer + if: ${{ steps.check-version-update.outputs.update-required-consumer == 'true' }} uses: Wandalen/wretry.action@ffdd254f4eaf1562b8a2c66aeaa37f1ff2231179 # v3.7.3 with: action: dblock/create-a-github-issue@v3 @@ -72,17 +83,17 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TARGET_APP_NAME: "Dressca-Consumer" LATEST_VERSION: ${{ steps.get-latest-openapi-generator-version.outputs.latest-version }} - CURRENT_VERSION: ${{ steps.get-current-openapi-generator-version.outputs.current-version }} + CURRENT_VERSION: ${{ steps.get-current-openapi-generator-version.outputs.current-version-consumer }} - - name: issue の情報を出力 - if: ${{ steps.check-version-update.outputs.update-required == 'true' }} + - name: issue の情報を出力(Dressca-Consumer) + if: ${{ steps.check-version-update.outputs.update-required-consumer == 'true' }} env: - STATUS: ${{ steps.create-issue.outputs.outputs && fromJson(steps.create-issue.outputs.outputs).status }} - ISSUE_NUMBER: ${{ steps.create-issue.outputs.outputs && fromJson(steps.create-issue.outputs.outputs).number }} - ISSUE_URL: ${{ steps.create-issue.outputs.outputs && fromJson(steps.create-issue.outputs.outputs).url }} + STATUS: ${{ steps.create-issue-consumer.outputs.outputs && fromJson(steps.create-issue-consumer.outputs.outputs).status }} + ISSUE_NUMBER: ${{ steps.create-issue-consumer.outputs.outputs && fromJson(steps.create-issue-consumer.outputs.outputs).number }} + ISSUE_URL: ${{ steps.create-issue-consumer.outputs.outputs && fromJson(steps.create-issue-consumer.outputs.outputs).url }} run: | - echo "# issue の作成結果" >> $GITHUB_STEP_SUMMARY + echo "# issue の作成結果(Dressca-Consumer)" >> $GITHUB_STEP_SUMMARY if [ $STATUS = 'created' ]; then echo "issue を新規作成しました。" >> $GITHUB_STEP_SUMMARY elif [ $STATUS = 'updated' ]; then @@ -93,3 +104,40 @@ jobs: echo issue number: $ISSUE_NUMBER >> $GITHUB_STEP_SUMMARY echo status: $STATUS >> $GITHUB_STEP_SUMMARY echo - $ISSUE_URL >> $GITHUB_STEP_SUMMARY + + - name: issue を作成(Dressca-Admin) + id: create-issue-admin + if: ${{ steps.check-version-update.outputs.update-required-admin == 'true' }} + uses: Wandalen/wretry.action@ffdd254f4eaf1562b8a2c66aeaa37f1ff2231179 # v3.7.3 + with: + action: dblock/create-a-github-issue@v3 + with: | + filename: ./.github/ISSUE_TEMPLATE/99-openapi-generator-update-issue.md + update_existing: true + search_existing: open + attempt_limit: 3 + attempt_delay: 300000 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARGET_APP_NAME: "Dressca-Admin" + LATEST_VERSION: ${{ steps.get-latest-openapi-generator-version.outputs.latest-version }} + CURRENT_VERSION: ${{ steps.get-current-openapi-generator-version.outputs.current-version-admin }} + + - name: issue の情報を出力(Dressca-Admin) + if: ${{ steps.check-version-update.outputs.update-required-admin == 'true' }} + env: + STATUS: ${{ steps.create-issue-admin.outputs.outputs && fromJson(steps.create-issue-admin.outputs.outputs).status }} + ISSUE_NUMBER: ${{ steps.create-issue-admin.outputs.outputs && fromJson(steps.create-issue-admin.outputs.outputs).number }} + ISSUE_URL: ${{ steps.create-issue-admin.outputs.outputs && fromJson(steps.create-issue-admin.outputs.outputs).url }} + run: | + echo "# issue の作成結果(Dressca-Admin)" >> $GITHUB_STEP_SUMMARY + if [ $STATUS = 'created' ]; then + echo "issue を新規作成しました。" >> $GITHUB_STEP_SUMMARY + elif [ $STATUS = 'updated' ]; then + echo "同名の issue が存在するため、更新のみ行いました。" >> $GITHUB_STEP_SUMMARY + else + echo "ステータスの値が不正です。" >> $GITHUB_STEP_SUMMARY + fi + echo issue number: $ISSUE_NUMBER >> $GITHUB_STEP_SUMMARY + echo status: $STATUS >> $GITHUB_STEP_SUMMARY + echo - $ISSUE_URL >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/.github/workflows/samples-dressca-admin-frontend.ci.yml b/.github/workflows/samples-dressca-admin-frontend.ci.yml new file mode 100644 index 000000000..d3e740368 --- /dev/null +++ b/.github/workflows/samples-dressca-admin-frontend.ci.yml @@ -0,0 +1,96 @@ +--- + +name: dressca-admin-frontend CI + +permissions: + contents: read + +on: + pull_request: + branches: [main] + paths: + - 'samples/web-csr/dressca-frontend/*.*' + - 'samples/web-csr/dressca-frontend/admin/**' + - '.github/workflows/samples-dressca-admin-frontend.ci.yml' + workflow_dispatch: + +defaults: + run: + working-directory: samples/web-csr/dressca-frontend/ + +jobs: + build: + name: Dressca 管理のフロントエンドアプリケーションのビルド + runs-on: ubuntu-latest + env: + NO_COLOR: "1" # 文字化け防止のためカラーコードを出力しない + strategy: + matrix: + node-version: [20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - uses: actions/cache@v4 + id: node_modules_cache_id + env: + cache-name: cache-node-modules + with: + path: '**/node_modules' + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + + - name: node パッケージのキャッシュ確認 + run: echo '${{ toJSON(steps.node_modules_cache_id.outputs) }}' + + - name: node パッケージのインストール + if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }} + run: npm ci + + - id: run-lint + name: lintの実行 + run: npm run lint:ci:admin >> /var/tmp/lint-result.txt 2>&1 + + - id: run-type-check + name: TypeScript の型チェック + run: npm run type-check:admin >> /var/tmp/type-check-result.txt 2>&1 + + - id: application-build + name: アプリケーションのビルド + run: npm run build-only:dev:admin >> /var/tmp/build-result.txt 2>&1 + + - id: run-unit-tests + name: 単体テストの実行 + run: npm run test:unit:admin >> /var/tmp/unit-test-result.txt 2>&1 + + - name: lintの結果出力 + if: ${{ success() || (failure() && steps.run-lint.conclusion == 'failure') }} + uses: ./.github/workflows/file-to-summary + with: + body: /var/tmp/lint-result.txt + header: 'lintの結果 :pen:' + + - name: 型チェックの結果出力 + if: ${{ success() || (failure() && steps.run-type-check.conclusion == 'failure') }} + uses: ./.github/workflows/file-to-summary + with: + body: /var/tmp/type-check-result.txt + header: '型チェックの結果 :pencil2:' + + - name: ビルドの結果出力 + if: ${{ success() || (failure() && steps.application-build.conclusion == 'failure') }} + uses: ./.github/workflows/file-to-summary + with: + body: /var/tmp/build-result.txt + header: 'ビルドの結果 :gear:' + + - name: 単体テストの結果出力 + if: ${{ success() || (failure() && steps.run-unit-tests.conclusion == 'failure') }} + uses: ./.github/workflows/file-to-summary + with: + body: /var/tmp/unit-test-result.txt + header: '単体テストの結果 :memo:' \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/.vscode/launch.json b/samples/web-csr/dressca-backend/.vscode/launch.json index b005e1e69..38f9b2936 100644 --- a/samples/web-csr/dressca-backend/.vscode/launch.json +++ b/samples/web-csr/dressca-backend/.vscode/launch.json @@ -2,12 +2,23 @@ "configurations": [ { "type": "java", - "name": "Spring Boot-WebApplication", + "name": "Spring Boot-WebApplication", "request": "launch", "cwd": "${workspaceFolder}", "console": "internalConsole", - "mainClass": "com.dressca.web.WebApplication", - "projectName": "web", + "mainClass": "com.dressca.web.consumer.WebApplication", + "projectName": "web-consumer", + "args": "--spring.profiles.active=local", + "envFile": "${workspaceFolder}/.env" + }, + { + "type": "java", + "name": "Spring Boot-WebApplication", + "request": "launch", + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "mainClass": "com.dressca.web.admin.WebApplication", + "projectName": "web-admin", "args": "--spring.profiles.active=local", "envFile": "${workspaceFolder}/.env" }, @@ -20,7 +31,7 @@ "mainClass": "com.dressca.batch.BatchApplication", "projectName": "batch", "args": "output=item_list_chunk.csv", - "env":{"spring.batch.job.names":"catalogItem_job"} + "env": { "spring.batch.job.names": "catalogItem_job" } }, { "type": "java", @@ -31,7 +42,7 @@ "mainClass": "com.dressca.batch.BatchApplication", "projectName": "batch", "args": "output=item_list_tasklet.csv", - "env":{"spring.batch.job.names":"catalogItem_tasklet_job"} + "env": { "spring.batch.job.names": "catalogItem_tasklet_job" } } ] -} \ No newline at end of file +} diff --git a/samples/web-csr/dressca-backend/api-docs/web-admin/api-specification.json b/samples/web-csr/dressca-backend/api-docs/web-admin/api-specification.json new file mode 100644 index 000000000..53a41ea9f --- /dev/null +++ b/samples/web-csr/dressca-backend/api-docs/web-admin/api-specification.json @@ -0,0 +1,765 @@ +{ + "openapi": "3.0.1", + "info": { + "description": "ECサイトDressca", + "title": "Dressca", + "version": "v1" + }, + "servers": [ + { + "url": "http://localhost:8081", + "description": "Generated server url" + } + ], + "tags": [ + { + "description": "カタログブランドの情報にアクセスするAPI", + "name": "CatalogBrands" + }, + { + "description": "ログイン中のユーザーの情報を取得します。", + "name": "Users" + }, + { + "description": "カタログアイテムの情報にアクセスする API コントローラーです.", + "name": "CatalogItems" + }, + { + "description": "Monitor and interact", + "externalDocs": { + "description": "Spring Boot Actuator Web API Documentation", + "url": "https://docs.spring.io/spring-boot/docs/current/actuator-api/html/" + }, + "name": "Actuator" + }, + { + "description": "アセットの情報にアクセスするAPI", + "name": "Assets" + }, + { + "description": "カタログカテゴリの情報にアクセスするAPI", + "name": "CatalogCategories" + } + ], + "paths": { + "/api": { + "get": { + "operationId": "links", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Link" + } + } + } + }, + "application/vnd.spring-boot.actuator.v2+json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Link" + } + } + } + }, + "application/vnd.spring-boot.actuator.v3+json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Link" + } + } + } + } + }, + "description": "OK" + } + }, + "summary": "Actuator root web endpoint", + "tags": [ + "Actuator" + ] + } + }, + "/api/assets/{assetCode}": { + "get": { + "description": "与えられたアセットコードに対応するアセットを返却する.", + "operationId": "get", + "parameters": [ + { + "description": "アセットコード", + "in": "path", + "name": "assetCode", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "image/*": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "description": "成功。" + }, + "401": { + "description": "未認証。" + }, + "404": { + "description": "アセットコードに対応するアセットがない。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "アセットを取得する.", + "tags": [ + "Assets" + ] + } + }, + "/api/catalog-brands": { + "get": { + "description": "カタログブランドの一覧を取得する.", + "operationId": "getCatalogBrands", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GetCatalogBrandsResponse" + } + } + } + }, + "description": "成功。" + }, + "401": { + "description": "未認証。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "カタログブランドの一覧を取得する.", + "tags": [ + "CatalogBrands" + ] + } + }, + "/api/catalog-categories": { + "get": { + "description": "カタログカテゴリの一覧を取得します.", + "operationId": "getCatalogCategories", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GetCatalogCategoriesResponse" + } + } + } + }, + "description": "成功。" + }, + "401": { + "description": "未認証。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "カタログカテゴリの一覧を取得します.", + "tags": [ + "CatalogCategories" + ] + } + }, + "/api/catalog-items": { + "get": { + "description": "カタログアイテムを検索して返します.", + "operationId": "getByQuery", + "parameters": [ + { + "in": "query", + "name": "brandId", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": 0 + } + }, + { + "in": "query", + "name": "categoryId", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": 0 + } + }, + { + "in": "query", + "name": "page", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "default": 1 + } + }, + { + "in": "query", + "name": "pageSize", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "default": 20 + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PagedListOfGetCatalogItemResponse" + } + } + }, + "description": "成功。" + }, + "400": { + "description": "リクエストエラー。" + }, + "401": { + "description": "未認証。" + }, + "404": { + "description": "失敗。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "カタログアイテムを検索して返します.", + "tags": [ + "CatalogItems" + ] + }, + "post": { + "description": "カタログにアイテムを追加します。", + "operationId": "postCatalogItem", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostCatalogItemRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "成功。" + }, + "400": { + "description": "リクエストエラー。" + }, + "401": { + "description": "未認証。" + }, + "404": { + "description": "失敗。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "カタログにアイテムを追加します。", + "tags": [ + "CatalogItems" + ] + } + }, + "/api/catalog-items/{catalogItemId}": { + "delete": { + "description": "カタログから指定したカタログアイテム ID のアイテムを削除します。", + "operationId": "deleteCatalogItem", + "parameters": [ + { + "in": "path", + "name": "catalogItemId", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "in": "query", + "name": "rowVersion", + "required": true, + "schema": { + "type": "string", + "format": "date-time" + } + } + ], + "responses": { + "204": { + "description": "成功。" + }, + "400": { + "description": "リクエストエラー。" + }, + "401": { + "description": "未認証。" + }, + "404": { + "description": "指定した ID のアイテムがカタログに存在しない。" + }, + "409": { + "description": "競合が発生。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "カタログから指定したカタログアイテム ID のアイテムを削除します。", + "tags": [ + "CatalogItems" + ] + }, + "put": { + "description": "指定したIDのカタログアイテムの情報を更新します。", + "operationId": "putCatalogItem", + "parameters": [ + { + "in": "path", + "name": "catalogItemId", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PutCatalogItemRequest" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "成功。" + }, + "400": { + "description": "リクエストエラー。" + }, + "401": { + "description": "未認証。" + }, + "404": { + "description": "指定した ID のアイテムがカタログに存在しない。" + }, + "409": { + "description": "競合が発生。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "指定したIDのカタログアイテムの情報を更新します。", + "tags": [ + "CatalogItems" + ] + } + }, + "/api/catalog-items/{id}": { + "get": { + "description": "指定したIDのカタログアイテムを返します。", + "operationId": "getCatalogItem", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetCatalogItemResponse" + } + } + }, + "description": "成功。" + }, + "400": { + "description": "リクエストエラー。" + }, + "401": { + "description": "未認証。" + }, + "404": { + "description": "指定した ID のアイテムがカタログに存在しない。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "指定したIDのカタログアイテムを返します。", + "tags": [ + "CatalogItems" + ] + } + }, + "/api/health": { + "get": { + "operationId": "health", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + }, + "application/vnd.spring-boot.actuator.v2+json": { + "schema": { + "type": "object" + } + }, + "application/vnd.spring-boot.actuator.v3+json": { + "schema": { + "type": "object" + } + } + }, + "description": "OK" + } + }, + "summary": "Actuator web endpoint \u0027health\u0027", + "tags": [ + "Actuator" + ] + } + }, + "/api/health/**": { + "get": { + "operationId": "health-path", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + }, + "application/vnd.spring-boot.actuator.v2+json": { + "schema": { + "type": "object" + } + }, + "application/vnd.spring-boot.actuator.v3+json": { + "schema": { + "type": "object" + } + } + }, + "description": "OK" + } + }, + "summary": "Actuator web endpoint \u0027health-path\u0027", + "tags": [ + "Actuator" + ] + } + }, + "/api/users": { + "get": { + "description": "ユーザーの情報。", + "operationId": "getLoginUser", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetLoginUserResponse" + } + } + }, + "description": "成功。" + }, + "401": { + "description": "未認証。" + }, + "500": { + "description": "サーバーエラー。" + } + }, + "summary": "ログイン中のユーザーの情報を取得します。", + "tags": [ + "Users" + ] + } + } + }, + "components": { + "schemas": { + "GetCatalogBrandsResponse": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "GetCatalogCategoriesResponse": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "GetCatalogItemResponse": { + "type": "object", + "properties": { + "assetCodes": { + "type": "array", + "items": { + "type": "string" + } + }, + "catalogBrandId": { + "type": "integer", + "format": "int64" + }, + "catalogCategoryId": { + "type": "integer", + "format": "int64" + }, + "description": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "price": { + "type": "number" + }, + "productCode": { + "type": "string" + }, + "rowVersion": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "catalogBrandId", + "catalogCategoryId", + "description", + "id", + "name", + "price", + "productCode", + "rowVersion" + ] + }, + "GetLoginUserResponse": { + "type": "object", + "properties": { + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "userName": { + "type": "string" + } + }, + "required": [ + "roles", + "userName" + ] + }, + "Link": { + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "templated": { + "type": "boolean" + } + } + }, + "PagedListOfGetCatalogItemResponse": { + "type": "object", + "properties": { + "hasNext": { + "type": "boolean" + }, + "hasPrevious": { + "type": "boolean" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GetCatalogItemResponse" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "totalCount": { + "type": "integer", + "format": "int32" + }, + "totalPages": { + "type": "integer", + "format": "int32" + } + } + }, + "PostCatalogItemRequest": { + "type": "object", + "properties": { + "catalogBrandId": { + "type": "integer", + "format": "int64" + }, + "catalogCategoryId": { + "type": "integer", + "format": "int64" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int64" + }, + "productCode": { + "type": "string" + } + }, + "required": [ + "catalogBrandId", + "catalogCategoryId", + "description", + "name", + "price", + "productCode" + ] + }, + "PutCatalogItemRequest": { + "type": "object", + "properties": { + "catalogBrandId": { + "type": "integer", + "format": "int64" + }, + "catalogCategoryId": { + "type": "integer", + "format": "int64" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int64" + }, + "productCode": { + "type": "string" + }, + "rowVersion": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "catalogBrandId", + "catalogCategoryId", + "description", + "name", + "price", + "productCode", + "rowVersion" + ] + } + } + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/api-docs/api-specification.json b/samples/web-csr/dressca-backend/api-docs/web-consumer/api-specification.json similarity index 98% rename from samples/web-csr/dressca-backend/api-docs/api-specification.json rename to samples/web-csr/dressca-backend/api-docs/web-consumer/api-specification.json index 7613fcfa0..9b70351ee 100644 --- a/samples/web-csr/dressca-backend/api-docs/api-specification.json +++ b/samples/web-csr/dressca-backend/api-docs/web-consumer/api-specification.json @@ -368,7 +368,7 @@ "schema": { "type": "integer", "format": "int32", - "default": 0 + "default": 1 } }, { @@ -833,6 +833,12 @@ "PagedListOfCatalogItemResponse": { "type": "object", "properties": { + "hasNext": { + "type": "boolean" + }, + "hasPrevious": { + "type": "boolean" + }, "items": { "type": "array", "items": { @@ -850,6 +856,10 @@ "totalCount": { "type": "integer", "format": "int32" + }, + "totalPages": { + "type": "integer", + "format": "int32" } } }, diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/AssetApplicationService.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/AssetApplicationService.java index ea62db042..36eb10ffa 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/AssetApplicationService.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/AssetApplicationService.java @@ -43,10 +43,8 @@ public class AssetApplicationService { */ public AssetResourceInfo getAssetResourceInfo(String assetCode) throws AssetNotFoundException { - apLog - .debug(messages.getMessage(MessageIdConstants.D_ASSET_GET_ASSET, - new Object[] { assetCode }, - Locale.getDefault())); + apLog.debug( + messages.getMessage(MessageIdConstants.D_ASSET_GET_ASSET, new Object[] { assetCode }, Locale.getDefault())); Asset asset = this.repository.findByAssetCode(assetCode) .orElseThrow(() -> new AssetNotFoundException(assetCode)); diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java index 21be4a3ba..89a078814 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java @@ -1,5 +1,7 @@ package com.dressca.applicationcore.applicationservice; +import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.List; import java.util.Locale; import org.slf4j.Logger; @@ -8,21 +10,27 @@ import org.springframework.context.MessageSource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.applicationcore.authorization.UserStore; import com.dressca.applicationcore.catalog.CatalogBrand; +import com.dressca.applicationcore.catalog.CatalogBrandNotFoundException; import com.dressca.applicationcore.catalog.CatalogBrandRepository; import com.dressca.applicationcore.catalog.CatalogCategory; +import com.dressca.applicationcore.catalog.CatalogCategoryNotFoundException; import com.dressca.applicationcore.catalog.CatalogCategoryRepository; +import com.dressca.applicationcore.catalog.CatalogDomainService; import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogNotFoundException; import com.dressca.applicationcore.catalog.CatalogRepository; +import com.dressca.applicationcore.catalog.OptimisticLockingFailureException; +import com.dressca.applicationcore.constant.UserRoleConstants; import com.dressca.applicationcore.constant.MessageIdConstants; import com.dressca.systemcommon.constant.SystemPropertyConstants; -import lombok.AllArgsConstructor; /** * カタログ情報に関するビジネスユースケースを実現するサービスです。 */ @Service -@AllArgsConstructor @Transactional(rollbackFor = Exception.class) public class CatalogApplicationService { @@ -31,27 +39,214 @@ public class CatalogApplicationService { private CatalogRepository catalogRepository; private CatalogBrandRepository brandRepository; - private CatalogCategoryRepository catalogCategoryRepository; + private CatalogCategoryRepository categoryRepository; + private CatalogDomainService catalogDomainService; + private UserStore userStore; + + /** + * コンストラクタ。 + * + * @param messages メッセージ。 + * @param catalogRepository カタログリポジトリ。 + * @param brandRepository カタログブランドリポジトリ。 + * @param categoryRepository カタログカテゴリリポジトリ。 + * @param catalogDomainService カタログドメインサービス。 + */ + public CatalogApplicationService(MessageSource messages, CatalogRepository catalogRepository, + CatalogBrandRepository brandRepository, CatalogCategoryRepository categoryRepository, + CatalogDomainService catalogDomainService) { + this.messages = messages; + this.catalogRepository = catalogRepository; + this.brandRepository = brandRepository; + this.categoryRepository = categoryRepository; + this.catalogDomainService = catalogDomainService; + } + + @Autowired(required = false) + public void setUserStore(UserStore userStore) { + this.userStore = userStore; + } private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); /** - * 条件に一致するカタログ情報を取得します。 + * 指定したIdのカタログアイテムを取得します。 + * + * @param id カタログアイテムID + * @return 条件に一致するカタログアイテム。 + * @throws CatalogNotFoundException カタログアイテムが見つからなかった場合。 + * @throws PermissionDeniedException 取得権限がない場合。 + */ + public CatalogItem getCatalogItem(long id) throws CatalogNotFoundException, PermissionDeniedException { + apLog.debug( + messages.getMessage(MessageIdConstants.D_CATALOG_GET_CATALOG_ITEM, new Object[] { id }, Locale.getDefault())); + + if (!this.userStore.isInRole(UserRoleConstants.ADMIN)) { + throw new PermissionDeniedException("getCatalogItem"); + } + + CatalogItem item = this.catalogRepository.findById(id); + if (item == null) { + throw new CatalogNotFoundException(id); + } + return item; + } + + /** + * 利用者が条件に一致するカタログ情報を取得します。 + * + * @param brandId ブランドID + * @param categoryId カテゴリID + * @param page ページ + * @param pageSize ページサイズ + * @return 条件に一致するカタログ情報のリスト。存在しない場合は空のリスト。 + */ + public List getCatalogItemsForConsumer(long brandId, long categoryId, int page, int pageSize) { + + apLog.debug(messages.getMessage(MessageIdConstants.D_CATALOG_GET_CATALOG_ITEMS, + new Object[] { brandId, categoryId, page, pageSize }, Locale.getDefault())); + + return this.catalogRepository.findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize); + } + + /** + * 管理者が条件に一致するカタログ情報を取得します。 * * @param brandId ブランドID * @param categoryId カテゴリID * @param page ページ * @param pageSize ページサイズ * @return 条件に一致するカタログ情報のリスト。存在しない場合は空のリスト。 + * @throws PermissionDeniedException 取得権限がない場合。 */ - public List getCatalogItems(long brandId, long categoryId, int page, int pageSize) { + public List getCatalogItemsForAdmin(long brandId, long categoryId, int page, int pageSize) + throws PermissionDeniedException { apLog.debug(messages.getMessage(MessageIdConstants.D_CATALOG_GET_CATALOG_ITEMS, new Object[] { brandId, categoryId, page, pageSize }, Locale.getDefault())); + if (!this.userStore.isInRole(UserRoleConstants.ADMIN)) { + throw new PermissionDeniedException("getCatalogItemsForAdmin"); + } + return this.catalogRepository.findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize); } + /** + * カタログにアイテムを追加します。 + * + * @param name 商品名 + * @param description 説明 + * @param price 単価 + * @param productCode 商品コード + * @param catalogCategoryId カテゴリID + * @param catalogBrandId ブランドID + * @return 追加したカタログアイテム。 + * @throws PermissionDeniedException 追加権限がない場合。 + * @throws CatalogCategoryNotFoundException 追加対象のカタログカテゴリが存在しなかった場合。 + * @throws CatalogBrandNotFoundException 追加対象のカタログブランドが存在しなかった場合。 + */ + public CatalogItem addItemToCatalog(String name, String description, BigDecimal price, String productCode, + long catalogCategoryId, long catalogBrandId) + throws PermissionDeniedException, CatalogCategoryNotFoundException, CatalogBrandNotFoundException { + apLog.debug( + messages.getMessage(MessageIdConstants.D_CATALOG_ADD_ITEM_TO_CATALOG, new Object[] {}, Locale.getDefault())); + + if (!this.userStore.isInRole(UserRoleConstants.ADMIN)) { + throw new PermissionDeniedException("addItemToCatalog"); + } + + if (!this.catalogDomainService.existCatalogCategory(catalogCategoryId)) { + throw new CatalogCategoryNotFoundException(catalogCategoryId); + } + + if (!this.catalogDomainService.existCatalogBrand(catalogBrandId)) { + throw new CatalogBrandNotFoundException(catalogBrandId); + } + + CatalogItem item = CatalogItem.createCatalogItemForRegistration(name, description, price, productCode, + catalogCategoryId, catalogBrandId); + item.setRowVersion(LocalDateTime.now()); + CatalogItem catalogItemAdded = this.catalogRepository.add(item); + return catalogItemAdded; + } + + /** + * カタログからアイテムを削除します。 + * + * @param id 削除対象のカタログアイテムのID。 + * @param rowVersion 行バージョン。 + * @throws PermissionDeniedException 削除権限がない場合。 + * @throws CatalogNotFoundException 削除対象のカタログアイテムが存在しなかった場合。 + * @throws OptimisticLockingFailureException 楽観ロックエラーの場合。 + */ + public void deleteItemFromCatalog(long id, LocalDateTime rowVersion) + throws PermissionDeniedException, CatalogNotFoundException, OptimisticLockingFailureException { + apLog.debug(messages.getMessage(MessageIdConstants.D_CATALOG_DELETE_ITEM_FROM_CATALOG, new Object[] { id }, + Locale.getDefault())); + if (!this.userStore.isInRole(UserRoleConstants.ADMIN)) { + throw new PermissionDeniedException("deleteItemFromCatalog"); + } + if (!this.catalogDomainService.existCatalogItem(id)) { + throw new CatalogNotFoundException(id); + } + int deleteRowCount = this.catalogRepository.remove(id, rowVersion); + if (deleteRowCount == 0) { + throw new OptimisticLockingFailureException(id); + } + } + + /** + * カタログアイテムを更新します。 + * + * @param id 更新対象のカタログアイテムID。 + * @param name 商品名。 + * @param description 説明。 + * @param price 価格。 + * @param productCode 商品コード。 + * @param catalogCategoryId カテゴリID。 + * @param catalogBrandId ブランドID。 + * @param rowVersion 行バージョン。 + * @throws CatalogNotFoundException 更新対象のカタログアイテムが存在しなかった場合。 + * @throws PermissionDeniedException 更新権限がない場合。 + * @throws CatalogCategoryNotFoundException 更新対象のカタログカテゴリが存在しなかった場合。 + * @throws CatalogBrandNotFoundException 更新対象のカタログブランドが存在しなかった場合。 + * @throws OptimisticLockingFailureException 楽観ロックエラーの場合。 + */ + public void updateCatalogItem(long id, String name, String description, BigDecimal price, String productCode, + long catalogCategoryId, long catalogBrandId, LocalDateTime rowVersion) + throws CatalogNotFoundException, PermissionDeniedException, CatalogCategoryNotFoundException, + CatalogBrandNotFoundException, OptimisticLockingFailureException { + + apLog.debug(messages.getMessage(MessageIdConstants.D_CATALOG_UPDATE_CATALOG_ITEM, new Object[] { id }, + Locale.getDefault())); + + if (!this.userStore.isInRole(UserRoleConstants.ADMIN)) { + throw new PermissionDeniedException("updateCatalogItem"); + } + + if (!this.catalogDomainService.existCatalogItem(id)) { + throw new CatalogNotFoundException(id); + } + + if (!this.catalogDomainService.existCatalogCategory(catalogCategoryId)) { + throw new CatalogCategoryNotFoundException(catalogCategoryId); + } + + if (!this.catalogDomainService.existCatalogBrand(catalogBrandId)) { + throw new CatalogBrandNotFoundException(catalogBrandId); + } + + CatalogItem item = new CatalogItem(id, name, description, price, productCode, catalogCategoryId, catalogBrandId); + // 変更前の行バージョンを、変更対象のカタログアイテムに追加 + item.setRowVersion(rowVersion); + + int updateRowCount = this.catalogRepository.update(item); + if (updateRowCount == 0) { + throw new OptimisticLockingFailureException(id); + } + } + /** * 条件に一致するカテゴリの件数を取得します。 * @@ -75,9 +270,7 @@ public int countCatalogItems(long brandId, long categoryId) { */ public List getBrands() { - apLog.debug(messages.getMessage(MessageIdConstants.D_CATALOG_GET_BRANDS, - new Object[] {}, - Locale.getDefault())); + apLog.debug(messages.getMessage(MessageIdConstants.D_CATALOG_GET_BRANDS, new Object[] {}, Locale.getDefault())); return this.brandRepository.getAll(); } @@ -89,10 +282,8 @@ public List getBrands() { */ public List getCategories() { - apLog.debug(messages.getMessage(MessageIdConstants.D_CATALOG_GET_CATEGORIES, - new Object[] {}, - Locale.getDefault())); + apLog.debug(messages.getMessage(MessageIdConstants.D_CATALOG_GET_CATEGORIES, new Object[] {}, Locale.getDefault())); - return this.catalogCategoryRepository.getAll(); + return this.categoryRepository.getAll(); } } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/OrderApplicationService.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/OrderApplicationService.java index 8cb658b93..a193f3809 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/OrderApplicationService.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/OrderApplicationService.java @@ -39,10 +39,8 @@ public class OrderApplicationService { */ public Order getOrder(long orderId, String buyerId) throws OrderNotFoundException { - apLog.debug( - messages.getMessage(MessageIdConstants.D_ORDER_GET_ORDER, - new Object[] { orderId, buyerId }, - Locale.getDefault())); + apLog.debug(messages.getMessage(MessageIdConstants.D_ORDER_GET_ORDER, new Object[] { orderId, buyerId }, + Locale.getDefault())); Order order = this.orderRepository.findById(orderId) .orElseThrow(() -> new OrderNotFoundException(null, orderId, buyerId)); @@ -52,5 +50,4 @@ public Order getOrder(long orderId, String buyerId) throws OrderNotFoundExceptio return order; } - } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/ShoppingApplicationService.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/ShoppingApplicationService.java index 9e3eb223c..d327df8b1 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/ShoppingApplicationService.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/ShoppingApplicationService.java @@ -88,8 +88,7 @@ public void setQuantities(String buyerId, Map quantities) throws CatalogNotFoundException, CatalogItemInBasketNotFoundException { apLog.debug(messages.getMessage(MessageIdConstants.D_SHOPPING_SET_BASKET_ITEMS_QUANTITIES, - new Object[] { buyerId, quantities }, - Locale.getDefault())); + new Object[] { buyerId, quantities }, Locale.getDefault())); Basket basket = getOrCreateBasketForUser(buyerId); // カタログリポジトリに存在しないカタログアイテムが指定されていないか確認 @@ -124,8 +123,8 @@ public void setQuantities(String buyerId, Map quantities) */ public BasketDetail getBasketDetail(String buyerId) { - apLog.debug(messages.getMessage(MessageIdConstants.D_SHOPPING_GET_BASKET_ITEMS, - new Object[] { buyerId }, Locale.getDefault())); + apLog.debug(messages.getMessage(MessageIdConstants.D_SHOPPING_GET_BASKET_ITEMS, new Object[] { buyerId }, + Locale.getDefault())); Basket basket = getOrCreateBasketForUser(buyerId); List catalogItemIds = basket.getItems().stream() @@ -146,8 +145,7 @@ public BasketDetail getBasketDetail(String buyerId) { public Order checkout(String buyerId, ShipTo shipToAddress) throws EmptyBasketOnCheckoutException { - apLog.debug(messages.getMessage(MessageIdConstants.D_SHOPPING_CHECKOUT, - new Object[] { buyerId, shipToAddress }, + apLog.debug(messages.getMessage(MessageIdConstants.D_SHOPPING_CHECKOUT, new Object[] { buyerId, shipToAddress }, Locale.getDefault())); Basket basket = getOrCreateBasketForUser(buyerId); diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/PermissionDeniedException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/PermissionDeniedException.java new file mode 100644 index 000000000..7c4777e2f --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/PermissionDeniedException.java @@ -0,0 +1,20 @@ +package com.dressca.applicationcore.authorization; + +import com.dressca.applicationcore.constant.ExceptionIdConstants; +import com.dressca.systemcommon.exception.LogicException; + +/** + * ユーザーに実行権限がないことを表す例外です。 + */ +public class PermissionDeniedException extends LogicException { + /** + * 実行を試みた操作を指定して + * {@link PermissionDeniedException} クラスの新しいインスタンスを初期化します。 + * + * @param operationName 実行を試みた操作 + */ + public PermissionDeniedException(String operationName) { + super(null, ExceptionIdConstants.E_PERMISSION_DENIED, new String[] { String.valueOf(operationName) }, + new String[] { String.valueOf(operationName) }); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/UserStore.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/UserStore.java new file mode 100644 index 000000000..6d6b65cc0 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/UserStore.java @@ -0,0 +1,15 @@ +package com.dressca.applicationcore.authorization; + +import java.util.List; + +/** + * ユーザーのセッション情報のインターフェース。 + */ +public interface UserStore { + + public String getLoginUserName(); + + public List getLoginUserRoles(); + + public boolean isInRole(String role); +} diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandNotFoundException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandNotFoundException.java new file mode 100644 index 000000000..a3aa4b2a4 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandNotFoundException.java @@ -0,0 +1,22 @@ +package com.dressca.applicationcore.catalog; + +import com.dressca.applicationcore.constant.ExceptionIdConstants; +import com.dressca.systemcommon.exception.LogicException; + +/** + * カタログブランドが存在しないことを表す例外です。 + */ +public class CatalogBrandNotFoundException extends LogicException { + + /** + * 見つからなかったカタログブランド Id を指定して + * {@link CatalogItemNotExistingInRepositoryException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogBrandId 見つからなかったカタログブランド Id 。 + */ + public CatalogBrandNotFoundException(long catalogBrandId) { + super(null, ExceptionIdConstants.E_CATALOG_BRAND_NOT_FOUND, new String[] { String.valueOf( + catalogBrandId) }, + new String[] { String.valueOf(catalogBrandId) }); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandRepository.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandRepository.java index 7bfcc02f4..48ad827ac 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandRepository.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandRepository.java @@ -12,4 +12,11 @@ public interface CatalogBrandRepository { * @return カタログブランドのリスト */ List getAll(); + + /** + * 指定した ID のカタログブランドを取得します。 + * + * @return 条件に一致するカタログブランド。 + */ + CatalogBrand findById(long id); } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryNotFoundException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryNotFoundException.java new file mode 100644 index 000000000..6e09c9b9e --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryNotFoundException.java @@ -0,0 +1,22 @@ +package com.dressca.applicationcore.catalog; + +import com.dressca.applicationcore.constant.ExceptionIdConstants; +import com.dressca.systemcommon.exception.LogicException; + +/** + * カタログカテゴリが存在しないことを表す例外です。 + */ +public class CatalogCategoryNotFoundException extends LogicException { + + /** + * 見つからなかったカタログカテゴリ Id を指定して + * {@link CatalogItemNotExistingInRepositoryException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogCategoryId 見つからなかったカタログカテゴリ Id 。 + */ + public CatalogCategoryNotFoundException(long catalogCategoryId) { + super(null, ExceptionIdConstants.E_CATALOG_CATEGORY_NOT_FOUND, new String[] { String.valueOf( + catalogCategoryId) }, + new String[] { String.valueOf(catalogCategoryId) }); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryRepository.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryRepository.java index 7b15bc679..ec832e836 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryRepository.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryRepository.java @@ -12,4 +12,11 @@ public interface CatalogCategoryRepository { * @return カタログカテゴリのリスト */ List getAll(); + + /** + * 指定した ID のカタログカテゴリを取得します。 + * + * @return 条件に一致するカタログカテゴリ。 + */ + CatalogCategory findById(long id); } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogDomainService.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogDomainService.java index 9307a9c29..d5faeb119 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogDomainService.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogDomainService.java @@ -12,6 +12,8 @@ @AllArgsConstructor public class CatalogDomainService { private CatalogRepository catalogRepository; + private CatalogBrandRepository brandRepository; + private CatalogCategoryRepository categoryRepository; /** * 指定したカタログアイテム Id のうち、存在するカタログアイテムの一覧を返却します。 @@ -38,6 +40,36 @@ public boolean existAll(List catalogItemIds) { return notExistCatalogItemIds.isEmpty(); } + /** + * 指定した Id のカタログブランドがリポジトリ内に存在するかどうかを示す真理値を取得します。 + * + * @param catalogBrandId カタログブランド Id。 + * @return 指定したカタログブランドがリポジトリ内に存在する場合は true 、存在しない場合は false 。 + */ + public boolean existCatalogBrand(long catalogBrandId) { + return this.brandRepository.findById(catalogBrandId) != null; + } + + /** + * 指定した Id のカタログカテゴリがリポジトリ内に存在するかどうかを示す真理値を取得します。 + * + * @param catalogCategoryId カタログカテゴリ Id。 + * @return 指定したカタログカテゴリがリポジトリ内に存在する場合は true 、存在しない場合は false 。 + */ + public boolean existCatalogCategory(long catalogCategoryId) { + return this.categoryRepository.findById(catalogCategoryId) != null; + } + + /** + * 指定した Id のカタログアイテムがリポジトリ内に存在するかどうかを示す真理値を取得します。 + * + * @param catalogItemId カタログアイテム Id。 + * @return 指定したカタログアイテムがリポジトリ内に存在する場合は true 、存在しない場合は false 。 + */ + public boolean existCatalogItem(long catalogItemId) { + return this.catalogRepository.findById(catalogItemId) != null; + } + private boolean existCatalogItemIdInItems(List items, long catalogItemId) { return items.stream() .anyMatch(catalogItem -> catalogItem.getId() == catalogItemId); diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java index 706a2a73d..3dc889b3e 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java @@ -1,6 +1,7 @@ package com.dressca.applicationcore.catalog; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import lombok.Data; @@ -27,6 +28,7 @@ public class CatalogItem { private String productCode; private long catalogCategoryId; private long catalogBrandId; + private LocalDateTime rowVersion; /** * コンストラクタ。 @@ -36,7 +38,7 @@ public class CatalogItem { * @param description 商品紹介 * @param price 単価 * @param productCode プロダクトコード - * @param catalogCategoryId カタログ商品ID + * @param catalogCategoryId カタログカテゴリID * @param catalogBrandId カタログブランドID */ public CatalogItem(long id, @NonNull String name, @NonNull String description, @@ -50,4 +52,21 @@ public CatalogItem(long id, @NonNull String name, @NonNull String description, this.catalogCategoryId = catalogCategoryId; this.catalogBrandId = catalogBrandId; } + + /** + * 登録用のカタログアイテムを作成します。 + * + * @param name 商品名。 + * @param description 商品紹介。 + * @param price 単価。 + * @param productCode プロダクトコード。 + * @param catalogCategoryId カタログカテゴリ ID 。 + * @param catalogBrandId カタログブランド ID 。 + * @return 登録用のカタログアイテム。 + */ + public static CatalogItem createCatalogItemForRegistration(@NonNull String name, @NonNull String description, + @NonNull BigDecimal price, @NonNull String productCode, long catalogCategoryId, long catalogBrandId) { + CatalogItem item = new CatalogItem(0, name, description, price, productCode, catalogCategoryId, catalogBrandId); + return item; + } } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogRepository.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogRepository.java index 5070afc5a..cfa068376 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogRepository.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogRepository.java @@ -1,5 +1,6 @@ package com.dressca.applicationcore.catalog; +import java.time.LocalDateTime; import java.util.List; /** @@ -51,4 +52,37 @@ List findByBrandIdAndCategoryId(long brandId, long categoryId, int * @param pageSize データ取得行数の最大値 */ List findWithPaging(int skipRows, int pageSize); + + /** + * 指定した ID のカタログアイテムを取得します。 + * + * @param id カタログアイテムID + * @return 条件に一致するカタログアイテム + */ + CatalogItem findById(long id); + + /** + * カタログアイテムを追加します。 + * + * @param item カタログアイテム + * @return 追加されたカタログアイテム + */ + CatalogItem add(CatalogItem item); + + /** + * カタログアイテムを削除します。 + * + * @param id カタログアイテムID + * @param rowVersion 行バージョン + * @return 削除できたら1、できなければ0を返す + */ + int remove(Long id, LocalDateTime rowVersion); + + /** + * カタログアイテムを更新します。 + * + * @param item カタログアイテム。 + * @return 更新できたら1、できなければ0を返す。 + */ + int update(CatalogItem item); } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/OptimisticLockingFailureException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/OptimisticLockingFailureException.java new file mode 100644 index 000000000..dc52533c3 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/OptimisticLockingFailureException.java @@ -0,0 +1,24 @@ +package com.dressca.applicationcore.catalog; + +import com.dressca.applicationcore.constant.ExceptionIdConstants; +import com.dressca.systemcommon.exception.LogicException; + +/** + * 楽観ロックエラーが発生したことを表す例外です。 + */ +public class OptimisticLockingFailureException extends LogicException { + + /** + * カタログアイテムidを指定して、 + * {@link OptimisticLockingFailureException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogItemId 更新処理を試みたカタログアイテムid + */ + public OptimisticLockingFailureException(long catalogItemId) { + super( + null, + ExceptionIdConstants.E_OPTIMISTIC_LOCKING_FAILURE, + new String[] { String.valueOf(catalogItemId) }, + new String[] { String.valueOf(catalogItemId) }); + } +} diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/ExceptionIdConstants.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/ExceptionIdConstants.java index 388d08b1a..df3274333 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/ExceptionIdConstants.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/ExceptionIdConstants.java @@ -28,4 +28,16 @@ public class ExceptionIdConstants { /** 商品ID: {0} の商品が見つかりませんでした。 */ public static final String E_CATALOG_ID_NOT_FOUND = "catalogIdNotFound"; + + /** ブランドID: {0} のブランドが見つかりませんでした。 */ + public static final String E_CATALOG_BRAND_NOT_FOUND = "catalogBrandNotFound"; + + /** カテゴリID: {0} のカテゴリが見つかりませんでした。 */ + public static final String E_CATALOG_CATEGORY_NOT_FOUND = "catalogCategoryNotFound"; + + /** {0} を実行する権限がありません。 */ + public static final String E_PERMISSION_DENIED = "permissionDenied"; + + /** カタログアイテム ID: {0} のカタログアイテムの更新時に楽観ロックエラーが発生しました。 */ + public static final String E_OPTIMISTIC_LOCKING_FAILURE = "optimisticLockingFailure"; } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/MessageIdConstants.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/MessageIdConstants.java index 1a664352b..7274108aa 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/MessageIdConstants.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/MessageIdConstants.java @@ -34,4 +34,16 @@ public class MessageIdConstants { /** フィルタリング用のカタログカテゴリリストを取得します。 */ public static final String D_CATALOG_GET_CATEGORIES = "catalogApplicationServiceGetCategories"; + + /** カタログアイテム ID: {0} のカタログアイテムを取得します。 */ + public static final String D_CATALOG_GET_CATALOG_ITEM = "catalogApplicationServiceGetCatalogItem"; + + /** カタログにアイテムを追加します。 */ + public static final String D_CATALOG_ADD_ITEM_TO_CATALOG = "catalogApplicationServiceAddItemToCatalog"; + + /** カタログアイテム ID: {0} のカタログアイテムを削除します。 */ + public static final String D_CATALOG_DELETE_ITEM_FROM_CATALOG = "catalogApplicationServiceDeleteItemFromCatalog"; + + /** カタログアイテム ID: {0} のカタログアイテムを更新します。 */ + public static final String D_CATALOG_UPDATE_CATALOG_ITEM = "catalogApplicationServiceUpdateCatalogItem"; } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/UserRoleConstants.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/UserRoleConstants.java new file mode 100644 index 000000000..6fbf094a7 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/UserRoleConstants.java @@ -0,0 +1,9 @@ +package com.dressca.applicationcore.constant; + +/** + * ユーザーのロール用定数クラス。 + */ +public class UserRoleConstants { + /** 管理者の権限名。 */ + public static final String ADMIN = "ROLE_ADMIN"; +} diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/order/EmptyBasketOnCheckoutException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/order/EmptyBasketOnCheckoutException.java index 4b3364d4b..eb8c94440 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/order/EmptyBasketOnCheckoutException.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/order/EmptyBasketOnCheckoutException.java @@ -11,5 +11,4 @@ public class EmptyBasketOnCheckoutException extends LogicException { public EmptyBasketOnCheckoutException(Throwable cause) { super(cause, ExceptionIdConstants.E_BASKET_IS_EMPTY_ON_CHECKOUT, null, null); } - } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/order/OrderNotFoundException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/order/OrderNotFoundException.java index a161c275d..402ec7af8 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/order/OrderNotFoundException.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/order/OrderNotFoundException.java @@ -20,5 +20,4 @@ public OrderNotFoundException(Throwable cause, long orderId, String buyerId) { super(cause, ExceptionIdConstants.E_ORDER_NOT_FOUND, new String[] { String.valueOf(orderId), buyerId }, new String[] { String.valueOf(orderId), buyerId }); } - } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/resources/applicationcore/messages.properties b/samples/web-csr/dressca-backend/application-core/src/main/resources/applicationcore/messages.properties index 9001a65b3..a291ff2d4 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/resources/applicationcore/messages.properties +++ b/samples/web-csr/dressca-backend/application-core/src/main/resources/applicationcore/messages.properties @@ -7,14 +7,23 @@ basketIsNullOnCheckout=存在しない買い物かごID: {0} の買い物かご catalogIdNotFound=商品ID: {0} の商品が見つかりませんでした。 catalogItemIdDoesNotExistInBasket=買い物かごID: {0} に商品ID: {1} の商品が見つかりませんでした。 orderNotFound=存在しない注文情報(注文ID: {0}, 購入者ID: {1})が要求されました。 +catalogIdNotFound=商品ID: {0} の商品が見つかりませんでした。 +catalogBrandNotFound=ブランドID: {0} のブランドが見つかりませんでした。 +catalogCategoryNotFound=カテゴリID: {0} のカテゴリが見つかりませんでした。 +permissionDenied={0} を実行する権限がありません。 +optimisticLockingFailure=カタログアイテム ID: {0} のカタログアイテムの更新時に楽観ロックエラーが発生しました。 # 通知用メッセージ assetApplicationServiceGetAsset=アセット情報{0}を取得します。 catalogApplicationServiceCountCatalogItems=条件(ブランドID: {0}, カテゴリID: {1})に一致するカテゴリの件数を取得します。 catalogApplicationServiceGetBrands=フィルタリング用のカタログブランドリストを取得します。 catalogApplicationServiceGetCatalogItems=条件(ブランドID: {0}, カテゴリID: {1}, ページ: {2}, ページサイズ: {3})に一致するカタログ情報を取得します。 catalogApplicationServiceGetCategories=フィルタリング用のカタログカテゴリリストを取得します。 +catalogApplicationServiceGetCatalogItem=カタログアイテム ID: {0} のカタログアイテムを取得します。 +catalogApplicationServiceAddItemToCatalog=カタログにアイテムを追加します。 +catalogApplicationServiceDeleteItemFromCatalog=カタログアイテム ID: {0} のカタログアイテムを削除します。 +catalogApplicationServiceUpdateCatalogItem=カタログアイテム ID: {0} のカタログアイテムを更新します。 shoppingApplicationServiceAddItemToBasket=買い物かごに商品(顧客ID: {0}, カタログ商品ID: {1}, 数量: {2})を追加します。 shoppingApplicationServiceCheckout=注文(顧客ID: {0}, お届け先: {1})を確定します。 shoppingApplicationServiceGetBasketItems=顧客(顧客ID: {0})の買い物かごと情報とその商品一覧を取得します。 shoppingApplicationServiceSetBasketItemsQuantities=買い物かごの商品の数量(顧客ID: {0}, 数量: {1})を設定します。 -orderApplicationServiceGetOrder=指定した注文ID: {0}, 購入者ID: {1} の注文情報を取得します。 \ No newline at end of file +orderApplicationServiceGetOrder=指定した注文ID: {0}, 購入者ID: {1} の注文情報を取得します。 diff --git a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java index b3c79c770..4eacf06ce 100644 --- a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java +++ b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java @@ -8,7 +8,6 @@ import java.util.Optional; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -49,8 +48,7 @@ void setUp() { } @Test - @DisplayName("testGetAssetResourceInfo_01_正常系_存在するアセットコード") - void testGetAssetResourceInfo_01_正常系_存在するアセットコード() throws AssetNotFoundException { + void testGetAssetResourceInfo_正常系_存在するアセットコード() throws AssetNotFoundException { // テスト用の入力データ String assetCode = "ExistAssetCode"; @@ -68,12 +66,10 @@ void setUp() { // モックが想定通り呼び出されていることの確認 verify(this.repository, times(1)).findByAssetCode(assetCode); verify(this.store, times(1)).getResource(asset); - } @Test - @DisplayName("testGetAssetResourceInfo_02_異常系_リポジトリに存在しないアセットコード") - void testGetAssetResourceInfo_02_異常系_リポジトリに存在しないアセットコード() { + void testGetAssetResourceInfo_異常系_リポジトリに存在しないアセットコード() { // テスト用の入力データ String assetCode = "NotExistAssetCode"; @@ -88,12 +84,10 @@ void setUp() { // モックが想定通り呼び出されていることの確認 verify(this.repository, times(1)).findByAssetCode(assetCode); } - } @Test - @DisplayName("testGetAssetResourceInfo_03_異常系_ストアに存在しないアセットコード") - void testGetAssetResourceInfo_03_異常系_ストアに存在しないアセットコード() { + void testGetAssetResourceInfo_異常系_ストアに存在しないアセットコード() { // テスト用の入力データ String assetCode = "NotExistAssetCode"; @@ -113,6 +107,5 @@ void setUp() { verify(this.repository, times(1)).findByAssetCode(assetCode); verify(this.store, times(1)).getResource(asset); } - } } diff --git a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/CatalogApplicationServiceTest.java b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/CatalogApplicationServiceTest.java index 048901f4b..0a0b48b7e 100644 --- a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/CatalogApplicationServiceTest.java +++ b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/CatalogApplicationServiceTest.java @@ -1,17 +1,24 @@ package com.dressca.applicationcore.applicationservice; -import static org.mockito.ArgumentMatchers.anyInt; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Random; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.function.Executable; import org.mockito.Mock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; @@ -19,12 +26,19 @@ import org.springframework.context.MessageSource; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.applicationcore.authorization.UserStore; import com.dressca.applicationcore.catalog.CatalogBrand; +import com.dressca.applicationcore.catalog.CatalogBrandNotFoundException; import com.dressca.applicationcore.catalog.CatalogBrandRepository; import com.dressca.applicationcore.catalog.CatalogCategory; +import com.dressca.applicationcore.catalog.CatalogCategoryNotFoundException; import com.dressca.applicationcore.catalog.CatalogCategoryRepository; +import com.dressca.applicationcore.catalog.CatalogDomainService; import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogNotFoundException; import com.dressca.applicationcore.catalog.CatalogRepository; +import com.dressca.applicationcore.catalog.OptimisticLockingFailureException; /** * {@link CatalogApplicationService}の動作をテストするクラスです。 @@ -38,7 +52,11 @@ public class CatalogApplicationServiceTest { @Mock private CatalogBrandRepository brandRepository; @Mock - private CatalogCategoryRepository catalogCategoryRepository; + private CatalogCategoryRepository categoryRepository; + @Mock + private CatalogDomainService catalogDomainService; + @Mock + private UserStore userStore; @Autowired private MessageSource messages; @@ -49,36 +67,516 @@ public class CatalogApplicationServiceTest { @BeforeEach void setUp() { - service = new CatalogApplicationService(messages, catalogRepository, brandRepository, catalogCategoryRepository); + service = new CatalogApplicationService(messages, catalogRepository, brandRepository, categoryRepository, + catalogDomainService); + service.setUserStore(this.userStore); } @Test - void testGetCatalogItems_正常系_リポジトリのfindByBrandIdAndCategoryIdを1回呼出す() { + void testGetCatalogItem_正常系_リポジトリのfindByIdを1回呼出す() throws CatalogNotFoundException, PermissionDeniedException { // Arrange - List catalogItems = List.of(createCatalogItem(1L)); - when(this.catalogRepository.findByBrandIdAndCategoryId(anyLong(), anyLong(), anyInt(), anyInt())) - .thenReturn(catalogItems); + long targetId = 1L; + CatalogItem catalogItem = createCatalogItem(targetId); + when(this.catalogRepository.findById(targetId)).thenReturn(catalogItem); + when(this.userStore.isInRole(anyString())).thenReturn(true); - // Act - service.getCatalogItems(1L, 1L, 1, 10); + // Action + service.getCatalogItem(targetId); + + // Assert + verify(this.catalogRepository, times(1)).findById(targetId); + } + + @Test + void testGetCatalogItem_正常系_指定したidのカタログアイテムが返却される() throws CatalogNotFoundException, PermissionDeniedException { + // Arrange + long targetId = 1L; + CatalogItem expectedCatalogItem = createCatalogItem(targetId); + when(this.catalogRepository.findById(targetId)).thenReturn(expectedCatalogItem); + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + CatalogItem actualCatalogItem = service.getCatalogItem(targetId); + + // Assert + assertThat(actualCatalogItem).isEqualTo(expectedCatalogItem); + } + + @Test + void testGetCatalogItem_異常系_対象のアイテムが存在しない() { + // Arrange + long targetId = 999L; + when(this.catalogRepository.findById(targetId)).thenReturn(null); + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + Executable action = () -> { + this.service.getCatalogItem(targetId); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testGetCatalogItem_異常系_カタログアイテムを取得する権限がない() { + // Arrange + long targetId = 1L; + CatalogItem item = createCatalogItem(targetId); + when(this.catalogRepository.findById(targetId)).thenReturn(item); + when(this.userStore.isInRole(anyString())).thenReturn(false); + + // Action + Executable action = () -> { + this.service.getCatalogItem(targetId); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testGetCatalogItemsForConsumer_正常系_リポジトリのfindByBrandIdAndCategoryIdを1回呼出す() { + // Arrange + long brandId = 1L; + long categoryId = 1L; + int page = 0; + int pageSize = 20; + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + service.getCatalogItemsForConsumer(brandId, categoryId, page, pageSize); + + // Assert + verify(this.catalogRepository, times(1)).findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize); + } + + @Test + void testGetCatalogItemsForConsumer_正常系_指定した条件のカタログアイテムのリストが返却される() { + // Arrange + when(this.userStore.isInRole(anyString())).thenReturn(true); + long brandId = 1L; + long categoryId = 1L; + int page = 0; + int pageSize = 20; + long targetId = 1L; + CatalogItem catalogItem = createCatalogItem(targetId); + List expectedCatalogItemList = new ArrayList<>(Arrays.asList(catalogItem)); + when(this.catalogRepository.findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize)) + .thenReturn(expectedCatalogItemList); + + // Action + List actualCatalogItemList = service.getCatalogItemsForConsumer(brandId, categoryId, page, pageSize); + + // Assert + assertThat(actualCatalogItemList).isEqualTo(expectedCatalogItemList); + } + + @Test + void testGetCatalogItemsForAdmin_正常系_リポジトリのfindByBrandIdAndCategoryIdを1回呼出す() throws PermissionDeniedException { + // Arrange + long brandId = 1L; + long categoryId = 1L; + int page = 0; + int pageSize = 20; + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + service.getCatalogItemsForAdmin(brandId, categoryId, page, pageSize); + + // Assert + verify(this.catalogRepository, times(1)).findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize); + } + + @Test + void testGetCatalogItemsForAdmin_正常系_指定した条件のカタログアイテムのリストが返却される() throws PermissionDeniedException { + // Arrange + when(this.userStore.isInRole(anyString())).thenReturn(true); + long brandId = 1L; + long categoryId = 1L; + int page = 0; + int pageSize = 20; + long targetId = 1L; + CatalogItem catalogItem = createCatalogItem(targetId); + List expectedCatalogItemList = new ArrayList<>(Arrays.asList(catalogItem)); + when(this.catalogRepository.findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize)) + .thenReturn(expectedCatalogItemList); + + // Action + List actualCatalogItemList = service.getCatalogItemsForAdmin(brandId, categoryId, page, pageSize); + + // Assert + assertThat(actualCatalogItemList).isEqualTo(expectedCatalogItemList); + } + + @Test + void testGetCatalogItemsForAdmin_異常系_カタログアイテムの一覧を取得する権限がない() { + // Arrange + long brandId = 1L; + long categoryId = 1L; + int page = 0; + int pageSize = 20; + when(this.userStore.isInRole(anyString())).thenReturn(false); + + // Action + Executable action = () -> { + service.getCatalogItemsForAdmin(brandId, categoryId, page, pageSize); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testAddItemToCatalog_正常系_リポジトリのaddCatalogItemを1回呼出す() + throws PermissionDeniedException, CatalogCategoryNotFoundException, CatalogBrandNotFoundException { + // Arrange + long brandId = 1L; + long categoryId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + String name = "テストアイテム"; + String description = "テスト用のアイテムです。"; + BigDecimal price = new BigDecimal(123456); + String productCode = "TEST001"; + + // Action + service.addItemToCatalog(name, description, price, productCode, categoryId, brandId); + + // Assert + verify(this.catalogRepository, times(1)).add(any()); + } + + @Test + void testAddItemToCatalog_正常系_追加したカタログアイテムが返却される() + throws PermissionDeniedException, CatalogCategoryNotFoundException, CatalogBrandNotFoundException { + // Arrange + long brandId = 1L; + long categoryId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + String name = "テストアイテム"; + String description = "テスト用のアイテムです。"; + BigDecimal price = new BigDecimal(123456); + String productCode = "TEST001"; + long targetId = 1L; + CatalogItem expectedCatalogItem = createCatalogItem(targetId); + when(this.catalogRepository.add(any())).thenReturn(expectedCatalogItem); + + // Action + CatalogItem actualCatalogItem = service.addItemToCatalog(name, description, price, productCode, categoryId, + brandId); + + // Assert + assertThat(actualCatalogItem).isEqualTo(expectedCatalogItem); + } + + @Test + void testAddItemToCatalog_異常系_カタログアイテムを追加する権限がない() { + // Arrange + long brandId = 1L; + long categoryId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(false); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + String name = "テストアイテム"; + String description = "テスト用のアイテムです。"; + BigDecimal price = new BigDecimal(123456); + String productCode = "TEST001"; + + // Action + Executable action = () -> { + service.addItemToCatalog(name, description, price, productCode, categoryId, brandId); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testAddItemToCatalog_異常系_追加対象のカタログカテゴリが存在しない() { + // Arrange + long brandId = 1L; + long categoryId = 999L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(false); + String name = "テストアイテム"; + String description = "テスト用のアイテムです。"; + BigDecimal price = new BigDecimal(123456); + String productCode = "TEST001"; + + // Action + Executable action = () -> { + service.addItemToCatalog(name, description, price, productCode, categoryId, brandId); + }; + + // Assert + assertThrows(CatalogCategoryNotFoundException.class, action); + } + + @Test + void testAddItemToCatalog_異常系_追加対象のカタログブランドが存在しない() { + // Arrange + long brandId = 999L; + long categoryId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(false); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + String name = "テストアイテム"; + String description = "テスト用のアイテムです。"; + BigDecimal price = new BigDecimal(123456); + String productCode = "TEST001"; + + // Action + Executable action = () -> { + service.addItemToCatalog(name, description, price, productCode, categoryId, brandId); + }; + + // Assert + assertThrows(CatalogBrandNotFoundException.class, action); + } + + @Test + void testDeleteItemFromCatalog_正常系_リポジトリのremoveを1回呼出す() + throws CatalogNotFoundException, PermissionDeniedException, OptimisticLockingFailureException { + // Arrange + long targetId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(true); + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + when(this.catalogRepository.remove(targetId, rowVersion)).thenReturn(1); + + // Action + this.service.deleteItemFromCatalog(targetId, rowVersion); + + // Assert + verify(this.catalogRepository, times(1)).remove(targetId, rowVersion); + } + + @Test + void testDeleteItemFromCatalog_異常系_対象のアイテムが存在しない() { + // Arrange + long targetId = 999L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(false); + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + when(this.catalogRepository.remove(targetId, rowVersion)).thenReturn(1); + + // Action + Executable action = () -> { + this.service.deleteItemFromCatalog(targetId, rowVersion); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testDeleteItemFromCatalog_異常系_カタログアイテムを削除する権限がない() { + // Arrange + long targetId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(false); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(true); + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + when(this.catalogRepository.remove(targetId, rowVersion)).thenReturn(1); + + // Action + Executable action = () -> { + this.service.deleteItemFromCatalog(targetId, rowVersion); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testDeleteItemFromCatalog_異常系_楽観ロックエラー() { + // Arrange + long targetId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(true); + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + when(this.catalogRepository.remove(targetId, rowVersion)).thenReturn(0); + + // Action + Executable action = () -> { + this.service.deleteItemFromCatalog(targetId, rowVersion); + }; + + // Assert + assertThrows(OptimisticLockingFailureException.class, action); + } + + @Test + void testUpdateCatalogItem_正常系_リポジトリのupdateを1回呼出す() throws CatalogNotFoundException, PermissionDeniedException, + CatalogBrandNotFoundException, CatalogCategoryNotFoundException, OptimisticLockingFailureException { + // Arrange + long targetId = 1L; + long categoryId = 1L; + long brandId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + when(this.catalogRepository.update(any())).thenReturn(1); + String name = "name"; + String description = "Description."; + BigDecimal price = BigDecimal.valueOf(100_000_000L); + String productCode = "C000000001"; + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + this.service.updateCatalogItem(targetId, name, description, price, productCode, categoryId, brandId, rowVersion); + + // Assert + verify(this.catalogRepository, times(1)).update(any()); + } + + @Test + void testUpdateCatalogItem_異常系_対象のアイテムが存在しない() { + // Arrange + long targetId = 1L; + long categoryId = 1L; + long brandId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(false); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + when(this.catalogRepository.update(any())).thenReturn(1); + String name = "name"; + String description = "Description."; + BigDecimal price = BigDecimal.valueOf(100_000_000L); + String productCode = "C000000001"; + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, name, description, price, productCode, categoryId, brandId, rowVersion); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_対象のカテゴリが存在しない() { + // Arrange + long targetId = 1L; + long categoryId = 1L; + long brandId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(false); + when(this.catalogRepository.update(any())).thenReturn(1); + String name = "name"; + String description = "Description."; + BigDecimal price = BigDecimal.valueOf(100_000_000L); + String productCode = "C000000001"; + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, name, description, price, productCode, categoryId, brandId, rowVersion); + }; + + // Assert + assertThrows(CatalogCategoryNotFoundException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_対象のブランドが存在しない() { + // Arrange + long targetId = 1L; + long categoryId = 1L; + long brandId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(false); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + when(this.catalogRepository.update(any())).thenReturn(1); + String name = "name"; + String description = "Description."; + BigDecimal price = BigDecimal.valueOf(100_000_000L); + String productCode = "C000000001"; + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, name, description, price, productCode, categoryId, brandId, rowVersion); + }; // Assert - verify(this.catalogRepository, times(1)).findByBrandIdAndCategoryId(anyLong(), anyLong(), - anyInt(), anyInt()); + assertThrows(CatalogBrandNotFoundException.class, action); + } + @Test + void testUpdateCatalogItem_異常系_カタログアイテムを更新する権限がない() { + // Arrange + long targetId = 1L; + long categoryId = 1L; + long brandId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(false); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + when(this.catalogRepository.update(any())).thenReturn(1); + String name = "name"; + String description = "Description."; + BigDecimal price = BigDecimal.valueOf(100_000_000L); + String productCode = "C000000001"; + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, name, description, price, productCode, categoryId, brandId, rowVersion); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_楽観ロックエラーにより正常に更新ができない() { + // Arrange + long targetId = 1L; + long categoryId = 1L; + long brandId = 1L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogDomainService.existCatalogItem(targetId)).thenReturn(true); + when(this.catalogDomainService.existCatalogBrand(brandId)).thenReturn(true); + when(this.catalogDomainService.existCatalogCategory(categoryId)).thenReturn(true); + when(this.catalogRepository.update(any())).thenReturn(0); + String name = "name"; + String description = "Description."; + BigDecimal price = BigDecimal.valueOf(100_000_000L); + String productCode = "C000000001"; + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, name, description, price, productCode, categoryId, brandId, rowVersion); + }; + + // Assert + assertThrows(OptimisticLockingFailureException.class, action); } @Test void testCountCatalogItems_正常系_リポジトリのcountByBrandIdAndCategoryIdを1回呼出す() { // Arrange + long brandId = 1L; + long categoryId = 1L; when(this.catalogRepository.countByBrandIdAndCategoryId(anyLong(), anyLong())).thenReturn(1); // Act - service.countCatalogItems(1L, 1L); + service.countCatalogItems(brandId, categoryId); // Assert verify(this.catalogRepository, times(1)).countByBrandIdAndCategoryId(anyLong(), anyLong()); - } @Test @@ -92,33 +590,31 @@ void setUp() { // Assert verify(this.brandRepository, times(1)).getAll(); - } @Test void testGetCategories_正常系_リポジトリのgetAllを1回呼出す() { // Arrange List catalogCategories = List.of(new CatalogCategory("dummy")); - when(this.catalogCategoryRepository.getAll()).thenReturn(catalogCategories); + when(this.categoryRepository.getAll()).thenReturn(catalogCategories); // Act service.getCategories(); // Assert - verify(this.catalogCategoryRepository, times(1)).getAll(); - + verify(this.categoryRepository, times(1)).getAll(); } private CatalogItem createCatalogItem(long id) { - long defaultCatalogCategoryId = random.nextInt(1000); long defaultCatalogBrandId = random.nextInt(1000); + long defaultCatalogCategoryId = random.nextInt(1000); String defaultDescription = "Description."; String defaultName = "Name"; BigDecimal defaultPrice = BigDecimal.valueOf(100_000_000L); String defaultProductCode = "C000000001"; CatalogItem catalogItem = new CatalogItem(id, defaultName, defaultDescription, defaultPrice, - defaultProductCode, defaultCatalogCategoryId, defaultCatalogBrandId); + defaultProductCode, defaultCatalogBrandId, defaultCatalogCategoryId); // catalogItem.setId(id); return catalogItem; } diff --git a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/OrderApplicationServiceTest.java b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/OrderApplicationServiceTest.java index f6b506d1e..2376cb05d 100644 --- a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/OrderApplicationServiceTest.java +++ b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/OrderApplicationServiceTest.java @@ -62,7 +62,6 @@ void setUp() { // Assert assertThat(actual).isEqualTo(order); - } @Test @@ -80,7 +79,6 @@ void setUp() { // Assert assertThrows(OrderNotFoundException.class, action); - } @Test @@ -96,7 +94,6 @@ void setUp() { // Assert assertThrows(OrderNotFoundException.class, action); - } private ShipTo createDefaultShipTo() { @@ -123,5 +120,4 @@ private List createDefaultOrderItems() { return items; } - } diff --git a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/ShoppingApplicationServiceTest.java b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/ShoppingApplicationServiceTest.java index 2033abd6b..126321111 100644 --- a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/ShoppingApplicationServiceTest.java +++ b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/ShoppingApplicationServiceTest.java @@ -102,7 +102,6 @@ void setUp() { verify(this.catalogDomainService, times(1)).existAll(catalogItemIds); verify(this.catalogDomainService, times(1)).getExistCatalogItems(catalogItemIds); verify(this.basketRepository, times(1)).update(basket); - } @Test @@ -134,7 +133,6 @@ void setUp() { verify(this.basketRepository, times(1)).update(captor.capture()); Basket argBasket = captor.getValue(); assertThat(argBasket.getItems().size()).isEqualTo(0); - } @Test @@ -164,7 +162,6 @@ void setUp() { } catch (Exception e) { fail("CatalogNotFoundException が発生しなければ失敗"); } - } @Test @@ -190,7 +187,6 @@ void setUp() { // モックが想定通り呼び出されていることの確認 verify(this.basketRepository, times(1)).findByBuyerId(buyerId); verify(this.basketRepository, times(1)).update(basket); - } @Test @@ -219,7 +215,6 @@ void setUp() { verify(this.basketRepository, times(1)).update(captor.capture()); Basket argBasket = captor.getValue(); assertThat(argBasket.getItems().get(0).getQuantity()).isEqualTo(newQuantity); - } @Test @@ -247,7 +242,6 @@ void setUp() { } catch (Exception e) { fail("CatalogNotFoundException が発生しなければ失敗"); } - } @Test @@ -276,7 +270,6 @@ void setUp() { } catch (Exception e) { fail("CatalogItemInBasketNotFoundException が発生しなければ失敗"); } - } @Test @@ -302,7 +295,6 @@ void setUp() { assertThat(actual.catalogItems.get(1).getId()).isEqualTo(2L); // モックが想定通り呼び出されていることの確認 verify(this.catalogRepository, times(1)).findByCatalogItemIdIn(catalogItemIds); - } @ParameterizedTest @@ -317,7 +309,6 @@ void setUp() { } // モックが想定通り呼び出されていることの確認 verify(this.catalogRepository, times(0)).findByCatalogItemIdIn(any()); - } @Test @@ -341,7 +332,6 @@ void setUp() { verify(this.orderRepository, times(1)).add(any()); verify(this.basketRepository, times(1)).findByBuyerId(buyerId); verify(this.basketRepository, times(1)).remove(basket); - } @Test @@ -357,7 +347,6 @@ void setUp() { // Assert assertThrows(EmptyBasketOnCheckoutException.class, action); - } private ShipTo createDefaultShipTo() { diff --git a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/catalog/CatalogDomainServiceTest.java b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/catalog/CatalogDomainServiceTest.java index fbd0048c7..fd8933082 100644 --- a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/catalog/CatalogDomainServiceTest.java +++ b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/catalog/CatalogDomainServiceTest.java @@ -23,7 +23,11 @@ @ExtendWith(SpringExtension.class) public class CatalogDomainServiceTest { @Mock - private CatalogRepository repository; + private CatalogRepository catalogRepository; + @Mock + private CatalogBrandRepository catalogBrandRepository; + @Mock + private CatalogCategoryRepository catalogCategoryRepository; @InjectMocks private CatalogDomainService service; @@ -36,13 +40,13 @@ public class CatalogDomainServiceTest { List catalogItemIdsList = Arrays.asList(ArrayUtils.toObject(catalogItemIds)); List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); // Act service.getExistCatalogItems(catalogItemIdsList); // Assert - verify(this.repository, times(1)).findByCatalogItemIdIn(catalogItemIdsList); + verify(this.catalogRepository, times(1)).findByCatalogItemIdIn(catalogItemIdsList); } @Test @@ -51,7 +55,7 @@ public class CatalogDomainServiceTest { long[] catalogItemIds = { 2L }; List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); // Act List actualItems = service.getExistCatalogItems(List.of(1L, 2L)); @@ -68,13 +72,13 @@ public class CatalogDomainServiceTest { List catalogItemIdsList = Arrays.asList(ArrayUtils.toObject(catalogItemIds)); List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); // Act service.existAll(catalogItemIdsList); // Assert - verify(this.repository, times(1)).findByCatalogItemIdIn(catalogItemIdsList); + verify(this.catalogRepository, times(1)).findByCatalogItemIdIn(catalogItemIdsList); } @Test @@ -84,7 +88,7 @@ public class CatalogDomainServiceTest { List catalogItemIdsList = Arrays.asList(ArrayUtils.toObject(catalogItemIds)); List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); // Act boolean existAll = service.existAll(List.of(1L, 2L)); @@ -99,7 +103,7 @@ public class CatalogDomainServiceTest { long[] catalogItemIds = { 2L }; List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); // Act boolean existAll = service.existAll(List.of(1L, 2L)); @@ -114,7 +118,7 @@ public class CatalogDomainServiceTest { long[] catalogItemIds = {}; List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); // Act boolean existAll = service.existAll(List.of(1L, 2L)); @@ -123,6 +127,87 @@ public class CatalogDomainServiceTest { assertThat(existAll).isFalse(); } + @Test + void testExistCatalogBrand_正常系_指定したカタログブランドが存在する場合trueを返す() { + // Arrange + long targetId = 1L; + CatalogBrand catalogBrand = this.createCatalogBrand(targetId); + when(this.catalogBrandRepository.findById(targetId)).thenReturn(catalogBrand); + + // Act + boolean existCatalogBrand = service.existCatalogBrand(targetId); + + // Assert + assertThat(existCatalogBrand).isTrue(); + } + + @Test + void testExistCatalogBrand_正常系_指定したカタログブランドが存在しない場合falseを返す() { + // Arrange + long targetId = 1L; + when(this.catalogBrandRepository.findById(targetId)).thenReturn(null); + + // Act + boolean existCatalogBrand = service.existCatalogBrand(targetId); + + // Assert + assertThat(existCatalogBrand).isFalse(); + } + + @Test + void testExistCatalogCategory_正常系_指定したカタログカテゴリが存在する場合trueを返す() { + // Arrange + long targetId = 1L; + CatalogCategory catalogCategory = this.createCatalogCategory(targetId); + when(this.catalogCategoryRepository.findById(targetId)).thenReturn(catalogCategory); + + // Act + boolean existCatalogCategory = service.existCatalogCategory(targetId); + + // Assert + assertThat(existCatalogCategory).isTrue(); + } + + @Test + void testExistCatalogCategory_正常系_指定したカタログカテゴリが存在しない場合falseを返す() { + // Arrange + long targetId = 1L; + when(this.catalogCategoryRepository.findById(targetId)).thenReturn(null); + + // Act + boolean existCatalogCategory = service.existCatalogCategory(targetId); + + // Assert + assertThat(existCatalogCategory).isFalse(); + } + + @Test + void testExistCatalogItem_正常系_指定したカタログアイテムが存在する場合trueを返す() { + // Arrange + long targetId = 1L; + CatalogItem catalogItem = this.createCatalogItem(targetId); + when(this.catalogRepository.findById(targetId)).thenReturn(catalogItem); + + // Act + boolean existCatalogItem = service.existCatalogItem(targetId); + + // Assert + assertThat(existCatalogItem).isTrue(); + } + + @Test + void testExistCatalogItem_正常系_指定したカタログアイテムが存在しない場合falseを返す() { + // Arrange + long targetId = 1L; + when(this.catalogRepository.findById(targetId)).thenReturn(null); + + // Act + boolean existCatalogItem = service.existCatalogItem(targetId); + + // Assert + assertThat(existCatalogItem).isFalse(); + } + private CatalogItem createCatalogItem(long id) { long defaultCatalogCategoryId = random.nextInt(1000); long defaultCatalogBrandId = random.nextInt(1000); @@ -136,4 +221,16 @@ private CatalogItem createCatalogItem(long id) { // catalogItem.setId(id); return catalogItem; } + + private CatalogBrand createCatalogBrand(long id) { + String defaultName = "Name"; + CatalogBrand catalogBrand = new CatalogBrand(defaultName); + return catalogBrand; + } + + private CatalogCategory createCatalogCategory(long id) { + String defaultName = "Name"; + CatalogCategory catalogCategory = new CatalogCategory(defaultName); + return catalogCategory; + } } diff --git a/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/BatchApplication.java b/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/BatchApplication.java index e793c7716..12b45cc92 100644 --- a/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/BatchApplication.java +++ b/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/BatchApplication.java @@ -18,5 +18,4 @@ public static void main(String[] args) { app.setWebApplicationType(WebApplicationType.NONE); System.exit(SpringApplication.exit(app.run(args))); } - } diff --git a/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/job/BatchConfiguration.java b/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/job/BatchConfiguration.java index 73f347e41..27e299924 100644 --- a/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/job/BatchConfiguration.java +++ b/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/job/BatchConfiguration.java @@ -98,5 +98,4 @@ public Job catalogItem_job(JobCompletionNotificationListener listener, return new JobBuilder("catalogItem_job", jobRepository).incrementer(new RunIdIncrementer()) .listener(listener).flow(step1).end().build(); } - } diff --git a/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/job/catalog/CatalogItemReaderConf.java b/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/job/catalog/CatalogItemReaderConf.java index 3cb1c390e..3749c8676 100644 --- a/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/job/catalog/CatalogItemReaderConf.java +++ b/samples/web-csr/dressca-backend/batch/src/main/java/com/dressca/batch/job/catalog/CatalogItemReaderConf.java @@ -28,5 +28,4 @@ public MyBatisPagingItemReader catalogItemReader() { .pageSize(10) .build(); } - } diff --git a/samples/web-csr/dressca-backend/batch/src/test/java/com/dressca/batch/CatalogItemJobTest.java b/samples/web-csr/dressca-backend/batch/src/test/java/com/dressca/batch/CatalogItemJobTest.java index b77ce0668..df646b861 100644 --- a/samples/web-csr/dressca-backend/batch/src/test/java/com/dressca/batch/CatalogItemJobTest.java +++ b/samples/web-csr/dressca-backend/batch/src/test/java/com/dressca/batch/CatalogItemJobTest.java @@ -125,8 +125,8 @@ public void stepTest_10data() throws Exception { private void insertTestData() { for (int i = 0; i < 10; i++) { String insertItem = "insert into catalog_items" - + " (id,name,description,price,product_code,catalog_category_id,catalog_brand_id)" - + " values (?,?,?,1000,'C000000001',1,1)"; + + " (id,name,description,price,product_code,catalog_category_id,catalog_brand_id,row_version)" + + " values (?,?,?,1000,'C000000001',1,1,'2024-01-01 00:00:00')"; String insertItemAsset = "insert into catalog_item_assets (id,asset_code,catalog_item_id)" + " values (?,'dummy',?)"; jdbcTemplate.update(insertItem, 101 + i, "sample" + i, "商品説明" + i); diff --git a/samples/web-csr/dressca-backend/infrastructure/build.gradle b/samples/web-csr/dressca-backend/infrastructure/build.gradle index cab6fee6e..1802e915b 100644 --- a/samples/web-csr/dressca-backend/infrastructure/build.gradle +++ b/samples/web-csr/dressca-backend/infrastructure/build.gradle @@ -47,3 +47,78 @@ tasks.named('test') { bootJar.enabled = false jar.enabled = true + +task updateMyBatisGeneratorMapperForOptimisticLocking { + doLast { + + // MyBatis Generator で生成されたマッパーの xml ファイルがあるディレクトリ + def generatedDirectory = 'src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/' + + // 楽観ロック対応させるマッパーの xml ファイルのリスト + def xmlFilePaths = ['CatalogItemMapper.xml'] + + // 楽観ロック制御を行う列名 + def optimisticLockColumn = 'row_version' + // 楽観ロック制御を行う列のDB上のデータ型 + def optimisticLockJdbcType = 'TIMESTAMP' + // エンティティに変換した際の楽観ロック制御を行う列名 + def optimisticLockVariable = toLowerCamelCase(optimisticLockColumn) + + xmlFilePaths.each { path -> + + def xmlFile = file(generatedDirectory + path) + def xmlContent = xmlFile.text + + // 正規表現と置換のペアをリストにまとめる + def replacements = [ + [ /()/, + "\$1 and ${optimisticLockColumn} = #{${optimisticLockVariable},jdbcType=${optimisticLockJdbcType}}\n \$2" ], + [ /()/, + "\$1 and ${optimisticLockColumn} = #{${optimisticLockVariable},jdbcType=${optimisticLockJdbcType}}\n \$2" ] + ] + + // 置換処理をループで実行 + replacements.each { pattern, replacement -> + xmlContent = xmlContent.replaceAll(pattern, replacement) + } + + xmlFile.write(xmlContent) + } + } +} + +// スネークケースをローワーキャメルケースに変換するメソッド +String toLowerCamelCase(String snakeCase) { + StringBuilder camelCase = new StringBuilder() + boolean nextCharUpperCase = false + + for (int i = 0; i < snakeCase.length(); i++) { + char currentChar = snakeCase.charAt(i) + + if (currentChar == '_') { + nextCharUpperCase = true + } else { + if (nextCharUpperCase) { + camelCase.append(Character.toUpperCase(currentChar)) + nextCharUpperCase = false + } else { + camelCase.append(currentChar) + } + } + } + + // 最初の文字を小文字にする + if (camelCase.length() > 0) { + camelCase.setCharAt(0, Character.toLowerCase(camelCase.charAt(0))) + } + + return camelCase.toString() +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogBrandRepository.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogBrandRepository.java index 9091f3f7c..d263410c9 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogBrandRepository.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogBrandRepository.java @@ -4,6 +4,7 @@ import java.util.stream.Collectors; import com.dressca.applicationcore.catalog.CatalogBrand; import com.dressca.applicationcore.catalog.CatalogBrandRepository; +import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogBrandEntity; import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogBrandEntityExample; import com.dressca.infrastructure.repository.mybatis.generated.mapper.CatalogBrandMapper; import com.dressca.infrastructure.repository.mybatis.translator.EntityTranslator; @@ -28,4 +29,11 @@ public List getAll() { .map(EntityTranslator::catalogBrandEntityTranslate) .collect(Collectors.toList()); } + + @Override + public CatalogBrand findById(long id) { + CatalogBrandEntity entity = catalogBrandMapper.selectByPrimaryKey(id); + CatalogBrand brand = EntityTranslator.catalogBrandEntityTranslate(entity); + return brand; + } } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogCategoryRepository.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogCategoryRepository.java index 01c857d02..29999374b 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogCategoryRepository.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogCategoryRepository.java @@ -4,6 +4,7 @@ import java.util.stream.Collectors; import com.dressca.applicationcore.catalog.CatalogCategory; import com.dressca.applicationcore.catalog.CatalogCategoryRepository; +import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogCategoryEntity; import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogCategoryEntityExample; import com.dressca.infrastructure.repository.mybatis.generated.mapper.CatalogCategoryMapper; import com.dressca.infrastructure.repository.mybatis.translator.EntityTranslator; @@ -29,4 +30,10 @@ public List getAll() { .collect(Collectors.toList()); } + @Override + public CatalogCategory findById(long id) { + CatalogCategoryEntity entity = catalogCategoryMapper.selectByPrimaryKey(id); + CatalogCategory category = EntityTranslator.catalogCategoryEntityTranslate(entity); + return category; + } } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogRepository.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogRepository.java index ec22d967a..3a6ae038a 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogRepository.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogRepository.java @@ -2,7 +2,12 @@ import com.dressca.applicationcore.catalog.CatalogItem; import com.dressca.applicationcore.catalog.CatalogRepository; +import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogItemEntity; +import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogItemEntityExample; +import com.dressca.infrastructure.repository.mybatis.generated.mapper.CatalogItemMapper; import com.dressca.infrastructure.repository.mybatis.mapper.JoinedCatalogItemMapper; +import com.dressca.infrastructure.repository.mybatis.translator.EntityTranslator; +import java.time.LocalDateTime; import java.util.List; import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; @@ -18,6 +23,9 @@ public class MybatisCatalogRepository implements CatalogRepository { @Autowired private JoinedCatalogItemMapper mapper; + @Autowired + private CatalogItemMapper catalogItemMapper; + @Override public List findByCategoryIdIn(List categoryIds) { return mapper.findByCategoryIdIn(categoryIds); @@ -26,7 +34,7 @@ public List findByCategoryIdIn(List categoryIds) { @Override public List findByBrandIdAndCategoryId(long brandId, long categoryId, int page, int pageSize) { - int offset = pageSize * page; + int offset = pageSize * (page - 1); return mapper.findByBrandIdAndCategoryId(brandId, categoryId, pageSize, offset); } @@ -44,4 +52,38 @@ public int countByBrandIdAndCategoryId(long brandId, long categoryId) { public List findWithPaging(int skipRows, int pageSize) { return mapper.findWithPaging(skipRows, pageSize); } + + @Override + public CatalogItem findById(long id) { + return mapper.findById(id); + } + + @Override + public CatalogItem add(CatalogItem item) { + CatalogItemEntity entity = EntityTranslator.createCatalogItemEntity(item); + catalogItemMapper.insert(entity); + item.setId(entity.getId()); + return item; + } + + @Override + public int remove(Long id, LocalDateTime rowVersion) { + CatalogItemEntityExample catalogItemExample = new CatalogItemEntityExample(); + catalogItemExample.createCriteria().andIdEqualTo(id).andRowVersionEqualTo(rowVersion); + return catalogItemMapper.deleteByExample(catalogItemExample); + } + + @Override + public int update(CatalogItem item) { + CatalogItemEntity catalogItemEntity = new CatalogItemEntity(); + catalogItemEntity.setId(item.getId()); + catalogItemEntity.setName(item.getName()); + catalogItemEntity.setDescription(item.getDescription()); + catalogItemEntity.setPrice(item.getPrice()); + catalogItemEntity.setProductCode(item.getProductCode()); + catalogItemEntity.setCatalogCategoryId(item.getCatalogCategoryId()); + catalogItemEntity.setCatalogBrandId(item.getCatalogBrandId()); + catalogItemEntity.setRowVersion(item.getRowVersion()); + return this.catalogItemMapper.updateByPrimaryKey(catalogItemEntity); + } } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntity.java index 7b0bc3cc7..bead9faee 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntity.java @@ -6,7 +6,7 @@ public class AssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class AssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String assetCode; @@ -24,7 +24,7 @@ public class AssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column assets.asset_type * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String assetType; @@ -34,7 +34,7 @@ public class AssetEntity { * * @return the value of assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -46,7 +46,7 @@ public Long getId() { * * @param id the value for assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -58,7 +58,7 @@ public void setId(Long id) { * * @return the value of assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getAssetCode() { return assetCode; @@ -70,7 +70,7 @@ public String getAssetCode() { * * @param assetCode the value for assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setAssetCode(String assetCode) { this.assetCode = assetCode; @@ -82,7 +82,7 @@ public void setAssetCode(String assetCode) { * * @return the value of assets.asset_type * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getAssetType() { return assetType; @@ -94,7 +94,7 @@ public String getAssetType() { * * @param assetType the value for assets.asset_type * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setAssetType(String assetType) { this.assetType = assetType; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntityExample.java index 17a7aa3f7..e0d756497 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntityExample.java @@ -8,7 +8,7 @@ public class AssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class AssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class AssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class AssetEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public AssetEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public AssetEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -399,7 +399,7 @@ public Criteria andAssetTypeNotBetween(String value1, String value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table assets * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -411,7 +411,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntity.java index efa6d5c92..06488e668 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntity.java @@ -6,7 +6,7 @@ public class BasketEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column baskets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class BasketEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column baskets.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String buyerId; @@ -25,7 +25,7 @@ public class BasketEntity { * * @return the value of baskets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -37,7 +37,7 @@ public Long getId() { * * @param id the value for baskets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -49,7 +49,7 @@ public void setId(Long id) { * * @return the value of baskets.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getBuyerId() { return buyerId; @@ -61,7 +61,7 @@ public String getBuyerId() { * * @param buyerId the value for baskets.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setBuyerId(String buyerId) { this.buyerId = buyerId; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntityExample.java index 2938f9fc2..5f76960f0 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntityExample.java @@ -8,7 +8,7 @@ public class BasketEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class BasketEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class BasketEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class BasketEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BasketEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public BasketEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -329,7 +329,7 @@ public Criteria andBuyerIdNotBetween(String value1, String value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table baskets * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -341,7 +341,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntity.java index bb4ecb454..eb69286db 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntity.java @@ -8,7 +8,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -17,7 +17,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.basket_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long basketId; @@ -26,7 +26,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long catalogItemId; @@ -35,7 +35,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal unitPrice; @@ -44,7 +44,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Integer quantity; @@ -54,7 +54,7 @@ public class BasketItemEntity { * * @return the value of basket_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -66,7 +66,7 @@ public Long getId() { * * @param id the value for basket_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -78,7 +78,7 @@ public void setId(Long id) { * * @return the value of basket_items.basket_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getBasketId() { return basketId; @@ -90,7 +90,7 @@ public Long getBasketId() { * * @param basketId the value for basket_items.basket_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setBasketId(Long basketId) { this.basketId = basketId; @@ -102,7 +102,7 @@ public void setBasketId(Long basketId) { * * @return the value of basket_items.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getCatalogItemId() { return catalogItemId; @@ -114,7 +114,7 @@ public Long getCatalogItemId() { * * @param catalogItemId the value for basket_items.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setCatalogItemId(Long catalogItemId) { this.catalogItemId = catalogItemId; @@ -126,7 +126,7 @@ public void setCatalogItemId(Long catalogItemId) { * * @return the value of basket_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getUnitPrice() { return unitPrice; @@ -138,7 +138,7 @@ public BigDecimal getUnitPrice() { * * @param unitPrice the value for basket_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setUnitPrice(BigDecimal unitPrice) { this.unitPrice = unitPrice; @@ -150,7 +150,7 @@ public void setUnitPrice(BigDecimal unitPrice) { * * @return the value of basket_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Integer getQuantity() { return quantity; @@ -162,7 +162,7 @@ public Integer getQuantity() { * * @param quantity the value for basket_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setQuantity(Integer quantity) { this.quantity = quantity; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntityExample.java index 75f416517..9ca21a956 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntityExample.java @@ -9,7 +9,7 @@ public class BasketItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -17,7 +17,7 @@ public class BasketItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -25,7 +25,7 @@ public class BasketItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -33,7 +33,7 @@ public class BasketItemEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BasketItemEntityExample() { oredCriteria = new ArrayList<>(); @@ -43,7 +43,7 @@ public BasketItemEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -53,7 +53,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -63,7 +63,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -73,7 +73,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -83,7 +83,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -93,7 +93,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -103,7 +103,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -115,7 +115,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -129,7 +129,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -140,7 +140,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -152,7 +152,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -500,7 +500,7 @@ public Criteria andQuantityNotBetween(Integer value1, Integer value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table basket_items * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -512,7 +512,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntity.java index 94190e0cd..d48fa6df8 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntity.java @@ -6,7 +6,7 @@ public class CatalogBrandEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_brands.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class CatalogBrandEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_brands.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String name; @@ -25,7 +25,7 @@ public class CatalogBrandEntity { * * @return the value of catalog_brands.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -37,7 +37,7 @@ public Long getId() { * * @param id the value for catalog_brands.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -49,7 +49,7 @@ public void setId(Long id) { * * @return the value of catalog_brands.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getName() { return name; @@ -61,7 +61,7 @@ public String getName() { * * @param name the value for catalog_brands.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setName(String name) { this.name = name; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntityExample.java index bf047cba2..d07492b58 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntityExample.java @@ -8,7 +8,7 @@ public class CatalogBrandEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class CatalogBrandEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class CatalogBrandEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class CatalogBrandEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public CatalogBrandEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public CatalogBrandEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -329,7 +329,7 @@ public Criteria andNameNotBetween(String value1, String value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_brands * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -341,7 +341,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntity.java index 79fa1b183..c9e502f36 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntity.java @@ -6,7 +6,7 @@ public class CatalogCategoryEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_categories.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class CatalogCategoryEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_categories.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String name; @@ -25,7 +25,7 @@ public class CatalogCategoryEntity { * * @return the value of catalog_categories.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -37,7 +37,7 @@ public Long getId() { * * @param id the value for catalog_categories.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -49,7 +49,7 @@ public void setId(Long id) { * * @return the value of catalog_categories.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getName() { return name; @@ -61,7 +61,7 @@ public String getName() { * * @param name the value for catalog_categories.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setName(String name) { this.name = name; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntityExample.java index d6ad792d9..09666aa1c 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntityExample.java @@ -8,7 +8,7 @@ public class CatalogCategoryEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class CatalogCategoryEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class CatalogCategoryEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class CatalogCategoryEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public CatalogCategoryEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public CatalogCategoryEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -329,7 +329,7 @@ public Criteria andNameNotBetween(String value1, String value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_categories * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -341,7 +341,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntity.java index 627876d8f..f6ea4e9d5 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntity.java @@ -6,7 +6,7 @@ public class CatalogItemAssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_item_assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class CatalogItemAssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_item_assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String assetCode; @@ -24,7 +24,7 @@ public class CatalogItemAssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_item_assets.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long catalogItemId; @@ -34,7 +34,7 @@ public class CatalogItemAssetEntity { * * @return the value of catalog_item_assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -46,7 +46,7 @@ public Long getId() { * * @param id the value for catalog_item_assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -58,7 +58,7 @@ public void setId(Long id) { * * @return the value of catalog_item_assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getAssetCode() { return assetCode; @@ -70,7 +70,7 @@ public String getAssetCode() { * * @param assetCode the value for catalog_item_assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setAssetCode(String assetCode) { this.assetCode = assetCode; @@ -82,7 +82,7 @@ public void setAssetCode(String assetCode) { * * @return the value of catalog_item_assets.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getCatalogItemId() { return catalogItemId; @@ -94,7 +94,7 @@ public Long getCatalogItemId() { * * @param catalogItemId the value for catalog_item_assets.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setCatalogItemId(Long catalogItemId) { this.catalogItemId = catalogItemId; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntityExample.java index 37471973d..b4944e8de 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntityExample.java @@ -8,7 +8,7 @@ public class CatalogItemAssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class CatalogItemAssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class CatalogItemAssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class CatalogItemAssetEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public CatalogItemAssetEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public CatalogItemAssetEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -389,7 +389,7 @@ public Criteria andCatalogItemIdNotBetween(Long value1, Long value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_item_assets * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -401,7 +401,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntity.java index a5c42d2dc..f26096e23 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntity.java @@ -1,6 +1,7 @@ package com.dressca.infrastructure.repository.mybatis.generated.entity; import java.math.BigDecimal; +import java.time.LocalDateTime; public class CatalogItemEntity { /** @@ -8,7 +9,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private Long id; @@ -17,7 +18,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private String name; @@ -26,7 +27,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.description * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private String description; @@ -35,7 +36,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private BigDecimal price; @@ -44,7 +45,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private String productCode; @@ -53,7 +54,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.catalog_category_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private Long catalogCategoryId; @@ -62,17 +63,26 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.catalog_brand_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private Long catalogBrandId; + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column catalog_items.row_version + * + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 + */ + private LocalDateTime rowVersion; + /** * This method was generated by MyBatis Generator. * This method returns the value of the database column catalog_items.id * * @return the value of catalog_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Long getId() { return id; @@ -84,7 +94,7 @@ public Long getId() { * * @param id the value for catalog_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setId(Long id) { this.id = id; @@ -96,7 +106,7 @@ public void setId(Long id) { * * @return the value of catalog_items.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public String getName() { return name; @@ -108,7 +118,7 @@ public String getName() { * * @param name the value for catalog_items.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setName(String name) { this.name = name; @@ -120,7 +130,7 @@ public void setName(String name) { * * @return the value of catalog_items.description * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public String getDescription() { return description; @@ -132,7 +142,7 @@ public String getDescription() { * * @param description the value for catalog_items.description * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setDescription(String description) { this.description = description; @@ -144,7 +154,7 @@ public void setDescription(String description) { * * @return the value of catalog_items.price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public BigDecimal getPrice() { return price; @@ -156,7 +166,7 @@ public BigDecimal getPrice() { * * @param price the value for catalog_items.price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setPrice(BigDecimal price) { this.price = price; @@ -168,7 +178,7 @@ public void setPrice(BigDecimal price) { * * @return the value of catalog_items.product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public String getProductCode() { return productCode; @@ -180,7 +190,7 @@ public String getProductCode() { * * @param productCode the value for catalog_items.product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setProductCode(String productCode) { this.productCode = productCode; @@ -192,7 +202,7 @@ public void setProductCode(String productCode) { * * @return the value of catalog_items.catalog_category_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Long getCatalogCategoryId() { return catalogCategoryId; @@ -204,7 +214,7 @@ public Long getCatalogCategoryId() { * * @param catalogCategoryId the value for catalog_items.catalog_category_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setCatalogCategoryId(Long catalogCategoryId) { this.catalogCategoryId = catalogCategoryId; @@ -216,7 +226,7 @@ public void setCatalogCategoryId(Long catalogCategoryId) { * * @return the value of catalog_items.catalog_brand_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Long getCatalogBrandId() { return catalogBrandId; @@ -228,9 +238,33 @@ public Long getCatalogBrandId() { * * @param catalogBrandId the value for catalog_items.catalog_brand_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setCatalogBrandId(Long catalogBrandId) { this.catalogBrandId = catalogBrandId; } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column catalog_items.row_version + * + * @return the value of catalog_items.row_version + * + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 + */ + public LocalDateTime getRowVersion() { + return rowVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column catalog_items.row_version + * + * @param rowVersion the value for catalog_items.row_version + * + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 + */ + public void setRowVersion(LocalDateTime rowVersion) { + this.rowVersion = rowVersion; + } } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntityExample.java index 9f8b38664..37ea4a7a2 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntityExample.java @@ -1,6 +1,7 @@ package com.dressca.infrastructure.repository.mybatis.generated.entity; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class CatalogItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected String orderByClause; @@ -17,7 +18,7 @@ public class CatalogItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected boolean distinct; @@ -25,7 +26,7 @@ public class CatalogItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected List oredCriteria; @@ -33,7 +34,7 @@ public class CatalogItemEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public CatalogItemEntityExample() { oredCriteria = new ArrayList<>(); @@ -43,7 +44,7 @@ public CatalogItemEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -53,7 +54,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -63,7 +64,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -73,7 +74,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public boolean isDistinct() { return distinct; @@ -83,7 +84,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -93,7 +94,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -103,7 +104,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -115,7 +116,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -129,7 +130,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -140,7 +141,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -152,7 +153,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -644,13 +645,73 @@ public Criteria andCatalogBrandIdNotBetween(Long value1, Long value2) { addCriterion("catalog_brand_id not between", value1, value2, "catalogBrandId"); return (Criteria) this; } + + public Criteria andRowVersionIsNull() { + addCriterion("row_version is null"); + return (Criteria) this; + } + + public Criteria andRowVersionIsNotNull() { + addCriterion("row_version is not null"); + return (Criteria) this; + } + + public Criteria andRowVersionEqualTo(LocalDateTime value) { + addCriterion("row_version =", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionNotEqualTo(LocalDateTime value) { + addCriterion("row_version <>", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionGreaterThan(LocalDateTime value) { + addCriterion("row_version >", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("row_version >=", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionLessThan(LocalDateTime value) { + addCriterion("row_version <", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionLessThanOrEqualTo(LocalDateTime value) { + addCriterion("row_version <=", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionIn(List values) { + addCriterion("row_version in", values, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionNotIn(List values) { + addCriterion("row_version not in", values, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("row_version between", value1, value2, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("row_version not between", value1, value2, "rowVersion"); + return (Criteria) this; + } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_items * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Fri Nov 01 11:41:58 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -662,7 +723,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntity.java index 18d529a15..c77b52ebe 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntity.java @@ -9,7 +9,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -18,7 +18,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String buyerId; @@ -27,7 +27,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.order_date * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Date orderDate; @@ -36,7 +36,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_full_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToFullName; @@ -45,7 +45,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_postal_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToPostalCode; @@ -54,7 +54,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_todofuken * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToTodofuken; @@ -63,7 +63,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_shikuchoson * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToShikuchoson; @@ -72,7 +72,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_azana_and_others * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToAzanaAndOthers; @@ -81,7 +81,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.consumption_tax_rate * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal consumptionTaxRate; @@ -90,7 +90,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.total_items_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal totalItemsPrice; @@ -99,7 +99,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.delivery_charge * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal deliveryCharge; @@ -108,7 +108,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.consumption_tax * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal consumptionTax; @@ -117,7 +117,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.total_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal totalPrice; @@ -127,7 +127,7 @@ public class OrderEntity { * * @return the value of orders.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -139,7 +139,7 @@ public Long getId() { * * @param id the value for orders.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -151,7 +151,7 @@ public void setId(Long id) { * * @return the value of orders.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getBuyerId() { return buyerId; @@ -163,7 +163,7 @@ public String getBuyerId() { * * @param buyerId the value for orders.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setBuyerId(String buyerId) { this.buyerId = buyerId; @@ -175,7 +175,7 @@ public void setBuyerId(String buyerId) { * * @return the value of orders.order_date * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Date getOrderDate() { return orderDate; @@ -187,7 +187,7 @@ public Date getOrderDate() { * * @param orderDate the value for orders.order_date * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderDate(Date orderDate) { this.orderDate = orderDate; @@ -199,7 +199,7 @@ public void setOrderDate(Date orderDate) { * * @return the value of orders.ship_to_full_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToFullName() { return shipToFullName; @@ -211,7 +211,7 @@ public String getShipToFullName() { * * @param shipToFullName the value for orders.ship_to_full_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToFullName(String shipToFullName) { this.shipToFullName = shipToFullName; @@ -223,7 +223,7 @@ public void setShipToFullName(String shipToFullName) { * * @return the value of orders.ship_to_postal_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToPostalCode() { return shipToPostalCode; @@ -235,7 +235,7 @@ public String getShipToPostalCode() { * * @param shipToPostalCode the value for orders.ship_to_postal_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToPostalCode(String shipToPostalCode) { this.shipToPostalCode = shipToPostalCode; @@ -247,7 +247,7 @@ public void setShipToPostalCode(String shipToPostalCode) { * * @return the value of orders.ship_to_todofuken * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToTodofuken() { return shipToTodofuken; @@ -259,7 +259,7 @@ public String getShipToTodofuken() { * * @param shipToTodofuken the value for orders.ship_to_todofuken * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToTodofuken(String shipToTodofuken) { this.shipToTodofuken = shipToTodofuken; @@ -271,7 +271,7 @@ public void setShipToTodofuken(String shipToTodofuken) { * * @return the value of orders.ship_to_shikuchoson * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToShikuchoson() { return shipToShikuchoson; @@ -283,7 +283,7 @@ public String getShipToShikuchoson() { * * @param shipToShikuchoson the value for orders.ship_to_shikuchoson * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToShikuchoson(String shipToShikuchoson) { this.shipToShikuchoson = shipToShikuchoson; @@ -295,7 +295,7 @@ public void setShipToShikuchoson(String shipToShikuchoson) { * * @return the value of orders.ship_to_azana_and_others * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToAzanaAndOthers() { return shipToAzanaAndOthers; @@ -307,7 +307,7 @@ public String getShipToAzanaAndOthers() { * * @param shipToAzanaAndOthers the value for orders.ship_to_azana_and_others * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToAzanaAndOthers(String shipToAzanaAndOthers) { this.shipToAzanaAndOthers = shipToAzanaAndOthers; @@ -319,7 +319,7 @@ public void setShipToAzanaAndOthers(String shipToAzanaAndOthers) { * * @return the value of orders.consumption_tax_rate * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getConsumptionTaxRate() { return consumptionTaxRate; @@ -331,7 +331,7 @@ public BigDecimal getConsumptionTaxRate() { * * @param consumptionTaxRate the value for orders.consumption_tax_rate * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setConsumptionTaxRate(BigDecimal consumptionTaxRate) { this.consumptionTaxRate = consumptionTaxRate; @@ -343,7 +343,7 @@ public void setConsumptionTaxRate(BigDecimal consumptionTaxRate) { * * @return the value of orders.total_items_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getTotalItemsPrice() { return totalItemsPrice; @@ -355,7 +355,7 @@ public BigDecimal getTotalItemsPrice() { * * @param totalItemsPrice the value for orders.total_items_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setTotalItemsPrice(BigDecimal totalItemsPrice) { this.totalItemsPrice = totalItemsPrice; @@ -367,7 +367,7 @@ public void setTotalItemsPrice(BigDecimal totalItemsPrice) { * * @return the value of orders.delivery_charge * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getDeliveryCharge() { return deliveryCharge; @@ -379,7 +379,7 @@ public BigDecimal getDeliveryCharge() { * * @param deliveryCharge the value for orders.delivery_charge * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDeliveryCharge(BigDecimal deliveryCharge) { this.deliveryCharge = deliveryCharge; @@ -391,7 +391,7 @@ public void setDeliveryCharge(BigDecimal deliveryCharge) { * * @return the value of orders.consumption_tax * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getConsumptionTax() { return consumptionTax; @@ -403,7 +403,7 @@ public BigDecimal getConsumptionTax() { * * @param consumptionTax the value for orders.consumption_tax * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setConsumptionTax(BigDecimal consumptionTax) { this.consumptionTax = consumptionTax; @@ -415,7 +415,7 @@ public void setConsumptionTax(BigDecimal consumptionTax) { * * @return the value of orders.total_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getTotalPrice() { return totalPrice; @@ -427,7 +427,7 @@ public BigDecimal getTotalPrice() { * * @param totalPrice the value for orders.total_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setTotalPrice(BigDecimal totalPrice) { this.totalPrice = totalPrice; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntityExample.java index 48b547dd1..de1bb0fdd 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntityExample.java @@ -10,7 +10,7 @@ public class OrderEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -18,7 +18,7 @@ public class OrderEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -26,7 +26,7 @@ public class OrderEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -34,7 +34,7 @@ public class OrderEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public OrderEntityExample() { oredCriteria = new ArrayList<>(); @@ -44,7 +44,7 @@ public OrderEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -54,7 +54,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -64,7 +64,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -74,7 +74,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -84,7 +84,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -94,7 +94,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -104,7 +104,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -116,7 +116,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -130,7 +130,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -141,7 +141,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -153,7 +153,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -1041,7 +1041,7 @@ public Criteria andTotalPriceNotBetween(BigDecimal value1, BigDecimal value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table orders * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -1053,7 +1053,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntity.java index 95d87e55d..97cb995be 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntity.java @@ -8,7 +8,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -17,7 +17,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.ordered_catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long orderedCatalogItemId; @@ -26,7 +26,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.ordered_product_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String orderedProductName; @@ -35,7 +35,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.ordered_product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String orderedProductCode; @@ -44,7 +44,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal unitPrice; @@ -53,7 +53,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Integer quantity; @@ -62,7 +62,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.order_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long orderId; @@ -72,7 +72,7 @@ public class OrderItemEntity { * * @return the value of order_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -84,7 +84,7 @@ public Long getId() { * * @param id the value for order_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -96,7 +96,7 @@ public void setId(Long id) { * * @return the value of order_items.ordered_catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getOrderedCatalogItemId() { return orderedCatalogItemId; @@ -108,7 +108,7 @@ public Long getOrderedCatalogItemId() { * * @param orderedCatalogItemId the value for order_items.ordered_catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderedCatalogItemId(Long orderedCatalogItemId) { this.orderedCatalogItemId = orderedCatalogItemId; @@ -120,7 +120,7 @@ public void setOrderedCatalogItemId(Long orderedCatalogItemId) { * * @return the value of order_items.ordered_product_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderedProductName() { return orderedProductName; @@ -132,7 +132,7 @@ public String getOrderedProductName() { * * @param orderedProductName the value for order_items.ordered_product_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderedProductName(String orderedProductName) { this.orderedProductName = orderedProductName; @@ -144,7 +144,7 @@ public void setOrderedProductName(String orderedProductName) { * * @return the value of order_items.ordered_product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderedProductCode() { return orderedProductCode; @@ -156,7 +156,7 @@ public String getOrderedProductCode() { * * @param orderedProductCode the value for order_items.ordered_product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderedProductCode(String orderedProductCode) { this.orderedProductCode = orderedProductCode; @@ -168,7 +168,7 @@ public void setOrderedProductCode(String orderedProductCode) { * * @return the value of order_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getUnitPrice() { return unitPrice; @@ -180,7 +180,7 @@ public BigDecimal getUnitPrice() { * * @param unitPrice the value for order_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setUnitPrice(BigDecimal unitPrice) { this.unitPrice = unitPrice; @@ -192,7 +192,7 @@ public void setUnitPrice(BigDecimal unitPrice) { * * @return the value of order_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Integer getQuantity() { return quantity; @@ -204,7 +204,7 @@ public Integer getQuantity() { * * @param quantity the value for order_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setQuantity(Integer quantity) { this.quantity = quantity; @@ -216,7 +216,7 @@ public void setQuantity(Integer quantity) { * * @return the value of order_items.order_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getOrderId() { return orderId; @@ -228,7 +228,7 @@ public Long getOrderId() { * * @param orderId the value for order_items.order_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderId(Long orderId) { this.orderId = orderId; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntityExample.java index c45755dde..35d96f103 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntityExample.java @@ -9,7 +9,7 @@ public class OrderItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -17,7 +17,7 @@ public class OrderItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -25,7 +25,7 @@ public class OrderItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -33,7 +33,7 @@ public class OrderItemEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public OrderItemEntityExample() { oredCriteria = new ArrayList<>(); @@ -43,7 +43,7 @@ public OrderItemEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -53,7 +53,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -63,7 +63,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -73,7 +73,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -83,7 +83,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -93,7 +93,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -103,7 +103,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -115,7 +115,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -129,7 +129,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -140,7 +140,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -152,7 +152,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -640,7 +640,7 @@ public Criteria andOrderIdNotBetween(Long value1, Long value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table order_items * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -652,7 +652,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.java index 03cc4807c..058a223e5 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.java @@ -12,7 +12,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(AssetEntityExample example); @@ -20,7 +20,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(AssetEntityExample example); @@ -28,7 +28,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(AssetEntity row); @@ -44,7 +44,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(AssetEntity row); @@ -52,7 +52,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(AssetEntityExample example); @@ -60,7 +60,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ AssetEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") AssetEntity row, @Param("example") AssetEntityExample example); @@ -76,7 +76,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") AssetEntity row, @Param("example") AssetEntityExample example); @@ -84,7 +84,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(AssetEntity row); @@ -92,7 +92,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(AssetEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.java index 451fe44b9..8fde6608a 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.java @@ -12,7 +12,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(BasketItemEntityExample example); @@ -20,7 +20,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(BasketItemEntityExample example); @@ -28,7 +28,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(BasketItemEntity row); @@ -44,7 +44,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(BasketItemEntity row); @@ -52,7 +52,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(BasketItemEntityExample example); @@ -60,7 +60,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ BasketItemEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") BasketItemEntity row, @Param("example") BasketItemEntityExample example); @@ -76,7 +76,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") BasketItemEntity row, @Param("example") BasketItemEntityExample example); @@ -84,7 +84,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(BasketItemEntity row); @@ -92,7 +92,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(BasketItemEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.java index 33f293120..651fb3066 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.java @@ -12,7 +12,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(BasketEntityExample example); @@ -20,7 +20,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(BasketEntityExample example); @@ -28,7 +28,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(BasketEntity row); @@ -44,7 +44,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(BasketEntity row); @@ -52,7 +52,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(BasketEntityExample example); @@ -60,7 +60,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ BasketEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") BasketEntity row, @Param("example") BasketEntityExample example); @@ -76,7 +76,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") BasketEntity row, @Param("example") BasketEntityExample example); @@ -84,7 +84,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(BasketEntity row); @@ -92,7 +92,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(BasketEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.java index f92bcda0d..249f2da53 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.java @@ -12,7 +12,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(CatalogBrandEntityExample example); @@ -20,7 +20,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(CatalogBrandEntityExample example); @@ -28,7 +28,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(CatalogBrandEntity row); @@ -44,7 +44,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(CatalogBrandEntity row); @@ -52,7 +52,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(CatalogBrandEntityExample example); @@ -60,7 +60,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ CatalogBrandEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") CatalogBrandEntity row, @Param("example") CatalogBrandEntityExample example); @@ -76,7 +76,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") CatalogBrandEntity row, @Param("example") CatalogBrandEntityExample example); @@ -84,7 +84,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(CatalogBrandEntity row); @@ -92,7 +92,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(CatalogBrandEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.java index d3bd0fac7..2eb65aa42 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.java @@ -12,7 +12,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(CatalogCategoryEntityExample example); @@ -20,7 +20,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(CatalogCategoryEntityExample example); @@ -28,7 +28,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(CatalogCategoryEntity row); @@ -44,7 +44,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(CatalogCategoryEntity row); @@ -52,7 +52,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(CatalogCategoryEntityExample example); @@ -60,7 +60,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ CatalogCategoryEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") CatalogCategoryEntity row, @Param("example") CatalogCategoryEntityExample example); @@ -76,7 +76,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") CatalogCategoryEntity row, @Param("example") CatalogCategoryEntityExample example); @@ -84,7 +84,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(CatalogCategoryEntity row); @@ -92,7 +92,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(CatalogCategoryEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.java index f1ddebea4..f23506499 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.java @@ -12,7 +12,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(CatalogItemAssetEntityExample example); @@ -20,7 +20,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(CatalogItemAssetEntityExample example); @@ -28,7 +28,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(CatalogItemAssetEntity row); @@ -44,7 +44,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(CatalogItemAssetEntity row); @@ -52,7 +52,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(CatalogItemAssetEntityExample example); @@ -60,7 +60,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ CatalogItemAssetEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") CatalogItemAssetEntity row, @Param("example") CatalogItemAssetEntityExample example); @@ -76,7 +76,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") CatalogItemAssetEntity row, @Param("example") CatalogItemAssetEntityExample example); @@ -84,7 +84,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(CatalogItemAssetEntity row); @@ -92,7 +92,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(CatalogItemAssetEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.java index d9fcb4612..387f7b801 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.java @@ -12,7 +12,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(CatalogItemEntityExample example); @@ -20,7 +20,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(CatalogItemEntityExample example); @@ -28,7 +28,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(CatalogItemEntity row); @@ -44,7 +44,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(CatalogItemEntity row); @@ -52,7 +52,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(CatalogItemEntityExample example); @@ -60,7 +60,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ CatalogItemEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") CatalogItemEntity row, @Param("example") CatalogItemEntityExample example); @@ -76,7 +76,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") CatalogItemEntity row, @Param("example") CatalogItemEntityExample example); @@ -84,7 +84,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(CatalogItemEntity row); @@ -92,7 +92,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(CatalogItemEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.java index f146c1d03..57a0a37cd 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.java @@ -12,7 +12,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(OrderItemEntityExample example); @@ -20,7 +20,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(OrderItemEntityExample example); @@ -28,7 +28,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(OrderItemEntity row); @@ -44,7 +44,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(OrderItemEntity row); @@ -52,7 +52,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(OrderItemEntityExample example); @@ -60,7 +60,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ OrderItemEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") OrderItemEntity row, @Param("example") OrderItemEntityExample example); @@ -76,7 +76,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") OrderItemEntity row, @Param("example") OrderItemEntityExample example); @@ -84,7 +84,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(OrderItemEntity row); @@ -92,7 +92,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(OrderItemEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.java index d1089bd29..9698db1ae 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.java @@ -12,7 +12,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(OrderEntityExample example); @@ -20,7 +20,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(OrderEntityExample example); @@ -28,7 +28,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(OrderEntity row); @@ -44,7 +44,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(OrderEntity row); @@ -52,7 +52,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(OrderEntityExample example); @@ -60,7 +60,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ OrderEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") OrderEntity row, @Param("example") OrderEntityExample example); @@ -76,7 +76,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") OrderEntity row, @Param("example") OrderEntityExample example); @@ -84,7 +84,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(OrderEntity row); @@ -92,7 +92,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(OrderEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedBasketMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedBasketMapper.java index 7f36b6bb3..5699fc921 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedBasketMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedBasketMapper.java @@ -13,5 +13,4 @@ public interface JoinedBasketMapper { Basket findById(@Param("id") long id); Basket findByBuyerId(@Param("buyerId") String buyerId); - } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.java index eb412511f..0df40f8bb 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.java @@ -22,4 +22,6 @@ int countByBrandIdAndCategoryId(@Param("brandId") long brandId, @Param("categoryId") long categoryId); List findWithPaging(@Param("_skiprows") int skipRows, @Param("_pagesize") int pageSize); + + CatalogItem findById(@Param("id") long id); } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.xml index 8c134f741..7fd81c0d9 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.xml @@ -23,11 +23,12 @@ CATALOG_ITEMS.PRODUCT_CODE, CATALOG_ITEMS.CATALOG_CATEGORY_ID, CATALOG_ITEMS.CATALOG_BRAND_ID, + CATALOG_ITEMS.ROW_VERSION, ASSETS.ID, ASSETS.CATALOG_ITEM_ID, ASSETS.ASSET_CODE FROM CATALOG_ITEMS - INNER JOIN CATALOG_ITEM_ASSETS AS ASSETS ON ( + LEFT OUTER JOIN CATALOG_ITEM_ASSETS AS ASSETS ON ( CATALOG_ITEMS.ID = ASSETS.CATALOG_ITEM_ID ) @@ -40,6 +41,7 @@ + @@ -96,4 +98,10 @@ LIMIT #{_skiprows}, #{_pagesize} + \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/translator/EntityTranslator.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/translator/EntityTranslator.java index d77cb7806..92fbecb80 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/translator/EntityTranslator.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/translator/EntityTranslator.java @@ -121,6 +121,18 @@ public static CatalogItem catalogItemEntityTranslate(CatalogItemEntity entity) { return catalogItem; } + /** + * ドメインオブジェクトから {@link CatalogItemEntity} オブジェクトを変換します。 + * + * @param catalogItem {@link CatalogItem} オブジェクト + * @return {@link CatalogItemEntity} オブジェクト + */ + public static CatalogItemEntity createCatalogItemEntity(CatalogItem catalogItem) { + CatalogItemEntity entity = new CatalogItemEntity(); + BeanUtils.copyProperties(catalogItem, entity); + return entity; + } + /** * {@link CatalogItemAssetEntity} をドメインオブジェクトに変換します。 * diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/store/StaticFileAssetStore.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/store/StaticFileAssetStore.java index cd2941a60..11c685b22 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/store/StaticFileAssetStore.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/store/StaticFileAssetStore.java @@ -39,5 +39,4 @@ private Path getFilePath(Asset asset) { String imagePath = "images"; return FileSystems.getDefault().getPath(basePath, imagePath, asset.getAssetCode()); } - } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.xml index 37ccc79f8..6d28617e5 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.xml @@ -5,7 +5,7 @@ @@ -15,7 +15,7 @@ @@ -49,7 +49,7 @@ @@ -83,7 +83,7 @@ id, asset_code, asset_type @@ -91,7 +91,7 @@ select @@ -110,7 +110,7 @@ select @@ -121,7 +121,7 @@ delete from assets where id = #{id,jdbcType=BIGINT} @@ -130,7 +130,7 @@ delete from assets @@ -141,7 +141,7 @@ insert into assets (asset_code, asset_type) values (#{assetCode,jdbcType=VARCHAR}, #{assetType,jdbcType=VARCHAR}) @@ -150,7 +150,7 @@ insert into assets @@ -174,7 +174,7 @@ select count(*) from assets @@ -185,7 +185,7 @@ update assets @@ -207,7 +207,7 @@ update assets set id = #{row.id,jdbcType=BIGINT}, @@ -221,7 +221,7 @@ update assets @@ -238,7 +238,7 @@ update assets set asset_code = #{assetCode,jdbcType=VARCHAR}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.xml index c03cc0ed1..977ee2fbe 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.xml @@ -5,7 +5,7 @@ @@ -17,7 +17,7 @@ @@ -51,7 +51,7 @@ @@ -85,7 +85,7 @@ id, basket_id, catalog_item_id, unit_price, quantity @@ -93,7 +93,7 @@ select @@ -112,7 +112,7 @@ select @@ -123,7 +123,7 @@ delete from basket_items where id = #{id,jdbcType=BIGINT} @@ -132,7 +132,7 @@ delete from basket_items @@ -143,7 +143,7 @@ insert into basket_items (basket_id, catalog_item_id, unit_price, quantity) @@ -154,7 +154,7 @@ insert into basket_items @@ -190,7 +190,7 @@ select count(*) from basket_items @@ -201,7 +201,7 @@ update basket_items @@ -229,7 +229,7 @@ update basket_items set id = #{row.id,jdbcType=BIGINT}, @@ -245,7 +245,7 @@ update basket_items @@ -268,7 +268,7 @@ update basket_items set basket_id = #{basketId,jdbcType=BIGINT}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.xml index 468ec6f2d..171a732ba 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.xml @@ -5,7 +5,7 @@ @@ -14,7 +14,7 @@ @@ -48,7 +48,7 @@ @@ -82,7 +82,7 @@ id, buyer_id @@ -90,7 +90,7 @@ select @@ -109,7 +109,7 @@ select @@ -120,7 +120,7 @@ delete from baskets where id = #{id,jdbcType=BIGINT} @@ -129,7 +129,7 @@ delete from baskets @@ -140,7 +140,7 @@ insert into baskets (buyer_id) values (#{buyerId,jdbcType=VARCHAR}) @@ -149,7 +149,7 @@ insert into baskets @@ -167,7 +167,7 @@ select count(*) from baskets @@ -178,7 +178,7 @@ update baskets @@ -197,7 +197,7 @@ update baskets set id = #{row.id,jdbcType=BIGINT}, @@ -210,7 +210,7 @@ update baskets @@ -224,7 +224,7 @@ update baskets set buyer_id = #{buyerId,jdbcType=VARCHAR} diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.xml index 709d10881..0f3acb10d 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.xml @@ -5,7 +5,7 @@ @@ -14,7 +14,7 @@ @@ -48,7 +48,7 @@ @@ -82,7 +82,7 @@ id, name @@ -90,7 +90,7 @@ select @@ -109,7 +109,7 @@ select @@ -120,7 +120,7 @@ delete from catalog_brands where id = #{id,jdbcType=BIGINT} @@ -129,7 +129,7 @@ delete from catalog_brands @@ -140,7 +140,7 @@ insert into catalog_brands (name) values (#{name,jdbcType=VARCHAR}) @@ -149,7 +149,7 @@ insert into catalog_brands @@ -167,7 +167,7 @@ select count(*) from catalog_brands @@ -178,7 +178,7 @@ update catalog_brands @@ -197,7 +197,7 @@ update catalog_brands set id = #{row.id,jdbcType=BIGINT}, @@ -210,7 +210,7 @@ update catalog_brands @@ -224,7 +224,7 @@ update catalog_brands set name = #{name,jdbcType=VARCHAR} diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.xml index b6da7b2dd..7f333d0e3 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.xml @@ -5,7 +5,7 @@ @@ -14,7 +14,7 @@ @@ -48,7 +48,7 @@ @@ -82,7 +82,7 @@ id, name @@ -90,7 +90,7 @@ select @@ -109,7 +109,7 @@ select @@ -120,7 +120,7 @@ delete from catalog_categories where id = #{id,jdbcType=BIGINT} @@ -129,7 +129,7 @@ delete from catalog_categories @@ -140,7 +140,7 @@ insert into catalog_categories (name) values (#{name,jdbcType=VARCHAR}) @@ -149,7 +149,7 @@ insert into catalog_categories @@ -167,7 +167,7 @@ select count(*) from catalog_categories @@ -178,7 +178,7 @@ update catalog_categories @@ -197,7 +197,7 @@ update catalog_categories set id = #{row.id,jdbcType=BIGINT}, @@ -210,7 +210,7 @@ update catalog_categories @@ -224,7 +224,7 @@ update catalog_categories set name = #{name,jdbcType=VARCHAR} diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.xml index 10db09645..0751a7395 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.xml @@ -5,7 +5,7 @@ @@ -15,7 +15,7 @@ @@ -49,7 +49,7 @@ @@ -83,7 +83,7 @@ id, asset_code, catalog_item_id @@ -91,7 +91,7 @@ select @@ -110,7 +110,7 @@ select @@ -121,7 +121,7 @@ delete from catalog_item_assets where id = #{id,jdbcType=BIGINT} @@ -130,7 +130,7 @@ delete from catalog_item_assets @@ -141,7 +141,7 @@ insert into catalog_item_assets (asset_code, catalog_item_id) values (#{assetCode,jdbcType=VARCHAR}, #{catalogItemId,jdbcType=BIGINT}) @@ -150,7 +150,7 @@ insert into catalog_item_assets @@ -174,7 +174,7 @@ select count(*) from catalog_item_assets @@ -185,7 +185,7 @@ update catalog_item_assets @@ -207,7 +207,7 @@ update catalog_item_assets set id = #{row.id,jdbcType=BIGINT}, @@ -221,7 +221,7 @@ update catalog_item_assets @@ -238,7 +238,7 @@ update catalog_item_assets set asset_code = #{assetCode,jdbcType=VARCHAR}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.xml index 3172794c4..3d89abafd 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.xml @@ -5,7 +5,7 @@ @@ -14,12 +14,13 @@ + @@ -53,7 +54,7 @@ @@ -87,15 +88,16 @@ - id, name, description, price, product_code, catalog_category_id, catalog_brand_id + id, name, description, price, product_code, catalog_category_id, catalog_brand_id, + row_version select count(*) from catalog_items @@ -217,7 +225,7 @@ update catalog_items @@ -242,6 +250,9 @@ catalog_brand_id = #{row.catalogBrandId,jdbcType=BIGINT}, + + row_version = CURRENT_TIMESTAMP, + @@ -251,7 +262,7 @@ update catalog_items set id = #{row.id,jdbcType=BIGINT}, @@ -260,7 +271,8 @@ price = #{row.price,jdbcType=NUMERIC}, product_code = #{row.productCode,jdbcType=VARCHAR}, catalog_category_id = #{row.catalogCategoryId,jdbcType=BIGINT}, - catalog_brand_id = #{row.catalogBrandId,jdbcType=BIGINT} + catalog_brand_id = #{row.catalogBrandId,jdbcType=BIGINT}, + row_version = CURRENT_TIMESTAMP @@ -269,7 +281,7 @@ update catalog_items @@ -291,14 +303,18 @@ catalog_brand_id = #{catalogBrandId,jdbcType=BIGINT}, + + row_version = CURRENT_TIMESTAMP, + where id = #{id,jdbcType=BIGINT} + and row_version = #{rowVersion,jdbcType=TIMESTAMP} update catalog_items set name = #{name,jdbcType=VARCHAR}, @@ -306,7 +322,9 @@ price = #{price,jdbcType=NUMERIC}, product_code = #{productCode,jdbcType=VARCHAR}, catalog_category_id = #{catalogCategoryId,jdbcType=BIGINT}, - catalog_brand_id = #{catalogBrandId,jdbcType=BIGINT} + catalog_brand_id = #{catalogBrandId,jdbcType=BIGINT}, + row_version = CURRENT_TIMESTAMP where id = #{id,jdbcType=BIGINT} + and row_version = #{rowVersion,jdbcType=TIMESTAMP} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.xml index 2d196c65f..6b9e03695 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.xml @@ -5,7 +5,7 @@ @@ -19,7 +19,7 @@ @@ -53,7 +53,7 @@ @@ -87,7 +87,7 @@ id, ordered_catalog_item_id, ordered_product_name, ordered_product_code, unit_price, quantity, order_id @@ -96,7 +96,7 @@ select @@ -115,7 +115,7 @@ select @@ -126,7 +126,7 @@ delete from order_items where id = #{id,jdbcType=BIGINT} @@ -135,7 +135,7 @@ delete from order_items @@ -146,7 +146,7 @@ insert into order_items (ordered_catalog_item_id, ordered_product_name, ordered_product_code, unit_price, quantity, @@ -159,7 +159,7 @@ insert into order_items @@ -207,7 +207,7 @@ select count(*) from order_items @@ -218,7 +218,7 @@ update order_items @@ -252,7 +252,7 @@ update order_items set id = #{row.id,jdbcType=BIGINT}, @@ -270,7 +270,7 @@ update order_items @@ -299,7 +299,7 @@ update order_items set ordered_catalog_item_id = #{orderedCatalogItemId,jdbcType=BIGINT}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.xml index fe1b72478..e351e6677 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.xml @@ -5,7 +5,7 @@ @@ -25,7 +25,7 @@ @@ -59,7 +59,7 @@ @@ -93,7 +93,7 @@ id, buyer_id, order_date, ship_to_full_name, ship_to_postal_code, ship_to_todofuken, ship_to_shikuchoson, ship_to_azana_and_others, consumption_tax_rate, total_items_price, @@ -103,7 +103,7 @@ select @@ -122,7 +122,7 @@ select @@ -133,7 +133,7 @@ delete from orders where id = #{id,jdbcType=BIGINT} @@ -142,7 +142,7 @@ delete from orders @@ -153,7 +153,7 @@ insert into orders (buyer_id, order_date, ship_to_full_name, ship_to_postal_code, ship_to_todofuken, ship_to_shikuchoson, @@ -170,7 +170,7 @@ insert into orders @@ -254,7 +254,7 @@ select count(*) from orders @@ -265,7 +265,7 @@ update orders @@ -317,7 +317,7 @@ update orders set id = #{row.id,jdbcType=BIGINT}, @@ -341,7 +341,7 @@ update orders @@ -388,7 +388,7 @@ update orders set buyer_id = #{buyerId,jdbcType=VARCHAR}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/data.sql b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/data.sql index 7e2b02b99..5d9b585ef 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/data.sql +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/data.sql @@ -1,48 +1,61 @@ INSERT INTO assets (asset_code, asset_type) -VALUES ('b52dc7f712d94ca5812dd995bf926c04', 'png'), -('80bc8e167ccb4543b2f9d51913073492', 'png'), -('05d38fad5693422c8a27dd5b14070ec8', 'png'), -('45c22ba3da064391baac91341067ffe9', 'png'), -('4aed07c4ed5d45a5b97f11acedfbb601', 'png'), -('082b37439ecc44919626ba00fc60ee85', 'png'), -('f5f89954281747fa878129c29e1e0f83', 'png'), -('a8291ef2e8e14869a7048e272915f33c', 'png'), -('66237018c769478a90037bd877f5fba1', 'png'), -('d136d4c81b86478990984dcafbf08244', 'png'), -('47183f32f6584d7fb661f9216e11318b', 'png'), -('cf151206efd344e1b86854f4aa49fdef', 'png'), -('ab2e78eb7fe3408aadbf1e17a9945a8c', 'png'), -('0e557e96bc054f10bc91c27405a83e85', 'png'), -('e622b0098808492cb883831c05486b58', 'png'); +VALUES + ('b52dc7f712d94ca5812dd995bf926c04', 'png'), + ('80bc8e167ccb4543b2f9d51913073492', 'png'), + ('05d38fad5693422c8a27dd5b14070ec8', 'png'), + ('45c22ba3da064391baac91341067ffe9', 'png'), + ('4aed07c4ed5d45a5b97f11acedfbb601', 'png'), + ('082b37439ecc44919626ba00fc60ee85', 'png'), + ('f5f89954281747fa878129c29e1e0f83', 'png'), + ('a8291ef2e8e14869a7048e272915f33c', 'png'), + ('66237018c769478a90037bd877f5fba1', 'png'), + ('d136d4c81b86478990984dcafbf08244', 'png'), + ('47183f32f6584d7fb661f9216e11318b', 'png'), + ('cf151206efd344e1b86854f4aa49fdef', 'png'), + ('ab2e78eb7fe3408aadbf1e17a9945a8c', 'png'), + ('0e557e96bc054f10bc91c27405a83e85', 'png'), + ('e622b0098808492cb883831c05486b58', 'png'); + +INSERT INTO catalog_brands (id, name) +VALUES + (1, '高級なブランド'), + (2, 'カジュアルなブランド'), + (3, 'ノーブランド'); +ALTER TABLE catalog_brands ALTER COLUMN id RESTART WITH 4; -insert into catalog_brands (id,name) values (1,'高級なブランド'); -insert into catalog_brands (id,name) values (2,'カジュアルなブランド'); -insert into catalog_brands (id,name) values (3,'ノーブランド'); +INSERT INTO catalog_categories (id, name) +VALUES + (1, '服'), + (2, 'バッグ'), + (3, 'シューズ'); +ALTER TABLE catalog_categories ALTER COLUMN id RESTART WITH 4; -insert into catalog_categories (id,name) values (1,'服'); -insert into catalog_categories (id,name) values (2,'バッグ'); -insert into catalog_categories (id,name) values (3,'シューズ'); - -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (1,'クルーネック Tシャツ - ブラック','定番の無地ロングTシャツです。',1980,'C000000001',1,3); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (2,'裏起毛 スキニーデニム','暖かいのに着膨れしない起毛デニムです。',4800,'C000000002',1,2); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (3,'ウールコート','あたたかく肌ざわりも良いウール100%のロングコートです。',49800,'C000000003',1,1); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (4,'無地 ボタンダウンシャツ','コットン100%の柔らかい着心地で、春先から夏、秋口まで万能に使いやすいです。',2800,'C000000004',1,2); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (5,'レザーハンドバッグ','コンパクトサイズのバッグですが収納力は抜群です。',18800,'B000000001',2,3); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (6,'ショルダーバッグ','エイジング加工したレザーを使用しています。',38000,'B000000002',2,2); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (7,'トートバッグ ポーチ付き','春の季節にぴったりのトートバッグです。インナーポーチまたは単体でも使用可能なポーチ付。',24800,'B000000003',2,3); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (8,'ショルダーバッグ','さらりと気軽に纏える、キュートなミニサイズショルダー。',2800,'B000000004',2,1); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (9,'レザー チェーンショルダーバッグ','エレガントな雰囲気を放つキルティングデザインです。',258000,'B000000005',2,1); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (10,'ランニングシューズ - ブルー','柔らかいソールは快適な履き心地で、ランニングに最適です。',12800,'S000000001',3,2); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (11,'メダリオン ストレートチップ ドレスシューズ','イタリアの職人が丁寧に手作業で作り上げた一品です。',23800,'S000000002',3,1); +INSERT INTO catalog_items (id, name, description, price, product_code, catalog_category_id, catalog_brand_id, row_version) +VALUES + (1, 'クルーネック Tシャツ - ブラック', '定番の無地ロングTシャツです。', 1980, 'C000000001', 1, 3, CURRENT_TIMESTAMP), + (2, '裏起毛 スキニーデニム', '暖かいのに着膨れしない起毛デニムです。', 4800, 'C000000002', 1, 2, CURRENT_TIMESTAMP), + (3, 'ウールコート', 'あたたかく肌ざわりも良いウール100%のロングコートです。', 49800, 'C000000003', 1, 1, CURRENT_TIMESTAMP), + (4, '無地 ボタンダウンシャツ', 'コットン100%の柔らかい着心地で、春先から夏、秋口まで万能に使いやすいです。', 2800, 'C000000004', 1, 2, CURRENT_TIMESTAMP), + (5, 'レザーハンドバッグ', 'コンパクトサイズのバッグですが収納力は抜群です。', 18800, 'B000000001', 2, 3, CURRENT_TIMESTAMP), + (6, 'ショルダーバッグ', 'エイジング加工したレザーを使用しています。', 38000, 'B000000002', 2, 2, CURRENT_TIMESTAMP), + (7, 'トートバッグ ポーチ付き', '春の季節にぴったりのトートバッグです。インナーポーチまたは単体でも使用可能なポーチ付。', 24800, 'B000000003', 2, 3, CURRENT_TIMESTAMP), + (8, 'ショルダーバッグ', 'さらりと気軽に纏える、キュートなミニサイズショルダー。', 2800, 'B000000004', 2, 1, CURRENT_TIMESTAMP), + (9, 'レザー チェーンショルダーバッグ', 'エレガントな雰囲気を放つキルティングデザインです。', 258000, 'B000000005', 2, 1, CURRENT_TIMESTAMP), + (10, 'ランニングシューズ - ブルー', '柔らかいソールは快適な履き心地で、ランニングに最適です。', 12800, 'S000000001', 3, 2, CURRENT_TIMESTAMP), + (11, 'メダリオン ストレートチップ ドレスシューズ', 'イタリアの職人が丁寧に手作業で作り上げた一品です。', 23800, 'S000000002', 3, 1, CURRENT_TIMESTAMP); +ALTER TABLE catalog_items ALTER COLUMN id RESTART WITH 12; -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (1,'45c22ba3da064391baac91341067ffe9',1); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (2,'4aed07c4ed5d45a5b97f11acedfbb601',2); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (3,'082b37439ecc44919626ba00fc60ee85',3); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (4,'f5f89954281747fa878129c29e1e0f83',4); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (5,'a8291ef2e8e14869a7048e272915f33c',5); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (6,'66237018c769478a90037bd877f5fba1',6); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (7,'d136d4c81b86478990984dcafbf08244',7); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (8,'47183f32f6584d7fb661f9216e11318b',8); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (9,'cf151206efd344e1b86854f4aa49fdef',9); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (10,'ab2e78eb7fe3408aadbf1e17a9945a8c',10); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (11,'0e557e96bc054f10bc91c27405a83e85',11); +INSERT INTO catalog_item_assets (id, asset_code, catalog_item_id) +VALUES + (1, '45c22ba3da064391baac91341067ffe9', 1), + (2, '4aed07c4ed5d45a5b97f11acedfbb601', 2), + (3, '082b37439ecc44919626ba00fc60ee85', 3), + (4, 'f5f89954281747fa878129c29e1e0f83', 4), + (5, 'a8291ef2e8e14869a7048e272915f33c', 5), + (6, '66237018c769478a90037bd877f5fba1', 6), + (7, 'd136d4c81b86478990984dcafbf08244', 7), + (8, '47183f32f6584d7fb661f9216e11318b', 8), + (9, 'cf151206efd344e1b86854f4aa49fdef', 9), + (10, 'ab2e78eb7fe3408aadbf1e17a9945a8c', 10), + (11, '0e557e96bc054f10bc91c27405a83e85', 11); +ALTER TABLE catalog_item_assets ALTER COLUMN id RESTART WITH 12; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/mybatisGeneratorConfig.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/mybatisGeneratorConfig.xml index fdc7e98b0..71c23cb63 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/mybatisGeneratorConfig.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/mybatisGeneratorConfig.xml @@ -11,6 +11,11 @@ connectionURL="jdbc:h2:file:~/stapler;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;" userId="" password="" /> + + + + diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/schema.sql b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/schema.sql index f57472b55..d284bbfa4 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/schema.sql +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/schema.sql @@ -66,6 +66,7 @@ CREATE TABLE catalog_items product_code VARCHAR(128) NOT NULL, catalog_category_id BIGINT NOT NULL, catalog_brand_id BIGINT NOT NULL, + row_version TIMESTAMP NOT NULL, CONSTRAINT FK_catalog_items_catalog_brands FOREIGN KEY (catalog_brand_id) REFERENCES catalog_brands(id) ON DELETE CASCADE, CONSTRAINT FK_catalog_items_catalog_categories FOREIGN KEY (catalog_category_id) REFERENCES catalog_categories(id) ON DELETE CASCADE ); diff --git a/samples/web-csr/dressca-backend/settings.gradle b/samples/web-csr/dressca-backend/settings.gradle index 4a11ed098..397371d3b 100644 --- a/samples/web-csr/dressca-backend/settings.gradle +++ b/samples/web-csr/dressca-backend/settings.gradle @@ -6,4 +6,4 @@ */ rootProject.name = 'dressca-backend' -include 'application-core', 'system-common', 'infrastructure', 'web', 'batch' +include 'application-core', 'system-common', 'infrastructure', 'web', 'web-consumer', 'web-admin', 'batch' diff --git a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/CommonExceptionIdConstants.java b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/CommonExceptionIdConstants.java index 178468ecc..d28435321 100644 --- a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/CommonExceptionIdConstants.java +++ b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/CommonExceptionIdConstants.java @@ -9,5 +9,4 @@ public class CommonExceptionIdConstants { /** 想定外の業務エラーが発生しました。 */ public static final String E_BUSINESS = "businessError"; - } diff --git a/samples/web-csr/dressca-backend/web-admin/.gitignore b/samples/web-csr/dressca-backend/web-admin/.gitignore new file mode 100644 index 000000000..c2065bc26 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/.gitignore @@ -0,0 +1,37 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/samples/web-csr/dressca-backend/web-admin/build.gradle b/samples/web-csr/dressca-backend/web-admin/build.gradle new file mode 100644 index 000000000..71e5d6d65 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/build.gradle @@ -0,0 +1,69 @@ +plugins { + id 'java' + id 'org.springframework.boot' version "${springBootVersion}" + id 'io.spring.dependency-management' version "${springDependencyManagementVersion}" + id 'org.springdoc.openapi-gradle-plugin' version "${springdocOpenapiGradlePluginVersion}" +} + +group = 'com.dressca' +version = '0.0.1-SNAPSHOT' + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation supportDependencies.spring_boot_starter_web + implementation supportDependencies.spring_boot_starter_validation + implementation supportDependencies.spring_boot_starter_actuator + implementation supportDependencies.springdoc_openapi_starter_webmvc_ui + implementation supportDependencies.commons_lang3 + implementation supportDependencies.spring_boot_security_starter + implementation supportDependencies.h2database + implementation supportDependencies.spring_boot_starter_log4j2 + + implementation project(':web') + implementation project(':application-core') + implementation project(':infrastructure') + implementation project(':system-common') + + testImplementation supportDependencies.spring_boot_starter_test + testImplementation supportDependencies.spring_security_test + + compileOnly supportDependencies.servlet_api +} + +configurations { + all { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' + } +} +afterEvaluate { + tasks.named("forkedSpringBootRun") { + workingDir("$rootDir/api-docs/web-admin") + } +} +openApi { + apiDocsUrl.set("http://localhost:8081/api-docs") + outputDir.set(file("$rootDir/api-docs/web-admin")) + outputFileName.set("api-specification.json") +} +tasks.register('bootRunDev', org.springframework.boot.gradle.tasks.run.BootRun){ + group = 'application' + description = 'Runs this project as a Spring Boot Application using local profile.' + args = ["--spring.profiles.active=local"] + main = 'com.dressca.web.admin.WebApplication' + classpath = sourceSets.main.runtimeClasspath +} + +tasks.named('test') { + useJUnitPlatform() +} + +build.dependsOn("generateOpenApiDocs") \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.jar b/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..e6441136f Binary files /dev/null and b/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.properties b/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..a4413138c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/web-csr/dressca-backend/web-admin/gradlew b/samples/web-csr/dressca-backend/web-admin/gradlew new file mode 100644 index 000000000..b740cf133 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/web-csr/dressca-backend/web-admin/gradlew.bat b/samples/web-csr/dressca-backend/web-admin/gradlew.bat new file mode 100644 index 000000000..25da30dbd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/web-csr/dressca-backend/web-admin/settings.gradle b/samples/web-csr/dressca-backend/web-admin/settings.gradle new file mode 100644 index 000000000..4303cec08 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'web-admin' diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/WebApplication.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/WebApplication.java new file mode 100644 index 000000000..46da3efb7 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/WebApplication.java @@ -0,0 +1,20 @@ +package com.dressca.web.admin; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Info; + +/** + * Dresscaアプリケーションを起動するためのmainクラスです。 + */ +@SpringBootApplication +@OpenAPIDefinition(info = @Info(title = "Dressca", description = "ECサイトDressca", version = "v1")) +@ComponentScan(basePackages = { "com.dressca" }) +public class WebApplication { + + public static void main(String[] args) { + SpringApplication.run(WebApplication.class, args); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/authorization/UserStoreImpl.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/authorization/UserStoreImpl.java new file mode 100644 index 000000000..2e38e1caa --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/authorization/UserStoreImpl.java @@ -0,0 +1,61 @@ +package com.dressca.web.admin.authorization; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; +import com.dressca.applicationcore.authorization.UserStore; + +/** + * ユーザのセッション情報。 + */ +@Component +public class UserStoreImpl implements UserStore { + + /** + * ログイン中のユーザー名を取得します。 + * + * @return ログイン中のユーザー名。未ログインの場合、空文字。 + */ + @Override + public String getLoginUserName() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + return authentication.getName(); + } + return ""; + } + + /** + * ログイン中のユーザーのロールを取得します。 + * + * @return ログイン中のユーザーのロールの配列。未ログインの場合、空の配列。 + */ + @Override + public List getLoginUserRoles() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + List roles = authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority) + .collect(Collectors.toList()); + return roles; + } + return new ArrayList<>(); + } + + /** + * ログイン中のユーザーが指定したロールに属しているかどうか確認します。 + * + * @return ロールに属している場合true。未ログインの場合false。 + */ + public boolean isInRole(String role) { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority) + .anyMatch(roles -> roles.equals(role)); + } + return false; + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/DresscaWebConfig.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/DresscaWebConfig.java new file mode 100644 index 000000000..526eb98ce --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/DresscaWebConfig.java @@ -0,0 +1,14 @@ +package com.dressca.web.admin.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +/** + * Dressca Web用の設定クラス。 + */ +@Configuration +public class DresscaWebConfig { + + @Autowired(required = false) + public H2ServerLauncher h2ServerLauncher; +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/H2ServerLauncher.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/H2ServerLauncher.java new file mode 100644 index 000000000..95bddb4ca --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/H2ServerLauncher.java @@ -0,0 +1,40 @@ +package com.dressca.web.admin.config; + +import org.h2.tools.Server; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import java.sql.SQLException; + +/** + * 開発環境でh2データベースを立ち上げるためのクラスです。 + */ +@Component +@Profile("local") +public class H2ServerLauncher { + + private Server tcpServer; + + /** + * h2サーバをサーバーモードで起動します。 + */ + @PostConstruct + public void start() { + try { + this.tcpServer = Server.createTcpServer("-tcpPort", "9092", "-tcpAllowOthers", "-ifNotExists").start(); + } catch (SQLException e) { + System.out.println("H2 server is already started."); + } + } + + /** + * h2サーバを停止します。 + */ + @PreDestroy + public void stop() { + if (this.tcpServer != null) { + this.tcpServer.stop(); + } + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/AssetsController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/AssetsController.java new file mode 100644 index 000000000..0909513b6 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/AssetsController.java @@ -0,0 +1,89 @@ +package com.dressca.web.admin.controller; + +import com.dressca.applicationcore.applicationservice.AssetApplicationService; +import com.dressca.applicationcore.assets.Asset; +import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.applicationcore.assets.AssetResourceInfo; +import com.dressca.applicationcore.assets.AssetTypes; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.LogicException; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link Asset} の情報にアクセスするAPIコントローラーです。 + */ +@RestController +@Tag(name = "Assets", description = "アセットの情報にアクセスするAPI") +@RequestMapping("/api/assets") +@AllArgsConstructor +@PreAuthorize(value = "isAuthenticated()") +public class AssetsController { + + @Autowired + private AssetApplicationService service; + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + /** + * アセットを取得します。 + * + * @param assetCode アセットコード + * @return アセット + */ + @Operation(summary = "アセットを取得する.", description = "与えられたアセットコードに対応するアセットを返却する.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功。", content = @Content(mediaType = "image/*", schema = @Schema(implementation = Resource.class))), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "404", description = "アセットコードに対応するアセットがない。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content) + }) + @GetMapping("{assetCode}") + public ResponseEntity get( + @Parameter(required = true, description = "アセットコード") @PathVariable("assetCode") String assetCode) + throws LogicException { + try { + AssetResourceInfo assetResourceInfo = this.service.getAssetResourceInfo(assetCode); + MediaType contentType = getContentType(assetResourceInfo.getAsset()); + + return ResponseEntity.ok().contentType(contentType).body(assetResourceInfo.getResource()); + } catch (AssetNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + } + + /** + * アセットタイプから Content-Type に変換します。 + * + * @param asset アセット + * @return Content-Type の名称 + */ + private MediaType getContentType(Asset asset) { + switch (asset.getAssetType()) { + case AssetTypes.png: + return MediaType.IMAGE_PNG; + default: + throw new IllegalArgumentException("指定したアセットのアセットタイプは Content-Type に変換できません。"); + } + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogBrandsController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogBrandsController.java new file mode 100644 index 000000000..4959827ee --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogBrandsController.java @@ -0,0 +1,56 @@ +package com.dressca.web.admin.controller; + +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.applicationservice.CatalogApplicationService; +import com.dressca.applicationcore.catalog.CatalogBrand; +import com.dressca.web.admin.controller.dto.catalog.GetCatalogBrandsResponse; +import com.dressca.web.admin.mapper.CatalogBrandMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +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.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link CatalogBrand} の情報にアクセスする API コントローラーです。 + */ +@RestController +@Tag(name = "CatalogBrands", description = "カタログブランドの情報にアクセスするAPI") +@RequestMapping("/api/catalog-brands") +@AllArgsConstructor +@PreAuthorize(value = "isAuthenticated()") +public class CatalogBrandsController { + + @Autowired + private CatalogApplicationService service; + + /** + * カタログブランドの一覧を取得します。 + * + * @return カタログブランドの一覧 + */ + @Operation(summary = "カタログブランドの一覧を取得する.", description = "カタログブランドの一覧を取得する.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功。", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GetCatalogBrandsResponse.class)))), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content) + }) + @GetMapping + public ResponseEntity> getCatalogBrands() { + List brands = this.service.getBrands().stream() + .map(CatalogBrandMapper::convert) + .collect(Collectors.toList()); + + return ResponseEntity.ok().body(brands); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogCategoriesController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogCategoriesController.java new file mode 100644 index 000000000..b2c77cf73 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogCategoriesController.java @@ -0,0 +1,56 @@ +package com.dressca.web.admin.controller; + +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.applicationservice.CatalogApplicationService; +import com.dressca.applicationcore.catalog.CatalogCategory; +import com.dressca.web.admin.controller.dto.catalog.GetCatalogCategoriesResponse; +import com.dressca.web.admin.mapper.CatalogCategoryMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +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.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link CatalogCategory} の情報にアクセスする API コントローラーです。 + */ +@RestController +@Tag(name = "CatalogCategories", description = "カタログカテゴリの情報にアクセスするAPI") +@RequestMapping("/api/catalog-categories") +@AllArgsConstructor +@PreAuthorize(value = "isAuthenticated()") +public class CatalogCategoriesController { + + @Autowired + private CatalogApplicationService service; + + /** + * カタログカテゴリの一覧を取得します。 + * + * @return カタログカテゴリの一覧。 + */ + @Operation(summary = "カタログカテゴリの一覧を取得します.", description = "カタログカテゴリの一覧を取得します.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功。", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GetCatalogCategoriesResponse.class)))), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content) + }) + @GetMapping + public ResponseEntity> getCatalogCategories() { + List categories = this.service.getCategories().stream() + .map(CatalogCategoryMapper::convert) + .collect(Collectors.toList()); + + return ResponseEntity.ok().body(categories); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogItemsController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogItemsController.java new file mode 100644 index 000000000..acb4f0f9b --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogItemsController.java @@ -0,0 +1,229 @@ +package com.dressca.web.admin.controller; + +import java.math.BigDecimal; +import java.net.URI; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.applicationservice.CatalogApplicationService; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.applicationcore.catalog.CatalogBrandNotFoundException; +import com.dressca.applicationcore.catalog.CatalogCategoryNotFoundException; +import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogNotFoundException; +import com.dressca.applicationcore.catalog.OptimisticLockingFailureException; +import com.dressca.applicationcore.constant.UserRoleConstants; +import com.dressca.systemcommon.constant.CommonExceptionIdConstants; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.web.admin.controller.dto.catalog.GetCatalogItemResponse; +import com.dressca.web.admin.controller.dto.catalog.PagedListOfGetCatalogItemResponse; +import com.dressca.web.admin.controller.dto.catalog.PostCatalogItemRequest; +import com.dressca.web.admin.controller.dto.catalog.PutCatalogItemRequest; +import com.dressca.web.admin.mapper.CatalogItemMapper; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.RequestBody; +import io.swagger.v3.oas.annotations.Operation; +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.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link CatalogItem} の情報にアクセスする API コントローラーです。 + */ +@RestController +@Tag(name = "CatalogItems", description = "カタログアイテムの情報にアクセスする API コントローラーです.") +@RequestMapping("/api/catalog-items") +@AllArgsConstructor +@PreAuthorize(value = "hasAuthority('" + UserRoleConstants.ADMIN + "')") +public class CatalogItemsController { + + @Autowired + private CatalogApplicationService service; + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + /** + * 指定したIDのカタログアイテムを返します。 + * + * @param id ID。 + * @return カタログアイテム。 + * @throws PermissionDeniedException 認可エラー。 + */ + @Operation(summary = "指定したIDのカタログアイテムを返します。", description = "指定したIDのカタログアイテムを返します。") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功。", content = @Content(mediaType = "application/json", schema = @Schema(implementation = GetCatalogItemResponse.class))), + @ApiResponse(responseCode = "400", description = "リクエストエラー。", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "404", description = "指定した ID のアイテムがカタログに存在しない。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content) + }) + @GetMapping("{id}") + public ResponseEntity getCatalogItem(@PathVariable("id") long id) + throws PermissionDeniedException { + CatalogItem item; + try { + item = this.service.getCatalogItem(id); + } catch (CatalogNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + GetCatalogItemResponse returnValue = CatalogItemMapper.convert(item); + return ResponseEntity.ok().body(returnValue); + } + + /** + * カタログアイテムを検索して返します。 + * + * @param brandId ブランドID。未指定の場合は0。 + * @param categoryId カテゴリID。未指定の場合は0。 + * @param page ページ番号。未指定の場合は1。 + * @param pageSize ページサイズ。未指定の場合は20。 + * @return カタログアイテムの一覧。 + * @throws PermissionDeniedException 認可エラー。 + */ + @Operation(summary = "カタログアイテムを検索して返します.", description = "カタログアイテムを検索して返します.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功。", content = @Content(mediaType = "application/json", schema = @Schema(implementation = PagedListOfGetCatalogItemResponse.class))), + @ApiResponse(responseCode = "400", description = "リクエストエラー。", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "404", description = "失敗。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content), + }) + @GetMapping + public ResponseEntity getByQuery( + @RequestParam(name = "brandId", defaultValue = "0") long brandId, + @RequestParam(name = "categoryId", defaultValue = "0") long categoryId, + @RequestParam(name = "page", defaultValue = "1") int page, + @RequestParam(name = "pageSize", defaultValue = "20") int pageSize) throws PermissionDeniedException { + + List items = this.service.getCatalogItemsForAdmin(brandId, categoryId, page, pageSize) + .stream() + .map(CatalogItemMapper::convert).collect(Collectors.toList()); + int totalCount = this.service.countCatalogItems(brandId, categoryId); + + PagedListOfGetCatalogItemResponse returnValue = new PagedListOfGetCatalogItemResponse(items, totalCount, page, + pageSize); + return ResponseEntity.ok().body(returnValue); + } + + /** + * カタログにアイテムを追加します。 + * + * @param postCatalogItemRequest 追加するアイテムの情報。 + * @return なし。 + * @throws PermissionDeniedException 認可エラー。 + */ + @Operation(summary = "カタログにアイテムを追加します。", description = "カタログにアイテムを追加します。") + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "成功。", content = @Content), + @ApiResponse(responseCode = "400", description = "リクエストエラー。", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "404", description = "失敗。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content) + }) + @PostMapping + public ResponseEntity postCatalogItem(@RequestBody PostCatalogItemRequest postCatalogItemRequest) + throws PermissionDeniedException { + + try { + CatalogItem addedCatalogItem = this.service.addItemToCatalog(postCatalogItemRequest.getName(), + postCatalogItemRequest.getDescription(), new BigDecimal(postCatalogItemRequest.getPrice()), + postCatalogItemRequest.getProductCode(), postCatalogItemRequest.getCatalogCategoryId(), + postCatalogItemRequest.getCatalogBrandId()); + return ResponseEntity.created(URI.create("/api/catalog-items/" + addedCatalogItem.getId())).build(); + } catch (CatalogBrandNotFoundException | CatalogCategoryNotFoundException e) { + apLog.error(ExceptionUtils.getStackTrace(e)); + // ここでは発生を想定していないので、システムエラーとする。 + throw new SystemException(e, CommonExceptionIdConstants.E_SYSTEM, null, null); + } + } + + /** + * カタログから指定したカタログアイテム ID のアイテムを削除します。 + * + * @param catalogItemId カタログアイテムID。 + * @param rowVersion 行バージョン。 + * @return なし。 + * @throws PermissionDeniedException 認可エラー。 + * @throws OptimisticLockingFailureException 楽観ロックエラー。 + */ + @Operation(summary = "カタログから指定したカタログアイテム ID のアイテムを削除します。", description = "カタログから指定したカタログアイテム ID のアイテムを削除します。") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "成功。", content = @Content), + @ApiResponse(responseCode = "400", description = "リクエストエラー。", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "404", description = "指定した ID のアイテムがカタログに存在しない。", content = @Content), + @ApiResponse(responseCode = "409", description = "競合が発生。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content), + }) + @DeleteMapping("{catalogItemId}") + public ResponseEntity deleteCatalogItem(@PathVariable("catalogItemId") long catalogItemId, + @RequestParam LocalDateTime rowVersion) + throws PermissionDeniedException, OptimisticLockingFailureException { + try { + this.service.deleteItemFromCatalog(catalogItemId, rowVersion); + } catch (CatalogNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + return ResponseEntity.noContent().build(); + } + + /** + * 指定したIDのカタログアイテムの情報を更新します。 + * + * @param catalogItemId カタログアイテムID。 + * @param putCatalogItemRequest 更新するカタログアイテムの情報。 + * @return なし。 + * @throws OptimisticLockingFailureException 楽観ロックエラー。 + * @throws PermissionDeniedException 認可エラー。 + */ + @Operation(summary = "指定したIDのカタログアイテムの情報を更新します。", description = "指定したIDのカタログアイテムの情報を更新します。") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "成功。", content = @Content), + @ApiResponse(responseCode = "400", description = "リクエストエラー。", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "404", description = "指定した ID のアイテムがカタログに存在しない。", content = @Content), + @ApiResponse(responseCode = "409", description = "競合が発生。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content), + }) + @PutMapping("{catalogItemId}") + public ResponseEntity putCatalogItem(@PathVariable("catalogItemId") long catalogItemId, + @RequestBody PutCatalogItemRequest putCatalogItemRequest) + throws PermissionDeniedException, OptimisticLockingFailureException { + try { + this.service.updateCatalogItem(catalogItemId, putCatalogItemRequest.getName(), + putCatalogItemRequest.getDescription(), new BigDecimal(putCatalogItemRequest.getPrice()), + putCatalogItemRequest.getProductCode(), putCatalogItemRequest.getCatalogCategoryId(), + putCatalogItemRequest.getCatalogBrandId(), putCatalogItemRequest.getRowVersion()); + } catch (CatalogNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } catch (CatalogBrandNotFoundException | CatalogCategoryNotFoundException e) { + apLog.error(ExceptionUtils.getStackTrace(e)); + // ここでは発生を想定していないので、システムエラーとする。 + throw new SystemException(e, CommonExceptionIdConstants.E_SYSTEM, null, null); + } + return ResponseEntity.noContent().build(); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/UsersController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/UsersController.java new file mode 100644 index 000000000..4072e9429 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/UsersController.java @@ -0,0 +1,48 @@ +package com.dressca.web.admin.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.dressca.applicationcore.authorization.UserStore; +import com.dressca.web.admin.controller.dto.user.GetLoginUserResponse; +import io.swagger.v3.oas.annotations.Operation; +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.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * {@link UserStore}の情報にアクセスする API コントローラです。 + */ +@RestController +@Tag(name = "Users", description = "ログイン中のユーザーの情報を取得します。") +@RequestMapping("/api/users") +@PreAuthorize(value = "isAuthenticated()") +public class UsersController { + + @Autowired(required = false) + private UserStore userStore; + + /** + * ログイン中のユーザーの情報を取得します。 + * + * @return ユーザの情報。 + */ + @Operation(summary = "ログイン中のユーザーの情報を取得します。", description = "ユーザーの情報。") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功。", content = @Content(mediaType = "application/json", schema = @Schema(implementation = GetLoginUserResponse.class))), + @ApiResponse(responseCode = "401", description = "未認証。", content = @Content), + @ApiResponse(responseCode = "500", description = "サーバーエラー。", content = @Content) + }) + @GetMapping + public ResponseEntity getLoginUser() { + + GetLoginUserResponse response = new GetLoginUserResponse(this.userStore.getLoginUserName(), + this.userStore.getLoginUserRoles()); + return ResponseEntity.ok().body(response); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogBrandsResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogBrandsResponse.java new file mode 100644 index 000000000..98e2bbb9f --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogBrandsResponse.java @@ -0,0 +1,19 @@ +package com.dressca.web.admin.controller.dto.catalog; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログブランドの情報を取得する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class GetCatalogBrandsResponse { + @NotNull + private long id; + @NotNull + private String name; +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogCategoriesResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogCategoriesResponse.java new file mode 100644 index 000000000..2718d3003 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogCategoriesResponse.java @@ -0,0 +1,19 @@ +package com.dressca.web.admin.controller.dto.catalog; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログカテゴリの情報を取得する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class GetCatalogCategoriesResponse { + @NotNull + private long id; + @NotNull + private String name; +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogItemResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogItemResponse.java new file mode 100644 index 000000000..15227eba1 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/GetCatalogItemResponse.java @@ -0,0 +1,36 @@ +package com.dressca.web.admin.controller.dto.catalog; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログアイテムを取得する際に用いるdtoクラスです。 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class GetCatalogItemResponse { + + @NotNull + private long id; + @NotNull + private String name; + @NotNull + private String productCode; + private List assetCodes; + @NotNull + private String description; + @NotNull + private BigDecimal price; + @NotNull + private long catalogCategoryId; + @NotNull + private long catalogBrandId; + @NotNull + private LocalDateTime rowVersion; +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PagedListOfGetCatalogItemResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PagedListOfGetCatalogItemResponse.java new file mode 100644 index 000000000..1cf4cf802 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PagedListOfGetCatalogItemResponse.java @@ -0,0 +1,36 @@ +package com.dressca.web.admin.controller.dto.catalog; + +import java.util.List; +import lombok.Data; + +/** + * 検索したカタログアイテムの情報を取得する際に用いるdtoクラスです。 + */ +@Data +public class PagedListOfGetCatalogItemResponse { + private List items; + private int totalCount; + private int page; + private int pageSize; + private int totalPages; + private boolean hasPrevious; + private boolean hasNext; + + /** + * コンストラクタ。 + * + * @param items カタログアイテムのリスト。 + * @param totalCount カタログアイテムの合計数。 + * @param page 現在のページ番号。 + * @param pageSize ページ数の合計。 + */ + public PagedListOfGetCatalogItemResponse(List items, int totalCount, int page, int pageSize) { + this.items = items; + this.totalCount = totalCount; + this.page = page; + this.pageSize = pageSize; + this.totalPages = this.totalCount / this.pageSize + (this.totalCount % this.pageSize == 0 ? 0 : 1); + this.hasPrevious = this.page > 1; + this.hasNext = this.page < this.totalPages; + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PostCatalogItemRequest.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PostCatalogItemRequest.java new file mode 100644 index 000000000..308e22898 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PostCatalogItemRequest.java @@ -0,0 +1,27 @@ +package com.dressca.web.admin.controller.dto.catalog; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログにアイテムを追加する際に用いるdtoクラスです。 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PostCatalogItemRequest { + @NotNull + private String name = ""; + @NotNull + private String description = ""; + @NotNull + private long price; + @NotNull + private String productCode; + @NotNull + private long catalogCategoryId; + @NotNull + private long catalogBrandId; +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PutCatalogItemRequest.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PutCatalogItemRequest.java new file mode 100644 index 000000000..a629445b2 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PutCatalogItemRequest.java @@ -0,0 +1,28 @@ +package com.dressca.web.admin.controller.dto.catalog; + +import java.time.LocalDateTime; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * カタログアイテムを変更する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +public class PutCatalogItemRequest { + @NotNull + private String name = ""; + @NotNull + private String description = ""; + @NotNull + private long price; + @NotNull + private String productCode; + @NotNull + private long catalogCategoryId; + @NotNull + private long catalogBrandId; + @NotNull + private LocalDateTime rowVersion; +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/user/GetLoginUserResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/user/GetLoginUserResponse.java new file mode 100644 index 000000000..89a516696 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/user/GetLoginUserResponse.java @@ -0,0 +1,19 @@ +package com.dressca.web.admin.controller.dto.user; + +import java.util.ArrayList; +import java.util.List; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * ユーザー情報を取得する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +public class GetLoginUserResponse { + @NotNull + private String userName = ""; + @NotNull + private List roles = new ArrayList<>(); +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/filter/DummyUserInjectionFilter.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/filter/DummyUserInjectionFilter.java new file mode 100644 index 000000000..043d22a10 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/filter/DummyUserInjectionFilter.java @@ -0,0 +1,39 @@ +package com.dressca.web.admin.filter; + +import java.io.IOException; +import java.util.List; +import org.springframework.context.annotation.Profile; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; +import com.dressca.applicationcore.constant.UserRoleConstants; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * ダミーユーザーをSecurityContextHolderに詰めるためのフィルタークラス。 + * 開発環境においてユーザ名がadmin@example.com、権限が管理者のユーザでアクセスしたことにして認証プロセスをスキップするために使用する。 + * また、本フィルターはWebSecurityConfigにて、セキュリティフィルターチェーンのUsernamePasswordAuthenticationFilterの前に挿入する。 + */ +@Profile("local") +@Component +public class DummyUserInjectionFilter extends OncePerRequestFilter { + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws IOException, ServletException { + UserDetails dummyUser = new User("admin@example.com", "", + List.of(new SimpleGrantedAuthority(UserRoleConstants.ADMIN))); + + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(dummyUser, + dummyUser.getPassword(), dummyUser.getAuthorities()); + SecurityContextHolder.getContext().setAuthentication(authentication); + filterChain.doFilter(request, response); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogBrandMapper.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogBrandMapper.java new file mode 100644 index 000000000..824dbbbae --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogBrandMapper.java @@ -0,0 +1,23 @@ +package com.dressca.web.admin.mapper; + +import com.dressca.applicationcore.catalog.CatalogBrand; +import com.dressca.web.admin.controller.dto.catalog.GetCatalogBrandsResponse; + +/** + * {@link CatalogBrand} と {@link GetCatalogBrandsResponse} のマッパーです。 + */ +public class CatalogBrandMapper { + + /** + * {@link CatalogBrand} オブジェクトを {@link GetCatalogBrandsResponse} に変換します。 + * + * @param catalogBrand オブジェクト + * @return {@link GetCatalogBrandsResponse} オブジェクト + */ + public static GetCatalogBrandsResponse convert(CatalogBrand catalogBrand) { + if (catalogBrand == null) { + return null; + } + return new GetCatalogBrandsResponse(catalogBrand.getId(), catalogBrand.getName()); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogCategoryMapper.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogCategoryMapper.java new file mode 100644 index 000000000..b1bb40c1d --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogCategoryMapper.java @@ -0,0 +1,23 @@ +package com.dressca.web.admin.mapper; + +import com.dressca.applicationcore.catalog.CatalogCategory; +import com.dressca.web.admin.controller.dto.catalog.GetCatalogCategoriesResponse; + +/** + * {@link CatalogCategory} と {@link GetCatalogCategoriesResponse} のマッパーです。 + */ +public class CatalogCategoryMapper { + + /** + * {@link CatalogCategory} オブジェクトを {@link GetCatalogCategoriesResponse} に変換します。 + * + * @param catalogCategory {@link CatalogCategory} オブジェクト + * @return {@link GetCatalogCategoriesResponse} オブジェクト + */ + public static GetCatalogCategoriesResponse convert(CatalogCategory catalogCategory) { + if (catalogCategory == null) { + return null; + } + return new GetCatalogCategoriesResponse(catalogCategory.getId(), catalogCategory.getName()); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogItemMapper.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogItemMapper.java new file mode 100644 index 000000000..52ef0b3c2 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogItemMapper.java @@ -0,0 +1,33 @@ +package com.dressca.web.admin.mapper; + +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogItemAsset; +import com.dressca.web.admin.controller.dto.catalog.GetCatalogItemResponse; + +/** + * {@link CatalogItem} と {@link GetCatalogItemResponse} のマッパーです。 + */ +public class CatalogItemMapper { + + /** + * {@link CatalogItem} オブジェクトを {@link GetCatalogItemResponse} に変換します。 + * + * @param item {@link CatalogItem} オブジェクト + * @return {@link GetCatalogItemResponse} オブジェクト + */ + public static GetCatalogItemResponse convert(CatalogItem item) { + + if (item == null) { + return null; + } + + List assetCodes = item.getAssets().stream().map(CatalogItemAsset::getAssetCode) + .collect(Collectors.toList()); + + return new GetCatalogItemResponse(item.getId(), item.getName(), item.getProductCode(), assetCodes, + item.getDescription(), item.getPrice(), item.getCatalogCategoryId(), item.getCatalogBrandId(), + item.getRowVersion()); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/security/WebSecurityConfig.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/security/WebSecurityConfig.java new file mode 100644 index 000000000..dc268747a --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/security/WebSecurityConfig.java @@ -0,0 +1,62 @@ +package com.dressca.web.admin.security; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.cors.CorsConfiguration; +import com.dressca.web.admin.filter.DummyUserInjectionFilter; +import java.util.Arrays; +import java.util.List; + +/** + * セキュリティ関連の実行クラス。 + */ +@Configuration +@EnableWebSecurity +@EnableMethodSecurity +public class WebSecurityConfig { + + @Value("${cors.allowed.origins:}") + private String allowedOrigins; + + @Autowired(required = false) + private DummyUserInjectionFilter dummyUserInjectionFilter; + + /** + * CORS設定、認可機能を実装。 + * + * @param http 認証認可の設定クラス + * @return フィルターチェーン + * @throws Exception 例外 + */ + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + http + .securityMatcher("/api/**") + // CSRF トークンを利用したリクエストの検証を無効化( OAuth2.0 による認証認可を利用する前提のため) + // OAuth2.0 によるリクエストの検証を利用しない場合は、有効化して CSRF 対策を施す + .csrf(csrf -> csrf.ignoringRequestMatchers("/api/**")) + .cors(cors -> cors.configurationSource(request -> { + CorsConfiguration conf = new CorsConfiguration(); + conf.setAllowCredentials(true); + conf.setAllowedOrigins(Arrays.asList(allowedOrigins)); + conf.setAllowedMethods(List.of("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")); + conf.setAllowedHeaders(List.of("*")); + return conf; + })) + .anonymous(anon -> anon.disable()); + + // 開発環境においてはダミーユーザを注入する + if (dummyUserInjectionFilter != null) { + http.addFilterBefore(dummyUserInjectionFilter, UsernamePasswordAuthenticationFilter.class); + } + + return http.build(); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-common.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-common.properties new file mode 100644 index 000000000..864752acd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-common.properties @@ -0,0 +1,19 @@ +# springdoc-openapi +springdoc.api-docs.path=/api-docs +springdoc.swagger-ui.path=/swagger-ui.html +springdoc.show-actuator=true + +# messages.properties +spring.messages.basename=applicationcore.messages,systemcommon.messages +spring.messages.encoding=UTF-8 + +# spring boot actuatorの設定(ステータスの変更,表示情報) +# ヘルスチェックAPIのURLを/apiから始まるように変更する +management.endpoints.web.base-path=/api +# サーバのヘルスチェック用のAPIを設定する(http://localhost:8081/api/health/check) +management.endpoint.health.group.check.include=ping +# データベースのヘルスチェック用のAPIを設定する(http://localhost:8081/api/health/datasource) +management.endpoint.health.group.datasource.include=db + +# ポート番号の指定 +server.port=8081 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-dev.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-dev.properties new file mode 100644 index 000000000..d7107958b --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-dev.properties @@ -0,0 +1,22 @@ +# h2 database +spring.datasource.hikari.driver-class-name=org.h2.Driver + +# DBをサーバーモードで立ち上げる場合の接続先情報 +spring.datasource.hikari.jdbc-url=jdbc:h2:tcp://localhost:9092/mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +spring.sql.init.mode=always + +# DBを組み込みモードで立ち上げる場合の接続先情報 +# spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +# spring.sql.init.mode=embedded + +spring.datasource.hikari.username= +spring.datasource.hikari.password= +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.h2.console.settings.web-allow-others=true + +# ヘルスチェックの API のログを検出するため logging level を変更する +logging.level.web=DEBUG + +# CORS 設定 +cors.allowed.origins=http://localhost,http://localhost:6173 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-prd.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-prd.properties new file mode 100644 index 000000000..f3cb76afe --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-prd.properties @@ -0,0 +1,9 @@ +# PostgreSQL database +spring.datasource.hikari.driver-class-name=org.postgresql.Driver +spring.datasource.hikari.jdbc-url=jdbc:postgresql://localhost:5432/project +spring.datasource.hikari.username=project +spring.datasource.hikari.password=project +spring.sql.init.mode=never + +# CORS 設定 +cors.allowed.origins=https://本番環境のフロントエンド配布サーバーのドメイン \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-ut.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-ut.properties new file mode 100644 index 000000000..e9e16c4a3 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-ut.properties @@ -0,0 +1,10 @@ +# h2 database +spring.datasource.hikari.driver-class-name=org.h2.Driver +spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +spring.datasource.hikari.username= +spring.datasource.hikari.password= +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.h2.console.settings.web-allow-others=true +spring.sql.init.mode=embedded +mybatis.configuration.map-underscore-to-camel-case=true \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application.properties new file mode 100644 index 000000000..7c8672e4a --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application.properties @@ -0,0 +1,9 @@ +# 環境別のプロファイル設定(common:全環境共通の設定、test:UT用、local:ローカル打鍵用、production:本番環境用) +spring.profiles.group.local=common,dev +spring.profiles.group.production=common,prd +spring.profiles.group.test=common,ut +# 環境情報未指定の場合に使用するプロファイル(環境情報を指定する場合、起動コマンドに「-Dspring.profiles.active=<プロファイル名>'」を追加する) +spring.profiles.default=production + +# Open API 仕様書を自動生成する際keyをアルファベット順でソートする +springdoc.writer-with-order-by-keys=true \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/log4j2.xml b/samples/web-csr/dressca-backend/web-admin/src/main/resources/log4j2.xml new file mode 100644 index 000000000..3de3d7921 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/log4j2.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplicationTests.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/WebApplicationTests.java similarity index 54% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplicationTests.java rename to samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/WebApplicationTests.java index 4a0cb6732..4b979a08b 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplicationTests.java +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/WebApplicationTests.java @@ -1,13 +1,14 @@ -package com.dressca.web; +package com.dressca.web.admin; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import org.junit.jupiter.api.DisplayName; @SpringBootTest class WebApplicationTests { @Test + @DisplayName("コンテキストが正常に読み込まれるか確認") void contextLoads() { } - } diff --git a/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/AssetsControllerTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/AssetsControllerTest.java new file mode 100644 index 000000000..05edd2deb --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/AssetsControllerTest.java @@ -0,0 +1,51 @@ +package com.dressca.web.admin.controller; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import com.dressca.web.admin.WebApplication; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; + +/** + * {@link AssetsController}の動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +@WithMockUser(roles = { "ADMIN" }) +public class AssetsControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + @DisplayName("testGet_01_正常系_存在するアセットコード") + void testGet_01() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + + // 期待する戻り値 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.IMAGE_PNG_VALUE)); + } + + @Test + @DisplayName("testGet_02_異常系_存在しないアセットコード") + void testGet_02() throws Exception { + // テスト用の入力データ + String assetCode = "NotExistAssetCode"; + + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isNotFound()); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/HealthCheckTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/HealthCheckTest.java similarity index 92% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/HealthCheckTest.java rename to samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/HealthCheckTest.java index 15e89f6c9..7a4730acd 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/HealthCheckTest.java +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/HealthCheckTest.java @@ -1,42 +1,42 @@ -package com.dressca.web.controller; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import com.dressca.web.WebApplication; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import org.springframework.test.web.servlet.MockMvc; - -/** - * ヘルスチェックAPIの動作をテストするクラスです。 - */ -@SpringJUnitConfig -@SpringBootTest(classes = WebApplication.class) -@AutoConfigureMockMvc -public class HealthCheckTest { - - @Autowired - private MockMvc mockMvc; - - @Test - @DisplayName("testGet_03_ヘルスチェック_サーバ正常動作確認") - void testGet_serverCheck() throws Exception { - this.mockMvc.perform(get("/api/health/check")) - .andExpect(status().isOk()) - .andExpect(content().json("{'status':'UP'}")); - } - - @Test - @DisplayName("testGet_04_ヘルスチェック_DB正常動作確認") - void testGet_databaseCheck() throws Exception { - this.mockMvc.perform(get("/api/health/datasource")) - .andExpect(status().isOk()) - .andExpect(content().json("{'status':'UP'}")); - } -} +package com.dressca.web.admin.controller; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import com.dressca.web.admin.WebApplication; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; + +/** + * ヘルスチェックAPIの動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +public class HealthCheckTest { + + @Autowired + private MockMvc mockMvc; + + @Test + @DisplayName("testGet_03_ヘルスチェック_サーバ正常動作確認") + void testGet_serverCheck() throws Exception { + this.mockMvc.perform(get("/api/health/check")) + .andExpect(status().isOk()) + .andExpect(content().json("{'status':'UP'}")); + } + + @Test + @DisplayName("testGet_04_ヘルスチェック_DB正常動作確認") + void testGet_databaseCheck() throws Exception { + this.mockMvc.perform(get("/api/health/datasource")) + .andExpect(status().isOk()) + .andExpect(content().json("{'status':'UP'}")); + } +} diff --git a/samples/web-csr/dressca-backend/web-consumer/.gitignore b/samples/web-csr/dressca-backend/web-consumer/.gitignore new file mode 100644 index 000000000..c2065bc26 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/.gitignore @@ -0,0 +1,37 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/samples/web-csr/dressca-backend/web-consumer/build.gradle b/samples/web-csr/dressca-backend/web-consumer/build.gradle new file mode 100644 index 000000000..ac22fc641 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/build.gradle @@ -0,0 +1,70 @@ +plugins { + id 'java' + id 'org.springframework.boot' version "${springBootVersion}" + id 'io.spring.dependency-management' version "${springDependencyManagementVersion}" + id 'org.springdoc.openapi-gradle-plugin' version "${springdocOpenapiGradlePluginVersion}" +} + +group = 'com.dressca' +version = '0.0.1-SNAPSHOT' + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation supportDependencies.spring_boot_starter_web + implementation supportDependencies.spring_boot_starter_validation + implementation supportDependencies.spring_boot_starter_actuator + implementation supportDependencies.springdoc_openapi_starter_webmvc_ui + implementation supportDependencies.commons_lang3 + implementation supportDependencies.spring_boot_security_starter + implementation supportDependencies.h2database + implementation supportDependencies.spring_boot_starter_log4j2 + + implementation project(':web') + implementation project(':application-core') + implementation project(':infrastructure') + implementation project(':system-common') + + testImplementation supportDependencies.spring_boot_starter_test + testImplementation supportDependencies.spring_security_test + + compileOnly supportDependencies.servlet_api +} + +configurations { + all { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' + } +} +afterEvaluate { + tasks.named("forkedSpringBootRun") { + workingDir("$rootDir/api-docs/web-consumer") + } +} +openApi { + apiDocsUrl.set("http://localhost:8080/api-docs") + outputDir.set(file("$rootDir/api-docs/web-consumer")) + outputFileName.set("api-specification.json") +} + +tasks.register('bootRunDev', org.springframework.boot.gradle.tasks.run.BootRun){ + group = 'application' + description = 'Runs this project as a Spring Boot Application using local profile.' + args = ["--spring.profiles.active=local"] + main = 'com.dressca.web.consumer.WebApplication' + classpath = sourceSets.main.runtimeClasspath +} + +tasks.named('test') { + useJUnitPlatform() +} + +build.dependsOn("generateOpenApiDocs") \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.jar b/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..e6441136f Binary files /dev/null and b/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.properties b/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..a4413138c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/web-csr/dressca-backend/web-consumer/gradlew b/samples/web-csr/dressca-backend/web-consumer/gradlew new file mode 100644 index 000000000..b740cf133 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/web-csr/dressca-backend/web-consumer/gradlew.bat b/samples/web-csr/dressca-backend/web-consumer/gradlew.bat new file mode 100644 index 000000000..25da30dbd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/web-csr/dressca-backend/web-consumer/settings.gradle b/samples/web-csr/dressca-backend/web-consumer/settings.gradle new file mode 100644 index 000000000..2015facfd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'web-consumer' diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/WebApplication.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/WebApplication.java new file mode 100644 index 000000000..4be8fdbba --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/WebApplication.java @@ -0,0 +1,20 @@ +package com.dressca.web.consumer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Info; + +/** + * Dresscaアプリケーションを起動するためのmainクラスです。 + */ +@SpringBootApplication +@OpenAPIDefinition(info = @Info(title = "Dressca", description = "ECサイトDressca", version = "v1")) +@ComponentScan(basePackages = { "com.dressca" }) +public class WebApplication { + + public static void main(String[] args) { + SpringApplication.run(WebApplication.class, args); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/config/DresscaWebConfig.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/DresscaWebConfig.java similarity index 76% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/config/DresscaWebConfig.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/DresscaWebConfig.java index 4d867c30d..415586f23 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/config/DresscaWebConfig.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/DresscaWebConfig.java @@ -1,7 +1,7 @@ -package com.dressca.web.config; +package com.dressca.web.consumer.config; -import com.dressca.web.filter.BuyerIdFilter; -import com.dressca.web.security.CookieSettings; +import com.dressca.web.consumer.filter.BuyerIdFilter; +import com.dressca.web.consumer.security.CookieSettings; import jakarta.servlet.Filter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.FilterRegistrationBean; @@ -17,6 +17,9 @@ public class DresscaWebConfig { @Autowired private CookieSettings cookieSettings; + @Autowired(required = false) + public H2ServerLauncher h2ServerLauncher; + /** * BuyerIdFilter の設定。 * diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/H2ServerLauncher.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/H2ServerLauncher.java new file mode 100644 index 000000000..802a00d70 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/H2ServerLauncher.java @@ -0,0 +1,40 @@ +package com.dressca.web.consumer.config; + +import org.h2.tools.Server; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import java.sql.SQLException; + +/** + * 開発環境でh2データベースを立ち上げるためのクラスです。 + */ +@Component +@Profile("local") +public class H2ServerLauncher { + + private Server tcpServer; + + /** + * h2サーバをサーバーモードで起動します。 + */ + @PostConstruct + public void start() { + try { + this.tcpServer = Server.createTcpServer("-tcpPort", "9092", "-tcpAllowOthers", "-ifNotExists").start(); + } catch (SQLException e) { + System.out.println("H2 server is already started."); + } + } + + /** + * h2サーバを停止します。 + */ + @PreDestroy + public void stop() { + if (this.tcpServer != null) { + this.tcpServer.stop(); + } + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/AssetsController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/AssetsController.java new file mode 100644 index 000000000..ba2e1c327 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/AssetsController.java @@ -0,0 +1,109 @@ +package com.dressca.web.consumer.controller; + +import com.dressca.applicationcore.applicationservice.AssetApplicationService; +import com.dressca.applicationcore.assets.Asset; +import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.applicationcore.assets.AssetResourceInfo; +import com.dressca.applicationcore.assets.AssetTypes; +import com.dressca.applicationcore.constant.ExceptionIdConstants; +import com.dressca.systemcommon.constant.CommonExceptionIdConstants; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.LogicException; +import com.dressca.web.controller.advice.ProblemDetailsFactory; +import com.dressca.web.log.ErrorMessageBuilder; +import java.util.Locale; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; +import org.springframework.core.io.Resource; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ProblemDetail; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link Asset} の情報にアクセスするAPIコントローラーです。 + */ +@RestController +@Tag(name = "Assets", description = "アセットの情報にアクセスするAPI") +@RequestMapping("/api/assets") +@AllArgsConstructor +public class AssetsController { + + @Autowired + private AssetApplicationService service; + + @Autowired + private ProblemDetailsFactory problemDetailsFactory; + + @Autowired + private MessageSource messages; + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + /** + * アセットを取得します。 + * + * @param assetCode アセットコード + * @return アセット + */ + @Operation(summary = "アセットを取得する.", description = "与えられたアセットコードに対応するアセットを返却する.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功.", content = @Content(mediaType = "image/*", schema = @Schema(implementation = Resource.class))), + @ApiResponse(responseCode = "404", description = "アセットコードに対応するアセットがない.", content = @Content(mediaType = "application/problem+json", schema = @Schema(implementation = ProblemDetail.class))) + }) + @GetMapping("{assetCode}") + public ResponseEntity get( + @Parameter(required = true, description = "アセットコード") @PathVariable("assetCode") String assetCode) + throws LogicException { + try { + AssetResourceInfo assetResourceInfo = this.service.getAssetResourceInfo(assetCode); + MediaType contentType = getContentType(assetResourceInfo.getAsset()); + + return ResponseEntity.ok().contentType(contentType).body(assetResourceInfo.getResource()); + } catch (AssetNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), + e.getLogMessageValue(), e.getFrontMessageValue()); + ProblemDetail problemDetail = problemDetailsFactory.createProblemDetail( + errorBuilder, + CommonExceptionIdConstants.E_BUSINESS, + HttpStatus.NOT_FOUND); + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .contentType(MediaType.APPLICATION_PROBLEM_JSON) + .body(problemDetail); + } + } + + /** + * アセットタイプから Content-Type に変換します。 + * + * @param asset アセット + * @return Content-Type の名称 + */ + private MediaType getContentType(Asset asset) { + switch (asset.getAssetType()) { + case AssetTypes.png: + return MediaType.IMAGE_PNG; + default: + String errorMessage = messages.getMessage(ExceptionIdConstants.E_ASSET_TYPE_NOT_CONVERTED, + new String[] { asset.getAssetType() }, Locale.getDefault()); + throw new IllegalArgumentException(errorMessage); + } + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/BasketItemController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/BasketItemController.java similarity index 96% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/BasketItemController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/BasketItemController.java index 3e95f4b0f..328926c1d 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/BasketItemController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/BasketItemController.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import com.dressca.applicationcore.applicationservice.BasketDetail; import com.dressca.applicationcore.applicationservice.ShoppingApplicationService; @@ -9,14 +9,14 @@ import com.dressca.applicationcore.catalog.CatalogNotFoundException; import com.dressca.systemcommon.constant.CommonExceptionIdConstants; import com.dressca.web.controller.advice.ProblemDetailsFactory; -import com.dressca.web.controller.dto.baskets.BasketItemResponse; -import com.dressca.web.controller.dto.baskets.BasketResponse; -import com.dressca.web.controller.dto.baskets.PostBasketItemsRequest; -import com.dressca.web.controller.dto.baskets.PutBasketItemsRequest; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketItemResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketResponse; +import com.dressca.web.consumer.controller.dto.baskets.PostBasketItemsRequest; +import com.dressca.web.consumer.controller.dto.baskets.PutBasketItemsRequest; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; import com.dressca.web.log.ErrorMessageBuilder; -import com.dressca.web.mapper.BasketMapper; -import com.dressca.web.mapper.CatalogItemSummaryMapper; +import com.dressca.web.consumer.mapper.BasketMapper; +import com.dressca.web.consumer.mapper.CatalogItemSummaryMapper; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogBrandsController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogBrandsController.java similarity index 91% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogBrandsController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogBrandsController.java index e5fa072c8..899136a60 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogBrandsController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogBrandsController.java @@ -1,11 +1,11 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.applicationservice.CatalogApplicationService; import com.dressca.applicationcore.catalog.CatalogBrand; -import com.dressca.web.controller.dto.catalog.CatalogBrandResponse; -import com.dressca.web.mapper.CatalogBrandMapper; +import com.dressca.web.consumer.controller.dto.catalog.CatalogBrandResponse; +import com.dressca.web.consumer.mapper.CatalogBrandMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogCategoriesController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogCategoriesController.java similarity index 91% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogCategoriesController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogCategoriesController.java index 5b19c3fd7..fa74a450a 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogCategoriesController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogCategoriesController.java @@ -1,11 +1,11 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.applicationservice.CatalogApplicationService; import com.dressca.applicationcore.catalog.CatalogCategory; -import com.dressca.web.controller.dto.catalog.CatalogCategoryResponse; -import com.dressca.web.mapper.CatalogCategoryMapper; +import com.dressca.web.consumer.controller.dto.catalog.CatalogCategoryResponse; +import com.dressca.web.consumer.mapper.CatalogCategoryMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogItemsController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogItemsController.java similarity index 86% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogItemsController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogItemsController.java index f304abc9c..b34016755 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogItemsController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogItemsController.java @@ -1,12 +1,12 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.applicationservice.CatalogApplicationService; import com.dressca.applicationcore.catalog.CatalogItem; -import com.dressca.web.controller.dto.catalog.CatalogItemResponse; -import com.dressca.web.controller.dto.catalog.PagedListOfCatalogItemResponse; -import com.dressca.web.mapper.CatalogItemMapper; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemResponse; +import com.dressca.web.consumer.controller.dto.catalog.PagedListOfCatalogItemResponse; +import com.dressca.web.consumer.mapper.CatalogItemMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ProblemDetail; import org.springframework.http.ResponseEntity; @@ -52,9 +52,9 @@ public class CatalogItemsController { public ResponseEntity getByQuery( @RequestParam(name = "brandId", defaultValue = "0") long brandId, @RequestParam(name = "categoryId", defaultValue = "0") long categoryId, - @RequestParam(name = "page", defaultValue = "0") int page, + @RequestParam(name = "page", defaultValue = "1") int page, @RequestParam(name = "pageSize", defaultValue = "20") int pageSize) { - List items = service.getCatalogItems(brandId, categoryId, page, pageSize).stream() + List items = service.getCatalogItemsForConsumer(brandId, categoryId, page, pageSize).stream() .map(CatalogItemMapper::convert) .collect(Collectors.toList()); int totalCount = service.countCatalogItems(brandId, categoryId); diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/OrderController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/OrderController.java similarity index 96% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/OrderController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/OrderController.java index adaa57ad3..02d8509ce 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/OrderController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/OrderController.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import com.dressca.applicationcore.applicationservice.ShoppingApplicationService; import com.dressca.applicationcore.applicationservice.OrderApplicationService; @@ -11,10 +11,10 @@ import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.SystemException; import com.dressca.web.controller.advice.ProblemDetailsFactory; -import com.dressca.web.controller.dto.order.OrderResponse; -import com.dressca.web.controller.dto.order.PostOrderRequest; +import com.dressca.web.consumer.controller.dto.order.OrderResponse; +import com.dressca.web.consumer.controller.dto.order.PostOrderRequest; import com.dressca.web.log.ErrorMessageBuilder; -import com.dressca.web.mapper.OrderMapper; +import com.dressca.web.consumer.mapper.OrderMapper; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/accounting/AccountResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/accounting/AccountResponse.java similarity index 90% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/accounting/AccountResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/accounting/AccountResponse.java index 0c9e8b713..3075cd67b 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/accounting/AccountResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/accounting/AccountResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.accounting; +package com.dressca.web.consumer.controller.dto.accounting; import java.math.BigDecimal; import jakarta.validation.constraints.NotNull; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketItemResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketItemResponse.java similarity index 80% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketItemResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketItemResponse.java index a61265925..e6a681aa3 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketItemResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketItemResponse.java @@ -1,8 +1,8 @@ -package com.dressca.web.controller.dto.baskets; +package com.dressca.web.consumer.controller.dto.baskets; import java.math.BigDecimal; import jakarta.validation.constraints.NotNull; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketResponse.java similarity index 77% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketResponse.java index 7dc0533e2..63a463fc0 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketResponse.java @@ -1,8 +1,8 @@ -package com.dressca.web.controller.dto.baskets; +package com.dressca.web.consumer.controller.dto.baskets; import java.util.List; import jakarta.validation.constraints.NotNull; -import com.dressca.web.controller.dto.accounting.AccountResponse; +import com.dressca.web.consumer.controller.dto.accounting.AccountResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PostBasketItemsRequest.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PostBasketItemsRequest.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PostBasketItemsRequest.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PostBasketItemsRequest.java index 4c3da350c..c1f613dff 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PostBasketItemsRequest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PostBasketItemsRequest.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.baskets; +package com.dressca.web.consumer.controller.dto.baskets; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PutBasketItemsRequest.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PutBasketItemsRequest.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PutBasketItemsRequest.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PutBasketItemsRequest.java index 2b7ec8036..853118ac8 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PutBasketItemsRequest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PutBasketItemsRequest.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.baskets; +package com.dressca.web.consumer.controller.dto.baskets; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogBrandResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogBrandResponse.java similarity index 86% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogBrandResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogBrandResponse.java index 07301a6fa..933167afd 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogBrandResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogBrandResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.consumer.controller.dto.catalog; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogCategoryResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogCategoryResponse.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogCategoryResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogCategoryResponse.java index ff53c2ae5..d5c7ba012 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogCategoryResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogCategoryResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.consumer.controller.dto.catalog; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemResponse.java similarity index 92% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemResponse.java index 4eddc5491..a1f67be25 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.consumer.controller.dto.catalog; import java.math.BigDecimal; import java.util.List; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemSummaryResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemSummaryResponse.java similarity index 89% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemSummaryResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemSummaryResponse.java index 11943ee38..d63c3c7a0 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemSummaryResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemSummaryResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.consumer.controller.dto.catalog; import java.util.List; import jakarta.validation.constraints.NotNull; diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/PagedListOfCatalogItemResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/PagedListOfCatalogItemResponse.java new file mode 100644 index 000000000..cb0bbf54c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/PagedListOfCatalogItemResponse.java @@ -0,0 +1,36 @@ +package com.dressca.web.consumer.controller.dto.catalog; + +import java.util.List; +import lombok.Data; + +/** + * 検索したカタログアイテムの情報を取得する際に用いるdtoクラスです。 + */ +@Data +public class PagedListOfCatalogItemResponse { + private List items; + private int totalCount; + private int page; + private int pageSize; + private int totalPages; + private boolean hasPrevious; + private boolean hasNext; + + /** + * コンストラクタ。 + * + * @param items カタログアイテムのリスト。 + * @param totalCount カタログアイテムの合計数。 + * @param page 現在のページ番号。 + * @param pageSize ページ数の合計。 + */ + public PagedListOfCatalogItemResponse(List items, int totalCount, int page, int pageSize) { + this.items = items; + this.totalCount = totalCount; + this.page = page; + this.pageSize = pageSize; + this.totalPages = this.totalCount / this.pageSize + (this.totalCount % this.pageSize == 0 ? 0 : 1); + this.hasPrevious = this.page > 1; + this.hasNext = this.page < this.totalPages; + } +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderItemResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderItemResponse.java similarity index 79% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderItemResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderItemResponse.java index 728bd3fc7..3e79af769 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderItemResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderItemResponse.java @@ -1,8 +1,8 @@ -package com.dressca.web.controller.dto.order; +package com.dressca.web.consumer.controller.dto.order; import java.math.BigDecimal; import jakarta.validation.constraints.NotNull; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderResponse.java similarity index 85% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderResponse.java index 0d470b23d..497510af6 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderResponse.java @@ -1,9 +1,9 @@ -package com.dressca.web.controller.dto.order; +package com.dressca.web.consumer.controller.dto.order; import java.time.LocalDateTime; import java.util.List; import jakarta.validation.constraints.NotNull; -import com.dressca.web.controller.dto.accounting.AccountResponse; +import com.dressca.web.consumer.controller.dto.accounting.AccountResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/PostOrderRequest.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/PostOrderRequest.java similarity index 91% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/PostOrderRequest.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/PostOrderRequest.java index 556916b52..349c665d9 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/PostOrderRequest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/PostOrderRequest.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.order; +package com.dressca.web.consumer.controller.dto.order; import jakarta.validation.constraints.NotNull; import org.hibernate.validator.constraints.Length; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/filter/BuyerIdFilter.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/filter/BuyerIdFilter.java similarity index 95% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/filter/BuyerIdFilter.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/filter/BuyerIdFilter.java index 4842a3858..02db1c101 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/filter/BuyerIdFilter.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/filter/BuyerIdFilter.java @@ -1,4 +1,4 @@ -package com.dressca.web.filter; +package com.dressca.web.consumer.filter; import java.io.IOException; import java.util.UUID; @@ -14,7 +14,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseCookie; -import com.dressca.web.security.CookieSettings; +import com.dressca.web.consumer.security.CookieSettings; /** * 購入者IDにフィルターをかけるクラスです。 @@ -54,5 +54,4 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha .sameSite(cookieSettings.getSameSite()).build(); ((HttpServletResponse) response).addHeader(HttpHeaders.SET_COOKIE, responseCookie.toString()); } - } diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketItemMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketItemMapper.java similarity index 86% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketItemMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketItemMapper.java index 6d8aca1f6..7fda96242 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketItemMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketItemMapper.java @@ -1,7 +1,7 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import com.dressca.applicationcore.baskets.BasketItem; -import com.dressca.web.controller.dto.baskets.BasketItemResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketItemResponse; /** * {@link BasketItem} と {@link BasketItemResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketMapper.java similarity index 81% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketMapper.java index 720216302..fdf1f0b61 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketMapper.java @@ -1,12 +1,12 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.accounting.Account; import com.dressca.applicationcore.baskets.Basket; -import com.dressca.web.controller.dto.accounting.AccountResponse; -import com.dressca.web.controller.dto.baskets.BasketItemResponse; -import com.dressca.web.controller.dto.baskets.BasketResponse; +import com.dressca.web.consumer.controller.dto.accounting.AccountResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketItemResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketResponse; /** * {@link Basket} と {@link BasketResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogBrandMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogBrandMapper.java similarity index 84% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogBrandMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogBrandMapper.java index 72839e658..81ac7ee2d 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogBrandMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogBrandMapper.java @@ -1,7 +1,7 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import com.dressca.applicationcore.catalog.CatalogBrand; -import com.dressca.web.controller.dto.catalog.CatalogBrandResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogBrandResponse; /** * {@link CatalogBrand} と {@link CatalogBrandResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogCategoryMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogCategoryMapper.java similarity index 85% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogCategoryMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogCategoryMapper.java index 69099ec26..44a028c19 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogCategoryMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogCategoryMapper.java @@ -1,7 +1,7 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import com.dressca.applicationcore.catalog.CatalogCategory; -import com.dressca.web.controller.dto.catalog.CatalogCategoryResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogCategoryResponse; /** * {@link CatalogCategory} と {@link CatalogCategoryResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemMapper.java similarity index 90% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemMapper.java index 39f02cf07..917f4ef88 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemMapper.java @@ -1,10 +1,10 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.catalog.CatalogItem; import com.dressca.applicationcore.catalog.CatalogItemAsset; -import com.dressca.web.controller.dto.catalog.CatalogItemResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemResponse; /** * {@link CatalogItem} と {@link CatalogItemResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemSummaryMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemSummaryMapper.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemSummaryMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemSummaryMapper.java index 7f75417ec..b626e7c1f 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemSummaryMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemSummaryMapper.java @@ -1,34 +1,34 @@ -package com.dressca.web.mapper; - -import java.util.List; -import java.util.stream.Collectors; -import com.dressca.applicationcore.catalog.CatalogItem; -import com.dressca.applicationcore.catalog.CatalogItemAsset; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; - -/** - * {@link CatalogItem} と {@link CatalogItemSummaryResponse} のマッパーです。 - */ -public class CatalogItemSummaryMapper { - /** - * {@link CatalogItem} オブジェクトを {@link CatalogItemSummaryResponse} に変換します。 - * - * @param item {@link CatalogItem} オブジェクト - * @return {@link CatalogItemSummaryResponse} オブジェクト - */ - public static CatalogItemSummaryResponse convert(CatalogItem item) { - if (item == null) { - return null; - } - - List assetCodes = item.getAssets().stream() - .map(CatalogItemAsset::getAssetCode) - .collect(Collectors.toList()); - - return new CatalogItemSummaryResponse( - item.getId(), - item.getName(), - item.getProductCode(), - assetCodes); - } -} +package com.dressca.web.consumer.mapper; + +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogItemAsset; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; + +/** + * {@link CatalogItem} と {@link CatalogItemSummaryResponse} のマッパーです。 + */ +public class CatalogItemSummaryMapper { + /** + * {@link CatalogItem} オブジェクトを {@link CatalogItemSummaryResponse} に変換します。 + * + * @param item {@link CatalogItem} オブジェクト + * @return {@link CatalogItemSummaryResponse} オブジェクト + */ + public static CatalogItemSummaryResponse convert(CatalogItem item) { + if (item == null) { + return null; + } + + List assetCodes = item.getAssets().stream() + .map(CatalogItemAsset::getAssetCode) + .collect(Collectors.toList()); + + return new CatalogItemSummaryResponse( + item.getId(), + item.getName(), + item.getProductCode(), + assetCodes); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderItemMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderItemMapper.java similarity index 84% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderItemMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderItemMapper.java index 22e005f00..c70686c66 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderItemMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderItemMapper.java @@ -1,10 +1,10 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import java.util.stream.Collectors; import com.dressca.applicationcore.order.OrderItem; import com.dressca.applicationcore.order.OrderItemAsset; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; -import com.dressca.web.controller.dto.order.OrderItemResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; +import com.dressca.web.consumer.controller.dto.order.OrderItemResponse; /** * {@link OrderItem} と {@link OrderItemResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderMapper.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderMapper.java index ad2c89ec8..94538c598 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderMapper.java @@ -1,9 +1,9 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import java.util.stream.Collectors; import com.dressca.applicationcore.order.Order; -import com.dressca.web.controller.dto.accounting.AccountResponse; -import com.dressca.web.controller.dto.order.OrderResponse; +import com.dressca.web.consumer.controller.dto.accounting.AccountResponse; +import com.dressca.web.consumer.controller.dto.order.OrderResponse; /** * {@link Order} と {@link OrderResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/CookieSettings.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/CookieSettings.java similarity index 89% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/CookieSettings.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/CookieSettings.java index 6bcb0b29b..ba3362859 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/CookieSettings.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/CookieSettings.java @@ -1,18 +1,18 @@ -package com.dressca.web.security; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; -import lombok.Data; - -/** - * Cookie の設定を格納するクラスです。 - */ -@Component -@ConfigurationProperties(prefix = "cookie.settings") -@Data -public class CookieSettings { - private String sameSite = "Strict"; - private boolean httpOnly = true; - private boolean secure = false; - private int expiredDays = 1; -} +package com.dressca.web.consumer.security; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; +import lombok.Data; + +/** + * Cookie の設定を格納するクラスです。 + */ +@Component +@ConfigurationProperties(prefix = "cookie.settings") +@Data +public class CookieSettings { + private String sameSite = "Strict"; + private boolean httpOnly = true; + private boolean secure = false; + private int expiredDays = 1; +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/WebSecurityConfig.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/WebSecurityConfig.java similarity index 95% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/WebSecurityConfig.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/WebSecurityConfig.java index 1022f8e60..b15d493f7 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/WebSecurityConfig.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/WebSecurityConfig.java @@ -1,50 +1,50 @@ -package com.dressca.web.security; - -import java.util.Arrays; -import java.util.List; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.web.cors.CorsConfiguration; - -/** - * セキュリティ関連の実行クラス。 - */ -@Configuration(proxyBeanMethods = false) -@EnableWebSecurity -public class WebSecurityConfig { - - @Value("${cors.allowed.origins:}") - private String[] allowedOrigins; - - /** - * CORS 設定を実行。 - * - * @param http http リクエスト - * @return フィルターチェーン - * @throws Exception 例外 - */ - @Bean - public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - http - .securityMatcher("/api/**") - // CSRF トークンを利用したリクエストの検証を無効化( OAuth2.0 による認証認可を利用する前提のため) - // OAuth2.0 によるリクエストの検証を利用しない場合は、有効化して CSRF 対策を施す - .csrf(csrf -> csrf.ignoringRequestMatchers("/api/**")) - .cors(cors -> cors.configurationSource(request -> { - CorsConfiguration conf = new CorsConfiguration(); - conf.setAllowCredentials(true); - conf.setAllowedOrigins(Arrays.asList(allowedOrigins)); - conf.setAllowedMethods(List.of("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")); - conf.setAllowedHeaders(List.of("*")); - // 注文情報の確定にLocationを利用するため公開ヘッダーとして設定 - conf.addExposedHeader("Location"); - return conf; - })); - - return http.build(); - } -} +package com.dressca.web.consumer.security; + +import java.util.Arrays; +import java.util.List; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.web.cors.CorsConfiguration; + +/** + * セキュリティ関連の実行クラス。 + */ +@Configuration(proxyBeanMethods = false) +@EnableWebSecurity +public class WebSecurityConfig { + + @Value("${cors.allowed.origins:}") + private String[] allowedOrigins; + + /** + * CORS 設定を実行。 + * + * @param http http リクエスト + * @return フィルターチェーン + * @throws Exception 例外 + */ + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + http + .securityMatcher("/api/**") + // CSRF トークンを利用したリクエストの検証を無効化( OAuth2.0 による認証認可を利用する前提のため) + // OAuth2.0 によるリクエストの検証を利用しない場合は、有効化して CSRF 対策を施す + .csrf(csrf -> csrf.ignoringRequestMatchers("/api/**")) + .cors(cors -> cors.configurationSource(request -> { + CorsConfiguration conf = new CorsConfiguration(); + conf.setAllowCredentials(true); + conf.setAllowedOrigins(Arrays.asList(allowedOrigins)); + conf.setAllowedMethods(List.of("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")); + conf.setAllowedHeaders(List.of("*")); + // 注文情報の確定にLocationを利用するため公開ヘッダーとして設定 + conf.addExposedHeader("Location"); + return conf; + })); + + return http.build(); + } +} diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-common.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-common.properties new file mode 100644 index 000000000..49ca039e7 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-common.properties @@ -0,0 +1,19 @@ +# springdoc-openapi +springdoc.api-docs.path=/api-docs +springdoc.swagger-ui.path=/swagger-ui.html +springdoc.show-actuator=true + +# messages.properties +spring.messages.basename=applicationcore.messages,systemcommon.messages +spring.messages.encoding=UTF-8 + +# spring boot actuatorの設定(ステータスの変更,表示情報) +# ヘルスチェックAPIのURLを/apiから始まるように変更する +management.endpoints.web.base-path=/api +# サーバのヘルスチェック用のAPIを設定する(http://localhost:8080/api/health/check) +management.endpoint.health.group.check.include=ping +# データベースのヘルスチェック用のAPIを設定する(http://localhost:8080/api/health/datasource) +management.endpoint.health.group.datasource.include=db + +# ポート番号の指定 +server.port=8080 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-dev.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-dev.properties new file mode 100644 index 000000000..9ad039e9c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-dev.properties @@ -0,0 +1,22 @@ +# h2 database +spring.datasource.hikari.driver-class-name=org.h2.Driver + +# DBをサーバーモードで立ち上げる場合の接続先情報 +spring.datasource.hikari.jdbc-url=jdbc:h2:tcp://localhost:9092/mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +spring.sql.init.mode=always + +# DBを組み込みモードで立ち上げる場合の接続先情報 +# spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +# spring.sql.init.mode=embedded + +spring.datasource.hikari.username= +spring.datasource.hikari.password= +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.h2.console.settings.web-allow-others=true + +# ヘルスチェックの API のログを検出するため logging level を変更する +logging.level.web=DEBUG + +# CORS 設定 +cors.allowed.origins=http://localhost,http://localhost:5173 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-prd.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-prd.properties new file mode 100644 index 000000000..4d68b9aa1 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-prd.properties @@ -0,0 +1,15 @@ +# PostgreSQL database +spring.datasource.hikari.driver-class-name=org.postgresql.Driver +spring.datasource.hikari.jdbc-url=jdbc:postgresql://localhost:5432/project +spring.datasource.hikari.username=project +spring.datasource.hikari.password=project +spring.sql.init.mode=never + +# CORS 設定 +cors.allowed.origins=https://本番環境のフロントエンド配布サーバーのドメイン + +# Cookie の設定 +cookie.settings.same-site=None +cookie.settings.http-only=true +cookie.settings.secure=true +cookie.settings.expired-days=7 diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-ut.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-ut.properties new file mode 100644 index 000000000..df4261b68 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-ut.properties @@ -0,0 +1,10 @@ +# h2 database +spring.datasource.hikari.driver-class-name=org.h2.Driver +spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +spring.datasource.hikari.username= +spring.datasource.hikari.password= +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.h2.console.settings.web-allow-others=true +spring.sql.init.mode=embedded +mybatis.configuration.map-underscore-to-camel-case=true diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application.properties new file mode 100644 index 000000000..7c8672e4a --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application.properties @@ -0,0 +1,9 @@ +# 環境別のプロファイル設定(common:全環境共通の設定、test:UT用、local:ローカル打鍵用、production:本番環境用) +spring.profiles.group.local=common,dev +spring.profiles.group.production=common,prd +spring.profiles.group.test=common,ut +# 環境情報未指定の場合に使用するプロファイル(環境情報を指定する場合、起動コマンドに「-Dspring.profiles.active=<プロファイル名>'」を追加する) +spring.profiles.default=production + +# Open API 仕様書を自動生成する際keyをアルファベット順でソートする +springdoc.writer-with-order-by-keys=true \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/log4j2.xml b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/log4j2.xml new file mode 100644 index 000000000..3de3d7921 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/log4j2.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/WebApplicationTests.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/WebApplicationTests.java new file mode 100644 index 000000000..12d7ec6d2 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/WebApplicationTests.java @@ -0,0 +1,14 @@ +package com.dressca.web.consumer; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.junit.jupiter.api.DisplayName; + +@SpringBootTest +class WebApplicationTests { + + @Test + @DisplayName("コンテキストが正常に読み込まれるか確認") + void contextLoads() { + } +} diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/AssetsControllerTest.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/AssetsControllerTest.java similarity index 94% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/AssetsControllerTest.java rename to samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/AssetsControllerTest.java index b9dd2b02a..08064e17c 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/AssetsControllerTest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/AssetsControllerTest.java @@ -1,10 +1,10 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import com.dressca.web.WebApplication; +import com.dressca.web.consumer.WebApplication; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/HealthCheckTest.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/HealthCheckTest.java new file mode 100644 index 000000000..b7f92ad5c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/HealthCheckTest.java @@ -0,0 +1,42 @@ +package com.dressca.web.consumer.controller; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import com.dressca.web.consumer.WebApplication; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; + +/** + * ヘルスチェックAPIの動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +public class HealthCheckTest { + + @Autowired + private MockMvc mockMvc; + + @Test + @DisplayName("testGet_03_ヘルスチェック_サーバ正常動作確認") + void testGet_serverCheck() throws Exception { + this.mockMvc.perform(get("/api/health/check")) + .andExpect(status().isOk()) + .andExpect(content().json("{'status':'UP'}")); + } + + @Test + @DisplayName("testGet_04_ヘルスチェック_DB正常動作確認") + void testGet_databaseCheck() throws Exception { + this.mockMvc.perform(get("/api/health/datasource")) + .andExpect(status().isOk()) + .andExpect(content().json("{'status':'UP'}")); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/filter/BuyerIdFilterTest.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/filter/BuyerIdFilterTest.java similarity index 94% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/filter/BuyerIdFilterTest.java rename to samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/filter/BuyerIdFilterTest.java index 24f3d46a2..d1eb5a2c5 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/filter/BuyerIdFilterTest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/filter/BuyerIdFilterTest.java @@ -1,96 +1,93 @@ -package com.dressca.web.filter; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.HttpHeaders; -import org.springframework.mock.web.MockFilterChain; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.mock.web.MockHttpServletResponse; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import com.dressca.web.WebApplication; -import com.dressca.web.security.CookieSettings; -import jakarta.servlet.FilterChain; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -/** - * {@link BuyerIdFilter}の動作をテストするクラスです。 - */ -@SpringJUnitConfig -@SpringBootTest(classes = WebApplication.class) -public class BuyerIdFilterTest { - - private HttpServletRequest request; - private HttpServletResponse response; - private FilterChain chain; - - @BeforeEach - void setup() { - // モックの作成 - this.request = new MockHttpServletRequest(); - this.response = new MockHttpServletResponse(); - this.chain = new MockFilterChain(); - } - - @Test - @DisplayName("構成ファイルの設定がない場合") - void testDoFilter_01() throws Exception { - - // デフォルトの CookieSettings を呼び出す - CookieSettings cookieSettings = new CookieSettings(); - - // テスト対象の Filter を作成 - BuyerIdFilter filter = new BuyerIdFilter(cookieSettings); - - // doFilter の実行 - filter.doFilter(request, response, chain); - String setCookieHeader = response.getHeader(HttpHeaders.SET_COOKIE); - - // Set-Cookieヘッダーの値が期待通りであることを確認 - assertNotNull(setCookieHeader); - assertTrue(setCookieHeader.startsWith("Dressca-Bid=")); - assertTrue(setCookieHeader.contains("Path=/")); - assertTrue(setCookieHeader.contains("HttpOnly")); - assertFalse(setCookieHeader.contains("Secure")); - assertTrue(setCookieHeader.contains("Max-Age=86400")); - assertTrue(setCookieHeader.contains("SameSite=Strict")); - - } - - @Test - @DisplayName("構成ファイルの設定がある場合") - void testDoFilter_02() throws Exception { - - // モックオブジェクトを作成 - CookieSettings cookieSettings = Mockito.mock(CookieSettings.class); - Mockito.when(cookieSettings.isHttpOnly()).thenReturn(true); - Mockito.when(cookieSettings.isSecure()).thenReturn(true); - Mockito.when(cookieSettings.getExpiredDays()).thenReturn(7); - Mockito.when(cookieSettings.getSameSite()).thenReturn("None"); - - // テスト対象の Filter を作成 - BuyerIdFilter filter = new BuyerIdFilter(cookieSettings); - - // doFilter の実行 - filter.doFilter(request, response, chain); - String setCookieHeader = response.getHeader(HttpHeaders.SET_COOKIE); - - // Set-Cookieヘッダーの値が期待通りであることを確認 - assertNotNull(setCookieHeader); - assertTrue(setCookieHeader.startsWith("Dressca-Bid=")); - assertTrue(setCookieHeader.contains("Path=/")); - assertTrue(setCookieHeader.contains("HttpOnly")); - assertTrue(setCookieHeader.contains("Secure")); - assertTrue(setCookieHeader.contains("Max-Age=604800")); - assertTrue(setCookieHeader.contains("SameSite=None")); - - } - -} +package com.dressca.web.consumer.filter; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.web.MockFilterChain; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import com.dressca.web.consumer.WebApplication; +import com.dressca.web.consumer.security.CookieSettings; +import jakarta.servlet.FilterChain; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * {@link BuyerIdFilter}の動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +public class BuyerIdFilterTest { + + private HttpServletRequest request; + private HttpServletResponse response; + private FilterChain chain; + + @BeforeEach + void setup() { + // モックの作成 + this.request = new MockHttpServletRequest(); + this.response = new MockHttpServletResponse(); + this.chain = new MockFilterChain(); + } + + @Test + @DisplayName("構成ファイルの設定がない場合") + void testDoFilter_01() throws Exception { + + // デフォルトの CookieSettings を呼び出す + CookieSettings cookieSettings = new CookieSettings(); + + // テスト対象の Filter を作成 + BuyerIdFilter filter = new BuyerIdFilter(cookieSettings); + + // doFilter の実行 + filter.doFilter(request, response, chain); + String setCookieHeader = response.getHeader(HttpHeaders.SET_COOKIE); + + // Set-Cookieヘッダーの値が期待通りであることを確認 + assertNotNull(setCookieHeader); + assertTrue(setCookieHeader.startsWith("Dressca-Bid=")); + assertTrue(setCookieHeader.contains("Path=/")); + assertTrue(setCookieHeader.contains("HttpOnly")); + assertFalse(setCookieHeader.contains("Secure")); + assertTrue(setCookieHeader.contains("Max-Age=86400")); + assertTrue(setCookieHeader.contains("SameSite=Strict")); + } + + @Test + @DisplayName("構成ファイルの設定がある場合") + void testDoFilter_02() throws Exception { + + // モックオブジェクトを作成 + CookieSettings cookieSettings = Mockito.mock(CookieSettings.class); + Mockito.when(cookieSettings.isHttpOnly()).thenReturn(true); + Mockito.when(cookieSettings.isSecure()).thenReturn(true); + Mockito.when(cookieSettings.getExpiredDays()).thenReturn(7); + Mockito.when(cookieSettings.getSameSite()).thenReturn("None"); + + // テスト対象の Filter を作成 + BuyerIdFilter filter = new BuyerIdFilter(cookieSettings); + + // doFilter の実行 + filter.doFilter(request, response, chain); + String setCookieHeader = response.getHeader(HttpHeaders.SET_COOKIE); + + // Set-Cookieヘッダーの値が期待通りであることを確認 + assertNotNull(setCookieHeader); + assertTrue(setCookieHeader.startsWith("Dressca-Bid=")); + assertTrue(setCookieHeader.contains("Path=/")); + assertTrue(setCookieHeader.contains("HttpOnly")); + assertTrue(setCookieHeader.contains("Secure")); + assertTrue(setCookieHeader.contains("Max-Age=604800")); + assertTrue(setCookieHeader.contains("SameSite=None")); + } +} diff --git a/samples/web-csr/dressca-backend/web/build.gradle b/samples/web-csr/dressca-backend/web/build.gradle index 8963f8cae..f35a12c1c 100644 --- a/samples/web-csr/dressca-backend/web/build.gradle +++ b/samples/web-csr/dressca-backend/web/build.gradle @@ -2,7 +2,6 @@ plugins { id 'java' id 'org.springframework.boot' version "${springBootVersion}" id 'io.spring.dependency-management' version "${springDependencyManagementVersion}" - id 'org.springdoc.openapi-gradle-plugin' version "${springdocOpenapiGradlePluginVersion}" } group = 'com.dressca' @@ -25,14 +24,14 @@ dependencies { implementation supportDependencies.springdoc_openapi_starter_webmvc_ui implementation supportDependencies.commons_lang3 implementation supportDependencies.spring_boot_security_starter - implementation supportDependencies.spring_boot_starter_log4j2 - + implementation project(':application-core') implementation project(':infrastructure') implementation project(':system-common') testImplementation supportDependencies.spring_boot_starter_test testImplementation supportDependencies.spring_security_test + testImplementation supportDependencies.spring_boot_starter_log4j2 compileOnly supportDependencies.servlet_api } @@ -42,25 +41,10 @@ configurations { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' } } -afterEvaluate { - tasks.named("forkedSpringBootRun") { - workingDir("$rootDir/api-docs") - } -} -openApi { - apiDocsUrl.set("http://localhost:8080/api-docs") - outputDir.set(file("$rootDir/api-docs")) - outputFileName.set("api-specification.json") -} + tasks.named('test') { useJUnitPlatform() } -tasks.register('bootRunDev', org.springframework.boot.gradle.tasks.run.BootRun){ - group = 'application' - description = 'Runs this project as a Spring Boot Application using local profile.' - args = ["--spring.profiles.active=local"] - main = 'com.dressca.web.WebApplication' - classpath = sourceSets.main.runtimeClasspath -} -build.dependsOn("generateOpenApiDocs") \ No newline at end of file +bootJar.enabled = false +jar.enabled = true \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdvice.java b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdvice.java index 89ab9e61e..22f072d74 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdvice.java +++ b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdvice.java @@ -1,11 +1,14 @@ package com.dressca.web.controller.advice; import jakarta.servlet.http.HttpServletRequest; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.applicationcore.catalog.OptimisticLockingFailureException; import com.dressca.systemcommon.constant.CommonExceptionIdConstants; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.LogicException; import com.dressca.systemcommon.exception.SystemException; import com.dressca.web.log.ErrorMessageBuilder; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -13,6 +16,8 @@ import org.springframework.http.MediaType; import org.springframework.http.ProblemDetail; import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; +import org.springframework.security.authorization.AuthorizationDeniedException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; @@ -28,6 +33,48 @@ public class ExceptionHandlerControllerAdvice extends ResponseEntityExceptionHan @Autowired private ProblemDetailsFactory problemDetailsFactory; + /** + * 未認証エラーをステータスコード401で返却する。 + * + * @param e 未認証エラー + * @param req リクエスト + * @return ステータースコード401のレスポンス + */ + @ExceptionHandler(AuthenticationCredentialsNotFoundException.class) + public ResponseEntity handleAuthenticationCredentialsNotFoundException( + AuthenticationCredentialsNotFoundException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); + } + + /** + * 認可エラーをステータスコード404で返却する。 + * + * @param e 認可エラー + * @param req リクエスト + * @return ステータースコード404のレスポンス + */ + @ExceptionHandler({ AuthorizationDeniedException.class, PermissionDeniedException.class }) + public ResponseEntity handleAuthorizationDeniedException( + AuthorizationDeniedException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + + /** + * 楽観ロックエラーをステータスコード409で返却する。 + * + * @param e 楽観ロックエラー + * @param req リクエスト + * @return ステータスコード409のレスポンス + */ + @ExceptionHandler(OptimisticLockingFailureException.class) + public ResponseEntity handleOptimisticLockingFailureException( + OptimisticLockingFailureException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.CONFLICT).body(null); + } + /** * その他の業務エラーをステータースコード500で返却する。 * diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdvice.java b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdvice.java new file mode 100644 index 000000000..76a4d3906 --- /dev/null +++ b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdvice.java @@ -0,0 +1,136 @@ +package com.dressca.web.controller.advice; + +import jakarta.servlet.http.HttpServletRequest; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.applicationcore.catalog.OptimisticLockingFailureException; +import com.dressca.systemcommon.constant.CommonExceptionIdConstants; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.LogicException; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.web.log.ErrorMessageBuilder; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ProblemDetail; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; +import org.springframework.security.authorization.AuthorizationDeniedException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; + +/** + * サーバーエラーのハンドリングを行うクラスです。 + */ +@ControllerAdvice(basePackages = "com.dressca") +public class LocalExceptionHandlerControllerAdvice extends ResponseEntityExceptionHandler { + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + @Autowired + private ProblemDetailsFactory problemDetailsFactory; + + /** + * 未認証エラーをステータスコード401で返却する。 + * + * @param e 未認証エラー + * @param req リクエスト + * @return ステータースコード401のレスポンス + */ + @ExceptionHandler(AuthenticationCredentialsNotFoundException.class) + public ResponseEntity handleAuthenticationCredentialsNotFoundException( + AuthenticationCredentialsNotFoundException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); + } + + /** + * 認可エラーをステータスコード404で返却する。 + * + * @param e 認可エラー + * @param req リクエスト + * @return ステータースコード404のレスポンス + */ + @ExceptionHandler({ AuthorizationDeniedException.class, PermissionDeniedException.class }) + public ResponseEntity handleAuthorizationDeniedException( + AuthorizationDeniedException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + + /** + * 楽観ロックエラーをステータスコード409で返却する。 + * + * @param e 楽観ロックエラー + * @param req リクエスト + * @return ステータスコード409のレスポンス + */ + @ExceptionHandler(OptimisticLockingFailureException.class) + public ResponseEntity handleOptimisticLockingFailureException( + OptimisticLockingFailureException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.CONFLICT).body(null); + } + + /** + * その他の業務エラーをステータースコード500で返却する。 + * + * @param e 業務例外 + * @param req リクエスト + * @return ステータースコード500のレスポンス + */ + @ExceptionHandler(LogicException.class) + public ResponseEntity handleLogicException(LogicException e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, CommonExceptionIdConstants.E_BUSINESS, null, null); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = problemDetailsFactory.createProblemDetail( + errorBuilder, + CommonExceptionIdConstants.E_BUSINESS, + HttpStatus.INTERNAL_SERVER_ERROR); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_PROBLEM_JSON) + .body(problemDetail); + } + + /** + * その他のシステムエラーをステータースコード500で返却する。 + * + * @param e その他の例外 + * @param req リクエスト + * @return ステータースコード500のレスポンス + */ + @ExceptionHandler(SystemException.class) + public ResponseEntity handleSystemException(SystemException e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, CommonExceptionIdConstants.E_SYSTEM, null, null); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = problemDetailsFactory.createProblemDetail( + errorBuilder, + CommonExceptionIdConstants.E_SYSTEM, + HttpStatus.INTERNAL_SERVER_ERROR); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_PROBLEM_JSON) + .body(problemDetail); + } + + /** + * 上記のいずれにも当てはまらない例外をステータースコード500で返却する。 + * + * @param e その他の例外 + * @param req リクエスト + * @return ステータースコード500のレスポンス + */ + @ExceptionHandler(Exception.class) + public ResponseEntity handleException(Exception e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, CommonExceptionIdConstants.E_SYSTEM, null, null); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = problemDetailsFactory.createProblemDetail(errorBuilder, + CommonExceptionIdConstants.E_SYSTEM, + HttpStatus.INTERNAL_SERVER_ERROR); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_PROBLEM_JSON) + .body(problemDetail); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/PagedListOfCatalogItemResponse.java b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/PagedListOfCatalogItemResponse.java deleted file mode 100644 index 77643bccb..000000000 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/PagedListOfCatalogItemResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.dressca.web.controller.dto.catalog; - -import java.util.List; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 検索したカタログアイテムの情報を取得する際に用いるdtoクラスです。 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -public class PagedListOfCatalogItemResponse { - private List items; - private int totalCount; - private int page; - private int pageSize; -} diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application-common.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application-common.properties index 4b7014a41..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application-common.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application-common.properties @@ -1,16 +0,0 @@ -# springdoc-openapi -springdoc.api-docs.path=/api-docs -springdoc.swagger-ui.path=/swagger-ui.html -springdoc.show-actuator=true - -# messages.properties -spring.messages.basename=applicationcore.messages,systemcommon.messages -spring.messages.encoding=UTF-8 - -# spring boot actuatorの設定(ステータスの変更,表示情報) -# ヘルスチェックAPIのURLを/apiから始まるように変更する -management.endpoints.web.base-path=/api -# サーバのヘルスチェック用のAPIを設定する(http://localhost:8080/api/health/check) -management.endpoint.health.group.check.include=ping -# データベースのヘルスチェック用のAPIを設定する(http://localhost:8080/api/health/datasource) -management.endpoint.health.group.datasource.include=db diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application-dev.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application-dev.properties index 023bf0553..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application-dev.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application-dev.properties @@ -1,15 +0,0 @@ -# h2 database -spring.datasource.hikari.driver-class-name=org.h2.Driver -spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; -spring.datasource.hikari.username= -spring.datasource.hikari.password= -spring.h2.console.enabled=true -spring.h2.console.path=/h2-console -spring.h2.console.settings.web-allow-others=true -spring.sql.init.mode=embedded - -# CORS 設定 -cors.allowed.origins=http://localhost,http://localhost:5173 - -# ヘルスチェックの API のログを検出するため logging level を変更する -logging.level.web=DEBUG diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application-prd.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application-prd.properties index 640fda112..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application-prd.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application-prd.properties @@ -1,15 +0,0 @@ -# PostgreSQL database -spring.datasource.hikari.driver-class-name=org.postgresql.Driver -spring.datasource.hikari.jdbc-url=jdbc:postgresql://localhost:5432/project -spring.datasource.hikari.username=project -spring.datasource.hikari.password=project -spring.sql.init.mode=never - -# CORS 設定 -cors.allowed.origins=https://本番環境のフロントエンド配布サーバーのドメイン - -# Cookie の設定 -cookie.settings.same-site=None -cookie.settings.http-only=true -cookie.settings.secure=true -cookie.settings.expired-days=7 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application-ut.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application-ut.properties index ff7b76b87..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application-ut.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application-ut.properties @@ -1,11 +0,0 @@ -# h2 database -spring.datasource.hikari.driver-class-name=org.h2.Driver -spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; -spring.datasource.hikari.username= -spring.datasource.hikari.password= -spring.h2.console.enabled=true -spring.h2.console.path=/h2-console -spring.h2.console.settings.web-allow-others=true -spring.sql.init.mode=embedded -mybatis.configuration.map-underscore-to-camel-case=true - diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application.properties index 7c8672e4a..f93c4f8f3 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application.properties @@ -1,9 +1,3 @@ -# 環境別のプロファイル設定(common:全環境共通の設定、test:UT用、local:ローカル打鍵用、production:本番環境用) -spring.profiles.group.local=common,dev -spring.profiles.group.production=common,prd -spring.profiles.group.test=common,ut -# 環境情報未指定の場合に使用するプロファイル(環境情報を指定する場合、起動コマンドに「-Dspring.profiles.active=<プロファイル名>'」を追加する) -spring.profiles.default=production - -# Open API 仕様書を自動生成する際keyをアルファベット順でソートする -springdoc.writer-with-order-by-keys=true \ No newline at end of file +# messages.properties +spring.messages.basename=applicationcore.messages,systemcommon.messages +spring.messages.encoding=UTF-8 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java deleted file mode 100644 index c2e430bbe..000000000 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.dressca.applicationcore.applicationservice; - -import org.junit.jupiter.api.Test; - -/** - * {@link AssetApplicationService}の動作をテストするクラスです。 - */ -public class AssetApplicationServiceTest { - @Test - void testGetAssetResourceInfo() { - - } -} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/AssetsController.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/AssetsController.java similarity index 99% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/AssetsController.java rename to samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/AssetsController.java index e985fe528..7315175ba 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/AssetsController.java +++ b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/AssetsController.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller; +package com.dressca.web; import com.dressca.applicationcore.applicationservice.AssetApplicationService; import com.dressca.applicationcore.assets.Asset; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/WebApplication.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplication.java similarity index 99% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/WebApplication.java rename to samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplication.java index 2c81cd369..212f65c38 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/WebApplication.java +++ b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplication.java @@ -17,5 +17,4 @@ public class WebApplication { public static void main(String[] args) { SpringApplication.run(WebApplication.class, args); } - } diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdviceTest.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdviceTest.java index f61b98c73..e71450e1d 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdviceTest.java +++ b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdviceTest.java @@ -8,13 +8,13 @@ import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.times; -import com.dressca.web.controller.AssetsController; import com.dressca.systemcommon.constant.CommonExceptionIdConstants; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.LogicException; import com.dressca.systemcommon.exception.SystemException; import com.dressca.systemcommon.util.ApplicationContextWrapper; import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.web.AssetsController; import com.dressca.web.WebApplication; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -24,6 +24,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.MessageSource; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.web.servlet.MockMvc; @@ -95,6 +96,7 @@ private void setLogLevel(Level level) { } @Test + @WithMockUser @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(本番環境)。") void testException_01() throws Exception { // テスト用の入力データ @@ -123,6 +125,7 @@ void testException_01() throws Exception { } @Test + @WithMockUser @DisplayName("testException_02_正常系_その他のシステムエラーをステータースコード500で返却する(本番環境)。") void testException_02() throws Exception { // テスト用の入力データ @@ -152,6 +155,7 @@ void testException_02() throws Exception { } @Test + @WithMockUser @DisplayName("testException_03_正常系_上記のいずれにも当てはまらない例外をステータースコード500で返却する(本番環境)。") void testException_03() throws Exception { // テスト用の入力データ diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdviceTest.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdviceTest.java index 89488674e..f1e5fcb8a 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdviceTest.java +++ b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdviceTest.java @@ -8,13 +8,13 @@ import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.times; -import com.dressca.web.controller.AssetsController; import com.dressca.systemcommon.constant.CommonExceptionIdConstants; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.LogicException; import com.dressca.systemcommon.exception.SystemException; import com.dressca.systemcommon.util.ApplicationContextWrapper; import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.web.AssetsController; import com.dressca.web.WebApplication; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -24,6 +24,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.MessageSource; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.web.servlet.MockMvc; @@ -95,6 +96,7 @@ private void setLogLevel(Level level) { } @Test + @WithMockUser @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(開発環境)。") void testException_01() throws Exception { // テスト用の入力データ @@ -123,6 +125,7 @@ void testException_01() throws Exception { } @Test + @WithMockUser @DisplayName("testException_02_正常系_その他のシステムエラーをステータースコード500で返却する(開発環境)。") void testException_02() throws Exception { // テスト用の入力データ @@ -151,6 +154,7 @@ void testException_02() throws Exception { } @Test + @WithMockUser @DisplayName("testException_03_正常系_上記のいずれにも当てはまらない例外をステータースコード500で返却する(開発環境)。") void testException_03() throws Exception { // テスト用の入力データ diff --git a/samples/web-csr/dressca-frontend/admin/.env.dev b/samples/web-csr/dressca-frontend/admin/.env.dev new file mode 100644 index 000000000..cf25d8e86 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/.env.dev @@ -0,0 +1,13 @@ +# Web API のエンドポイントです。 +VITE_AXIOS_BASE_ENDPOINT_ORIGIN= + +# 開発環境において Web API をプロキシ経由で呼び出す際のエンドポイントです。 +VITE_PROXY_ENDPOINT_ORIGIN=http://localhost:8081 + +# これより下はサンプルアプリケーション Dressca 固有の設定です。 + +# 商品画像が存在しない場合の代替画像の URL です。 +VITE_NO_ASSET_URL=/api/assets/e622b0098808492cb883831c05486b58 + +# 商品画像が保存されているディレクトリの URL です。 +VITE_ASSET_URL=/api/assets/ diff --git a/samples/web-csr/dressca-frontend/admin/.env.mock b/samples/web-csr/dressca-frontend/admin/.env.mock new file mode 100644 index 000000000..c9230f4b3 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/.env.mock @@ -0,0 +1,13 @@ +# Web API のエンドポイントです。 +VITE_AXIOS_BASE_ENDPOINT_ORIGIN= + +# 開発環境において Web API をプロキシ経由で呼び出す際のエンドポイントです。 +VITE_PROXY_ENDPOINT_ORIGIN=https://localhost:6001 + +# これより下はサンプルアプリケーション Dressca 固有の設定です。 + +# 商品画像が存在しない場合の代替画像の URL です。 +VITE_NO_ASSET_URL=/api/assets/e622b0098808492cb883831c05486b58 + +# 商品画像が保存されているディレクトリの URL です。 +VITE_ASSET_URL=/api/assets/ diff --git a/samples/web-csr/dressca-frontend/admin/.env.prod b/samples/web-csr/dressca-frontend/admin/.env.prod new file mode 100644 index 000000000..1d9ec430e --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/.env.prod @@ -0,0 +1,10 @@ +# Web API のエンドポイントです。 +VITE_AXIOS_BASE_ENDPOINT_ORIGIN= + +# これより下はサンプルアプリケーション Dressca 固有の設定です。 + +# 商品画像が存在しない場合の代替画像の URL です。 +VITE_NO_ASSET_URL=/api/assets/e622b0098808492cb883831c05486b58 + +# 商品画像が保存されているディレクトリの URL です。 +VITE_ASSET_URL=/api/assets/ diff --git a/samples/web-csr/dressca-frontend/admin/.eslintrc.cjs b/samples/web-csr/dressca-frontend/admin/.eslintrc.cjs new file mode 100644 index 000000000..eff3fb7a5 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/.eslintrc.cjs @@ -0,0 +1,8 @@ +/* eslint-env node */ +require('@rushstack/eslint-patch/modern-module-resolution'); + +module.exports = { + root: true, + extends: '../.eslintrc.cjs', + ignorePatterns: ['**/mockServiceWorker.js'], +}; diff --git a/samples/web-csr/dressca-frontend/admin/.gitignore b/samples/web-csr/dressca-frontend/admin/.gitignore new file mode 100644 index 000000000..8ee54e8d3 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/.gitignore @@ -0,0 +1,30 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist +dist-ssr +coverage +*.local + +/cypress/videos/ +/cypress/screenshots/ + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +*.tsbuildinfo diff --git a/samples/web-csr/dressca-frontend/admin/.stylelintrc.js b/samples/web-csr/dressca-frontend/admin/.stylelintrc.js new file mode 100644 index 000000000..2a4eadc7b --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/.stylelintrc.js @@ -0,0 +1,5 @@ +import stylelintConfigBase from '../.stylelintrc.js' + +export default { + extends: stylelintConfigBase +}; diff --git a/samples/web-csr/dressca-frontend/admin/cypress.config.ts b/samples/web-csr/dressca-frontend/admin/cypress.config.ts new file mode 100644 index 000000000..0a991f720 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/cypress.config.ts @@ -0,0 +1,9 @@ +/* eslint-disable import/no-default-export */ +import { defineConfig } from 'cypress'; + +export default defineConfig({ + e2e: { + specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}', + baseUrl: 'http://localhost:6173', + }, +}); diff --git a/samples/web-csr/dressca-frontend/admin/cypress/e2e/example.cy.ts b/samples/web-csr/dressca-frontend/admin/cypress/e2e/example.cy.ts new file mode 100644 index 000000000..388fa5e51 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/cypress/e2e/example.cy.ts @@ -0,0 +1,8 @@ +// https://on.cypress.io/api + +describe('My First Test', () => { + it('visits the app root url', () => { + cy.visit('/'); + cy.contains('Dressca'); + }); +}); diff --git a/samples/web-csr/dressca-frontend/admin/cypress/e2e/tsconfig.json b/samples/web-csr/dressca-frontend/admin/cypress/e2e/tsconfig.json new file mode 100644 index 000000000..c94f1d49b --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/cypress/e2e/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["./**/*", "../support/**/*"], + "compilerOptions": { + "isolatedModules": false, + "types": ["cypress"] + } +} diff --git a/samples/web-csr/dressca-frontend/admin/cypress/fixtures/example.json b/samples/web-csr/dressca-frontend/admin/cypress/fixtures/example.json new file mode 100644 index 000000000..02e425437 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} diff --git a/samples/web-csr/dressca-frontend/admin/cypress/support/commands.ts b/samples/web-csr/dressca-frontend/admin/cypress/support/commands.ts new file mode 100644 index 000000000..2ed74fb33 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/cypress/support/commands.ts @@ -0,0 +1,39 @@ +/// +// *********************************************** +// This example commands.ts shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add('login', (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) +// +// declare global { +// namespace Cypress { +// interface Chainable { +// login(email: string, password: string): Chainable +// drag(subject: string, options?: Partial): Chainable +// dismiss(subject: string, options?: Partial): Chainable +// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable +// } +// } +// } + +export {}; diff --git a/samples/web-csr/dressca-frontend/admin/cypress/support/e2e.ts b/samples/web-csr/dressca-frontend/admin/cypress/support/e2e.ts new file mode 100644 index 000000000..37a498fb5 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/cypress/support/e2e.ts @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands'; + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/samples/web-csr/dressca-frontend/admin/env.d.ts b/samples/web-csr/dressca-frontend/admin/env.d.ts new file mode 100644 index 000000000..8ad31084c --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/env.d.ts @@ -0,0 +1,11 @@ +/// +interface ImportMetaEnv { + readonly VITE_NO_ASSET_URL: string; + readonly VITE_ASSET_URL: string; + readonly VITE_AXIOS_BASE_ENDPOINT_ORIGIN: string; + readonly VITE_PROXY_ENDPOINT_ORIGIN: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} diff --git a/samples/web-csr/dressca-frontend/admin/index.html b/samples/web-csr/dressca-frontend/admin/index.html new file mode 100644 index 000000000..0b904d75e --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/index.html @@ -0,0 +1,13 @@ + + + + + + + Dressca 管理 + + +
+ + + diff --git a/samples/web-csr/dressca-frontend/admin/mock/browser.ts b/samples/web-csr/dressca-frontend/admin/mock/browser.ts new file mode 100644 index 000000000..e2be5106c --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/browser.ts @@ -0,0 +1,7 @@ +import { setupWorker } from 'msw/browser'; +import { handlers } from './handler'; + +/** + * ブラウザー用のワーカーを起動します。 + */ +export const worker = setupWorker(...handlers); diff --git a/samples/web-csr/dressca-frontend/admin/mock/data/catalogItems.ts b/samples/web-csr/dressca-frontend/admin/mock/data/catalogItems.ts new file mode 100644 index 000000000..82d01eb3c --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/data/catalogItems.ts @@ -0,0 +1,140 @@ +import type { + GetCatalogItemResponse, + PagedListOfGetCatalogItemResponse, +} from '@/generated/api-client'; + +export const catalogItems: GetCatalogItemResponse[] = [ + { + id: 1, + catalogCategoryId: 1, + catalogBrandId: 3, + description: '定番の無地ロングTシャツです。', + name: 'クルーネック Tシャツ - ブラック', + price: 1980, + productCode: 'C000000001', + assetCodes: [], + rowVersion: 'byte', + }, + { + id: 2, + catalogCategoryId: 1, + catalogBrandId: 2, + description: '暖かいのに着膨れしない起毛デニムです。', + name: '裏起毛 スキニーデニム', + price: 4800, + productCode: 'C000000002', + assetCodes: ['4aed07c4ed5d45a5b97f11acedfbb601'], + rowVersion: 'byte', + }, + { + id: 3, + catalogCategoryId: 1, + catalogBrandId: 1, + description: 'あたたかく肌ざわりも良いウール100%のロングコートです。', + name: 'ウールコート', + price: 49800, + productCode: 'C000000003', + assetCodes: ['082b37439ecc44919626ba00fc60ee85'], + rowVersion: 'byte', + }, + { + id: 4, + catalogCategoryId: 1, + catalogBrandId: 2, + description: + 'コットン100%の柔らかい着心地で、春先から夏、秋口まで万能に使いやすいです。', + name: '無地 ボタンダウンシャツ', + price: 2800, + productCode: 'C000000004', + assetCodes: ['f5f89954281747fa878129c29e1e0f83'], + rowVersion: 'byte', + }, + { + id: 5, + catalogCategoryId: 2, + catalogBrandId: 3, + description: 'コンパクトサイズのバッグですが収納力は抜群です。', + name: 'レザーハンドバッグ', + price: 18800, + productCode: 'B000000001', + assetCodes: ['a8291ef2e8e14869a7048e272915f33c'], + rowVersion: 'byte', + }, + { + id: 6, + catalogCategoryId: 2, + catalogBrandId: 2, + description: 'エイジング加工したレザーを使用しています。', + name: 'ショルダーバッグ', + price: 38000, + productCode: 'B000000002', + assetCodes: ['66237018c769478a90037bd877f5fba1'], + rowVersion: 'byte', + }, + { + id: 7, + catalogCategoryId: 2, + catalogBrandId: 3, + description: + '春の季節にぴったりのトートバッグです。インナーポーチまたは単体でも使用可能なポーチ付。', + name: 'トートバッグ ポーチ付き', + price: 24800, + productCode: 'B000000003', + assetCodes: ['d136d4c81b86478990984dcafbf08244'], + rowVersion: 'byte', + }, + { + id: 8, + catalogCategoryId: 2, + catalogBrandId: 1, + description: 'さらりと気軽に纏える、キュートなミニサイズショルダー。', + name: 'ショルダーバッグ', + price: 2800, + productCode: 'B000000004', + assetCodes: ['47183f32f6584d7fb661f9216e11318b'], + rowVersion: 'byte', + }, + { + id: 9, + catalogCategoryId: 2, + catalogBrandId: 1, + description: 'エレガントな雰囲気を放つキルティングデザインです。', + name: 'レザー チェーンショルダーバッグ', + price: 258000, + productCode: 'B000000005', + assetCodes: ['cf151206efd344e1b86854f4aa49fdef'], + rowVersion: 'byte', + }, + { + id: 10, + catalogCategoryId: 3, + catalogBrandId: 2, + description: '柔らかいソールは快適な履き心地で、ランニングに最適です。', + name: 'ランニングシューズ - ブルー', + price: 12800, + productCode: 'S000000001', + assetCodes: ['ab2e78eb7fe3408aadbf1e17a9945a8c'], + rowVersion: 'byte', + }, + { + id: 11, + catalogCategoryId: 3, + catalogBrandId: 1, + description: 'イタリアの職人が丁寧に手作業で作り上げた一品です。', + name: 'メダリオン ストレートチップ ドレスシューズ', + price: 23800, + productCode: 'S000000002', + assetCodes: ['0e557e96bc054f10bc91c27405a83e85'], + rowVersion: 'byte', + }, +]; + +export const pagedListCatalogItem: PagedListOfGetCatalogItemResponse = { + hasNext: false, + hasPrevious: false, + page: 1, + pageSize: 20, + totalCount: 3, + totalPages: 1, + items: catalogItems, +}; diff --git a/samples/web-csr/dressca-frontend/admin/mock/handler.ts b/samples/web-csr/dressca-frontend/admin/mock/handler.ts new file mode 100644 index 000000000..15d43d6c0 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handler.ts @@ -0,0 +1,13 @@ +import { catalogItemsHandlers } from './handlers/catalogItems'; +import { catalogBrandsHandlers } from './handlers/catalogBrands'; +import { catalogCategoriesHandlers } from './handlers/catalogCategories'; +import { assetsHandlers } from './handlers/assets'; +import { usersHandlers } from './handlers/users'; + +export const handlers = [ + ...catalogItemsHandlers, + ...catalogBrandsHandlers, + ...catalogCategoriesHandlers, + ...assetsHandlers, + ...usersHandlers, +]; diff --git a/samples/web-csr/dressca-frontend/admin/mock/handlers/assets.ts b/samples/web-csr/dressca-frontend/admin/mock/handlers/assets.ts new file mode 100644 index 000000000..7bdbf753a --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/assets.ts @@ -0,0 +1,16 @@ +import { HttpStatusCode } from 'axios'; +import { HttpResponse, http } from 'msw'; + +export const assetsHandlers = [ + http.get('/api/assets/:assetCode', async ({ params }) => { + const imageBuffer = await fetch( + `/mock/images/${params.assetCode}.png`, + ).then((response) => response.arrayBuffer()); + return HttpResponse.arrayBuffer(imageBuffer, { + status: HttpStatusCode.Ok, + headers: { + 'Content-Type': 'image/png', + }, + }); + }), +]; diff --git a/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogBrands.ts b/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogBrands.ts new file mode 100644 index 000000000..8e4b79a12 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogBrands.ts @@ -0,0 +1,24 @@ +import type { GetCatalogBrandsResponse } from '@/generated/api-client'; +import { HttpStatusCode } from 'axios'; +import { HttpResponse, http } from 'msw'; + +const catalogBrands: GetCatalogBrandsResponse[] = [ + { + id: 1, + name: '高級なブランド', + }, + { + id: 2, + name: 'カジュアルなブランド', + }, + { + id: 3, + name: 'ノーブランド', + }, +]; + +export const catalogBrandsHandlers = [ + http.get('/api/catalog-brands', () => { + return HttpResponse.json(catalogBrands, { status: HttpStatusCode.Ok }); + }), +]; diff --git a/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogCategories.ts b/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogCategories.ts new file mode 100644 index 000000000..ac23fb4b0 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogCategories.ts @@ -0,0 +1,24 @@ +import type { GetCatalogCategoriesResponse } from '@/generated/api-client'; +import { HttpStatusCode } from 'axios'; +import { HttpResponse, http } from 'msw'; + +const catalogCategories: GetCatalogCategoriesResponse[] = [ + { + id: 1, + name: '服', + }, + { + id: 2, + name: 'バッグ', + }, + { + id: 3, + name: 'シューズ', + }, +]; + +export const catalogCategoriesHandlers = [ + http.get('/api/catalog-categories', () => { + return HttpResponse.json(catalogCategories, { status: HttpStatusCode.Ok }); + }), +]; diff --git a/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogItems.ts b/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogItems.ts new file mode 100644 index 000000000..aa43dcba1 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogItems.ts @@ -0,0 +1,46 @@ +import { HttpResponse, http } from 'msw'; +import type { + PostCatalogItemRequest, + PutCatalogItemRequest, +} from '@/generated/api-client'; +import { HttpStatusCode } from 'axios'; +import { pagedListCatalogItem, catalogItems } from '../data/catalogItems'; + +type GetCatalogItemParams = { + catalogItemId: string; +}; + +export const catalogItemsHandlers = [ + http.get('/api/catalog-items', () => { + return HttpResponse.json(pagedListCatalogItem, { + status: HttpStatusCode.Ok, + }); + }), + http.post( + '/api/catalog-items', + async () => { + return new HttpResponse(null, { status: HttpStatusCode.Created }); + }, + ), + http.get< + GetCatalogItemParams, + never, + never, + '/api/catalog-items/:catalogItemId' + >('/api/catalog-items/:catalogItemId', async ({ params }) => { + const { catalogItemId } = params; + const item = catalogItems.find( + (items) => items.id === Number(catalogItemId), + ); + return HttpResponse.json(item, { status: HttpStatusCode.Ok }); + }), + http.delete('/api/catalog-items/:catalogItemId', async () => { + return new HttpResponse(null, { status: HttpStatusCode.NoContent }); + }), + http.put( + '/api/catalog-items/:catalogItemId', + async () => { + return new HttpResponse(null, { status: HttpStatusCode.NoContent }); + }, + ), +]; diff --git a/samples/web-csr/dressca-frontend/admin/mock/handlers/users.ts b/samples/web-csr/dressca-frontend/admin/mock/handlers/users.ts new file mode 100644 index 000000000..7dd5668df --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/users.ts @@ -0,0 +1,14 @@ +import { HttpResponse, http } from 'msw'; +import type { GetLoginUserResponse } from '@/generated/api-client'; +import { HttpStatusCode } from 'axios'; + +const user: GetLoginUserResponse = { + userName: 'admin@example.com', + roles: ['Admin'], +}; + +export const usersHandlers = [ + http.get('/api/users', () => { + return HttpResponse.json(user, { status: HttpStatusCode.Ok }); + }), +]; diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/05d38fad5693422c8a27dd5b14070ec8.png b/samples/web-csr/dressca-frontend/admin/mock/images/05d38fad5693422c8a27dd5b14070ec8.png new file mode 100644 index 000000000..29e8b47ad Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/05d38fad5693422c8a27dd5b14070ec8.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/082b37439ecc44919626ba00fc60ee85.png b/samples/web-csr/dressca-frontend/admin/mock/images/082b37439ecc44919626ba00fc60ee85.png new file mode 100644 index 000000000..4b70ba452 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/082b37439ecc44919626ba00fc60ee85.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/0e557e96bc054f10bc91c27405a83e85.png b/samples/web-csr/dressca-frontend/admin/mock/images/0e557e96bc054f10bc91c27405a83e85.png new file mode 100644 index 000000000..2ace15a66 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/0e557e96bc054f10bc91c27405a83e85.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/45c22ba3da064391baac91341067ffe9.png b/samples/web-csr/dressca-frontend/admin/mock/images/45c22ba3da064391baac91341067ffe9.png new file mode 100644 index 000000000..9d7e6ae4d Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/45c22ba3da064391baac91341067ffe9.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/47183f32f6584d7fb661f9216e11318b.png b/samples/web-csr/dressca-frontend/admin/mock/images/47183f32f6584d7fb661f9216e11318b.png new file mode 100644 index 000000000..9526c66cf Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/47183f32f6584d7fb661f9216e11318b.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/4aed07c4ed5d45a5b97f11acedfbb601.png b/samples/web-csr/dressca-frontend/admin/mock/images/4aed07c4ed5d45a5b97f11acedfbb601.png new file mode 100644 index 000000000..26a89ff13 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/4aed07c4ed5d45a5b97f11acedfbb601.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/66237018c769478a90037bd877f5fba1.png b/samples/web-csr/dressca-frontend/admin/mock/images/66237018c769478a90037bd877f5fba1.png new file mode 100644 index 000000000..618b88535 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/66237018c769478a90037bd877f5fba1.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/80bc8e167ccb4543b2f9d51913073492.png b/samples/web-csr/dressca-frontend/admin/mock/images/80bc8e167ccb4543b2f9d51913073492.png new file mode 100644 index 000000000..841f9b879 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/80bc8e167ccb4543b2f9d51913073492.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/a8291ef2e8e14869a7048e272915f33c.png b/samples/web-csr/dressca-frontend/admin/mock/images/a8291ef2e8e14869a7048e272915f33c.png new file mode 100644 index 000000000..9b7a0949e Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/a8291ef2e8e14869a7048e272915f33c.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/ab2e78eb7fe3408aadbf1e17a9945a8c.png b/samples/web-csr/dressca-frontend/admin/mock/images/ab2e78eb7fe3408aadbf1e17a9945a8c.png new file mode 100644 index 000000000..f054b414f Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/ab2e78eb7fe3408aadbf1e17a9945a8c.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/b52dc7f712d94ca5812dd995bf926c04.png b/samples/web-csr/dressca-frontend/admin/mock/images/b52dc7f712d94ca5812dd995bf926c04.png new file mode 100644 index 000000000..de3e5e911 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/b52dc7f712d94ca5812dd995bf926c04.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/cf151206efd344e1b86854f4aa49fdef.png b/samples/web-csr/dressca-frontend/admin/mock/images/cf151206efd344e1b86854f4aa49fdef.png new file mode 100644 index 000000000..3f7e82404 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/cf151206efd344e1b86854f4aa49fdef.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/d136d4c81b86478990984dcafbf08244.png b/samples/web-csr/dressca-frontend/admin/mock/images/d136d4c81b86478990984dcafbf08244.png new file mode 100644 index 000000000..f369d9fbc Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/d136d4c81b86478990984dcafbf08244.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/e622b0098808492cb883831c05486b58.png b/samples/web-csr/dressca-frontend/admin/mock/images/e622b0098808492cb883831c05486b58.png new file mode 100644 index 000000000..5241fa4fc Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/e622b0098808492cb883831c05486b58.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/images/f5f89954281747fa878129c29e1e0f83.png b/samples/web-csr/dressca-frontend/admin/mock/images/f5f89954281747fa878129c29e1e0f83.png new file mode 100644 index 000000000..baf4a9ef7 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/mock/images/f5f89954281747fa878129c29e1e0f83.png differ diff --git a/samples/web-csr/dressca-frontend/admin/mock/node.ts b/samples/web-csr/dressca-frontend/admin/mock/node.ts new file mode 100644 index 000000000..08a931ce5 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/node.ts @@ -0,0 +1,7 @@ +import { setupServer } from 'msw/node'; +import { handlers } from './handler'; + +/** + * Node.js 環境用のワーカーを起動します。 + */ +export const server = setupServer(...handlers); diff --git a/samples/web-csr/dressca-frontend/admin/openapitools.json b/samples/web-csr/dressca-frontend/admin/openapitools.json new file mode 100644 index 000000000..f80faaa6d --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.9.0" + } +} diff --git a/samples/web-csr/dressca-frontend/admin/package.json b/samples/web-csr/dressca-frontend/admin/package.json new file mode 100644 index 000000000..46c0ec47c --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/package.json @@ -0,0 +1,74 @@ +{ + "name": "admin", + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite --mode dev", + "mock": "vite --mode mock", + "build:dev": "run-p type-check build-only:dev", + "build:prod": "run-p type-check build-only:prod", + "preview": "vite preview", + "test:unit": "vitest", + "test:e2e": "start-server-and-test dev http://localhost:6173/ 'cypress open --e2e --browser chrome'", + "test:e2e:ci": "start-server-and-test dev http://localhost:6173/ 'cypress run'", + "build-only:dev": "vite build --mode dev", + "build-only:prod": "vite build --mode prod", + "type-check": "vue-tsc --build --force", + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore && stylelint **/*.{vue,css} --fix", + "lint:ci": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore && stylelint **/*.{vue,css}", + "format": "prettier --write src/", + "generate-client": "run-s openapi-client:clean openapi-client:generate --print-label", + "openapi-client:clean": "node -e \"fs.promises.rm('./src/generated/api-client', {recursive: true, force: true})\"", + "openapi-client:generate": "openapi-generator-cli generate -g typescript-axios -i ./../../dressca-backend/api-docs/web-admin/api-specification.json --additional-properties=withSeparateModelsAndApi=true,modelPackage=models,apiPackage=api,supportsES6=true -o ./src/generated/api-client" + }, + "dependencies": { + "@heroicons/vue": "^2.1.5", + "axios": "^1.7.7", + "msw": "2.7.0", + "@vee-validate/yup": "^4.13.2", + "pinia": "^2.2.5", + "vee-validate": "^4.14.4", + "vitest": "^2.1.4", + "vue": "^3.5.12", + "vue-router": "^4.4.5", + "yup": "^1.4.0" + }, + "msw": { + "workerDirectory": [ + "public" + ] + }, + "devDependencies": { + "@openapitools/openapi-generator-cli": "^2.15.0", + "@rushstack/eslint-patch": "^1.10.4", + "@tsconfig/node20": "^20.1.4", + "@types/jsdom": "^21.1.7", + "@types/node": "^22.8.5", + "@vitejs/plugin-vue": "^5.1.4", + "@vitejs/plugin-vue-jsx": "^4.0.0", + "@vue/eslint-config-airbnb-with-typescript": "^8.0.0", + "@vue/eslint-config-prettier": "^9.0.0", + "@vue/eslint-config-typescript": "^13.0.0", + "@vue/test-utils": "^2.4.6", + "@vue/tsconfig": "^0.5.1", + "autoprefixer": "^10.4.20", + "cypress": "^13.15.1", + "eslint": "^8.57.0", + "eslint-plugin-cypress": "^3.4.0", + "eslint-plugin-vue": "^9.30.0", + "jsdom": "^25.0.1", + "npm-run-all2": "^7.0.1", + "postcss": "^8.4.47", + "postcss-nesting": "^13.0.1", + "prettier": "^3.3.3", + "start-server-and-test": "^2.0.8", + "stylelint": "^16.9.0", + "stylelint-config-recommended-vue": "^1.5.0", + "stylelint-config-standard": "^36.0.1", + "stylelint-prettier": "^5.0.2", + "tailwindcss": "^3.4.14", + "typescript": "5.3.3", + "vite": "^5.4.8", + "vue-tsc": "^2.1.10" + } +} diff --git a/samples/web-csr/dressca-frontend/admin/postcss.config.cjs b/samples/web-csr/dressca-frontend/admin/postcss.config.cjs new file mode 100644 index 000000000..783c75736 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/postcss.config.cjs @@ -0,0 +1,7 @@ +module.exports = { + plugins: [ + require('tailwindcss'), + require('autoprefixer'), + require('postcss-nesting'), + ], +}; diff --git a/samples/web-csr/dressca-frontend/admin/public/favicon.ico b/samples/web-csr/dressca-frontend/admin/public/favicon.ico new file mode 100644 index 000000000..672976bd1 Binary files /dev/null and b/samples/web-csr/dressca-frontend/admin/public/favicon.ico differ diff --git a/samples/web-csr/dressca-frontend/admin/public/mockServiceWorker.js b/samples/web-csr/dressca-frontend/admin/public/mockServiceWorker.js new file mode 100644 index 000000000..ec47a9a50 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/public/mockServiceWorker.js @@ -0,0 +1,307 @@ +/* eslint-disable */ +/* tslint:disable */ + +/** + * Mock Service Worker. + * @see https://github.com/mswjs/msw + * - Please do NOT modify this file. + * - Please do NOT serve this file on production. + */ + +const PACKAGE_VERSION = '2.7.0' +const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f' +const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') +const activeClientIds = new Set() + +self.addEventListener('install', function () { + self.skipWaiting() +}) + +self.addEventListener('activate', function (event) { + event.waitUntil(self.clients.claim()) +}) + +self.addEventListener('message', async function (event) { + const clientId = event.source.id + + if (!clientId || !self.clients) { + return + } + + const client = await self.clients.get(clientId) + + if (!client) { + return + } + + const allClients = await self.clients.matchAll({ + type: 'window', + }) + + switch (event.data) { + case 'KEEPALIVE_REQUEST': { + sendToClient(client, { + type: 'KEEPALIVE_RESPONSE', + }) + break + } + + case 'INTEGRITY_CHECK_REQUEST': { + sendToClient(client, { + type: 'INTEGRITY_CHECK_RESPONSE', + payload: { + packageVersion: PACKAGE_VERSION, + checksum: INTEGRITY_CHECKSUM, + }, + }) + break + } + + case 'MOCK_ACTIVATE': { + activeClientIds.add(clientId) + + sendToClient(client, { + type: 'MOCKING_ENABLED', + payload: { + client: { + id: client.id, + frameType: client.frameType, + }, + }, + }) + break + } + + case 'MOCK_DEACTIVATE': { + activeClientIds.delete(clientId) + break + } + + case 'CLIENT_CLOSED': { + activeClientIds.delete(clientId) + + const remainingClients = allClients.filter((client) => { + return client.id !== clientId + }) + + // Unregister itself when there are no more clients + if (remainingClients.length === 0) { + self.registration.unregister() + } + + break + } + } +}) + +self.addEventListener('fetch', function (event) { + const { request } = event + + // Bypass navigation requests. + if (request.mode === 'navigate') { + return + } + + // Opening the DevTools triggers the "only-if-cached" request + // that cannot be handled by the worker. Bypass such requests. + if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') { + return + } + + // Bypass all requests when there are no active clients. + // Prevents the self-unregistered worked from handling requests + // after it's been deleted (still remains active until the next reload). + if (activeClientIds.size === 0) { + return + } + + // Generate unique request ID. + const requestId = crypto.randomUUID() + event.respondWith(handleRequest(event, requestId)) +}) + +async function handleRequest(event, requestId) { + const client = await resolveMainClient(event) + const response = await getResponse(event, client, requestId) + + // Send back the response clone for the "response:*" life-cycle events. + // Ensure MSW is active and ready to handle the message, otherwise + // this message will pend indefinitely. + if (client && activeClientIds.has(client.id)) { + ;(async function () { + const responseClone = response.clone() + + sendToClient( + client, + { + type: 'RESPONSE', + payload: { + requestId, + isMockedResponse: IS_MOCKED_RESPONSE in response, + type: responseClone.type, + status: responseClone.status, + statusText: responseClone.statusText, + body: responseClone.body, + headers: Object.fromEntries(responseClone.headers.entries()), + }, + }, + [responseClone.body], + ) + })() + } + + return response +} + +// Resolve the main client for the given event. +// Client that issues a request doesn't necessarily equal the client +// that registered the worker. It's with the latter the worker should +// communicate with during the response resolving phase. +async function resolveMainClient(event) { + const client = await self.clients.get(event.clientId) + + if (activeClientIds.has(event.clientId)) { + return client + } + + if (client?.frameType === 'top-level') { + return client + } + + const allClients = await self.clients.matchAll({ + type: 'window', + }) + + return allClients + .filter((client) => { + // Get only those clients that are currently visible. + return client.visibilityState === 'visible' + }) + .find((client) => { + // Find the client ID that's recorded in the + // set of clients that have registered the worker. + return activeClientIds.has(client.id) + }) +} + +async function getResponse(event, client, requestId) { + const { request } = event + + // Clone the request because it might've been already used + // (i.e. its body has been read and sent to the client). + const requestClone = request.clone() + + function passthrough() { + // Cast the request headers to a new Headers instance + // so the headers can be manipulated with. + const headers = new Headers(requestClone.headers) + + // Remove the "accept" header value that marked this request as passthrough. + // This prevents request alteration and also keeps it compliant with the + // user-defined CORS policies. + const acceptHeader = headers.get('accept') + if (acceptHeader) { + const values = acceptHeader.split(',').map((value) => value.trim()) + const filteredValues = values.filter( + (value) => value !== 'msw/passthrough', + ) + + if (filteredValues.length > 0) { + headers.set('accept', filteredValues.join(', ')) + } else { + headers.delete('accept') + } + } + + return fetch(requestClone, { headers }) + } + + // Bypass mocking when the client is not active. + if (!client) { + return passthrough() + } + + // Bypass initial page load requests (i.e. static assets). + // The absence of the immediate/parent client in the map of the active clients + // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet + // and is not ready to handle requests. + if (!activeClientIds.has(client.id)) { + return passthrough() + } + + // Notify the client that a request has been intercepted. + const requestBuffer = await request.arrayBuffer() + const clientMessage = await sendToClient( + client, + { + type: 'REQUEST', + payload: { + id: requestId, + url: request.url, + mode: request.mode, + method: request.method, + headers: Object.fromEntries(request.headers.entries()), + cache: request.cache, + credentials: request.credentials, + destination: request.destination, + integrity: request.integrity, + redirect: request.redirect, + referrer: request.referrer, + referrerPolicy: request.referrerPolicy, + body: requestBuffer, + keepalive: request.keepalive, + }, + }, + [requestBuffer], + ) + + switch (clientMessage.type) { + case 'MOCK_RESPONSE': { + return respondWithMock(clientMessage.data) + } + + case 'PASSTHROUGH': { + return passthrough() + } + } + + return passthrough() +} + +function sendToClient(client, message, transferrables = []) { + return new Promise((resolve, reject) => { + const channel = new MessageChannel() + + channel.port1.onmessage = (event) => { + if (event.data && event.data.error) { + return reject(event.data.error) + } + + resolve(event.data) + } + + client.postMessage( + message, + [channel.port2].concat(transferrables.filter(Boolean)), + ) + }) +} + +async function respondWithMock(response) { + // Setting response status code to 0 is a no-op. + // However, when responding with a "Response.error()", the produced Response + // instance will have status code set to 0. Since it's not possible to create + // a Response instance with status code 0, handle that use-case separately. + if (response.status === 0) { + return Response.error() + } + + const mockedResponse = new Response(response.body, response) + + Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, { + value: true, + enumerable: true, + }) + + return mockedResponse +} diff --git a/samples/web-csr/dressca-frontend/admin/src/App.vue b/samples/web-csr/dressca-frontend/admin/src/App.vue new file mode 100644 index 000000000..1cd5bd9b6 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/App.vue @@ -0,0 +1,118 @@ + + diff --git a/samples/web-csr/dressca-frontend/admin/src/api-client/index.ts b/samples/web-csr/dressca-frontend/admin/src/api-client/index.ts new file mode 100644 index 000000000..b037af792 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/api-client/index.ts @@ -0,0 +1,86 @@ +import axios, { HttpStatusCode } from 'axios'; +import * as apiClient from '@/generated/api-client'; +import { + ConflictError, + HttpError, + NetworkError, + NotFoundError, + ServerError, + UnauthorizedError, +} from '@/shared/error-handler/custom-error'; + +/** api-client の共通の Configuration があればここに定義します。 */ +function createConfig(): apiClient.Configuration { + const config = new apiClient.Configuration(); + return config; +} + +/** axios の共通の設定があればここに定義します。 */ +const axiosInstance = axios.create({ + baseURL: import.meta.env.VITE_AXIOS_BASE_ENDPOINT_ORIGIN, + headers: { + 'Content-Type': 'application/json', + }, + withCredentials: true, +}); + +/** レスポンスのステータスコードに応じてカスタムエラーを割り当てます。 */ +axiosInstance.interceptors.response.use( + (response) => response, + (error) => { + if (axios.isAxiosError(error)) { + if (!error.response) { + return Promise.reject(new NetworkError('Network Error', error)); + } + if (error.response.status === HttpStatusCode.InternalServerError) { + return Promise.reject(new ServerError('Server Error', error)); + } + if (error.response.status === HttpStatusCode.Unauthorized) { + return Promise.reject( + new UnauthorizedError('Unauthorized Error', error), + ); + } + if (error.response.status === HttpStatusCode.NotFound) { + return Promise.reject(new NotFoundError('NotFound Error', error)); + } + if (error.response.status === HttpStatusCode.Conflict) { + return Promise.reject(new ConflictError('Conflict Error', error)); + } + return Promise.reject(new HttpError(error.message, error)); + } + return Promise.reject(error); + }, +); + +/** + * カタログブランド API のクライアントです。 + */ +const catalogBrandsApi = new apiClient.CatalogBrandsApi( + createConfig(), + '', + axiosInstance, +); + +/** + * カタログカテゴリ API のクライアントです。 + */ +const catalogCategoriesApi = new apiClient.CatalogCategoriesApi( + createConfig(), + '', + axiosInstance, +); + +/** + * カタログアイテム API のクライアントです。 + */ +const catalogItemsApi = new apiClient.CatalogItemsApi( + createConfig(), + '', + axiosInstance, +); + +/** + * ユーザー API のクライアントです。 + */ +const UsersApi = new apiClient.UsersApi(createConfig(), '', axiosInstance); +export { catalogBrandsApi, catalogCategoriesApi, catalogItemsApi, UsersApi }; diff --git a/samples/web-csr/dressca-frontend/admin/src/assets/base.css b/samples/web-csr/dressca-frontend/admin/src/assets/base.css new file mode 100644 index 000000000..b5c61c956 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/assets/base.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/samples/web-csr/dressca-frontend/admin/src/components/ConfirmationModal.vue b/samples/web-csr/dressca-frontend/admin/src/components/ConfirmationModal.vue new file mode 100644 index 000000000..f1a23699f --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/components/ConfirmationModal.vue @@ -0,0 +1,84 @@ + + + diff --git a/samples/web-csr/dressca-frontend/admin/src/components/NotificationModal.vue b/samples/web-csr/dressca-frontend/admin/src/components/NotificationModal.vue new file mode 100644 index 000000000..4bd1b8478 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/components/NotificationModal.vue @@ -0,0 +1,77 @@ + + + diff --git a/samples/web-csr/dressca-frontend/admin/src/components/NotificationToast.vue b/samples/web-csr/dressca-frontend/admin/src/components/NotificationToast.vue new file mode 100644 index 000000000..c8aa81d2c --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/components/NotificationToast.vue @@ -0,0 +1,60 @@ + + + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.gitignore b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.gitignore new file mode 100644 index 000000000..149b57654 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.npmignore b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.npmignore new file mode 100644 index 000000000..999d88df6 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator-ignore b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator-ignore new file mode 100644 index 000000000..7484ee590 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator/FILES b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator/FILES new file mode 100644 index 000000000..9d03d4a1c --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator/FILES @@ -0,0 +1,24 @@ +.gitignore +.npmignore +.openapi-generator-ignore +api.ts +api/actuator-api.ts +api/assets-api.ts +api/catalog-brands-api.ts +api/catalog-categories-api.ts +api/catalog-items-api.ts +api/users-api.ts +base.ts +common.ts +configuration.ts +git_push.sh +index.ts +models/get-catalog-brands-response.ts +models/get-catalog-categories-response.ts +models/get-catalog-item-response.ts +models/get-login-user-response.ts +models/index.ts +models/link.ts +models/paged-list-of-get-catalog-item-response.ts +models/post-catalog-item-request.ts +models/put-catalog-item-request.ts diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator/VERSION b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator/VERSION new file mode 100644 index 000000000..4bc5d6181 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.9.0 diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api.ts new file mode 100644 index 000000000..8a3e650fb --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api.ts @@ -0,0 +1,23 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +export * from './api/actuator-api'; +export * from './api/assets-api'; +export * from './api/catalog-brands-api'; +export * from './api/catalog-categories-api'; +export * from './api/catalog-items-api'; +export * from './api/users-api'; + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/actuator-api.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/actuator-api.ts new file mode 100644 index 000000000..d4335f351 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/actuator-api.ts @@ -0,0 +1,248 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +// @ts-ignore +import type { Link } from '../models'; +/** + * ActuatorApi - axios parameter creator + * @export + */ +export const ActuatorApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Actuator web endpoint \'health\' + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + health: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/health`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Actuator web endpoint \'health-path\' + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + healthPath: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/health/**`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Actuator root web endpoint + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + links: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ActuatorApi - functional programming interface + * @export + */ +export const ActuatorApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ActuatorApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Actuator web endpoint \'health\' + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async health(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.health(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ActuatorApi.health']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary Actuator web endpoint \'health-path\' + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async healthPath(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.healthPath(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ActuatorApi.healthPath']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary Actuator root web endpoint + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async links(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: { [key: string]: Link; }; }>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.links(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ActuatorApi.links']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * ActuatorApi - factory interface + * @export + */ +export const ActuatorApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ActuatorApiFp(configuration) + return { + /** + * + * @summary Actuator web endpoint \'health\' + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + health(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.health(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Actuator web endpoint \'health-path\' + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + healthPath(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.healthPath(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Actuator root web endpoint + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + links(options?: RawAxiosRequestConfig): AxiosPromise<{ [key: string]: { [key: string]: Link; }; }> { + return localVarFp.links(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ActuatorApi - object-oriented interface + * @export + * @class ActuatorApi + * @extends {BaseAPI} + */ +export class ActuatorApi extends BaseAPI { + /** + * + * @summary Actuator web endpoint \'health\' + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ActuatorApi + */ + public health(options?: RawAxiosRequestConfig) { + return ActuatorApiFp(this.configuration).health(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Actuator web endpoint \'health-path\' + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ActuatorApi + */ + public healthPath(options?: RawAxiosRequestConfig) { + return ActuatorApiFp(this.configuration).healthPath(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Actuator root web endpoint + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ActuatorApi + */ + public links(options?: RawAxiosRequestConfig) { + return ActuatorApiFp(this.configuration).links(options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/assets-api.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/assets-api.ts new file mode 100644 index 000000000..9f5fb3e95 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/assets-api.ts @@ -0,0 +1,129 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +/** + * AssetsApi - axios parameter creator + * @export + */ +export const AssetsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * 与えられたアセットコードに対応するアセットを返却する. + * @summary アセットを取得する. + * @param {string} assetCode アセットコード + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + get: async (assetCode: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'assetCode' is not null or undefined + assertParamExists('get', 'assetCode', assetCode) + const localVarPath = `/api/assets/{assetCode}` + .replace(`{${"assetCode"}}`, encodeURIComponent(String(assetCode))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * AssetsApi - functional programming interface + * @export + */ +export const AssetsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = AssetsApiAxiosParamCreator(configuration) + return { + /** + * 与えられたアセットコードに対応するアセットを返却する. + * @summary アセットを取得する. + * @param {string} assetCode アセットコード + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async get(assetCode: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.get(assetCode, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['AssetsApi.get']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * AssetsApi - factory interface + * @export + */ +export const AssetsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = AssetsApiFp(configuration) + return { + /** + * 与えられたアセットコードに対応するアセットを返却する. + * @summary アセットを取得する. + * @param {string} assetCode アセットコード + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + get(assetCode: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.get(assetCode, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * AssetsApi - object-oriented interface + * @export + * @class AssetsApi + * @extends {BaseAPI} + */ +export class AssetsApi extends BaseAPI { + /** + * 与えられたアセットコードに対応するアセットを返却する. + * @summary アセットを取得する. + * @param {string} assetCode アセットコード + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssetsApi + */ + public get(assetCode: string, options?: RawAxiosRequestConfig) { + return AssetsApiFp(this.configuration).get(assetCode, options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-brands-api.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-brands-api.ts new file mode 100644 index 000000000..96a8a86a4 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-brands-api.ts @@ -0,0 +1,124 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +// @ts-ignore +import type { GetCatalogBrandsResponse } from '../models'; +/** + * CatalogBrandsApi - axios parameter creator + * @export + */ +export const CatalogBrandsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * カタログブランドの一覧を取得する. + * @summary カタログブランドの一覧を取得する. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCatalogBrands: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/catalog-brands`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * CatalogBrandsApi - functional programming interface + * @export + */ +export const CatalogBrandsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = CatalogBrandsApiAxiosParamCreator(configuration) + return { + /** + * カタログブランドの一覧を取得する. + * @summary カタログブランドの一覧を取得する. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCatalogBrands(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getCatalogBrands(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CatalogBrandsApi.getCatalogBrands']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * CatalogBrandsApi - factory interface + * @export + */ +export const CatalogBrandsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = CatalogBrandsApiFp(configuration) + return { + /** + * カタログブランドの一覧を取得する. + * @summary カタログブランドの一覧を取得する. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCatalogBrands(options?: RawAxiosRequestConfig): AxiosPromise> { + return localVarFp.getCatalogBrands(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * CatalogBrandsApi - object-oriented interface + * @export + * @class CatalogBrandsApi + * @extends {BaseAPI} + */ +export class CatalogBrandsApi extends BaseAPI { + /** + * カタログブランドの一覧を取得する. + * @summary カタログブランドの一覧を取得する. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogBrandsApi + */ + public getCatalogBrands(options?: RawAxiosRequestConfig) { + return CatalogBrandsApiFp(this.configuration).getCatalogBrands(options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-categories-api.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-categories-api.ts new file mode 100644 index 000000000..8de65feb3 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-categories-api.ts @@ -0,0 +1,124 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +// @ts-ignore +import type { GetCatalogCategoriesResponse } from '../models'; +/** + * CatalogCategoriesApi - axios parameter creator + * @export + */ +export const CatalogCategoriesApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * カタログカテゴリの一覧を取得します. + * @summary カタログカテゴリの一覧を取得します. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCatalogCategories: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/catalog-categories`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * CatalogCategoriesApi - functional programming interface + * @export + */ +export const CatalogCategoriesApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = CatalogCategoriesApiAxiosParamCreator(configuration) + return { + /** + * カタログカテゴリの一覧を取得します. + * @summary カタログカテゴリの一覧を取得します. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCatalogCategories(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getCatalogCategories(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CatalogCategoriesApi.getCatalogCategories']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * CatalogCategoriesApi - factory interface + * @export + */ +export const CatalogCategoriesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = CatalogCategoriesApiFp(configuration) + return { + /** + * カタログカテゴリの一覧を取得します. + * @summary カタログカテゴリの一覧を取得します. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCatalogCategories(options?: RawAxiosRequestConfig): AxiosPromise> { + return localVarFp.getCatalogCategories(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * CatalogCategoriesApi - object-oriented interface + * @export + * @class CatalogCategoriesApi + * @extends {BaseAPI} + */ +export class CatalogCategoriesApi extends BaseAPI { + /** + * カタログカテゴリの一覧を取得します. + * @summary カタログカテゴリの一覧を取得します. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogCategoriesApi + */ + public getCatalogCategories(options?: RawAxiosRequestConfig) { + return CatalogCategoriesApiFp(this.configuration).getCatalogCategories(options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-items-api.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-items-api.ts new file mode 100644 index 000000000..660a7bc3d --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-items-api.ts @@ -0,0 +1,461 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +// @ts-ignore +import type { GetCatalogItemResponse } from '../models'; +// @ts-ignore +import type { PagedListOfGetCatalogItemResponse } from '../models'; +// @ts-ignore +import type { PostCatalogItemRequest } from '../models'; +// @ts-ignore +import type { PutCatalogItemRequest } from '../models'; +/** + * CatalogItemsApi - axios parameter creator + * @export + */ +export const CatalogItemsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * カタログから指定したカタログアイテム ID のアイテムを削除します。 + * @summary カタログから指定したカタログアイテム ID のアイテムを削除します。 + * @param {number} catalogItemId + * @param {string} rowVersion + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteCatalogItem: async (catalogItemId: number, rowVersion: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'catalogItemId' is not null or undefined + assertParamExists('deleteCatalogItem', 'catalogItemId', catalogItemId) + // verify required parameter 'rowVersion' is not null or undefined + assertParamExists('deleteCatalogItem', 'rowVersion', rowVersion) + const localVarPath = `/api/catalog-items/{catalogItemId}` + .replace(`{${"catalogItemId"}}`, encodeURIComponent(String(catalogItemId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (rowVersion !== undefined) { + localVarQueryParameter['rowVersion'] = (rowVersion as any instanceof Date) ? + (rowVersion as any).toISOString() : + rowVersion; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * カタログアイテムを検索して返します. + * @summary カタログアイテムを検索して返します. + * @param {number} [brandId] + * @param {number} [categoryId] + * @param {number} [page] + * @param {number} [pageSize] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getByQuery: async (brandId?: number, categoryId?: number, page?: number, pageSize?: number, options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/catalog-items`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (brandId !== undefined) { + localVarQueryParameter['brandId'] = brandId; + } + + if (categoryId !== undefined) { + localVarQueryParameter['categoryId'] = categoryId; + } + + if (page !== undefined) { + localVarQueryParameter['page'] = page; + } + + if (pageSize !== undefined) { + localVarQueryParameter['pageSize'] = pageSize; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定したIDのカタログアイテムを返します。 + * @summary 指定したIDのカタログアイテムを返します。 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCatalogItem: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('getCatalogItem', 'id', id) + const localVarPath = `/api/catalog-items/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * カタログにアイテムを追加します。 + * @summary カタログにアイテムを追加します。 + * @param {PostCatalogItemRequest} postCatalogItemRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postCatalogItem: async (postCatalogItemRequest: PostCatalogItemRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'postCatalogItemRequest' is not null or undefined + assertParamExists('postCatalogItem', 'postCatalogItemRequest', postCatalogItemRequest) + const localVarPath = `/api/catalog-items`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(postCatalogItemRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定したIDのカタログアイテムの情報を更新します。 + * @summary 指定したIDのカタログアイテムの情報を更新します。 + * @param {number} catalogItemId + * @param {PutCatalogItemRequest} putCatalogItemRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putCatalogItem: async (catalogItemId: number, putCatalogItemRequest: PutCatalogItemRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'catalogItemId' is not null or undefined + assertParamExists('putCatalogItem', 'catalogItemId', catalogItemId) + // verify required parameter 'putCatalogItemRequest' is not null or undefined + assertParamExists('putCatalogItem', 'putCatalogItemRequest', putCatalogItemRequest) + const localVarPath = `/api/catalog-items/{catalogItemId}` + .replace(`{${"catalogItemId"}}`, encodeURIComponent(String(catalogItemId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(putCatalogItemRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * CatalogItemsApi - functional programming interface + * @export + */ +export const CatalogItemsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = CatalogItemsApiAxiosParamCreator(configuration) + return { + /** + * カタログから指定したカタログアイテム ID のアイテムを削除します。 + * @summary カタログから指定したカタログアイテム ID のアイテムを削除します。 + * @param {number} catalogItemId + * @param {string} rowVersion + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteCatalogItem(catalogItemId: number, rowVersion: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteCatalogItem(catalogItemId, rowVersion, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CatalogItemsApi.deleteCatalogItem']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * カタログアイテムを検索して返します. + * @summary カタログアイテムを検索して返します. + * @param {number} [brandId] + * @param {number} [categoryId] + * @param {number} [page] + * @param {number} [pageSize] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getByQuery(brandId?: number, categoryId?: number, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getByQuery(brandId, categoryId, page, pageSize, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CatalogItemsApi.getByQuery']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 指定したIDのカタログアイテムを返します。 + * @summary 指定したIDのカタログアイテムを返します。 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCatalogItem(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getCatalogItem(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CatalogItemsApi.getCatalogItem']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * カタログにアイテムを追加します。 + * @summary カタログにアイテムを追加します。 + * @param {PostCatalogItemRequest} postCatalogItemRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async postCatalogItem(postCatalogItemRequest: PostCatalogItemRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.postCatalogItem(postCatalogItemRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CatalogItemsApi.postCatalogItem']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 指定したIDのカタログアイテムの情報を更新します。 + * @summary 指定したIDのカタログアイテムの情報を更新します。 + * @param {number} catalogItemId + * @param {PutCatalogItemRequest} putCatalogItemRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async putCatalogItem(catalogItemId: number, putCatalogItemRequest: PutCatalogItemRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.putCatalogItem(catalogItemId, putCatalogItemRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CatalogItemsApi.putCatalogItem']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * CatalogItemsApi - factory interface + * @export + */ +export const CatalogItemsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = CatalogItemsApiFp(configuration) + return { + /** + * カタログから指定したカタログアイテム ID のアイテムを削除します。 + * @summary カタログから指定したカタログアイテム ID のアイテムを削除します。 + * @param {number} catalogItemId + * @param {string} rowVersion + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteCatalogItem(catalogItemId: number, rowVersion: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.deleteCatalogItem(catalogItemId, rowVersion, options).then((request) => request(axios, basePath)); + }, + /** + * カタログアイテムを検索して返します. + * @summary カタログアイテムを検索して返します. + * @param {number} [brandId] + * @param {number} [categoryId] + * @param {number} [page] + * @param {number} [pageSize] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getByQuery(brandId?: number, categoryId?: number, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.getByQuery(brandId, categoryId, page, pageSize, options).then((request) => request(axios, basePath)); + }, + /** + * 指定したIDのカタログアイテムを返します。 + * @summary 指定したIDのカタログアイテムを返します。 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCatalogItem(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.getCatalogItem(id, options).then((request) => request(axios, basePath)); + }, + /** + * カタログにアイテムを追加します。 + * @summary カタログにアイテムを追加します。 + * @param {PostCatalogItemRequest} postCatalogItemRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postCatalogItem(postCatalogItemRequest: PostCatalogItemRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.postCatalogItem(postCatalogItemRequest, options).then((request) => request(axios, basePath)); + }, + /** + * 指定したIDのカタログアイテムの情報を更新します。 + * @summary 指定したIDのカタログアイテムの情報を更新します。 + * @param {number} catalogItemId + * @param {PutCatalogItemRequest} putCatalogItemRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putCatalogItem(catalogItemId: number, putCatalogItemRequest: PutCatalogItemRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.putCatalogItem(catalogItemId, putCatalogItemRequest, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * CatalogItemsApi - object-oriented interface + * @export + * @class CatalogItemsApi + * @extends {BaseAPI} + */ +export class CatalogItemsApi extends BaseAPI { + /** + * カタログから指定したカタログアイテム ID のアイテムを削除します。 + * @summary カタログから指定したカタログアイテム ID のアイテムを削除します。 + * @param {number} catalogItemId + * @param {string} rowVersion + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogItemsApi + */ + public deleteCatalogItem(catalogItemId: number, rowVersion: string, options?: RawAxiosRequestConfig) { + return CatalogItemsApiFp(this.configuration).deleteCatalogItem(catalogItemId, rowVersion, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * カタログアイテムを検索して返します. + * @summary カタログアイテムを検索して返します. + * @param {number} [brandId] + * @param {number} [categoryId] + * @param {number} [page] + * @param {number} [pageSize] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogItemsApi + */ + public getByQuery(brandId?: number, categoryId?: number, page?: number, pageSize?: number, options?: RawAxiosRequestConfig) { + return CatalogItemsApiFp(this.configuration).getByQuery(brandId, categoryId, page, pageSize, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 指定したIDのカタログアイテムを返します。 + * @summary 指定したIDのカタログアイテムを返します。 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogItemsApi + */ + public getCatalogItem(id: number, options?: RawAxiosRequestConfig) { + return CatalogItemsApiFp(this.configuration).getCatalogItem(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * カタログにアイテムを追加します。 + * @summary カタログにアイテムを追加します。 + * @param {PostCatalogItemRequest} postCatalogItemRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogItemsApi + */ + public postCatalogItem(postCatalogItemRequest: PostCatalogItemRequest, options?: RawAxiosRequestConfig) { + return CatalogItemsApiFp(this.configuration).postCatalogItem(postCatalogItemRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 指定したIDのカタログアイテムの情報を更新します。 + * @summary 指定したIDのカタログアイテムの情報を更新します。 + * @param {number} catalogItemId + * @param {PutCatalogItemRequest} putCatalogItemRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogItemsApi + */ + public putCatalogItem(catalogItemId: number, putCatalogItemRequest: PutCatalogItemRequest, options?: RawAxiosRequestConfig) { + return CatalogItemsApiFp(this.configuration).putCatalogItem(catalogItemId, putCatalogItemRequest, options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/users-api.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/users-api.ts new file mode 100644 index 000000000..ee8b9fb30 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/users-api.ts @@ -0,0 +1,124 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +// @ts-ignore +import type { GetLoginUserResponse } from '../models'; +/** + * UsersApi - axios parameter creator + * @export + */ +export const UsersApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * ユーザーの情報。 + * @summary ログイン中のユーザーの情報を取得します。 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getLoginUser: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/users`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * UsersApi - functional programming interface + * @export + */ +export const UsersApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UsersApiAxiosParamCreator(configuration) + return { + /** + * ユーザーの情報。 + * @summary ログイン中のユーザーの情報を取得します。 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getLoginUser(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getLoginUser(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['UsersApi.getLoginUser']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * UsersApi - factory interface + * @export + */ +export const UsersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UsersApiFp(configuration) + return { + /** + * ユーザーの情報。 + * @summary ログイン中のユーザーの情報を取得します。 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getLoginUser(options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.getLoginUser(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * UsersApi - object-oriented interface + * @export + * @class UsersApi + * @extends {BaseAPI} + */ +export class UsersApi extends BaseAPI { + /** + * ユーザーの情報。 + * @summary ログイン中のユーザーの情報を取得します。 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public getLoginUser(options?: RawAxiosRequestConfig) { + return UsersApiFp(this.configuration).getLoginUser(options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/base.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/base.ts new file mode 100644 index 000000000..df297feb1 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/base.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; + +export const BASE_PATH = "http://localhost:8081".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: RawAxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath ?? basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } +} + +interface ServerMap { + [key: string]: { + url: string, + description: string, + }[]; +} + +/** + * + * @export + */ +export const operationServerMap: ServerMap = { +} diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/common.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/common.ts new file mode 100644 index 000000000..8c12c34bf --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/common.ts @@ -0,0 +1,150 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/configuration.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/configuration.ts new file mode 100644 index 000000000..65960202a --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/configuration.ts @@ -0,0 +1,110 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + serverIndex?: number; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * override server index + * + * @type {number} + * @memberof Configuration + */ + serverIndex?: number; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.serverIndex = param.serverIndex; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/git_push.sh b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/git_push.sh new file mode 100644 index 000000000..f53a75d4f --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/index.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/index.ts new file mode 100644 index 000000000..526c6ab3d --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; +export * from "./models"; diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-brands-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-brands-response.ts new file mode 100644 index 000000000..763934b37 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-brands-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface GetCatalogBrandsResponse + */ +export interface GetCatalogBrandsResponse { + /** + * + * @type {number} + * @memberof GetCatalogBrandsResponse + */ + 'id': number; + /** + * + * @type {string} + * @memberof GetCatalogBrandsResponse + */ + 'name': string; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-categories-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-categories-response.ts new file mode 100644 index 000000000..2647f07a0 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-categories-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface GetCatalogCategoriesResponse + */ +export interface GetCatalogCategoriesResponse { + /** + * + * @type {number} + * @memberof GetCatalogCategoriesResponse + */ + 'id': number; + /** + * + * @type {string} + * @memberof GetCatalogCategoriesResponse + */ + 'name': string; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-item-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-item-response.ts new file mode 100644 index 000000000..73c7d1355 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-catalog-item-response.ts @@ -0,0 +1,78 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface GetCatalogItemResponse + */ +export interface GetCatalogItemResponse { + /** + * + * @type {Array} + * @memberof GetCatalogItemResponse + */ + 'assetCodes'?: Array; + /** + * + * @type {number} + * @memberof GetCatalogItemResponse + */ + 'catalogBrandId': number; + /** + * + * @type {number} + * @memberof GetCatalogItemResponse + */ + 'catalogCategoryId': number; + /** + * + * @type {string} + * @memberof GetCatalogItemResponse + */ + 'description': string; + /** + * + * @type {number} + * @memberof GetCatalogItemResponse + */ + 'id': number; + /** + * + * @type {string} + * @memberof GetCatalogItemResponse + */ + 'name': string; + /** + * + * @type {number} + * @memberof GetCatalogItemResponse + */ + 'price': number; + /** + * + * @type {string} + * @memberof GetCatalogItemResponse + */ + 'productCode': string; + /** + * + * @type {string} + * @memberof GetCatalogItemResponse + */ + 'rowVersion': string; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-login-user-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-login-user-response.ts new file mode 100644 index 000000000..0fd3c651b --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/get-login-user-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface GetLoginUserResponse + */ +export interface GetLoginUserResponse { + /** + * + * @type {Array} + * @memberof GetLoginUserResponse + */ + 'roles': Array; + /** + * + * @type {string} + * @memberof GetLoginUserResponse + */ + 'userName': string; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/index.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/index.ts new file mode 100644 index 000000000..507cc4acf --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/index.ts @@ -0,0 +1,8 @@ +export * from './get-catalog-brands-response'; +export * from './get-catalog-categories-response'; +export * from './get-catalog-item-response'; +export * from './get-login-user-response'; +export * from './link'; +export * from './paged-list-of-get-catalog-item-response'; +export * from './post-catalog-item-request'; +export * from './put-catalog-item-request'; diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/link.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/link.ts new file mode 100644 index 000000000..3479c4796 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/link.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface Link + */ +export interface Link { + /** + * + * @type {string} + * @memberof Link + */ + 'href'?: string; + /** + * + * @type {boolean} + * @memberof Link + */ + 'templated'?: boolean; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/paged-list-of-get-catalog-item-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/paged-list-of-get-catalog-item-response.ts new file mode 100644 index 000000000..cc376b255 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/paged-list-of-get-catalog-item-response.ts @@ -0,0 +1,69 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { GetCatalogItemResponse } from './get-catalog-item-response'; + +/** + * + * @export + * @interface PagedListOfGetCatalogItemResponse + */ +export interface PagedListOfGetCatalogItemResponse { + /** + * + * @type {boolean} + * @memberof PagedListOfGetCatalogItemResponse + */ + 'hasNext'?: boolean; + /** + * + * @type {boolean} + * @memberof PagedListOfGetCatalogItemResponse + */ + 'hasPrevious'?: boolean; + /** + * + * @type {Array} + * @memberof PagedListOfGetCatalogItemResponse + */ + 'items'?: Array; + /** + * + * @type {number} + * @memberof PagedListOfGetCatalogItemResponse + */ + 'page'?: number; + /** + * + * @type {number} + * @memberof PagedListOfGetCatalogItemResponse + */ + 'pageSize'?: number; + /** + * + * @type {number} + * @memberof PagedListOfGetCatalogItemResponse + */ + 'totalCount'?: number; + /** + * + * @type {number} + * @memberof PagedListOfGetCatalogItemResponse + */ + 'totalPages'?: number; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/post-catalog-item-request.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/post-catalog-item-request.ts new file mode 100644 index 000000000..77db21a34 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/post-catalog-item-request.ts @@ -0,0 +1,60 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface PostCatalogItemRequest + */ +export interface PostCatalogItemRequest { + /** + * + * @type {number} + * @memberof PostCatalogItemRequest + */ + 'catalogBrandId': number; + /** + * + * @type {number} + * @memberof PostCatalogItemRequest + */ + 'catalogCategoryId': number; + /** + * + * @type {string} + * @memberof PostCatalogItemRequest + */ + 'description': string; + /** + * + * @type {string} + * @memberof PostCatalogItemRequest + */ + 'name': string; + /** + * + * @type {number} + * @memberof PostCatalogItemRequest + */ + 'price': number; + /** + * + * @type {string} + * @memberof PostCatalogItemRequest + */ + 'productCode': string; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/put-catalog-item-request.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/put-catalog-item-request.ts new file mode 100644 index 000000000..b6cc08803 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/put-catalog-item-request.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Dressca + * ECサイトDressca + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface PutCatalogItemRequest + */ +export interface PutCatalogItemRequest { + /** + * + * @type {number} + * @memberof PutCatalogItemRequest + */ + 'catalogBrandId': number; + /** + * + * @type {number} + * @memberof PutCatalogItemRequest + */ + 'catalogCategoryId': number; + /** + * + * @type {string} + * @memberof PutCatalogItemRequest + */ + 'description': string; + /** + * + * @type {string} + * @memberof PutCatalogItemRequest + */ + 'name': string; + /** + * + * @type {number} + * @memberof PutCatalogItemRequest + */ + 'price': number; + /** + * + * @type {string} + * @memberof PutCatalogItemRequest + */ + 'productCode': string; + /** + * + * @type {string} + * @memberof PutCatalogItemRequest + */ + 'rowVersion': string; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/main.ts b/samples/web-csr/dressca-frontend/admin/src/main.ts new file mode 100644 index 000000000..e9c391e04 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/main.ts @@ -0,0 +1,45 @@ +import './assets/base.css'; +import { createApp } from 'vue'; +import { createPinia } from 'pinia'; +import { authenticationGuard } from '@/shared/authentication/authentication-guard'; +import { globalErrorHandler } from '@/shared/error-handler/global-error-handler'; +import { createCustomErrorHandler } from '@/shared/error-handler/custom-error-handler'; +import { router } from './router'; +import App from './App.vue'; + +/** + * モック用のワーカープロセスが起動していることを確認します。 + * @returns {Promise} + */ +async function enableMocking(): Promise { + const { worker } = await import('../mock/browser'); + return worker.start({ + onUnhandledRequest: 'bypass', + }); +} + +/* + * ワーカープロセスの起動前にアプリケーションがマウントされると、 + * ホーム画面に API をコールする処理があった場合に想定外のエラーが発生するので、 + * モック用のワーカープロセスの起動を待つ必要があります。 + */ +if (import.meta.env.MODE === 'mock') { + try { + await enableMocking(); + } catch (error) { + /* eslint no-console: 0 */ + console.error('モック用のワーカープロセスの起動に失敗しました。', error); + } +} + +const app = createApp(App); + +app.use(createPinia()); +app.use(router); + +app.use(globalErrorHandler); +app.use(createCustomErrorHandler()); + +authenticationGuard(router); + +app.mount('#app'); diff --git a/samples/web-csr/dressca-frontend/admin/src/router/authentication/authentication.ts b/samples/web-csr/dressca-frontend/admin/src/router/authentication/authentication.ts new file mode 100644 index 000000000..8a2fc76b3 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/router/authentication/authentication.ts @@ -0,0 +1,12 @@ +import type { RouteRecordRaw } from 'vue-router'; + +/** + * '/login'に割り当てるコンポーネントを定義します。 + */ +export const authenticationRoutes: RouteRecordRaw[] = [ + { + path: '/authentication/login', + name: 'authentication/login', + component: () => import('@/views/authentication/LoginView.vue'), + }, +]; diff --git a/samples/web-csr/dressca-frontend/admin/src/router/catalog/catalog.ts b/samples/web-csr/dressca-frontend/admin/src/router/catalog/catalog.ts new file mode 100644 index 000000000..3da0bbb33 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/router/catalog/catalog.ts @@ -0,0 +1,22 @@ +import type { RouteRecordRaw } from 'vue-router'; + +/** + * '/catalog/'に割り当てるコンポーネントを定義します。 + */ +export const catalogRoutes: RouteRecordRaw[] = [ + { + path: '/catalog/items', + name: 'catalog/items', + component: () => import('@/views/catalog/ItemsView.vue'), + }, + { + path: '/catalog/items/edit/:itemId', + name: 'catalog/items/edit', + component: () => import('@/views/catalog/ItemsEditView.vue'), + }, + { + path: '/catalog/items/add', + name: 'catalog/items/add', + component: () => import('@/views/catalog/ItemsAddView.vue'), + }, +]; diff --git a/samples/web-csr/dressca-frontend/admin/src/router/error/error.ts b/samples/web-csr/dressca-frontend/admin/src/router/error/error.ts new file mode 100644 index 000000000..60f54c908 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/router/error/error.ts @@ -0,0 +1,12 @@ +import type { RouteRecordRaw } from 'vue-router'; + +/** + * '/error'に割り当てるコンポーネントを定義します。 + */ +export const errorRoutes: RouteRecordRaw[] = [ + { + path: '/error', + name: 'error', + component: () => import('@/views/error/ErrorView.vue'), + }, +]; diff --git a/samples/web-csr/dressca-frontend/admin/src/router/home/home.ts b/samples/web-csr/dressca-frontend/admin/src/router/home/home.ts new file mode 100644 index 000000000..7394ee13a --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/router/home/home.ts @@ -0,0 +1,12 @@ +import type { RouteRecordRaw } from 'vue-router'; + +/** + * '/'に割り当てるコンポーネントを定義します。 + */ +export const homeRoutes: RouteRecordRaw[] = [ + { + path: '/', + name: 'home', + component: () => import('@/views/home/HomeView.vue'), + }, +]; diff --git a/samples/web-csr/dressca-frontend/admin/src/router/index.ts b/samples/web-csr/dressca-frontend/admin/src/router/index.ts new file mode 100644 index 000000000..c1cbfba60 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/router/index.ts @@ -0,0 +1,18 @@ +import { createRouter, createWebHistory } from 'vue-router'; +import { catalogRoutes } from '@/router/catalog/catalog'; +import { authenticationRoutes } from '@/router/authentication/authentication'; +import { homeRoutes } from './home/home'; +import { errorRoutes } from './error/error'; + +/** + * vue-routerを作成します。 + */ +export const router = createRouter({ + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + ...errorRoutes, + ...homeRoutes, + ...catalogRoutes, + ...authenticationRoutes, + ], +}); diff --git a/samples/web-csr/dressca-frontend/admin/src/services/authentication/authentication-service.ts b/samples/web-csr/dressca-frontend/admin/src/services/authentication/authentication-service.ts new file mode 100644 index 000000000..1de2498cf --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/services/authentication/authentication-service.ts @@ -0,0 +1,17 @@ +import { useAuthenticationStore } from '@/stores/authentication/authentication'; + +/** + * アプリケーションにログインします。 + */ +export async function loginAsync() { + const authenticationStore = useAuthenticationStore(); + await authenticationStore.signInAsync(); +} + +/** + * アプリケーションからログアウトします。 + */ +export async function logoutAsync() { + const authenticationStore = useAuthenticationStore(); + await authenticationStore.signOutAsync(); +} diff --git a/samples/web-csr/dressca-frontend/admin/src/services/catalog/catalog-service.ts b/samples/web-csr/dressca-frontend/admin/src/services/catalog/catalog-service.ts new file mode 100644 index 000000000..653385165 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/services/catalog/catalog-service.ts @@ -0,0 +1,148 @@ +import { + catalogBrandsApi, + catalogCategoriesApi, + catalogItemsApi, +} from '@/api-client'; +import type { + GetCatalogBrandsResponse, + GetCatalogCategoriesResponse, + GetCatalogItemResponse, + PagedListOfGetCatalogItemResponse, + PostCatalogItemRequest, + PutCatalogItemRequest, +} from '@/generated/api-client'; + +/** + * カテゴリの情報を取得します。 + * @returns カタログカテゴリの配列。 + */ +export async function fetchCategories(): Promise< + GetCatalogCategoriesResponse[] +> { + const response = await catalogCategoriesApi.getCatalogCategories(); + return response.data; +} + +/** + * ブランドの情報を取得します。 + * @returns カテゴリブランドの配列。 + */ +export async function fetchBrands(): Promise { + const response = await catalogBrandsApi.getCatalogBrands(); + return response.data; +} + +/** + * カテゴリとブランドの情報を取得します。 + * @returns カテゴリとブランドの情報のタプル。 + */ +export async function fetchCategoriesAndBrands(): Promise< + [GetCatalogCategoriesResponse[], GetCatalogBrandsResponse[]] +> { + const categories = await fetchCategories(); + const brands = await fetchBrands(); + return [categories, brands]; +} + +/** + * 検索条件に合致する、ページネーションされたカタログアイテムのリストを取得します。 + * @param categoryId カテゴリのID。 + * @param brandId ブランドのID。 + * @param page ページ数。 + * @returns ページネーションされたカタログアイテムのリスト。 + */ +export async function fetchItems( + categoryId: number, + brandId: number, + page?: number, +): Promise { + const response = await catalogItemsApi.getByQuery( + brandId === 0 ? undefined : brandId, + categoryId === 0 ? undefined : categoryId, + page, + undefined, + ); + return response.data; +} + +/** + * 対象のIDを持つカタログアイテムの情報を取得します。 + * @param itemId アイテム ID。 + * @returns カタログアイテムの情報。 + */ +export async function fetchItem( + itemId: number, +): Promise { + const itemResponse = await catalogItemsApi.getCatalogItem(itemId); + return itemResponse.data; +} + +/** + * アイテムをカタログに追加します。 + * @param name アイテム名。 + * @param description 説明。 + * @param price 単価。 + * @param productCode 商品コード。 + * @param catalogCategoryId カテゴリ ID。 + * @param catalogBrandId ブランド ID。 + */ +export async function postCatalogItem( + name: string, + description: string, + price: number, + productCode: string, + catalogCategoryId: number, + catalogBrandId: number, +) { + const postCatalogItemInput: PostCatalogItemRequest = { + name, + description, + price, + productCode, + catalogCategoryId, + catalogBrandId, + }; + await catalogItemsApi.postCatalogItem(postCatalogItemInput); +} + +/** + * アイテムの情報を更新します。 + * @param id アイテム ID 。 + * @param name アイテム名。 + * @param description 説明。 + * @param price 単価。 + * @param productCode 商品コード。 + * @param catalogCategoryId カテゴリ ID。 + * @param catalogBrandId ブランド ID。 + * @param rowVersion 排他制御のための行バージョン。 + */ +export async function updateCatalogItem( + id: number, + name: string, + description: string, + price: number, + productCode: string, + catalogCategoryId: number, + catalogBrandId: number, + rowVersion: string, +) { + const putCatalogItemRequest: PutCatalogItemRequest = { + name, + description, + price, + productCode, + catalogCategoryId, + catalogBrandId, + rowVersion, + }; + await catalogItemsApi.putCatalogItem(id, putCatalogItemRequest); +} + +/** + * 対象の ID を持つアイテムをカタログから削除します。 + * @param id アイテム ID 。 + * @param rowVersion 排他制御のための行バージョン。 + */ +export async function deleteCatalogItem(id: number, rowVersion: string) { + await catalogItemsApi.deleteCatalogItem(id, rowVersion); +} diff --git a/samples/web-csr/dressca-frontend/admin/src/services/notification/notificationService.ts b/samples/web-csr/dressca-frontend/admin/src/services/notification/notificationService.ts new file mode 100644 index 000000000..fb90bedd2 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/services/notification/notificationService.ts @@ -0,0 +1,11 @@ +import { useNotificationStore } from '@/stores/notification/notification'; + +/** + * トーストを画面に表示します。 + * @param message 表示するメッセージ。 + * @param timeout タイムアウト値(ミリ秒)。デフォルトは5000。 + */ +export function showToast(message: string, timeout: number = 5000) { + const notificationStore = useNotificationStore(); + notificationStore.setMessage(message, timeout); +} diff --git a/samples/web-csr/dressca-frontend/admin/src/shared/authentication/authentication-guard.ts b/samples/web-csr/dressca-frontend/admin/src/shared/authentication/authentication-guard.ts new file mode 100644 index 000000000..a3e325587 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/shared/authentication/authentication-guard.ts @@ -0,0 +1,32 @@ +import type { Router, RouteRecordName } from 'vue-router'; +import { useAuthenticationStore } from '@/stores/authentication/authentication'; +import { useRoutingStore } from '@/stores/routing/routing'; + +/** + * ナビゲーションガードです。 + * 画面遷移する際に共通して実行する処理を定義します。 + * たとえば、未認証の場合はログイン画面に遷移させます。 + * @param router vue-router。 + */ +export const authenticationGuard = (router: Router) => { + const authenticationStore = useAuthenticationStore(); + const routingStore = useRoutingStore(); + + router.beforeEach((to) => { + const ignoreAuthPaths: (RouteRecordName | null | undefined)[] = [ + 'authentication/login', + 'error', + ]; + if (ignoreAuthPaths.includes(to.name)) { + return true; + } + + if (authenticationStore.isAuthenticated) { + return true; + } + + const redirectFromPath: string = to.fullPath; + routingStore.setRedirectFrom(redirectFromPath); + return { name: 'authentication/login' }; + }); +}; diff --git a/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/custom-error-handler.ts b/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/custom-error-handler.ts new file mode 100644 index 000000000..73cdeb6e1 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/custom-error-handler.ts @@ -0,0 +1,80 @@ +import type { App } from 'vue'; +import { showToast } from '@/services/notification/notificationService'; +import { useRoutingStore } from '@/stores/routing/routing'; +import { router } from '@/router'; +import { customErrorHandlerKey } from '@/shared/injection-symbols'; +import { + CustomErrorBase, + UnauthorizedError, + NetworkError, + ServerError, +} from './custom-error'; + +/** + * カスタムエラーハンドラーを型付けするためのインターフェースです。 + */ +export interface CustomErrorHandler { + install(app: App): void; + handle( + error: unknown, + callback: () => void, + handlingUnauthorizedError?: (() => void) | null, + handlingNetworkError?: (() => void) | null, + handlingServerError?: (() => void) | null, + ): void; +} + +/** + * カスタムエラーハンドラーを provide する Vue プラグインです。 + * @returns カスタムエラーハンドラー。 + */ +export function createCustomErrorHandler(): CustomErrorHandler { + const customErrorHandler: CustomErrorHandler = { + install: (app: App) => { + app.provide(customErrorHandlerKey, customErrorHandler); + }, + handle: ( + error: unknown, + callback: () => void, + handlingUnauthorizedError: (() => void) | null = null, + handlingNetworkError: (() => void) | null = null, + handlingServerError: (() => void) | null = null, + ) => { + // ハンドリングできるエラーの場合はコールバックを実行 + if (error instanceof CustomErrorBase) { + callback(); + + // エラーの種類によって共通処理を行う + // switch だと instanceof での判定ができないため if 文で判定 + if (error instanceof UnauthorizedError) { + if (handlingUnauthorizedError) { + handlingUnauthorizedError(); + } else { + const routingStore = useRoutingStore(); + routingStore.setRedirectFrom( + router.currentRoute.value.path.slice(1), + ); + router.push({ name: 'authentication/login' }); + showToast('ログインしてください。'); + } + } else if (error instanceof NetworkError) { + if (handlingNetworkError) { + handlingNetworkError(); + } else { + showToast('ネットワークエラーが発生しました。'); + } + } else if (error instanceof ServerError) { + if (handlingServerError) { + handlingServerError(); + } else { + showToast('サーバーエラーが発生しました。'); + } + } + } else { + // ハンドリングできないエラーの場合は上位にエラーを投げる + throw error; + } + }, + }; + return customErrorHandler; +} diff --git a/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/custom-error.ts b/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/custom-error.ts new file mode 100644 index 000000000..edf524fa9 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/custom-error.ts @@ -0,0 +1,74 @@ +/* eslint max-classes-per-file: 0 */ + +/** + * カスタムエラーの基底クラスです。 + */ +export abstract class CustomErrorBase extends Error { + cause?: Error | null; + + constructor(message: string, cause?: Error) { + super(message); + // ラップ前のエラーを cause として保持 + this.cause = cause; + } +} + +/** + * HTTP 通信でのエラーを表すカスタムエラーです。 + */ +export class HttpError extends CustomErrorBase { + constructor(message: string, cause?: Error) { + super(message, cause); + this.name = 'HttpError'; + } +} + +/** + * ネットワークエラーを表すカスタムエラーです。 + */ +export class NetworkError extends HttpError { + constructor(message: string, cause?: Error) { + super(message, cause); + this.name = 'NetworkError'; + } +} + +/** + * 401 Unauthorized を表すカスタムエラーです。 + */ +export class UnauthorizedError extends HttpError { + constructor(message: string, cause?: Error) { + super(message, cause); + this.name = 'UnauthorizedError'; + } +} + +/** + * 409 Conflict を表すカスタムエラーです。 + */ +export class ConflictError extends HttpError { + constructor(message: string, cause?: Error) { + super(message, cause); + this.name = 'ConflictError'; + } +} + +/** + * 404 Not Found を表すカスタムエラーです。 + */ +export class NotFoundError extends HttpError { + constructor(message: string, cause?: Error) { + super(message, cause); + this.name = 'NotFoundError'; + } +} + +/** + * 500 Internal Server Error を表すカスタムエラーです。 + */ +export class ServerError extends HttpError { + constructor(message: string, cause?: Error) { + super(message, cause); + this.name = 'ServerError'; + } +} diff --git a/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/global-error-handler.ts b/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/global-error-handler.ts new file mode 100644 index 000000000..612111c95 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/global-error-handler.ts @@ -0,0 +1,38 @@ +import type { App, ComponentPublicInstance } from 'vue'; +import { router } from '../../router'; + +/** + * Vue アプリケーション内のエラー、 + * アプリケーション外の同期エラー、 + * アプリケーション外の非同期エラーについて、 + * 業務上想定しないシステムエラーをハンドリングするためのグローバルエラーハンドラーです。 + */ +export const globalErrorHandler = { + /* eslint no-param-reassign: 0 */ + install(app: App) { + app.config.errorHandler = ( + err: unknown, + instance: ComponentPublicInstance | null, + info: string, + ) => { + // 本サンプルAPではログの出力とエラー画面への遷移を行っています。 + // APの要件によってはサーバーやログ収集ツールにログを送信し、エラーを握りつぶすこともあります。 + /* eslint no-console: 0 */ + console.log(err, instance, info); + router.replace({ name: 'error' }); + }; + + // Vue.js 以外のエラー + // テストやデバッグ時にエラーの発生を検知するために利用する + window.addEventListener('error', (event) => { + /* eslint no-console: 0 */ + console.log(event); + }); + + // テストやデバッグ時に予期せぬ非同期エラーの発生を検知するために利用する + window.addEventListener('unhandledrejection', (event) => { + /* eslint no-console: 0 */ + console.log(event); + }); + }, +}; diff --git a/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/use-custom-error-handler.ts b/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/use-custom-error-handler.ts new file mode 100644 index 000000000..11e72319a --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/shared/error-handler/use-custom-error-handler.ts @@ -0,0 +1,11 @@ +import { inject } from 'vue'; +import type { CustomErrorHandler } from './custom-error-handler'; +import { customErrorHandlerKey } from '../injection-symbols'; + +/** + * カスタムエラーハンドラーを取得します。 + * @returns アプリケーションレベルで提供されたカスタムエラーハンドラー。 + */ +export function useCustomErrorHandler(): CustomErrorHandler { + return inject(customErrorHandlerKey)!; +} diff --git a/samples/web-csr/dressca-frontend/admin/src/shared/helpers/assetHelper.ts b/samples/web-csr/dressca-frontend/admin/src/shared/helpers/assetHelper.ts new file mode 100644 index 000000000..aba398819 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/shared/helpers/assetHelper.ts @@ -0,0 +1,31 @@ +export function assetHelper() { + const getAssetUrl = (assetCode: string): string => { + if (assetCode === '') { + return `${import.meta.env.VITE_NO_ASSET_URL}`; + } + + return `${import.meta.env.VITE_ASSET_URL}${assetCode}`; + }; + + function getFirstItem(assetCodes: string[] | undefined): string { + if ( + typeof assetCodes === 'undefined' || + assetCodes == null || + assetCodes.length === 0 + ) { + return ''; + } + + return assetCodes[0]; + } + + const getFirstAssetUrl = (assetCodes: string[] | undefined): string => { + const firstItem = getFirstItem(assetCodes); + return getAssetUrl(firstItem); + }; + + return { + getFirstAssetUrl, + getAssetUrl, + }; +} diff --git a/samples/web-csr/dressca-frontend/admin/src/shared/helpers/currencyHelper.ts b/samples/web-csr/dressca-frontend/admin/src/shared/helpers/currencyHelper.ts new file mode 100644 index 000000000..8e9ddb215 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/shared/helpers/currencyHelper.ts @@ -0,0 +1,14 @@ +export function currencyHelper() { + const toCurrencyJPY = (price: number | undefined): string => { + if (typeof price === 'undefined') { + return '-'; + } + return price.toLocaleString('ja-JP', { + style: 'currency', + currency: 'JPY', + }); + }; + return { + toCurrencyJPY, + }; +} diff --git a/samples/web-csr/dressca-frontend/admin/src/shared/injection-symbols.ts b/samples/web-csr/dressca-frontend/admin/src/shared/injection-symbols.ts new file mode 100644 index 000000000..b9037943d --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/shared/injection-symbols.ts @@ -0,0 +1,9 @@ +import type { InjectionKey } from 'vue'; +import type { CustomErrorHandler } from './error-handler/custom-error-handler'; + +/** + * カスタムエラーハンドラーを provide/inject するための一意なキー。 + */ +export const customErrorHandlerKey = Symbol( + 'customErrorHandler', +) as InjectionKey; diff --git a/samples/web-csr/dressca-frontend/admin/src/stores/authentication/authentication.ts b/samples/web-csr/dressca-frontend/admin/src/stores/authentication/authentication.ts new file mode 100644 index 000000000..2d504d4e2 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/stores/authentication/authentication.ts @@ -0,0 +1,57 @@ +import { defineStore } from 'pinia'; +import { UsersApi } from '@/api-client'; + +/** + * 認証状態のストアです。 + */ +export const useAuthenticationStore = defineStore({ + id: 'authentication', + state: () => ({ + authenticationState: JSON.parse( + sessionStorage.getItem('isAuthenticated') || 'false', + ) as boolean, + userName: JSON.parse(sessionStorage.getItem('userName') || '""'), + userRoles: JSON.parse(sessionStorage.getItem('userRoles') || '""'), + }), + actions: { + /** + * アプリケーションにログインします。 + * セッションストレージに認証状態を保存します。 + */ + async signInAsync() { + const response = await UsersApi.getLoginUser(); + const { userName, roles } = response.data; + this.userName = userName; + this.userRoles = roles; + this.authenticationState = true; + sessionStorage.setItem('userName', JSON.stringify(this.userName)); + sessionStorage.setItem('userRoles', JSON.stringify(this.userRoles)); + sessionStorage.setItem( + 'isAuthenticated', + JSON.stringify(this.authenticationState), + ); + }, + /** + * アプリケーションからログアウトします。 + * セッションストレージから認証状態を削除します。 + */ + async signOutAsync() { + this.userName = ''; + this.userRoles = ''; + this.authenticationState = false; + sessionStorage.removeItem('isAuthenticated'); + sessionStorage.removeItem('userName'); + sessionStorage.removeItem('userRoles'); + }, + }, + getters: { + /** + * ユーザーが認証済みかどうかを取得します。 + * @param state 状態。 + * @returns 認証済みかどうかを表す真理値。 + */ + isAuthenticated(state) { + return state.authenticationState; + }, + }, +}); diff --git a/samples/web-csr/dressca-frontend/admin/src/stores/notification/notification.ts b/samples/web-csr/dressca-frontend/admin/src/stores/notification/notification.ts new file mode 100644 index 000000000..47e6f072a --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/stores/notification/notification.ts @@ -0,0 +1,34 @@ +import { defineStore } from 'pinia'; + +/** + * 通知のストアです。 + */ +export const useNotificationStore = defineStore({ + id: 'notification', + state: () => ({ + message: '' as string, + timeout: 5000 as number, + }), + actions: { + /** + * メッセージとタイムアウトまでの時間を設定します。 + * @param message メッセージ。 + * @param timeout タイムアウトまでの時間(ミリ秒)。 + */ + setMessage(message: string, timeout: number = 5000) { + this.message = message; + this.timeout = timeout; + + setTimeout(() => { + this.clearMessage(); + }, this.timeout); + }, + + /** + * メッセージを空にします。 + */ + clearMessage() { + this.message = ''; + }, + }, +}); diff --git a/samples/web-csr/dressca-frontend/admin/src/stores/routing/routing.ts b/samples/web-csr/dressca-frontend/admin/src/stores/routing/routing.ts new file mode 100644 index 000000000..3764c30a5 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/stores/routing/routing.ts @@ -0,0 +1,26 @@ +import { defineStore } from 'pinia'; + +/** + * ルーティング情報のストア。 + */ +export const useRoutingStore = defineStore({ + id: 'routing', + state: () => ({ + redirectFrom: null as null | string, + }), + actions: { + /** + * リダイレクト元の URL を設定します。 + * @param from リダイレクト元のURL。 + */ + setRedirectFrom(from: string) { + this.redirectFrom = from; + }, + /** + * リダイレクト元の URL を削除します。 + */ + deleteRedirectFrom() { + this.redirectFrom = null; + }, + }, +}); diff --git a/samples/web-csr/dressca-frontend/admin/src/validation/validation-items.ts b/samples/web-csr/dressca-frontend/admin/src/validation/validation-items.ts new file mode 100644 index 000000000..a73ddb573 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/validation/validation-items.ts @@ -0,0 +1,35 @@ +import * as yup from 'yup'; +import { toTypedSchema } from '@vee-validate/yup'; +import type { TypedSchema } from 'vee-validate'; + +// バリデーション定義(一元化) +export const validationItems = { + email: yup.string().email(), +}; + +/** + * カタログアイテムのバリデーションを定義する型付きのスキーマです。 + */ +export const catalogItemSchema: TypedSchema = toTypedSchema( + yup.object({ + itemName: yup + .string() + .required('アイテム名は必須です。') + .max(256, '256文字以下で入力してください。'), + itemDescription: yup + .string() + .required('説明は必須です。') + .max(1024, '1024文字以下で入力してください。'), + price: yup + .number() + .required('単価は必須です。') + .typeError('数値で入力してください。') + .integer('整数で入力してください。') + .positive('正の数で入力してください。'), + productCode: yup + .string() + .required('商品コードは必須です。') + .max(128, '128文字以下で入力してください。') + .matches(/^[0-9a-zA-Z]+$/, '半角英数字で入力してください。'), + }), +); diff --git a/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsAddView.spec.ts b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsAddView.spec.ts new file mode 100644 index 000000000..826bf6e50 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsAddView.spec.ts @@ -0,0 +1,43 @@ +import { describe, it, expect, vi, beforeAll } from 'vitest'; +import { flushPromises, mount, VueWrapper } from '@vue/test-utils'; +import { router } from '@/router'; +import { createPinia, setActivePinia } from 'pinia'; +import { createCustomErrorHandler } from '@/shared/error-handler/custom-error-handler'; +import ItemsAddView from '@/views/catalog/ItemsAddView.vue'; + +async function getWrapper() { + const pinia = createPinia(); + setActivePinia(pinia); + const customErrorHandler = createCustomErrorHandler(); + return mount(ItemsAddView, { + global: { plugins: [pinia, router, customErrorHandler] }, + }); +} + +describe('アイテムを追加できる', () => { + let wrapper: VueWrapper; + + beforeAll(async () => { + wrapper = await getWrapper(); + }); + + it('追加画面に遷移できる', async () => { + // Arrange + // Act + await flushPromises(); + // Assert + expect(wrapper.html()).toContain('カタログアイテム追加'); + }); + + it('追加ボタンを押下_追加成功_通知モーダルが開く', async () => { + // Arrange + // Act + wrapper.find('button').trigger('click'); + await flushPromises(); + await vi.waitUntil(() => + wrapper.findAllComponents({ name: 'NotificationModal' })[0].isVisible(), + ); + // Assert + expect(wrapper.html()).toContain('カタログアイテムを追加しました。'); + }); +}); diff --git a/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsEditView.spec.ts b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsEditView.spec.ts new file mode 100644 index 000000000..62d8ff1f5 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsEditView.spec.ts @@ -0,0 +1,132 @@ +import { describe, it, expect, vi, beforeAll } from 'vitest'; +import { flushPromises, mount, VueWrapper } from '@vue/test-utils'; +import { createPinia, setActivePinia } from 'pinia'; +import { createCustomErrorHandler } from '@/shared/error-handler/custom-error-handler'; +import ItemsEditView from '@/views/catalog/ItemsEditView.vue'; +import { router } from '@/router'; + +async function getWrapper() { + const pinia = createPinia(); + setActivePinia(pinia); + const customErrorHandler = createCustomErrorHandler(); + router.push({ name: 'catalog/items/edit', params: { itemId: 1 } }); + await router.isReady(); + return mount(ItemsEditView, { + global: { plugins: [pinia, router, customErrorHandler] }, + }); +} + +describe('アイテムが削除できる', () => { + let wrapper: VueWrapper; + + beforeAll(async () => { + wrapper = await getWrapper(); + }); + + it('編集画面に遷移できる', async () => { + // Arrange + // Act + await flushPromises(); + // Assert + expect(wrapper.html()).toContain('カタログアイテム編集'); + }); + + it('削除ボタンを押下_確認モーダルが開く', async () => { + // Arrange + // Act + await wrapper.findAll('button')[0].trigger('click'); + // Assert + expect(wrapper.html()).toContain('カタログアイテムを削除します。'); + }); + + it('OKボタンを押下_確認モーダルが閉じる', async () => { + // Arrange + // Act + await wrapper + .findAllComponents({ name: 'ConfirmationModal' })[0] + .findAll('button')[0] + .trigger('click'); + await flushPromises(); + // Assert + expect( + wrapper.findAllComponents({ name: 'ConfirmationModal' })[0].isVisible(), + ).toBeFalsy(); + }); + + it('削除成功_通知モーダルが開く', async () => { + // Arrange + // Act + await vi.waitUntil(() => + wrapper.findAllComponents({ name: 'NotificationModal' })[0].isVisible(), + ); + // Assert + expect(wrapper.html()).toContain('カタログアイテムを削除しました。'); + }); + + it('OKボタンを押下__通知モーダルが閉じる', async () => { + // Act + await wrapper + .findAllComponents({ name: 'NotificationModal' })[0] + .findAll('button')[0] + .trigger('click'); + // Assert + expect( + wrapper.findAllComponents({ name: 'NotificationModal' })[0].isVisible(), + ).toBeFalsy(); + }); +}); + +describe('アイテムが更新できる', () => { + let wrapper: VueWrapper; + + beforeAll(async () => { + wrapper = await getWrapper(); + }); + + it('編集画面に遷移できる', async () => { + // Arrange + // Act + await flushPromises(); + // Assert + expect(wrapper.html()).toContain('カタログアイテム編集'); + }); + + it('更新ボタンを押下__確認モーダルが開く', async () => { + // Arrange + const editButton = wrapper.findAll('button')[1]; + // Act + await editButton.trigger('click'); + // Assert + expect(wrapper.html()).toContain('カタログアイテムを更新します。'); + }); + + it('更新成功__通知モーダルが開く', async () => { + // Arrange + // Act + await wrapper + .findAllComponents({ name: 'ConfirmationModal' })[1] + .findAll('button')[0] + .trigger('click'); + await flushPromises(); + await vi.waitUntil(() => + wrapper.findAllComponents({ name: 'NotificationModal' })[1].isVisible(), + ); + // Assert + expect( + wrapper.findAllComponents({ name: 'ConfirmationModal' })[1].isVisible(), + ).toBeFalsy(); + expect(wrapper.html()).toContain('カタログアイテムを更新しました。'); + }); + + it('OKボタンを押下__通知モーダルが閉じる', async () => { + // Act + await wrapper + .findAllComponents({ name: 'NotificationModal' })[1] + .findAll('button')[0] + .trigger('click'); + // Assert + expect( + wrapper.findAllComponents({ name: 'NotificationModal' })[1].isVisible(), + ).toBeFalsy(); + }); +}); diff --git a/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsView.spec.ts b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsView.spec.ts new file mode 100644 index 000000000..cc6696555 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsView.spec.ts @@ -0,0 +1,39 @@ +import { describe, it, expect, beforeAll } from 'vitest'; +import { flushPromises, mount, VueWrapper } from '@vue/test-utils'; +import { router } from '@/router'; +import { createPinia, setActivePinia } from 'pinia'; +import { createCustomErrorHandler } from '@/shared/error-handler/custom-error-handler'; +import ItemsView from '@/views/catalog/ItemsView.vue'; + +async function getWrapper() { + const pinia = createPinia(); + setActivePinia(pinia); + const customErrorHandler = createCustomErrorHandler(); + return mount(ItemsView, { + global: { plugins: [pinia, router, customErrorHandler] }, + }); +} +describe('アイテム一覧が表示できる', () => { + let wrapper: VueWrapper; + + beforeAll(async () => { + wrapper = await getWrapper(); + }); + + it('アイテム一覧画面に遷移できる', async () => { + // Arrange + // Act + await flushPromises(); + // Assert + expect(wrapper.html()).toContain('カタログアイテム一覧'); + }); + + it('アイテムが取得した個数分表示される', async () => { + // Arrange + const expectedItemCount = 11; + // Act + const tableRows = wrapper.find('tbody').findAll('tr'); + // Assert + expect(tableRows.length).toBe(expectedItemCount); + }); +}); diff --git a/samples/web-csr/dressca-frontend/admin/src/views/authentication/LoginView.vue b/samples/web-csr/dressca-frontend/admin/src/views/authentication/LoginView.vue new file mode 100644 index 000000000..85c00c0a2 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/authentication/LoginView.vue @@ -0,0 +1,104 @@ + + + diff --git a/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsAddView.vue b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsAddView.vue new file mode 100644 index 000000000..617d58444 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsAddView.vue @@ -0,0 +1,221 @@ + + + diff --git a/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsEditView.vue b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsEditView.vue new file mode 100644 index 000000000..dbaa93e41 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsEditView.vue @@ -0,0 +1,578 @@ + + + diff --git a/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsView.vue b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsView.vue new file mode 100644 index 000000000..d00a9b596 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsView.vue @@ -0,0 +1,171 @@ + + + diff --git a/samples/web-csr/dressca-frontend/admin/src/views/error/ErrorView.vue b/samples/web-csr/dressca-frontend/admin/src/views/error/ErrorView.vue new file mode 100644 index 000000000..771f0eaa2 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/error/ErrorView.vue @@ -0,0 +1,7 @@ + diff --git a/samples/web-csr/dressca-frontend/admin/src/views/home/HomeView.vue b/samples/web-csr/dressca-frontend/admin/src/views/home/HomeView.vue new file mode 100644 index 000000000..075d215c4 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/home/HomeView.vue @@ -0,0 +1,28 @@ + + + diff --git a/samples/web-csr/dressca-frontend/admin/tailwind.config.js b/samples/web-csr/dressca-frontend/admin/tailwind.config.js new file mode 100644 index 000000000..5eef83c9c --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/tailwind.config.js @@ -0,0 +1,9 @@ +/** @type {import('tailwindcss').Config} */ +export default { + content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], + theme: { + extend: {}, + }, + plugins: [], +} + diff --git a/samples/web-csr/dressca-frontend/admin/tsconfig.app.json b/samples/web-csr/dressca-frontend/admin/tsconfig.app.json new file mode 100644 index 000000000..5e6bd76f3 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["env.d.ts", "src/**/*", "src/**/*.vue","mock/**/*", "vitest.setup.ts"], + "exclude": ["src/**/__tests__/*"], + "compilerOptions": { + "composite": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + }, +} diff --git a/samples/web-csr/dressca-frontend/admin/tsconfig.json b/samples/web-csr/dressca-frontend/admin/tsconfig.json new file mode 100644 index 000000000..b4c49da8e --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/tsconfig.json @@ -0,0 +1,17 @@ +{ + "files": [], + "references": [ + { + "path": "./tsconfig.node.json" + }, + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.vitest.json" + }, + ], + "compilerOptions": { + "module": "NodeNext" + } +} diff --git a/samples/web-csr/dressca-frontend/admin/tsconfig.node.json b/samples/web-csr/dressca-frontend/admin/tsconfig.node.json new file mode 100644 index 000000000..818becf19 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/tsconfig.node.json @@ -0,0 +1,17 @@ +{ + "extends": "@tsconfig/node20/tsconfig.json", + "include": [ + "vite.config.*", + "vitest.config.*", + "cypress.config.*", + ], + "compilerOptions": { + "composite": true, + "noEmit": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + + "module": "ESNext", + "moduleResolution": "Bundler", + "types": ["node"] + } +} diff --git a/samples/web-csr/dressca-frontend/admin/tsconfig.vitest.json b/samples/web-csr/dressca-frontend/admin/tsconfig.vitest.json new file mode 100644 index 000000000..571995d11 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/tsconfig.vitest.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.app.json", + "exclude": [], + "compilerOptions": { + "composite": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo", + + "lib": [], + "types": ["node", "jsdom"] + } +} diff --git a/samples/web-csr/dressca-frontend/admin/vite.config.ts b/samples/web-csr/dressca-frontend/admin/vite.config.ts new file mode 100644 index 000000000..f6f5bd23c --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/vite.config.ts @@ -0,0 +1,58 @@ +/* eslint-disable import/no-default-export */ +import { fileURLToPath, URL } from 'node:url'; +import { defineConfig, loadEnv, Plugin } from 'vite'; +import vue from '@vitejs/plugin-vue'; +import vueJsx from '@vitejs/plugin-vue-jsx'; +import fs from 'fs'; +import path from 'path'; + +/** + * Mock Service Worker のワーカースクリプトを削除するプラグインです。 + * 本番ビルド時にワーカースクリプトを削除するために使用します。 + * @returns Vite のプラグイン + */ +function excludeMsw(): Plugin { + return { + name: 'exclude-msw', + resolveId: (source) => { + return source === 'virtual-module' ? source : null; + }, + renderStart() { + const outDir = './public'; + const msWorker = path.resolve(outDir, 'mockServiceWorker.js'); + // eslint-disable-next-line no-console + fs.rm(msWorker, () => console.log(`Deleted ${msWorker}`)); + }, + }; +} + +// https://vitejs.dev/config/ +export default defineConfig(({ mode }) => { + const plugins = [vue(), vueJsx()]; + const env = loadEnv(mode, process.cwd()); + + return { + plugins: mode === 'prod' ? [...plugins, excludeMsw()] : plugins, + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)), + }, + }, + server: { + port: 6173, + proxy: { + '/api': { + target: env.VITE_PROXY_ENDPOINT_ORIGIN, + changeOrigin: true, + autoRewrite: true, + secure: false, + }, + '/swagger': { + target: env.VITE_PROXY_ENDPOINT_ORIGIN, + changeOrigin: true, + secure: false, + }, + }, + }, + }; +}); diff --git a/samples/web-csr/dressca-frontend/admin/vitest.config.ts b/samples/web-csr/dressca-frontend/admin/vitest.config.ts new file mode 100644 index 000000000..8658da058 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/vitest.config.ts @@ -0,0 +1,18 @@ +/* eslint-disable import/no-default-export */ +import { fileURLToPath } from 'node:url'; +import { mergeConfig, defineConfig, configDefaults } from 'vitest/config'; +import viteConfig from './vite.config'; + +export default defineConfig((configEnv) => + mergeConfig( + viteConfig(configEnv), + defineConfig({ + test: { + environment: 'jsdom', + exclude: [...configDefaults.exclude, 'e2e/*'], + root: fileURLToPath(new URL('./', import.meta.url)), + setupFiles: ['./vitest.setup.ts'], + }, + }), + ), +); diff --git a/samples/web-csr/dressca-frontend/admin/vitest.setup.ts b/samples/web-csr/dressca-frontend/admin/vitest.setup.ts new file mode 100644 index 000000000..533643cb6 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/vitest.setup.ts @@ -0,0 +1,21 @@ +import { beforeAll, beforeEach, afterEach, afterAll } from 'vitest'; +import { server } from './mock/node'; + +/* + * Vitestの自動テスト実行時に、共通で実行したい処理を定義する設定ファイルです。 + * たとえば、モックのワーカープロセスの起動、初期化、終了を設定しています。 + */ + +beforeAll(() => { + server.listen(); +}); + +beforeEach(() => {}); + +afterEach(() => { + server.resetHandlers(); +}); + +afterAll(() => { + server.close(); +}); diff --git a/samples/web-csr/dressca-frontend/consumer/README.md b/samples/web-csr/dressca-frontend/consumer/README.md deleted file mode 100644 index d7ff2fb66..000000000 --- a/samples/web-csr/dressca-frontend/consumer/README.md +++ /dev/null @@ -1,62 +0,0 @@ - - - -# dressca-frontend - -This template should help get you started developing with Vue 3 in Vite. - -## Recommended IDE Setup - -[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). - -## Type Support for `.vue` Imports in TS - -TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types. - -## Customize configuration - -See [Vite Configuration Reference](https://vitejs.dev/config/). - -## Project Setup - -```sh -npm install -``` - -### Compile and Hot-Reload for Development - -```sh -npm run dev -``` - -### Type-Check, Compile and Minify for Production - -```sh -npm run build -``` - -### Run Unit Tests with [Vitest](https://vitest.dev/) - -```sh -npm run test:unit -``` - -### Run End-to-End Tests with [Cypress](https://www.cypress.io/) - -```sh -npm run build -npm run test:e2e # or `npm run test:e2e:ci` for headless testing -``` - -### Lint with [ESLint](https://eslint.org/) - -```sh -npm run lint -``` - -## Credits - -- favicon: -- content: - - diff --git a/samples/web-csr/dressca-frontend/consumer/mock/catalog/catalog.api.mock.ts b/samples/web-csr/dressca-frontend/consumer/mock/catalog/catalog.api.mock.ts index 039ffd126..cf5b0bfd7 100644 --- a/samples/web-csr/dressca-frontend/consumer/mock/catalog/catalog.api.mock.ts +++ b/samples/web-csr/dressca-frontend/consumer/mock/catalog/catalog.api.mock.ts @@ -39,9 +39,12 @@ const brands: CatalogBrandResponse[] = [ ]; const catalogItemPage: PagedListOfCatalogItemResponse = { + hasNext: false, + hasPrevious: false, page: 1, pageSize: 20, totalCount: 3, + totalPages: 1, items: [ { id: 1, @@ -173,9 +176,12 @@ export const catalogApiMock = (middlewares: Connect.Server) => { res.writeHead(200, { 'Content-Type': 'application/json' }); const query = req.url && url.parse(req.url, true).query; const page: PagedListOfCatalogItemResponse = { + hasNext: catalogItemPage.hasNext, + hasPrevious: catalogItemPage.hasPrevious, page: catalogItemPage.page, pageSize: catalogItemPage.pageSize, totalCount: catalogItemPage.totalCount, + totalPages: catalogItemPage.totalPages, }; let filterdItems = catalogItemPage.items; diff --git a/samples/web-csr/dressca-frontend/consumer/package.json b/samples/web-csr/dressca-frontend/consumer/package.json index 08158ddd1..af850ceab 100644 --- a/samples/web-csr/dressca-frontend/consumer/package.json +++ b/samples/web-csr/dressca-frontend/consumer/package.json @@ -18,7 +18,7 @@ "mock": "vite --mode mock", "generate-client": "run-s openapi-client:clean openapi-client:generate --print-label", "openapi-client:clean": "node -e \"fs.promises.rm('./src/generated/api-client', {recursive: true, force: true})\"", - "openapi-client:generate": "openapi-generator-cli generate -g typescript-axios -i ./../../dressca-backend/api-docs/api-specification.json --additional-properties=withSeparateModelsAndApi=true,modelPackage=models,apiPackage=api,supportsES6=true -o ./src/generated/api-client" + "openapi-client:generate": "openapi-generator-cli generate -g typescript-axios -i ./../../dressca-backend/api-docs/web-consumer/api-specification.json --additional-properties=withSeparateModelsAndApi=true,modelPackage=models,apiPackage=api,supportsES6=true -o ./src/generated/api-client" }, "dependencies": { "@heroicons/vue": "^2.1.5", diff --git a/samples/web-csr/dressca-frontend/consumer/src/api-client/index.ts b/samples/web-csr/dressca-frontend/consumer/src/api-client/index.ts index d588a7a87..2460a5d1f 100644 --- a/samples/web-csr/dressca-frontend/consumer/src/api-client/index.ts +++ b/samples/web-csr/dressca-frontend/consumer/src/api-client/index.ts @@ -1,4 +1,4 @@ -import axios from 'axios'; +import axios, { HttpStatusCode } from 'axios'; import * as apiClient from '@/generated/api-client'; import { HttpError, @@ -28,10 +28,10 @@ axiosInstance.interceptors.response.use( if (!error.response) { return Promise.reject(new NetworkError(error.message, error)); } - if (error.response.status === 500) { + if (error.response.status === HttpStatusCode.InternalServerError) { return Promise.reject(new ServerError(error.message, error)); } - if (error.response.status === 401) { + if (error.response.status === HttpStatusCode.Unauthorized) { return Promise.reject(new UnauthorizedError(error.message, error)); } diff --git a/samples/web-csr/dressca-frontend/consumer/src/generated/api-client/models/paged-list-of-catalog-item-response.ts b/samples/web-csr/dressca-frontend/consumer/src/generated/api-client/models/paged-list-of-catalog-item-response.ts index f6f26b6ec..946a4a0b2 100644 --- a/samples/web-csr/dressca-frontend/consumer/src/generated/api-client/models/paged-list-of-catalog-item-response.ts +++ b/samples/web-csr/dressca-frontend/consumer/src/generated/api-client/models/paged-list-of-catalog-item-response.ts @@ -23,6 +23,18 @@ import type { CatalogItemResponse } from './catalog-item-response'; * @interface PagedListOfCatalogItemResponse */ export interface PagedListOfCatalogItemResponse { + /** + * + * @type {boolean} + * @memberof PagedListOfCatalogItemResponse + */ + 'hasNext'?: boolean; + /** + * + * @type {boolean} + * @memberof PagedListOfCatalogItemResponse + */ + 'hasPrevious'?: boolean; /** * * @type {Array} @@ -47,5 +59,11 @@ export interface PagedListOfCatalogItemResponse { * @memberof PagedListOfCatalogItemResponse */ 'totalCount'?: number; + /** + * + * @type {number} + * @memberof PagedListOfCatalogItemResponse + */ + 'totalPages'?: number; } diff --git a/samples/web-csr/dressca-frontend/package-lock.json b/samples/web-csr/dressca-frontend/package-lock.json index fb1c9f25b..6d99f53f0 100644 --- a/samples/web-csr/dressca-frontend/package-lock.json +++ b/samples/web-csr/dressca-frontend/package-lock.json @@ -8,9 +8,338 @@ "name": "dressca-frontend", "version": "1.0.0", "workspaces": [ - "consumer" + "consumer", + "admin" ] }, + "admin": { + "version": "0.0.0", + "dependencies": { + "@heroicons/vue": "2.1.5", + "@vee-validate/yup": "4.13.2", + "axios": "1.7.7", + "msw": "2.7.0", + "pinia": "2.2.5", + "vee-validate": "4.14.4", + "vitest": "2.1.4", + "vue": "3.5.12", + "vue-router": "4.4.5", + "yup": "1.4.0" + }, + "devDependencies": { + "@openapitools/openapi-generator-cli": "2.15.0", + "@rushstack/eslint-patch": "1.10.4", + "@tsconfig/node20": "20.1.4", + "@types/jsdom": "21.1.7", + "@types/node": "22.8.5", + "@vitejs/plugin-vue": "5.1.4", + "@vitejs/plugin-vue-jsx": "4.0.0", + "@vue/eslint-config-airbnb-with-typescript": "8.0.0", + "@vue/eslint-config-prettier": "9.0.0", + "@vue/eslint-config-typescript": "13.0.0", + "@vue/test-utils": "2.4.6", + "@vue/tsconfig": "0.5.1", + "autoprefixer": "10.4.20", + "cypress": "13.15.1", + "eslint": "8.57.0", + "eslint-plugin-cypress": "3.4.0", + "eslint-plugin-vue": "9.30.0", + "jsdom": "25.0.1", + "npm-run-all2": "7.0.1", + "postcss": "8.4.47", + "postcss-nesting": "13.0.1", + "prettier": "3.3.3", + "start-server-and-test": "2.0.8", + "stylelint": "16.9.0", + "stylelint-config-recommended-vue": "1.5.0", + "stylelint-config-standard": "36.0.1", + "stylelint-prettier": "5.0.2", + "tailwindcss": "3.4.14", + "typescript": "5.3.3", + "vite": "5.4.8", + "vue-tsc": "2.1.10" + } + }, + "admin/node_modules/@vitejs/plugin-vue-jsx": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue-jsx/-/plugin-vue-jsx-4.0.0.tgz", + "integrity": "sha512-A+6wL2AdQhDsLsDnY+2v4rRDI1HLJGIMc97a8FURO9tqKsH5QvjWrzsa5DH3NlZsM742W2wODl2fF+bfcTWtXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.6", + "@babel/plugin-transform-typescript": "^7.24.6", + "@vue/babel-plugin-jsx": "^1.2.2" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "vite": "^5.0.0", + "vue": "^3.0.0" + } + }, + "admin/node_modules/@vue/devtools-api": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.6.8.tgz", + "integrity": "sha512-ma6dY/sZR36zALVsV1W7eC57c6IJPXsy8SNgZn1PLVWU4z4dPn5TIBmnF4stmdJ4sQcixqKaQ8pwjbMPzEZwiA==", + "license": "MIT", + "dependencies": { + "@vue/devtools-kit": "^7.6.8" + } + }, + "admin/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "admin/node_modules/balanced-match": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", + "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", + "dev": true, + "license": "MIT" + }, + "admin/node_modules/css-tree": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", + "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.0.30", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "admin/node_modules/eslint-plugin-cypress": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-3.4.0.tgz", + "integrity": "sha512-Rrrr3Ri6wHqzrRr+TyUV7bDS4UnMMrFY1R1PP2F7XdGfe9txDC6lQEshyoNOWqGoPkbbeDm1x1XPc/adxemsnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "globals": "^13.20.0" + }, + "peerDependencies": { + "eslint": ">=7" + } + }, + "admin/node_modules/file-entry-cache": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-9.1.0.tgz", + "integrity": "sha512-/pqPFG+FdxWQj+/WSuzXSDaNzxgTLr/OrR1QuqfEZzDakpdYE70PwUxL7BPUa8hpjbvY1+qvCl8k+8Tq34xJgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "admin/node_modules/flat-cache": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-5.0.0.tgz", + "integrity": "sha512-JrqFmyUl2PnPi1OvLyTVHnQvwQ0S+e6lGSwu8OkAZlSaNIZciTY2H/cOOROxsBA1m/LZNHDsqAgDZt6akWcjsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.3.1", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=18" + } + }, + "admin/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "admin/node_modules/mdn-data": { + "version": "2.0.30", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", + "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", + "dev": true, + "license": "CC0-1.0" + }, + "admin/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "admin/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "admin/node_modules/stylelint": { + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.9.0.tgz", + "integrity": "sha512-31Nm3WjxGOBGpQqF43o3wO9L5AC36TPIe6030Lnm13H3vDMTcS21DrLh69bMX+DBilKqMMVLian4iG6ybBoNRQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/stylelint" + }, + { + "type": "github", + "url": "https://github.com/sponsors/stylelint" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/css-parser-algorithms": "^3.0.1", + "@csstools/css-tokenizer": "^3.0.1", + "@csstools/media-query-list-parser": "^3.0.1", + "@csstools/selector-specificity": "^4.0.0", + "@dual-bundle/import-meta-resolve": "^4.1.0", + "balanced-match": "^2.0.0", + "colord": "^2.9.3", + "cosmiconfig": "^9.0.0", + "css-functions-list": "^3.2.2", + "css-tree": "^2.3.1", + "debug": "^4.3.6", + "fast-glob": "^3.3.2", + "fastest-levenshtein": "^1.0.16", + "file-entry-cache": "^9.0.0", + "global-modules": "^2.0.0", + "globby": "^11.1.0", + "globjoin": "^0.1.4", + "html-tags": "^3.3.1", + "ignore": "^5.3.2", + "imurmurhash": "^0.1.4", + "is-plain-object": "^5.0.0", + "known-css-properties": "^0.34.0", + "mathml-tag-names": "^2.1.3", + "meow": "^13.2.0", + "micromatch": "^4.0.8", + "normalize-path": "^3.0.0", + "picocolors": "^1.0.1", + "postcss": "^8.4.41", + "postcss-resolve-nested-selector": "^0.1.6", + "postcss-safe-parser": "^7.0.0", + "postcss-selector-parser": "^6.1.2", + "postcss-value-parser": "^4.2.0", + "resolve-from": "^5.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^7.1.0", + "supports-hyperlinks": "^3.1.0", + "svg-tags": "^1.0.0", + "table": "^6.8.2", + "write-file-atomic": "^5.0.1" + }, + "bin": { + "stylelint": "bin/stylelint.mjs" + }, + "engines": { + "node": ">=18.12.0" + } + }, + "admin/node_modules/stylelint/node_modules/postcss-safe-parser": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-7.0.1.tgz", + "integrity": "sha512-0AioNCJZ2DPYz5ABT6bddIqlhgwhpHZ/l65YAYo0BCIn0xiDpsnTHz0gnoTGk0OXZW0JRs+cDwL8u/teRdz+8A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss-safe-parser" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "engines": { + "node": ">=18.0" + }, + "peerDependencies": { + "postcss": "^8.4.31" + } + }, + "admin/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "admin/node_modules/vee-validate": { + "version": "4.14.4", + "resolved": "https://registry.npmjs.org/vee-validate/-/vee-validate-4.14.4.tgz", + "integrity": "sha512-Eg1FK2IqxqmujjN8Oehvqfx+QynyrIVc6Su2h/HQI/m3VEyUXW4wlB0h0sLkNizsEWlTj7Kwxn5Q2UWCr7RTQg==", + "license": "MIT", + "dependencies": { + "@vue/devtools-api": "^7.5.2", + "type-fest": "^4.8.3" + }, + "peerDependencies": { + "vue": "^3.4.26" + } + }, + "admin/node_modules/vee-validate/node_modules/type-fest": { + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.31.0.tgz", + "integrity": "sha512-yCxltHW07Nkhv/1F6wWBr8kz+5BGMfP+RbRSYFnegVb0qV/UMT0G0ElBloPVerqn4M2ZV80Ir1FtCcYv1cT6vQ==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "consumer": { "version": "0.0.0", "dependencies": { @@ -479,6 +808,34 @@ "node": ">=6.9.0" } }, + "node_modules/@bundled-es-modules/cookie": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/cookie/-/cookie-2.0.1.tgz", + "integrity": "sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw==", + "license": "ISC", + "dependencies": { + "cookie": "^0.7.2" + } + }, + "node_modules/@bundled-es-modules/statuses": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/statuses/-/statuses-1.0.1.tgz", + "integrity": "sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==", + "license": "ISC", + "dependencies": { + "statuses": "^2.0.1" + } + }, + "node_modules/@bundled-es-modules/tough-cookie": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@bundled-es-modules/tough-cookie/-/tough-cookie-0.1.6.tgz", + "integrity": "sha512-dvMHbL464C0zI+Yqxbz6kZ5TOEp7GLW+pry/RWndAR8MJQAXZ2rPmIs8tziTZjeIyhSNZgZbCePtfSbdWqStJw==", + "license": "ISC", + "dependencies": { + "@types/tough-cookie": "^4.0.5", + "tough-cookie": "^4.1.4" + } + }, "node_modules/@colors/colors": { "version": "1.5.0", "dev": true, @@ -640,7 +997,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -835,6 +1191,93 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/@inquirer/confirm": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-5.1.1.tgz", + "integrity": "sha512-vVLSbGci+IKQvDOtzpPTCOiEJCNidHcAq9JYVoWTW0svb5FiwSLotkM+JXNXejfjnzVYV9n0DTBythl9+XgTxg==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^10.1.2", + "@inquirer/type": "^3.0.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + } + }, + "node_modules/@inquirer/core": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-10.1.2.tgz", + "integrity": "sha512-bHd96F3ezHg1mf/J0Rb4CV8ndCN0v28kUlrHqP7+ECm1C/A+paB7Xh2lbMk6x+kweQC+rZOxM/YeKikzxco8bQ==", + "license": "MIT", + "dependencies": { + "@inquirer/figures": "^1.0.9", + "@inquirer/type": "^3.0.2", + "ansi-escapes": "^4.3.2", + "cli-width": "^4.1.0", + "mute-stream": "^2.0.0", + "signal-exit": "^4.1.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.2.0", + "yoctocolors-cjs": "^2.1.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/core/node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "license": "ISC", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@inquirer/core/node_modules/mute-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-2.0.0.tgz", + "integrity": "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==", + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@inquirer/core/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@inquirer/figures": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.9.tgz", + "integrity": "sha512-BXvGj0ehzrngHTPTDqUoDT3NXL8U0RxUk2zJm2A66RhCEIWdtU1v6GuUqNAgArW4PQ9CinqIWyHdQgdwOj06zQ==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/type": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-3.0.2.tgz", + "integrity": "sha512-ZhQ4TvhwHZF+lGhQ2O/rsjo80XoZR5/5qhOY3t6FJuX5XBg5Be8YzYTvaUGJnc12AUGI2nr4QSUE4PhKSigx7g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + } + }, "node_modules/@intlify/core-base": { "version": "10.0.4", "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-10.0.4.tgz", @@ -1014,6 +1457,23 @@ "node": ">=8" } }, + "node_modules/@mswjs/interceptors": { + "version": "0.37.3", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.37.3.tgz", + "integrity": "sha512-USvgCL/uOGFtVa6SVyRrC8kIAedzRohxIXN5LISlg5C5vLZCn7dgMFVSNhSF9cuBEFrm/O2spDWEZeMnw4ZXYg==", + "license": "MIT", + "dependencies": { + "@open-draft/deferred-promise": "^2.2.0", + "@open-draft/logger": "^0.3.0", + "@open-draft/until": "^2.0.0", + "is-node-process": "^1.2.0", + "outvariant": "^1.4.3", + "strict-event-emitter": "^0.5.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@nestjs/axios": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.1.0.tgz", @@ -1157,6 +1617,28 @@ "dev": true, "license": "MIT" }, + "node_modules/@open-draft/deferred-promise": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz", + "integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==", + "license": "MIT" + }, + "node_modules/@open-draft/logger": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@open-draft/logger/-/logger-0.3.0.tgz", + "integrity": "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==", + "license": "MIT", + "dependencies": { + "is-node-process": "^1.2.0", + "outvariant": "^1.4.0" + } + }, + "node_modules/@open-draft/until": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-2.1.0.tgz", + "integrity": "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==", + "license": "MIT" + }, "node_modules/@openapitools/openapi-generator-cli": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.15.0.tgz", @@ -1263,7 +1745,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "android" @@ -1276,7 +1757,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "android" @@ -1289,7 +1769,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "darwin" @@ -1302,7 +1781,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "darwin" @@ -1315,7 +1793,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1328,7 +1805,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1341,7 +1817,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1354,7 +1829,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1367,7 +1841,6 @@ "cpu": [ "ppc64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1380,7 +1853,6 @@ "cpu": [ "riscv64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1393,7 +1865,6 @@ "cpu": [ "s390x" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1418,7 +1889,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1431,7 +1901,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "win32" @@ -1444,7 +1913,6 @@ "cpu": [ "ia32" ], - "dev": true, "optional": true, "os": [ "win32" @@ -1457,7 +1925,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "win32" @@ -1507,11 +1974,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==", + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", - "dev": true + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" }, "node_modules/@types/jsdom": { "version": "21.1.7", @@ -1541,7 +2013,6 @@ "version": "22.8.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.5.tgz", "integrity": "sha512-5iYk6AMPtsMbkZqCO1UGF9W5L38twq11S2pYWkybGHH2ogPUvXWNlQqJBzuEZWKj/WRH+QTeiv6ySWqJtvIEgA==", - "dev": true, "dependencies": { "undici-types": "~6.19.8" } @@ -1563,9 +2034,14 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/statuses": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.5.tgz", + "integrity": "sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A==", + "license": "MIT" + }, "node_modules/@types/tough-cookie": { "version": "4.0.5", - "dev": true, "license": "MIT" }, "node_modules/@types/yauzl": { @@ -1819,6 +2295,42 @@ "dev": true, "license": "ISC" }, + "node_modules/@vee-validate/yup": { + "version": "4.13.2", + "resolved": "https://registry.npmjs.org/@vee-validate/yup/-/yup-4.13.2.tgz", + "integrity": "sha512-ai0UL46S3GKO8wxnjTN6ksbxmpRrgOxKZlVO0GVqMAF52ZXW92wcADk5qUtuuW+kWe3cePuK6MH305J+kT9scw==", + "license": "MIT", + "dependencies": { + "type-fest": "^4.8.3", + "vee-validate": "4.13.2", + "yup": "^1.3.2" + } + }, + "node_modules/@vee-validate/yup/node_modules/type-fest": { + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.31.0.tgz", + "integrity": "sha512-yCxltHW07Nkhv/1F6wWBr8kz+5BGMfP+RbRSYFnegVb0qV/UMT0G0ElBloPVerqn4M2ZV80Ir1FtCcYv1cT6vQ==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vee-validate/yup/node_modules/vee-validate": { + "version": "4.13.2", + "resolved": "https://registry.npmjs.org/vee-validate/-/vee-validate-4.13.2.tgz", + "integrity": "sha512-HlpR/6MJ92TW9f135umMZKUqdd/tFQTxLNSf2ImbU4Y/MlLVAUpF1l64VdjTOhbClAqPjCb5p/SqHDxLpUHXrw==", + "license": "MIT", + "dependencies": { + "@vue/devtools-api": "^6.6.1", + "type-fest": "^4.8.3" + }, + "peerDependencies": { + "vue": "^3.4.26" + } + }, "node_modules/@vitejs/plugin-vue": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.1.4.tgz", @@ -1856,7 +2368,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.4.tgz", "integrity": "sha512-DOETT0Oh1avie/D/o2sgMHGrzYUFFo3zqESB2Hn70z6QB1HrS2IQ9z5DfyTqU8sg4Bpu13zZe9V4+UTNQlUeQA==", - "dev": true, "dependencies": { "@vitest/spy": "2.1.4", "@vitest/utils": "2.1.4", @@ -1871,7 +2382,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.4.tgz", "integrity": "sha512-Ky/O1Lc0QBbutJdW0rqLeFNbuLEyS+mIPiNdlVlp2/yhJ0SbyYqObS5IHdhferJud8MbbwMnexg4jordE5cCoQ==", - "dev": true, "dependencies": { "@vitest/spy": "2.1.4", "estree-walker": "^3.0.3", @@ -1897,7 +2407,6 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, "dependencies": { "@types/estree": "^1.0.0" } @@ -1906,7 +2415,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.4.tgz", "integrity": "sha512-L95zIAkEuTDbUX1IsjRl+vyBSLh3PwLLgKpghl37aCK9Jvw0iP+wKwIFhfjdUtA2myLgjrG6VU6JCFLv8q/3Ww==", - "dev": true, "dependencies": { "tinyrainbow": "^1.2.0" }, @@ -1918,7 +2426,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.4.tgz", "integrity": "sha512-sKRautINI9XICAMl2bjxQM8VfCMTB0EbsBc/EDFA57V6UQevEKY/TOPOF5nzcvCALltiLfXWbq4MaAwWx/YxIA==", - "dev": true, "dependencies": { "@vitest/utils": "2.1.4", "pathe": "^1.1.2" @@ -1931,7 +2438,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.4.tgz", "integrity": "sha512-3Kab14fn/5QZRog5BPj6Rs8dc4B+mim27XaKWFWHWA87R56AKjHTGcBFKpvZKDzC4u5Wd0w/qKsUIio3KzWW4Q==", - "dev": true, "dependencies": { "@vitest/pretty-format": "2.1.4", "magic-string": "^0.30.12", @@ -1945,7 +2451,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.4.tgz", "integrity": "sha512-4JOxa+UAizJgpZfaCPKK2smq9d8mmjZVPMt2kOsg/R8QkoRzydHH1qHxIYNvr1zlEaFj4SXiaaJWxq/LPLKaLg==", - "dev": true, "dependencies": { "tinyspy": "^3.0.2" }, @@ -1957,7 +2462,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.4.tgz", "integrity": "sha512-MXDnZn0Awl2S86PSNIim5PWXgIAx8CIkzu35mBdSApUip6RFOGXBCf3YFyeEu8n1IHk4bWD46DeYFu9mQlFIRg==", - "dev": true, "dependencies": { "@vitest/pretty-format": "2.1.4", "loupe": "^3.1.2", @@ -2114,12 +2618,12 @@ "license": "MIT" }, "node_modules/@vue/devtools-kit": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.5.4.tgz", - "integrity": "sha512-0i7WFgc1B2TL52tstn82zlb9opSA0aIiHfkUYFXtZb8CIpmlFMTkHtgwVl6PMWNBj3LNhYou1YJCLpCYvJYYoA==", + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.6.8.tgz", + "integrity": "sha512-JhJ8M3sPU+v0P2iZBF2DkdmR9L0dnT5RXJabJqX6o8KtFs3tebdvfoXV2Dm3BFuqeECuMJIfF1aCzSt+WQ4wrw==", "license": "MIT", "dependencies": { - "@vue/devtools-shared": "^7.5.4", + "@vue/devtools-shared": "^7.6.8", "birpc": "^0.2.19", "hookable": "^5.5.3", "mitt": "^3.0.1", @@ -2129,9 +2633,9 @@ } }, "node_modules/@vue/devtools-shared": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.5.4.tgz", - "integrity": "sha512-dwuq4YmwTyLc7eBOqX63s3JB8il7qnKsNgENglSMkUPwiItHkVAYYfPESN1rxSdYkl1RCux1l5TBidYqfUDNAA==", + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.6.8.tgz", + "integrity": "sha512-9MBPO5Z3X1nYGFqTJyohl6Gmf/J7UNN1oicHdyzBVZP4jnhZ4c20MgtaHDIzWmHDHCMYVS5bwKxT3jxh7gOOKA==", "license": "MIT", "dependencies": { "rfdc": "^1.4.1" @@ -2558,9 +3062,13 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/admin": { + "resolved": "admin", + "link": true + }, "node_modules/agent-base": { "version": "7.1.1", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "debug": "^4.3.4" @@ -2612,7 +3120,6 @@ }, "node_modules/ansi-escapes": { "version": "4.3.2", - "dev": true, "license": "MIT", "dependencies": { "type-fest": "^0.21.3" @@ -2626,7 +3133,6 @@ }, "node_modules/ansi-regex": { "version": "5.0.1", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2634,7 +3140,6 @@ }, "node_modules/ansi-styles": { "version": "4.3.0", - "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -2892,7 +3397,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", - "dev": true, "engines": { "node": ">=12" } @@ -3212,7 +3716,6 @@ "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, "engines": { "node": ">=8" } @@ -3290,7 +3793,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.2.tgz", "integrity": "sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==", - "dev": true, "dependencies": { "assertion-error": "^2.0.1", "check-error": "^2.1.1", @@ -3326,7 +3828,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", - "dev": true, "engines": { "node": ">= 16" } @@ -3490,7 +3991,6 @@ }, "node_modules/color-convert": { "version": "2.0.1", - "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -3501,7 +4001,6 @@ }, "node_modules/color-name": { "version": "1.1.4", - "dev": true, "license": "MIT" }, "node_modules/colord": { @@ -3652,6 +4151,15 @@ "dev": true, "license": "MIT" }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/copy-anything": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", @@ -3752,7 +4260,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.1.0.tgz", "integrity": "sha512-h66W1URKpBS5YMI/V8PyXvTMFT8SupJ1IzoIV8IeBC/ji8WVmrO8dGlTi+2dh6whmdk6BiKJLD/ZBkhWbcg6nA==", - "dev": true, + "devOptional": true, "dependencies": { "rrweb-cssom": "^0.7.1" }, @@ -3906,7 +4414,7 @@ }, "node_modules/data-urls": { "version": "5.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "whatwg-mimetype": "^4.0.0", @@ -4000,7 +4508,6 @@ "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, "dependencies": { "ms": "^2.1.3" }, @@ -4015,14 +4522,13 @@ }, "node_modules/decimal.js": { "version": "10.4.3", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/deep-eql": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", - "dev": true, "engines": { "node": ">=6" } @@ -4513,7 +5019,6 @@ }, "node_modules/esbuild": { "version": "0.21.5", - "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { @@ -4552,7 +5057,6 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -5384,7 +5888,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.1.0.tgz", "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==", - "dev": true, "engines": { "node": ">=12.0.0" } @@ -5723,7 +6226,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -5782,7 +6284,6 @@ }, "node_modules/get-caller-file": { "version": "2.0.5", - "dev": true, "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" @@ -6085,6 +6586,15 @@ "dev": true, "license": "MIT" }, + "node_modules/graphql": { + "version": "16.10.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.10.0.tgz", + "integrity": "sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==", + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", @@ -6172,6 +6682,12 @@ "he": "bin/he" } }, + "node_modules/headers-polyfill": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-4.0.3.tgz", + "integrity": "sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==", + "license": "MIT" + }, "node_modules/hookable": { "version": "5.5.3", "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz", @@ -6180,7 +6696,7 @@ }, "node_modules/html-encoding-sniffer": { "version": "4.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "whatwg-encoding": "^3.1.1" @@ -6225,7 +6741,7 @@ }, "node_modules/http-proxy-agent": { "version": "7.0.2", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "agent-base": "^7.1.0", @@ -6253,7 +6769,7 @@ "version": "7.0.5", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", - "dev": true, + "devOptional": true, "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -6619,7 +7135,6 @@ }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -6701,6 +7216,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-node-process": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.2.0.tgz", + "integrity": "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==", + "license": "MIT" + }, "node_modules/is-number": { "version": "7.0.0", "dev": true, @@ -6745,7 +7266,7 @@ }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/is-regex": { @@ -7093,7 +7614,7 @@ "version": "25.0.1", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-25.0.1.tgz", "integrity": "sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==", - "dev": true, + "devOptional": true, "dependencies": { "cssstyle": "^4.1.0", "data-urls": "^5.0.0", @@ -7133,7 +7654,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.0.0.tgz", "integrity": "sha512-FRKsF7cz96xIIeMZ82ehjC3xW2E+O2+v11udrDYewUbszngYhsGa8z6YUMMzO9QJZzzyd0nGGXnML/TReX6W8Q==", - "dev": true, + "devOptional": true, "dependencies": { "tldts": "^6.1.32" }, @@ -7143,7 +7664,7 @@ }, "node_modules/jsdom/node_modules/xml-name-validator": { "version": "5.0.0", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "engines": { "node": ">=18" @@ -7473,8 +7994,7 @@ "node_modules/loupe": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.2.tgz", - "integrity": "sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==", - "dev": true + "integrity": "sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==" }, "node_modules/lru-cache": { "version": "5.1.1", @@ -7626,8 +8146,127 @@ "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/msw": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/msw/-/msw-2.7.0.tgz", + "integrity": "sha512-BIodwZ19RWfCbYTxWTUfTXc+sg4OwjCAgxU1ZsgmggX/7S3LdUifsbUPJs61j0rWb19CZRGY5if77duhc0uXzw==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@bundled-es-modules/cookie": "^2.0.1", + "@bundled-es-modules/statuses": "^1.0.1", + "@bundled-es-modules/tough-cookie": "^0.1.6", + "@inquirer/confirm": "^5.0.0", + "@mswjs/interceptors": "^0.37.0", + "@open-draft/deferred-promise": "^2.2.0", + "@open-draft/until": "^2.1.0", + "@types/cookie": "^0.6.0", + "@types/statuses": "^2.0.4", + "graphql": "^16.8.1", + "headers-polyfill": "^4.0.2", + "is-node-process": "^1.2.0", + "outvariant": "^1.4.3", + "path-to-regexp": "^6.3.0", + "picocolors": "^1.1.1", + "strict-event-emitter": "^0.5.1", + "type-fest": "^4.26.1", + "yargs": "^17.7.2" + }, + "bin": { + "msw": "cli/index.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/mswjs" + }, + "peerDependencies": { + "typescript": ">= 4.8.x" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/msw/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/msw/node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "license": "MIT" + }, + "node_modules/msw/node_modules/type-fest": { + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.31.0.tgz", + "integrity": "sha512-yCxltHW07Nkhv/1F6wWBr8kz+5BGMfP+RbRSYFnegVb0qV/UMT0G0ElBloPVerqn4M2ZV80Ir1FtCcYv1cT6vQ==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/msw/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/msw/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/msw/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } }, "node_modules/muggle-string": { "version": "0.4.1", @@ -7851,7 +8490,7 @@ }, "node_modules/nwsapi": { "version": "2.2.12", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/object-assign": { @@ -8050,6 +8689,12 @@ "dev": true, "license": "MIT" }, + "node_modules/outvariant": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.4.3.tgz", + "integrity": "sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==", + "license": "MIT" + }, "node_modules/p-limit": { "version": "3.1.0", "dev": true, @@ -8168,7 +8813,7 @@ }, "node_modules/parse5": { "version": "7.1.2", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "entities": "^4.4.0" @@ -8252,14 +8897,12 @@ "node_modules/pathe": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", - "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", - "dev": true + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==" }, "node_modules/pathval": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", - "dev": true, "engines": { "node": ">= 14.16" } @@ -8293,9 +8936,10 @@ "dev": true }, "node_modules/picocolors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", - "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", @@ -8773,8 +9417,7 @@ "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", - "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", - "dev": true + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" }, "node_modules/pump": { "version": "3.0.0", @@ -8787,7 +9430,6 @@ }, "node_modules/punycode": { "version": "2.3.1", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -8811,8 +9453,7 @@ "node_modules/querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, "node_modules/queue-microtask": { "version": "1.2.3", @@ -8947,7 +9588,6 @@ }, "node_modules/require-directory": { "version": "2.1.1", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -8966,8 +9606,7 @@ "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" }, "node_modules/resolve": { "version": "1.22.8", @@ -9046,7 +9685,6 @@ "version": "4.24.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.24.0.tgz", "integrity": "sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==", - "dev": true, "dependencies": { "@types/estree": "1.0.6" }, @@ -9084,7 +9722,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -9092,7 +9729,7 @@ }, "node_modules/rrweb-cssom": { "version": "0.7.1", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/run-async": { @@ -9191,12 +9828,12 @@ }, "node_modules/safer-buffer": { "version": "2.1.2", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/saxes": { "version": "6.0.0", - "dev": true, + "devOptional": true, "license": "ISC", "dependencies": { "xmlchars": "^2.2.0" @@ -9293,7 +9930,6 @@ }, "node_modules/siginfo": { "version": "2.0.0", - "dev": true, "license": "ISC" }, "node_modules/signal-exit": { @@ -9437,7 +10073,6 @@ }, "node_modules/stackback": { "version": "0.0.2", - "dev": true, "license": "MIT" }, "node_modules/start-server-and-test": { @@ -9505,9 +10140,17 @@ "node": ">=10.17.0" } }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/std-env": { "version": "3.7.0", - "dev": true, "license": "MIT" }, "node_modules/stream-combiner": { @@ -9518,6 +10161,12 @@ "duplexer": "~0.1.1" } }, + "node_modules/strict-event-emitter": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz", + "integrity": "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==", + "license": "MIT" + }, "node_modules/string_decoder": { "version": "1.3.0", "dev": true, @@ -9528,7 +10177,6 @@ }, "node_modules/string-width": { "version": "4.2.3", - "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -9560,7 +10208,6 @@ }, "node_modules/string-width/node_modules/emoji-regex": { "version": "8.0.0", - "dev": true, "license": "MIT" }, "node_modules/string.prototype.includes": { @@ -9670,7 +10317,6 @@ }, "node_modules/strip-ansi": { "version": "6.0.1", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -10103,7 +10749,7 @@ }, "node_modules/symbol-tree": { "version": "3.2.4", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/synckit": { @@ -10270,20 +10916,17 @@ }, "node_modules/tinybench": { "version": "2.9.0", - "dev": true, "license": "MIT" }, "node_modules/tinyexec": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.1.tgz", - "integrity": "sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==", - "dev": true + "integrity": "sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==" }, "node_modules/tinypool": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.1.tgz", "integrity": "sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==", - "dev": true, "engines": { "node": "^18.0.0 || >=20.0.0" } @@ -10292,7 +10935,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-1.2.0.tgz", "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==", - "dev": true, "engines": { "node": ">=14.0.0" } @@ -10301,7 +10943,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", - "dev": true, "engines": { "node": ">=14.0.0" } @@ -10310,7 +10951,7 @@ "version": "6.1.47", "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.47.tgz", "integrity": "sha512-R/K2tZ5MiY+mVrnSkNJkwqYT2vUv1lcT6wJvd2emGaMJ7PHUGRY4e3tUsdFCXgqxi2QgbHjL3yJgXCo40v9Hxw==", - "dev": true, + "devOptional": true, "dependencies": { "tldts-core": "^6.1.47" }, @@ -10322,7 +10963,7 @@ "version": "6.1.47", "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.47.tgz", "integrity": "sha512-6SWyFMnlst1fEt7GQVAAu16EGgFK0cLouH/2Mk6Ftlwhv3Ol40L0dlpGMcnnNiiOMyD2EV/aF3S+U2nKvvLvrA==", - "dev": true + "devOptional": true }, "node_modules/tmp": { "version": "0.2.3", @@ -10351,7 +10992,6 @@ "version": "4.1.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", - "dev": true, "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", @@ -10366,14 +11006,13 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", - "dev": true, "engines": { "node": ">= 4.0.0" } }, "node_modules/tr46": { "version": "5.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "punycode": "^2.3.1" @@ -10471,7 +11110,6 @@ }, "node_modules/type-fest": { "version": "0.21.3", - "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" @@ -10602,8 +11240,7 @@ "node_modules/undici-types": { "version": "6.19.8", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" }, "node_modules/universalify": { "version": "2.0.1", @@ -10664,7 +11301,6 @@ "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dev": true, "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -10736,7 +11372,6 @@ "version": "5.4.8", "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.8.tgz", "integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==", - "dev": true, "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", @@ -10795,7 +11430,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.4.tgz", "integrity": "sha512-kqa9v+oi4HwkG6g8ufRnb5AeplcRw8jUF6/7/Qz1qRQOXHImG8YnLbB+LLszENwFnoBl9xIf9nVdCFzNd7GQEg==", - "dev": true, "dependencies": { "cac": "^6.7.14", "debug": "^4.3.7", @@ -10816,7 +11450,6 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.4.tgz", "integrity": "sha512-eDjxbVAJw1UJJCHr5xr/xM86Zx+YxIEXGAR+bmnEID7z9qWfoxpHw0zdobz+TQAFOLT+nEXz3+gx6nUJ7RgmlQ==", - "dev": true, "dependencies": { "@vitest/expect": "2.1.4", "@vitest/mocker": "2.1.4", @@ -11037,7 +11670,7 @@ }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "xml-name-validator": "^5.0.0" @@ -11048,7 +11681,7 @@ }, "node_modules/w3c-xmlserializer/node_modules/xml-name-validator": { "version": "5.0.0", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "engines": { "node": ">=18" @@ -11083,7 +11716,7 @@ }, "node_modules/webidl-conversions": { "version": "7.0.0", - "dev": true, + "devOptional": true, "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -11091,7 +11724,7 @@ }, "node_modules/whatwg-encoding": { "version": "3.1.1", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "iconv-lite": "0.6.3" @@ -11102,7 +11735,7 @@ }, "node_modules/whatwg-encoding/node_modules/iconv-lite": { "version": "0.6.3", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -11113,7 +11746,7 @@ }, "node_modules/whatwg-mimetype": { "version": "4.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=18" @@ -11121,7 +11754,7 @@ }, "node_modules/whatwg-url": { "version": "14.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "tr46": "^5.0.0", @@ -11230,7 +11863,6 @@ }, "node_modules/why-is-node-running": { "version": "2.3.0", - "dev": true, "license": "MIT", "dependencies": { "siginfo": "^2.0.0", @@ -11253,7 +11885,6 @@ }, "node_modules/wrap-ansi": { "version": "6.2.0", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -11315,7 +11946,7 @@ }, "node_modules/ws": { "version": "8.18.0", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=10.0.0" @@ -11343,12 +11974,11 @@ }, "node_modules/xmlchars": { "version": "2.2.0", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/y18n": { "version": "5.0.8", - "dev": true, "license": "ISC", "engines": { "node": ">=10" @@ -11417,6 +12047,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/yoctocolors-cjs": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.2.tgz", + "integrity": "sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/yup": { "version": "1.4.0", "license": "MIT", diff --git a/samples/web-csr/dressca-frontend/package.json b/samples/web-csr/dressca-frontend/package.json index ff63c32bb..3ba1d8591 100644 --- a/samples/web-csr/dressca-frontend/package.json +++ b/samples/web-csr/dressca-frontend/package.json @@ -10,9 +10,17 @@ "build:prod:consumer": "npm run build:prod -w consumer", "test:unit:consumer": "npm run test:unit -w consumer", "dev:consumer": "npm run dev -w consumer", - "mock:consumer": "npm run mock -w consumer" + "mock:consumer": "npm run mock -w consumer", + "lint:ci:admin": "npm run lint:ci -w admin", + "type-check:admin": "npm run type-check -w admin", + "build-only:dev:admin": "npm run build-only:dev -w admin", + "build:prod:admin": "npm run build:prod -w admin", + "test:unit:admin": "npm run test:unit -w admin", + "dev:admin": "npm run dev -w admin", + "mock:admin": "npm run mock -w admin" }, "workspaces": [ - "consumer" + "consumer", + "admin" ] }