diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 288801633..336933678 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -117,6 +117,30 @@ updates: - "gradle" - "dependencies" + - package-ecosystem: "gradle" + directory: "/samples/web-csr/dressca-backend/web-admin" + schedule: + interval: "daily" + open-pull-requests-limit: 20 + commit-message: + prefix: "gradle-web-admin" + labels: + - "target: Dressca" + - "gradle" + - "dependencies" + + - package-ecosystem: "gradle" + directory: "/samples/web-csr/dressca-backend/web-consumer" + schedule: + interval: "daily" + open-pull-requests-limit: 20 + commit-message: + prefix: "gradle-web-consumer" + labels: + - "target: Dressca" + - "gradle" + - "dependencies" + # Azure AD B2C - package-ecosystem: "npm" directory: "/samples/azure-ad-b2c-sample/auth-frontend" diff --git a/.github/workflows/check-openapi-generator-update.yml b/.github/workflows/check-openapi-generator-update.yml index 94f32a08c..0072ba7ae 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@master 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@master + 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..344adb58d --- /dev/null +++ b/.github/workflows/samples-dressca-admin-frontend.ci.yml @@ -0,0 +1,93 @@ +--- + +name: dressca-admin-frontend CI + +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 1f81dd98a..abb5d5e46 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": "", + "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": "", "envFile": "${workspaceFolder}/.env" }, 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 260c73089..473f1b645 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 @@ -326,7 +326,7 @@ "schema": { "type": "integer", "format": "int32", - "default": 0 + "default": 1 } }, { @@ -763,6 +763,12 @@ "PagedListOfCatalogItemResponse": { "type": "object", "properties": { + "hasNext": { + "type": "boolean" + }, + "hasPrevious": { + "type": "boolean" + }, "items": { "type": "array", "items": { @@ -780,6 +786,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/CatalogApplicationService.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java index f0cd22be4..22a0ebd53 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,26 @@ 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.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogNotFoundException; import com.dressca.applicationcore.catalog.CatalogRepository; +import com.dressca.applicationcore.constant.UserRoleConstant; import com.dressca.systemcommon.constant.MessageIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; -import lombok.AllArgsConstructor; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; /** * カタログ情報に関するビジネスユースケースを実現するサービスです。 */ @Service -@AllArgsConstructor @Transactional(rollbackFor = Exception.class) public class CatalogApplicationService { @@ -31,27 +38,199 @@ public class CatalogApplicationService { private CatalogRepository catalogRepository; private CatalogBrandRepository brandRepository; - private CatalogCategoryRepository catalogCategoryRepository; + private CatalogCategoryRepository categoryRepository; + private UserStore userStore; + + /** + * コンストラクタ。 + * + * @param messages メッセージ + * @param catalogRepository カタログリポジトリ。 + * @param brandRepository カタログブランドリポジトリ。 + * @param categoryRepository カタログカテゴリリポジトリ。 + */ + public CatalogApplicationService(MessageSource messages, CatalogRepository catalogRepository, + CatalogBrandRepository brandRepository, CatalogCategoryRepository categoryRepository) { + this.messages = messages; + this.catalogRepository = catalogRepository; + this.brandRepository = brandRepository; + this.categoryRepository = categoryRepository; + } + + @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(MessageIdConstant.D_CATALOG0005_LOG, new Object[] { id }, Locale.getDefault())); + + if (!this.userStore.isInRole(UserRoleConstant.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 getCatalogItemsByConsumer(long brandId, long categoryId, int page, int pageSize) { + + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0001_LOG, + 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 getCatalogItemsByAdmin(long brandId, long categoryId, int page, int pageSize) + throws PermissionDeniedException { apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0001_LOG, new Object[] { brandId, categoryId, page, pageSize }, Locale.getDefault())); + if (!this.userStore.isInRole(UserRoleConstant.ADMIN)) { + throw new PermissionDeniedException("getCatalogItemsByAdmin"); + } + return this.catalogRepository.findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize); } + /** + * カタログにアイテムを追加します。 + * + * @param name 商品名 + * @param description 説明 + * @param price 単価 + * @param productCode 商品コード + * @param catalogBrandId ブランドID + * @param catalogCategoryId カテゴリID + * @return 追加したカタログアイテム。 + * @throws PermissionDeniedException 追加権限がない場合。 + */ + public CatalogItem addItemToCatalog(String name, String description, BigDecimal price, String productCode, + long catalogCategoryId, long catalogBrandId) throws PermissionDeniedException { + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0006_LOG, new Object[] {}, Locale.getDefault())); + + if (!this.userStore.isInRole(UserRoleConstant.ADMIN)) { + throw new PermissionDeniedException("addItemToCatalog"); + } + + // 0は仮の値で、DBにINSERTされる時にDBによって自動採番される + CatalogItem item = new CatalogItem(0, 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 CatalogNotFoundException, PermissionDeniedException, OptimisticLockingFailureException { + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0007_LOG, new Object[] { id }, Locale.getDefault())); + if (!this.userStore.isInRole(UserRoleConstant.ADMIN)) { + throw new PermissionDeniedException("deleteItemFromCatalog"); + } + CatalogItem item = this.catalogRepository.findById(id); + if (item == null) { + 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 CatalogBrandNotFoundException 更新対象のカタログブランドが存在しなかった場合。 + * @throws CatalogCategoryNotFoundException 更新対象のカタログカテゴリが存在しなかった場合。 + * @throws OptimisticLockingFailureException 楽観ロックエラーの場合。 + */ + public void updateCatalogItem(long id, String name, String description, BigDecimal price, String productCode, + long catalogCategoryId, long catalogBrandId, LocalDateTime rowVersion) + throws CatalogNotFoundException, PermissionDeniedException, CatalogBrandNotFoundException, + CatalogCategoryNotFoundException, OptimisticLockingFailureException { + + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0008_LOG, new Object[] { id }, Locale.getDefault())); + + if (!this.userStore.isInRole(UserRoleConstant.ADMIN)) { + throw new PermissionDeniedException("updateCatalogItem"); + } + CatalogItem currentCatalogItem = catalogRepository.findById(id); + if (currentCatalogItem == null) { + throw new CatalogNotFoundException(id); + } + + CatalogCategory catalogCategory = categoryRepository.findById(catalogCategoryId); + if (catalogCategory == null) { + throw new CatalogCategoryNotFoundException(catalogCategoryId); + } + + CatalogBrand catalogBrand = brandRepository.findById(catalogBrandId); + if (catalogBrand == null) { + 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); + } + } + /** * 条件に一致するカテゴリの件数を取得します。 * @@ -88,6 +267,6 @@ public List getCategories() { apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0004_LOG, 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/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..a00e8f838 --- /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.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.exception.LogicException; + +/** + * ユーザーに実行権限がないことを表す例外です。 + */ +public class PermissionDeniedException extends LogicException { + /** + * 実行を試みた操作を指定して + * {@link PermissionDeniedException} クラスの新しいインスタンスを初期化します。 + * + * @param operationName 実行を試みた操作 + */ + public PermissionDeniedException(String operationName) { + super(null, ExceptionIdConstant.E_CATALOG0004, 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..8f9386b86 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandNotFoundException.java @@ -0,0 +1,23 @@ +package com.dressca.applicationcore.catalog; + +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.exception.LogicException; + +/** + * カタログブランドが存在しないことを表す例外です。 + */ +public class CatalogBrandNotFoundException extends LogicException { + + /** + * 見つからなかったカタログブランド Id を指定して + * {@link CatalogItemNotExistingInRepositoryException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogBrandId 見つからなかったカタログブランド Id 。 + */ + public CatalogBrandNotFoundException(long catalogBrandId) { + super(null, ExceptionIdConstant.E_CATALOG0002, 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..d3d2cc4f9 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryNotFoundException.java @@ -0,0 +1,23 @@ +package com.dressca.applicationcore.catalog; + +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.exception.LogicException; + +/** + * カタログカテゴリが存在しないことを表す例外です。 + */ +public class CatalogCategoryNotFoundException extends LogicException { + + /** + * 見つからなかったカタログカテゴリ Id を指定して + * {@link CatalogItemNotExistingInRepositoryException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogCategoryId 見つからなかったカタログカテゴリ Id 。 + */ + public CatalogCategoryNotFoundException(long catalogCategoryId) { + super(null, ExceptionIdConstant.E_CATALOG0003, 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/CatalogItem.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java index 706a2a73d..f06bafe98 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, 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..bdb479804 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,38 @@ 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/constant/UserRoleConstant.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/UserRoleConstant.java new file mode 100644 index 000000000..8c6ce7367 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/constant/UserRoleConstant.java @@ -0,0 +1,9 @@ +package com.dressca.applicationcore.constant; + +/** + * ユーザーのロール用定数クラス。 + */ +public class UserRoleConstant { + /** 管理者の権限名。 */ + public static final String ADMIN = "ROLE_ADMIN"; +} 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 7b263b017..e5463d78b 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; @@ -47,8 +46,7 @@ void setUp() { } @Test - @DisplayName("testGetAssetResourceInfo_01_正常系_存在するアセットコード") - void testGetAssetResourceInfo_01_正常系_存在するアセットコード() throws AssetNotFoundException { + void testGetAssetResourceInfo_正常系_存在するアセットコード() throws AssetNotFoundException { // テスト用の入力データ String assetCode = "ExistAssetCode"; @@ -70,8 +68,7 @@ void setUp() { } @Test - @DisplayName("testGetAssetResourceInfo_02_異常系_リポジトリに存在しないアセットコード") - void testGetAssetResourceInfo_02_異常系_リポジトリに存在しないアセットコード() { + void testGetAssetResourceInfo_異常系_リポジトリに存在しないアセットコード() { // テスト用の入力データ String assetCode = "NotExistAssetCode"; @@ -90,8 +87,7 @@ void setUp() { } @Test - @DisplayName("testGetAssetResourceInfo_03_異常系_ストアに存在しないアセットコード") - void testGetAssetResourceInfo_03_異常系_ストアに存在しないアセットコード() { + void testGetAssetResourceInfo_異常系_ストアに存在しないアセットコード() { // テスト用の入力データ String assetCode = "NotExistAssetCode"; 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 196a3610c..feeb9eeb2 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,29 +1,40 @@ package com.dressca.applicationcore.applicationservice; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; 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.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; import org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration; import org.springframework.context.MessageSource; 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.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogNotFoundException; import com.dressca.applicationcore.catalog.CatalogRepository; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; /** * {@link CatalogApplicationService}の動作をテストするクラスです。 @@ -36,7 +47,9 @@ public class CatalogApplicationServiceTest { @Mock private CatalogBrandRepository brandRepository; @Mock - private CatalogCategoryRepository catalogCategoryRepository; + private CatalogCategoryRepository categoryRepository; + @Mock + private UserStore userStore; @Autowired private MessageSource messages; @@ -45,23 +58,327 @@ public class CatalogApplicationServiceTest { @BeforeEach void setUp() { - service = new CatalogApplicationService(messages, catalogRepository, brandRepository, catalogCategoryRepository); + service = new CatalogApplicationService(messages, catalogRepository, brandRepository, categoryRepository); + service.setUserStore(this.userStore); } @Test - void testGetCatalogItems_正常系_リポジトリのfindByBrandIdAndCategoryIdを1回呼出す() { + void testGetCatalogItemsByAdmin_正常系_リポジトリのfindByBrandIdAndCategoryIdを1回呼出す() throws PermissionDeniedException { // Arrange - List catalogItems = List.of(createCatalogItem(1L)); - when(this.catalogRepository.findByBrandIdAndCategoryId(anyLong(), anyLong(), anyInt(), anyInt())) - .thenReturn(catalogItems); + when(this.userStore.isInRole(anyString())).thenReturn(true); - // Act - service.getCatalogItems(1L, 1L, 1, 10); + // Action + service.getCatalogItemsByAdmin(1L, 1L, 0, 20); + + // Assert + verify(this.catalogRepository, times(1)).findByBrandIdAndCategoryId(anyLong(), anyLong(), anyInt(), anyInt()); + } + + @Test + void testGetCatalogItemsByAdmin_異常系_カタログアイテムの一覧を取得する権限がない() { + // Arrange + when(this.userStore.isInRole(anyString())).thenReturn(false); + + // Action + Executable action = () -> { + service.getCatalogItemsByAdmin(1L, 1L, 0, 20); + }; // Assert - verify(this.catalogRepository, times(1)).findByBrandIdAndCategoryId(anyLong(), anyLong(), - anyInt(), anyInt()); + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testGetCatalogItem_正常系_リポジトリのfindByIdを1回呼出す() throws CatalogNotFoundException, PermissionDeniedException { + // Arrange + long targetId = 1L; + CatalogItem catalogItem = createCatalogItem(targetId); + when(this.catalogRepository.findById(anyLong())).thenReturn(catalogItem); + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + service.getCatalogItem(1L); + // Assert + verify(this.catalogRepository, times(1)).findById(anyLong()); + } + + @Test + void testGetCatalogItem_異常系_対象のアイテムが存在しない() { + // Arrange + when(this.catalogRepository.findById(anyLong())).thenReturn(null); + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + Executable action = () -> { + this.service.getCatalogItem(anyLong()); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testGetCatalogItem_異常系_カタログアイテムを取得する権限がない() { + // Arrange + long targetId = 1L; + CatalogItem item = createCatalogItem(targetId); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.userStore.isInRole(anyString())).thenReturn(false); + + // Action + Executable action = () -> { + this.service.getCatalogItem(anyLong()); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testAddItemToCatalog_正常系_リポジトリのaddCatalogItemを1回呼出す() throws PermissionDeniedException { + // Arrange + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + service.addItemToCatalog("テストアイテム", "テスト用のアイテムです。", new BigDecimal(123456), "TEST001", 1, 1); + + // Assert + verify(this.catalogRepository, times(1)).add(any()); + } + + @Test + void testAddItemToCatalog_異常系_カタログアイテムを追加する権限がない() { + // Arrange + when(this.userStore.isInRole(anyString())).thenReturn(false); + + // Action + Executable action = () -> { + service.addItemToCatalog("テストアイテム", "テスト用のアイテムです。", new BigDecimal(123456), "TEST001", 1, 1); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testDeleteItemFromCatalog_正常系_リポジトリのremoveを1回呼出す() + throws CatalogNotFoundException, PermissionDeniedException, OptimisticLockingFailureException { + // Arrange + long targetId = 1L; + CatalogItem item = createCatalogItem(targetId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.catalogRepository.remove(anyLong(), any())).thenReturn(1); + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + this.service.deleteItemFromCatalog(1L, rowVersion); + + // Assert + verify(this.catalogRepository, times(1)).remove(any(), any()); + + } + + @Test + void testDeleteItemFromCatalog_異常系_対象のアイテムが存在しない() { + // Arrange + long targetId = 999L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(null); + when(this.catalogRepository.remove(anyLong(), any())).thenReturn(1); + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + Executable action = () -> { + this.service.deleteItemFromCatalog(targetId, rowVersion); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testDeleteItemFromCatalog_異常系_カタログアイテムを削除する権限がない() { + // Arrange + long targetId = 1L; + CatalogItem item = createCatalogItem(targetId); + when(this.userStore.isInRole(anyString())).thenReturn(false); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.catalogRepository.remove(anyLong(), any())).thenReturn(1); + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + Executable action = () -> { + this.service.deleteItemFromCatalog(1L, rowVersion); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testDeleteItemFromCatalog_異常系_楽観ロックエラー() { + // Arrange + long targetId = 1L; + CatalogItem item = createCatalogItem(targetId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.catalogRepository.remove(anyLong(), any())).thenReturn(0); + LocalDateTime rowVersion = LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0); + + // Action + Executable action = () -> { + this.service.deleteItemFromCatalog(1L, rowVersion); + }; + + // Assert + assertThrows(OptimisticLockingFailureException.class, action); + + } + + @Test + void testUpdateCatalogItem_正常系_リポジトリのupdateを1回呼出す() throws CatalogNotFoundException, PermissionDeniedException, + CatalogBrandNotFoundException, CatalogCategoryNotFoundException, OptimisticLockingFailureException { + // Arrange + long targetId = 1L; + long brandId = 1L; + long categoryId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogBrand brand = createCatalogBrand(brandId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + this.service.updateCatalogItem(1L, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", 1L, 1L, + LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0)); + + // Assert + verify(this.catalogRepository, times(1)).update(any()); + } + + @Test + void testUpdateCatalogItem_異常系_対象のアイテムが存在しない() { + // Arrange + long targetId = 999L; + long brandId = 1L; + long categoryId = 1L; + CatalogBrand brand = createCatalogBrand(brandId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(null); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", + 1L, 1L, LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0)); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_対象のブランドが存在しない() { + // Arrange + long targetId = 1L; + long categoryId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(null); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(1L, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", 1L, + targetId, LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0)); + }; + + // Assert + assertThrows(CatalogBrandNotFoundException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_対象のカテゴリが存在しない() { + // Arrange + long targetId = 1L; + long brandId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogBrand brand = createCatalogBrand(brandId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(null); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(1L, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", + targetId, 1L, LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0)); + }; + + // Assert + assertThrows(CatalogCategoryNotFoundException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_カタログアイテムを更新する権限がない() { + // Arrange + long targetId = 1L; + long brandId = 1L; + long categoryId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogBrand brand = createCatalogBrand(brandId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(false); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(1L, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", + 1L, 1L, LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0)); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_楽観ロックエラーにより正常に更新ができない() { + // Arrange + long targetId = 1L; + long brandId = 1L; + long categoryId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogBrand brand = createCatalogBrand(brandId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(0); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", + 1L, 1L, LocalDateTime.of(2024, 1, 1, 0, 0, 0, 0)); + }; + + // Assert + assertThrows(OptimisticLockingFailureException.class, action); } @Test @@ -95,13 +412,13 @@ void setUp() { 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(); } @@ -119,4 +436,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/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 0aa20d338..5cc433985 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 @@ -8,7 +8,6 @@ import java.math.BigDecimal; import java.util.Arrays; import java.util.List; -import java.util.Random; import java.util.stream.Collectors; import org.apache.commons.lang3.ArrayUtils; import org.junit.jupiter.api.Test; @@ -23,7 +22,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; @@ -34,13 +37,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 @@ -49,7 +52,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)); @@ -66,13 +69,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 @@ -82,7 +85,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)); @@ -97,7 +100,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)); @@ -112,7 +115,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)); @@ -122,9 +125,8 @@ public class CatalogDomainServiceTest { } private CatalogItem createCatalogItem(long id) { - Random random = new Random(); - long defaultCatalogCategoryId = random.nextInt(1000); - long defaultCatalogBrandId = random.nextInt(1000); + long defaultCatalogCategoryId = 1L; + long defaultCatalogBrandId = 1L; String defaultDescription = "Description."; String defaultName = "Name"; BigDecimal defaultPrice = BigDecimal.valueOf(100_000_000L); 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 e82f74e29..28b213237 100644 --- a/samples/web-csr/dressca-backend/infrastructure/build.gradle +++ b/samples/web-csr/dressca-backend/infrastructure/build.gradle @@ -40,3 +40,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/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/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/ExceptionIdConstant.java b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/ExceptionIdConstant.java index fe69d707d..08c0a165f 100644 --- a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/ExceptionIdConstant.java +++ b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/ExceptionIdConstant.java @@ -24,6 +24,17 @@ public class ExceptionIdConstant { public static final String E_ORDER0002 = "E_ORDER0002"; /** カタログ情報が存在しなかった際の例外。 */ - public static final String E_CATALOG0001 = "E_CATALOG0002"; + public static final String E_CATALOG0001 = "E_CATALOG0001"; + /** カタログブランドが存在しなかった際の例外。 */ + public static final String E_CATALOG0002 = "E_CATALOG0002"; + + /** カタログカテゴリが存在しなかった際の例外。 */ + public static final String E_CATALOG0003 = "E_CATALOG0003"; + + /** ユーザに実行権限が無かった際の例外。 */ + public static final String E_CATALOG0004 = "E_CATALOG0004"; + + /** カタログアイテムの更新時に楽観ロックエラーが発生した際の例外。 */ + public static final String E_CATALOG0005 = "E_CATALOG0005"; } diff --git a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/MessageIdConstant.java b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/MessageIdConstant.java index 4d57df26f..20f0bedb9 100644 --- a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/MessageIdConstant.java +++ b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/MessageIdConstant.java @@ -56,4 +56,16 @@ public class MessageIdConstant { /** フィルタリング用のカタログカテゴリリストを取得します。 */ public static final String D_CATALOG0004_LOG = "D_CATALOG0004.log"; + + /** カタログアイテム ID: {0} のカタログアイテムを取得します。 */ + public static final String D_CATALOG0005_LOG = "D_CATALOG0005.log"; + + /** カタログにアイテムを追加します。 */ + public static final String D_CATALOG0006_LOG = "D_CATALOG0006.log"; + + /** カタログアイテム ID: {0} のカタログアイテムを削除します。 */ + public static final String D_CATALOG0007_LOG = "D_CATALOG0007.log"; + + /** カタログアイテム ID: {0} のカタログアイテムを更新します。 */ + public static final String D_CATALOG0008_LOG = "D_CATALOG0008.log"; } diff --git a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/exception/OptimisticLockingFailureException.java b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/exception/OptimisticLockingFailureException.java new file mode 100644 index 000000000..8c935fbed --- /dev/null +++ b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/exception/OptimisticLockingFailureException.java @@ -0,0 +1,24 @@ +package com.dressca.systemcommon.exception; + +import com.dressca.systemcommon.constant.ExceptionIdConstant; + +/** + * 楽観ロックエラーが発生したことを表す例外です。 + */ +public class OptimisticLockingFailureException extends LogicException { + + /** + * カタログアイテムidを指定して、 + * {@link OptimisticLockingFailureException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogItemId 更新処理を試みたカタログアイテムid + */ + public OptimisticLockingFailureException(long catalogItemId) { + super( + null, + ExceptionIdConstant.E_CATALOG0005, + new String[] { String.valueOf(catalogItemId) }, + new String[] { String.valueOf(catalogItemId) }); + } + +} diff --git a/samples/web-csr/dressca-backend/system-common/src/main/resources/messages.properties b/samples/web-csr/dressca-backend/system-common/src/main/resources/messages.properties index 453a11f01..45751a11d 100644 --- a/samples/web-csr/dressca-backend/system-common/src/main/resources/messages.properties +++ b/samples/web-csr/dressca-backend/system-common/src/main/resources/messages.properties @@ -12,6 +12,14 @@ E_ORDER0002.front=注文ID: {0}, 購入者ID: {1} に該当する注文情報が E_ORDER0002.log=存在しない注文情報(注文ID: {0}, 購入者ID: {1})が要求されました。 E_CATALOG0001.front=商品ID: {0} の商品が見つかりませんでした。 E_CATALOG0001.log=商品ID: {0} の商品が見つかりませんでした。 +E_CATALOG0002.front=ブランドID: {0} のブランドが見つかりませんでした。 +E_CATALOG0002.log=ブランドID: {0} のブランドが見つかりませんでした。 +E_CATALOG0003.front=カテゴリID: {0} のカテゴリが見つかりませんでした。 +E_CATALOG0003.log=カテゴリID: {0} のカテゴリが見つかりませんでした。 +E_CATALOG0004.front={0} を実行する権限がありません。 +E_CATALOG0004.log={0} を実行する権限がありません。 +E_CATALOG0005.front=カタログアイテム ID: {0} のカタログアイテムの更新時に楽観ロックエラーが発生しました。 +E_CATALOG0005.log=カタログアイテム ID: {0} のカタログアイテムの更新時に楽観ロックエラーが発生しました。 D_ASSET0001.log=アセット情報{0}を取得します。 D_BASKET0001.log=買い物かごに商品(顧客ID: {0}, カタログ商品ID: {1}, 数量: {2})を追加します。 D_BASKET0002.log=買い物かごの商品の数量(顧客ID: {0}, 数量: {1})を設定します。 @@ -21,4 +29,8 @@ D_ORDER0001.log=指定した注文ID: {0}, 購入者ID: {1} の注文情報を D_CATALOG0001.log=条件(ブランドID: {0}, カテゴリID: {1}, ページ: {2}, ページサイズ: {3})に一致するカタログ情報を取得します。 D_CATALOG0002.log=条件(ブランドID: {0}, カテゴリID: {1})に一致するカテゴリの件数を取得します。 D_CATALOG0003.log=フィルタリング用のカタログブランドリストを取得します。 -D_CATALOG0004.log=フィルタリング用のカタログカテゴリリストを取得します。 \ No newline at end of file +D_CATALOG0004.log=フィルタリング用のカタログカテゴリリストを取得します。 +D_CATALOG0005.log=カタログアイテム ID: {0} のカタログアイテムを取得します。 +D_CATALOG0006.log=カタログにアイテムを追加します。 +D_CATALOG0007.log=カタログアイテム ID: {0} のカタログアイテムを削除します。 +D_CATALOG0008.log=カタログアイテム ID: {0} のカタログアイテムを更新します。 \ No newline at end of file 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..31ca06e85 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/build.gradle @@ -0,0 +1,61 @@ +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 project(':web') + implementation project(':application-core') + implementation project(':infrastructure') + implementation project(':system-common') + + testImplementation supportDependencies.spring_boot_starter_test + testImplementation supportDependencies.spring_boot_starter_log4j2 + 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.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..62fecf08d --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/WebApplication.java @@ -0,0 +1,21 @@ +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..5766964dd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/AssetsController.java @@ -0,0 +1,90 @@ +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..00e06a6d1 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogItemsController.java @@ -0,0 +1,223 @@ +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.constant.UserRoleConstant; +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; +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('" + UserRoleConstant.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.getCatalogItemsByAdmin(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 { + + 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(); + } + + /** + * カタログから指定したカタログアイテム 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, ExceptionIdConstant.E_SHARE0000, 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..6b6be4db8 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/UsersController.java @@ -0,0 +1,49 @@ +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..d8bec6244 --- /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.UserRoleConstant; +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(UserRoleConstant.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..3c44c2e3a --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/security/WebSecurityConfig.java @@ -0,0 +1,60 @@ +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(csrf -> csrf.disable()) + .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..3e9719b32 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-common.properties @@ -0,0 +1,12 @@ +# springdoc-openapi +springdoc.api-docs.path=/api-docs +springdoc.swagger-ui.path=/swagger-ui.html +springdoc.show-actuator=true + +# 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 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..7681bc7ed --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-dev.properties @@ -0,0 +1,25 @@ +# 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 + +# ポート番号の指定 +server.port=8081 \ 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..df4261b68 --- /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 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..41fa11b1e --- /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=local + +# 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/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java similarity index 100% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java rename to samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java 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 85% 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..98d777708 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,4 +1,4 @@ -package com.dressca.web; +package com.dressca.web.admin; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; 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-admin/src/test/java/com/dressca/web/admin/controlleradvice/ExceptionHandlerControllerAdviceTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/ExceptionHandlerControllerAdviceTest.java new file mode 100644 index 000000000..e8e9c0654 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/ExceptionHandlerControllerAdviceTest.java @@ -0,0 +1,193 @@ +package com.dressca.web.admin.controlleradvice; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.times; + +import com.dressca.web.admin.controller.AssetsController; +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.systemcommon.util.ApplicationContextWrapper; +import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.web.admin.WebApplication; +import com.dressca.web.constant.ProblemDetailsConstant; +import org.junit.jupiter.api.BeforeEach; +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.boot.test.mock.mockito.MockBean; +import org.springframework.context.MessageSource; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.apache.logging.log4j.core.Appender; +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.config.Configuration; +import org.apache.logging.log4j.core.config.LoggerConfig; +import java.util.Locale; + +/** + * {@link ExceptionHandlerControllerAdvice }の動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +@ActiveProfiles("production") +public class ExceptionHandlerControllerAdviceTest { + + private static final String EXCEPTION_MESSAGE_SUFFIX_LOG = "log"; + private static final String EXCEPTION_MESSAGE_SUFFIX_FRONT = "front"; + private static final String PROPERTY_DELIMITER = "."; + private static final String MOCK_APPENDER_NAME = "MockAppender"; + + @Autowired + private MockMvc mockMvc; + + @MockBean + AssetsController assetsController; + + @Mock + private Appender mockAppender; + + @Captor + private ArgumentCaptor logCaptor; + + /** + * 各テスト実施前のセットアップを行うメソッド。 + */ + @BeforeEach + public void setup() { + // アプリケーションログメッセージを取得する設定 + // Appenderの初期化 + Mockito.reset(mockAppender); + // Appenderの名前を設定 + Mockito.when(mockAppender.getName()).thenReturn(MOCK_APPENDER_NAME); + // Appenderとして利用できる準備ができていることを設定(下2行) + Mockito.when(mockAppender.isStarted()).thenReturn(true); + Mockito.when(mockAppender.isStopped()).thenReturn(false); + + this.setLogLevel(Level.INFO); + } + + private void setLogLevel(Level level) { + // application.logのロガーを取り出し、Appenderの設定(mockAppenderにログを出力させる)を行う。 + LoggerContext ctx = (LoggerContext) LogManager.getContext(false); + Configuration config = ctx.getConfiguration(); + LoggerConfig loggerConfig = config.getLoggerConfig(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + // テスト毎にAppenderを設定するため、一度初期化する。 + loggerConfig.removeAppender(MOCK_APPENDER_NAME); + + loggerConfig.setLevel(level); + loggerConfig.addAppender(mockAppender, level, null); + ctx.updateLoggers(); + } + + @Test + @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(本番環境)。") + void testException_01() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_ASSET0001; + String[] frontMessageValue = { assetCode }; + String[] logMessageValue = { assetCode }; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new AssetNotFoundException(assetCode)); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.LOGIC_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").doesNotExist()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + @Test + @DisplayName("testException_02_正常系_その他のシステムエラーをステータースコード500で返却する(本番環境)。") + void testException_02() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_SHARE0000; + String[] frontMessageValue = null; + String[] logMessageValue = null; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new SystemException(new AssetNotFoundException(assetCode), exceptionId, frontMessageValue, + logMessageValue)); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.SYSTEM_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").doesNotExist()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + @Test + @DisplayName("testException_03_正常系_上記のいずれにも当てはまらない例外をステータースコード500で返却する(本番環境)。") + void testException_03() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_SHARE0000; + String[] frontMessageValue = null; + String[] logMessageValue = null; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new RuntimeException()); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.SYSTEM_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").doesNotExist()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + // エラー時のアプリケーションログ出力メッセージの先頭行を返す(2行目以降はエラーのスタックトレースのため可変) + private String createLogMessage(String exceptionId, String[] logMessageValue) { + MessageSource messageSource = (MessageSource) ApplicationContextWrapper.getBean(MessageSource.class); + String code = String.join(PROPERTY_DELIMITER, exceptionId, EXCEPTION_MESSAGE_SUFFIX_LOG); + String exceptionMessage = messageSource.getMessage(code, logMessageValue, Locale.getDefault()); + return exceptionId + " " + exceptionMessage + SystemPropertyConstants.LINE_SEPARATOR; + } + + // エラー時のフロントに出力するメッセージを返す + private String createFrontErrorMessage(String exceptionId, String[] frontMessageValue) { + String code = String.join(PROPERTY_DELIMITER, exceptionId, EXCEPTION_MESSAGE_SUFFIX_FRONT); + MessageSource messageSource = (MessageSource) ApplicationContextWrapper.getBean(MessageSource.class); + return messageSource.getMessage(code, frontMessageValue, Locale.getDefault()); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/LocalExceptionHandlerControllerAdviceTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/LocalExceptionHandlerControllerAdviceTest.java new file mode 100644 index 000000000..ea2cf6e2e --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/LocalExceptionHandlerControllerAdviceTest.java @@ -0,0 +1,192 @@ +package com.dressca.web.admin.controlleradvice; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.times; + +import com.dressca.web.admin.controller.AssetsController; +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.systemcommon.util.ApplicationContextWrapper; +import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.web.admin.WebApplication; +import com.dressca.web.constant.ProblemDetailsConstant; +import org.junit.jupiter.api.BeforeEach; +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.boot.test.mock.mockito.MockBean; +import org.springframework.context.MessageSource; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.apache.logging.log4j.core.Appender; +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.config.Configuration; +import org.apache.logging.log4j.core.config.LoggerConfig; +import java.util.Locale; + +/** + * {@link ExceptionHandlerControllerAdvice }の動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +@ActiveProfiles("local") +public class LocalExceptionHandlerControllerAdviceTest { + + private static final String EXCEPTION_MESSAGE_SUFFIX_LOG = "log"; + private static final String EXCEPTION_MESSAGE_SUFFIX_FRONT = "front"; + private static final String PROPERTY_DELIMITER = "."; + private static final String MOCK_APPENDER_NAME = "MockAppender"; + + @Autowired + private MockMvc mockMvc; + + @MockBean + AssetsController assetsController; + + @Mock + private Appender mockAppender; + + @Captor + private ArgumentCaptor logCaptor; + + /** + * 各テスト実施前のセットアップを行うメソッド。 + */ + @BeforeEach + public void setup() { + // アプリケーションログメッセージを取得する設定 + // Appenderの初期化 + Mockito.reset(mockAppender); + // Appenderの名前を設定 + Mockito.when(mockAppender.getName()).thenReturn(MOCK_APPENDER_NAME); + // Appenderとして利用できる準備ができていることを設定(下2行) + Mockito.when(mockAppender.isStarted()).thenReturn(true); + Mockito.when(mockAppender.isStopped()).thenReturn(false); + + this.setLogLevel(Level.INFO); + } + + private void setLogLevel(Level level) { + // application.logのロガーを取り出し、Appenderの設定(mockAppenderにログを出力させる)を行う。 + LoggerContext ctx = (LoggerContext) LogManager.getContext(false); + Configuration config = ctx.getConfiguration(); + LoggerConfig loggerConfig = config.getLoggerConfig(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + // テスト毎にAppenderを設定するため、一度初期化する。 + loggerConfig.removeAppender(MOCK_APPENDER_NAME); + + loggerConfig.setLevel(level); + loggerConfig.addAppender(mockAppender, level, null); + ctx.updateLoggers(); + } + + @Test + @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(開発環境)。") + void testException_01() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_ASSET0001; + String[] frontMessageValue = { assetCode }; + String[] logMessageValue = { assetCode }; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new AssetNotFoundException(assetCode)); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.LOGIC_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").exists()); + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + @Test + @DisplayName("testException_02_正常系_その他のシステムエラーをステータースコード500で返却する(開発環境)。") + void testException_02() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_SHARE0000; + String[] frontMessageValue = null; + String[] logMessageValue = null; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new SystemException(new AssetNotFoundException(assetCode), exceptionId, frontMessageValue, + logMessageValue)); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.SYSTEM_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").exists()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + @Test + @DisplayName("testException_03_正常系_上記のいずれにも当てはまらない例外をステータースコード500で返却する(開発環境)。") + void testException_03() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_SHARE0000; + String[] frontMessageValue = null; + String[] logMessageValue = null; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new RuntimeException()); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.SYSTEM_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").exists()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + // エラー時のアプリケーションログ出力メッセージの先頭行を返す(2行目以降はエラーのスタックトレースのため可変) + private String createLogMessage(String exceptionId, String[] logMessageValue) { + MessageSource messageSource = (MessageSource) ApplicationContextWrapper.getBean(MessageSource.class); + String code = String.join(PROPERTY_DELIMITER, exceptionId, EXCEPTION_MESSAGE_SUFFIX_LOG); + String exceptionMessage = messageSource.getMessage(code, logMessageValue, Locale.getDefault()); + return exceptionId + " " + exceptionMessage + SystemPropertyConstants.LINE_SEPARATOR; + } + + // エラー時のフロントに出力するメッセージを返す + private String createFrontErrorMessage(String exceptionId, String[] frontMessageValue) { + String code = String.join(PROPERTY_DELIMITER, exceptionId, EXCEPTION_MESSAGE_SUFFIX_FRONT); + MessageSource messageSource = (MessageSource) ApplicationContextWrapper.getBean(MessageSource.class); + return messageSource.getMessage(code, frontMessageValue, Locale.getDefault()); + } +} 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..7b368d30d --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/build.gradle @@ -0,0 +1,61 @@ +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 project(':web') + implementation project(':application-core') + implementation project(':infrastructure') + implementation project(':system-common') + + testImplementation supportDependencies.spring_boot_starter_test + testImplementation supportDependencies.spring_boot_starter_log4j2 + 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.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..15ab52678 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/WebApplication.java @@ -0,0 +1,21 @@ +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..d40df7d7b --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/AssetsController.java @@ -0,0 +1,84 @@ +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.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.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; + + 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) }) + @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/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 95% 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 2c1dc33fc..bcfa0c7c3 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; @@ -7,13 +7,13 @@ import com.dressca.applicationcore.baskets.CatalogItemInBasketNotFoundException; import com.dressca.applicationcore.catalog.CatalogItem; import com.dressca.applicationcore.catalog.CatalogNotFoundException; -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.mapper.BasketMapper; -import com.dressca.web.mapper.CatalogItemSummaryMapper; +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.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 73402d341..eb231feb9 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.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -50,9 +50,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.getCatalogItemsByConsumer(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 95% 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 9822ba95d..ca1b0f411 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; @@ -10,9 +10,9 @@ import com.dressca.systemcommon.constant.ExceptionIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.SystemException; -import com.dressca.web.controller.dto.order.OrderResponse; -import com.dressca.web.controller.dto.order.PostOrderRequest; -import com.dressca.web.mapper.OrderMapper; +import com.dressca.web.consumer.controller.dto.order.OrderResponse; +import com.dressca.web.consumer.controller.dto.order.PostOrderRequest; +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..83af7bc30 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にフィルターをかけるクラスです。 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 5bbd9d0f8..8fbe2c5ee 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,48 +1,48 @@ -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(csrf -> csrf.disable()) - .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(csrf -> csrf.disable()) + .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..bab1946c6 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-common.properties @@ -0,0 +1,12 @@ +# springdoc-openapi +springdoc.api-docs.path=/api-docs +springdoc.swagger-ui.path=/swagger-ui.html +springdoc.show-actuator=true + +# 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-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..86fb2b46a --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-dev.properties @@ -0,0 +1,25 @@ +# 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 + +# ポート番号の指定 +server.port=8080 \ 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..41fa11b1e --- /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=local + +# 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/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java new file mode 100644 index 000000000..c2e430bbe --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java @@ -0,0 +1,13 @@ +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-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..0e8a4c683 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/WebApplicationTests.java @@ -0,0 +1,13 @@ +package com.dressca.web.consumer; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class WebApplicationTests { + + @Test + 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..87d55bc06 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,96 @@ -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 b3720d4ac..f1f96f4fe 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' @@ -42,18 +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() } -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 27b12130e..4e06ff56d 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,19 +1,24 @@ package com.dressca.web.controller.advice; import jakarta.servlet.http.HttpServletRequest; +import com.dressca.applicationcore.authorization.PermissionDeniedException; import com.dressca.systemcommon.constant.ExceptionIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.LogicException; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; import com.dressca.systemcommon.exception.SystemException; import com.dressca.web.constant.ProblemDetailsConstant; import com.dressca.web.log.ErrorMessageBuilder; import java.util.Map; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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; @@ -28,6 +33,48 @@ public class ExceptionHandlerControllerAdvice extends ResponseEntityExceptionHan private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + /** + * 未認証エラーをステータスコード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 index 4b65b4431..2bc494d27 100644 --- 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 @@ -1,92 +1,139 @@ -package com.dressca.web.controller.advice; - -import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Profile; -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.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; -import com.dressca.systemcommon.constant.ExceptionIdConstant; -import com.dressca.systemcommon.constant.SystemPropertyConstants; -import com.dressca.systemcommon.exception.LogicException; -import com.dressca.systemcommon.exception.SystemException; -import com.dressca.web.constant.ProblemDetailsConstant; -import com.dressca.web.log.ErrorMessageBuilder; -import jakarta.servlet.http.HttpServletRequest; - -/** - * サーバーエラーのハンドリングを行うクラスです(開発環境用)。 - */ -@ControllerAdvice -@Profile("local") -public class LocalExceptionHandlerControllerAdvice extends ResponseEntityExceptionHandler { - - private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); - - /** - * その他の業務エラーをステータースコード500で返却する(開発環境用)。 - * - * @param e 業務例外 - * @param req リクエスト - * @return ステータースコード500のレスポンス - */ - @ExceptionHandler(LogicException.class) - public ResponseEntity localHandleLogicException(LogicException e, HttpServletRequest req) { - ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), e.getLogMessageValue(), - e.getFrontMessageValue()); - apLog.error(errorBuilder.createLogMessageStackTrace()); - ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.LOGIC_ERROR_TITLE); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.APPLICATION_JSON) - .body(problemDetail); - } - - /** - * その他のシステムエラーをステータースコード500で返却する(開発環境用)。 - * - * @param e その他の例外 - * @param req リクエスト - * @return ステータースコード500のレスポンス - */ - @ExceptionHandler(SystemException.class) - public ResponseEntity localHandleException(SystemException e, HttpServletRequest req) { - ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), e.getLogMessageValue(), - e.getFrontMessageValue()); - apLog.error(errorBuilder.createLogMessageStackTrace()); - ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.SYSTEM_ERROR_TITLE); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.APPLICATION_JSON) - .body(problemDetail); - } - - /** - * 上記のいずれにも当てはまらない例外をステータースコード500で返却する(開発環境用)。 - * - * @param e その他の例外 - * @param req リクエスト - * @return ステータースコード500のレスポンス - */ - @ExceptionHandler(Exception.class) - public ResponseEntity localHandleException(Exception e, HttpServletRequest req) { - ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, ExceptionIdConstant.E_SHARE0000, null, null); - apLog.error(errorBuilder.createLogMessageStackTrace()); - ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.SYSTEM_ERROR_TITLE); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.APPLICATION_JSON) - .body(problemDetail); - } - - private ProblemDetail createProblemDetail(ErrorMessageBuilder errorBuilder, String title) { - Map errorProperty = Map.of(errorBuilder.getExceptionId(), errorBuilder.createFrontErrorMessage()); - ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.INTERNAL_SERVER_ERROR, - errorBuilder.createLogMessageStackTrace()); - problemDetail.setTitle(title); - problemDetail.setProperty(ProblemDetailsConstant.ERROR_KEY, errorProperty); - return problemDetail; - } -} +package com.dressca.web.controller.advice; + +import java.util.Map; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +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; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.LogicException; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.web.constant.ProblemDetailsConstant; +import com.dressca.web.log.ErrorMessageBuilder; +import jakarta.servlet.http.HttpServletRequest; + +/** + * サーバーエラーのハンドリングを行うクラスです(開発環境用)。 + */ +@ControllerAdvice +@Profile("local") +public class LocalExceptionHandlerControllerAdvice extends ResponseEntityExceptionHandler { + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + /** + * 未認証エラーをステータスコード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 localHandleLogicException(LogicException e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), e.getLogMessageValue(), + e.getFrontMessageValue()); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.LOGIC_ERROR_TITLE); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_JSON) + .body(problemDetail); + } + + /** + * その他のシステムエラーをステータースコード500で返却する(開発環境用)。 + * + * @param e その他の例外 + * @param req リクエスト + * @return ステータースコード500のレスポンス + */ + @ExceptionHandler(SystemException.class) + public ResponseEntity localHandleException(SystemException e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), e.getLogMessageValue(), + e.getFrontMessageValue()); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.SYSTEM_ERROR_TITLE); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_JSON) + .body(problemDetail); + } + + /** + * 上記のいずれにも当てはまらない例外をステータースコード500で返却する(開発環境用)。 + * + * @param e その他の例外 + * @param req リクエスト + * @return ステータースコード500のレスポンス + */ + @ExceptionHandler(Exception.class) + public ResponseEntity localHandleException(Exception e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, ExceptionIdConstant.E_SHARE0000, null, null); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.SYSTEM_ERROR_TITLE); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_JSON) + .body(problemDetail); + } + + private ProblemDetail createProblemDetail(ErrorMessageBuilder errorBuilder, String title) { + Map errorProperty = Map.of(errorBuilder.getExceptionId(), errorBuilder.createFrontErrorMessage()); + ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.INTERNAL_SERVER_ERROR, + errorBuilder.createLogMessageStackTrace()); + problemDetail.setTitle(title); + problemDetail.setProperty(ProblemDetailsConstant.ERROR_KEY, errorProperty); + return 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 bab1946c6..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,12 +0,0 @@ -# springdoc-openapi -springdoc.api-docs.path=/api-docs -springdoc.swagger-ui.path=/swagger-ui.html -springdoc.show-actuator=true - -# 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 41fa11b1e..e69de29bb 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 +0,0 @@ -# 環境別のプロファイル設定(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=local - -# 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/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 6dd177d26..35cef8156 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 100% 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 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 4105385ca..ef222691f 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 @@ -5,10 +5,10 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.mockito.Mockito.anyString; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; -import com.dressca.web.controller.AssetsController; +import com.dressca.web.AssetsController; import com.dressca.systemcommon.constant.ExceptionIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.SystemException; @@ -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; @@ -98,6 +99,7 @@ private void setLogLevel(Level level) { } @Test + @WithMockUser @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(本番環境)。") void testException_01() throws Exception { // テスト用の入力データ @@ -124,6 +126,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-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 2a181d39d..7ce1a6f34 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 @@ -5,10 +5,10 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.mockito.Mockito.anyString; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; -import com.dressca.web.controller.AssetsController; +import com.dressca.web.AssetsController; import com.dressca.systemcommon.constant.ExceptionIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.SystemException; @@ -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; @@ -98,6 +99,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 { // テスト用の入力データ @@ -150,6 +153,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/README.md b/samples/web-csr/dressca-frontend/admin/README.md new file mode 100644 index 000000000..7b72809ca --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/README.md @@ -0,0 +1,64 @@ + + + +# vue-project + +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 test:e2e:dev +``` + +This runs the end-to-end tests against the Vite development server. +It is much faster than the production build. + +But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments): + +```sh +npm run build +npm run test:e2e +``` + +### Lint with [ESLint](https://eslint.org/) + +```sh +npm run lint +``` 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..116d1e0e0 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/data/catalogItems.ts @@ -0,0 +1,140 @@ +import type { + CatalogItemResponse, + PagedListOfCatalogItemResponse, +} from '@/generated/api-client'; + +export const catalogItems: CatalogItemResponse[] = [ + { + 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: PagedListOfCatalogItemResponse = { + 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..ecb371100 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/assets.ts @@ -0,0 +1,15 @@ +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: 200, + 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..4b963b0a3 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogBrands.ts @@ -0,0 +1,23 @@ +import type { CatalogBrandResponse } from '@/generated/api-client'; +import { HttpResponse, http } from 'msw'; + +const catalogBrands: CatalogBrandResponse[] = [ + { + id: 1, + name: '高級なブランド', + }, + { + id: 2, + name: 'カジュアルなブランド', + }, + { + id: 3, + name: 'ノーブランド', + }, +]; + +export const catalogBrandsHandlers = [ + http.get('/api/catalog-brands', () => { + return HttpResponse.json(catalogBrands, { status: 200 }); + }), +]; 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..1376ac4e9 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/catalogCategories.ts @@ -0,0 +1,23 @@ +import type { CatalogCategoryResponse } from '@/generated/api-client'; +import { HttpResponse, http } from 'msw'; + +const catalogCategories: CatalogCategoryResponse[] = [ + { + id: 1, + name: '服', + }, + { + id: 2, + name: 'バッグ', + }, + { + id: 3, + name: 'シューズ', + }, +]; + +export const catalogCategoriesHandlers = [ + http.get('/api/catalog-categories', () => { + return HttpResponse.json(catalogCategories, { status: 200 }); + }), +]; 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..f4e7f8a43 --- /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 './httpStatusCode'; +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/httpStatusCode.ts b/samples/web-csr/dressca-frontend/admin/mock/handlers/httpStatusCode.ts new file mode 100644 index 000000000..1c8d6cbaf --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/httpStatusCode.ts @@ -0,0 +1,5 @@ +export enum HttpStatusCode { + Ok = 200, + Created = 201, + NoContent = 204, +} 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..f97c9ce88 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/mock/handlers/users.ts @@ -0,0 +1,13 @@ +import { HttpResponse, http } from 'msw'; +import type { UserResponse } from '@/generated/api-client'; + +const user: UserResponse = { + userName: 'admin@example.com', + role: 'Admin', +}; + +export const usersHandlers = [ + http.get('/api/users', () => { + return HttpResponse.json(user, { status: 200 }); + }), +]; 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..a2ac1a7d3 --- /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.3.5", + "@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..15751fa19 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/public/mockServiceWorker.js @@ -0,0 +1,284 @@ +/* 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.3.5' +const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423' +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: true, + }) + 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 (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() { + const headers = Object.fromEntries(requestClone.headers.entries()) + + // Remove internal MSW request header so the passthrough request + // complies with any potential CORS preflight checks on the server. + // Some servers forbid unknown request headers. + delete headers['x-msw-intention'] + + 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..f1fbe1d80 --- /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..64e507fab --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/api-client/index.ts @@ -0,0 +1,86 @@ +import axios 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 === 500) { + return Promise.reject(new ServerError('Server Error', error)); + } + if (error.response.status === 401) { + return Promise.reject( + new UnauthorizedError('Unauthorized Error', error), + ); + } + if (error.response.status === 404) { + return Promise.reject(new NotFoundError('NotFound Error', error)); + } + if (error.response.status === 409) { + 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..6c4d678ca --- /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/catalog-brand-response.ts +models/catalog-category-response.ts +models/catalog-item-response.ts +models/index.ts +models/link.ts +models/paged-list-of-catalog-item-response.ts +models/post-catalog-item-request.ts +models/put-catalog-item-request.ts +models/user-response.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..57d1dee47 --- /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 { CatalogBrandResponse } 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..8acf5c757 --- /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 { CatalogCategoryResponse } 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..edff118fb --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/api/catalog-items-api.ts @@ -0,0 +1,449 @@ +/* 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 { CatalogItemResponse } from '../models'; +// @ts-ignore +import type { PagedListOfCatalogItemResponse } 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 {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteCatalogItem: async (catalogItemId: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'catalogItemId' is not null or undefined + assertParamExists('deleteCatalogItem', 'catalogItemId', catalogItemId) + 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; + + + + 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} + */ + getById: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('getById', '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 {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, + }; + }, + /** + * カタログにアイテムを追加します。 + * @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 {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteCatalogItem(catalogItemId: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteCatalogItem(catalogItemId, 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); + }, + /** + * 指定したIDのカタログアイテムを返します。 + * @summary 指定したIDのカタログアイテムを返します。 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getById(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getById(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CatalogItemsApi.getById']?.[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); + }, + /** + * カタログにアイテムを追加します。 + * @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 {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteCatalogItem(catalogItemId: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.deleteCatalogItem(catalogItemId, options).then((request) => request(axios, basePath)); + }, + /** + * 指定したIDのカタログアイテムを返します。 + * @summary 指定したIDのカタログアイテムを返します。 + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getById(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.getById(id, 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)); + }, + /** + * カタログにアイテムを追加します。 + * @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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogItemsApi + */ + public deleteCatalogItem(catalogItemId: number, options?: RawAxiosRequestConfig) { + return CatalogItemsApiFp(this.configuration).deleteCatalogItem(catalogItemId, 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 getById(id: number, options?: RawAxiosRequestConfig) { + return CatalogItemsApiFp(this.configuration).getById(id, 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)); + } + + /** + * カタログにアイテムを追加します。 + * @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..4a5682578 --- /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 { UserResponse } 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/catalog-brand-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/catalog-brand-response.ts new file mode 100644 index 000000000..f727d9b96 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/catalog-brand-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 CatalogBrandResponse + */ +export interface CatalogBrandResponse { + /** + * + * @type {number} + * @memberof CatalogBrandResponse + */ + 'id': number; + /** + * + * @type {string} + * @memberof CatalogBrandResponse + */ + 'name': string; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/catalog-category-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/catalog-category-response.ts new file mode 100644 index 000000000..074982223 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/catalog-category-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 CatalogCategoryResponse + */ +export interface CatalogCategoryResponse { + /** + * + * @type {number} + * @memberof CatalogCategoryResponse + */ + 'id': number; + /** + * + * @type {string} + * @memberof CatalogCategoryResponse + */ + 'name': string; +} + diff --git a/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/catalog-item-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/catalog-item-response.ts new file mode 100644 index 000000000..c93942f33 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/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 CatalogItemResponse + */ +export interface CatalogItemResponse { + /** + * + * @type {Array} + * @memberof CatalogItemResponse + */ + 'assetCodes'?: Array; + /** + * + * @type {number} + * @memberof CatalogItemResponse + */ + 'catalogBrandId': number; + /** + * + * @type {number} + * @memberof CatalogItemResponse + */ + 'catalogCategoryId': number; + /** + * + * @type {string} + * @memberof CatalogItemResponse + */ + 'description': string; + /** + * + * @type {number} + * @memberof CatalogItemResponse + */ + 'id': number; + /** + * + * @type {string} + * @memberof CatalogItemResponse + */ + 'name': string; + /** + * + * @type {number} + * @memberof CatalogItemResponse + */ + 'price': number; + /** + * + * @type {string} + * @memberof CatalogItemResponse + */ + 'productCode': string; + /** + * + * @type {string} + * @memberof CatalogItemResponse + */ + 'rowVersion': 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..5c2b54ac9 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/index.ts @@ -0,0 +1,8 @@ +export * from './catalog-brand-response'; +export * from './catalog-category-response'; +export * from './catalog-item-response'; +export * from './link'; +export * from './paged-list-of-catalog-item-response'; +export * from './post-catalog-item-request'; +export * from './put-catalog-item-request'; +export * from './user-response'; 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-catalog-item-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/paged-list-of-catalog-item-response.ts new file mode 100644 index 000000000..946a4a0b2 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/paged-list-of-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 { CatalogItemResponse } from './catalog-item-response'; + +/** + * + * @export + * @interface PagedListOfCatalogItemResponse + */ +export interface PagedListOfCatalogItemResponse { + /** + * + * @type {boolean} + * @memberof PagedListOfCatalogItemResponse + */ + 'hasNext'?: boolean; + /** + * + * @type {boolean} + * @memberof PagedListOfCatalogItemResponse + */ + 'hasPrevious'?: boolean; + /** + * + * @type {Array} + * @memberof PagedListOfCatalogItemResponse + */ + 'items'?: Array; + /** + * + * @type {number} + * @memberof PagedListOfCatalogItemResponse + */ + 'page'?: number; + /** + * + * @type {number} + * @memberof PagedListOfCatalogItemResponse + */ + 'pageSize'?: number; + /** + * + * @type {number} + * @memberof PagedListOfCatalogItemResponse + */ + 'totalCount'?: number; + /** + * + * @type {number} + * @memberof PagedListOfCatalogItemResponse + */ + '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/generated/api-client/models/user-response.ts b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/user-response.ts new file mode 100644 index 000000000..1b27d9a58 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/generated/api-client/models/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 UserResponse + */ +export interface UserResponse { + /** + * + * @type {string} + * @memberof UserResponse + */ + 'role': string; + /** + * + * @type {string} + * @memberof UserResponse + */ + 'userName': 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..43ffeffb4 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/services/catalog/catalog-service.ts @@ -0,0 +1,149 @@ +import { + catalogBrandsApi, + catalogCategoriesApi, + catalogItemsApi, +} from '@/api-client'; +import type { + CatalogBrandResponse, + CatalogCategoryResponse, + CatalogItemResponse, + PagedListOfCatalogItemResponse, + PostCatalogItemRequest, + PutCatalogItemRequest, +} from '@/generated/api-client'; + +/** + * カテゴリの情報を取得します。 + * UIの都合で、すべてのカテゴリを表すカテゴリの情報を追加します。 + * @returns カタログカテゴリの配列。 + */ +export async function fetchCategories(): Promise { + const response = await catalogCategoriesApi.getCatalogCategories(); + const categories = response.data; + categories.unshift({ id: 0, name: 'すべて' }); + return categories; +} + +/** + * ブランドの情報を取得します。 + * UIの都合で、すべてのカテゴリを表すカテゴリの情報を追加します。 + * @returns カテゴリブランドの配列。 + */ +export async function fetchBrands(): Promise { + const response = await catalogBrandsApi.getCatalogBrands(); + const brands = response.data; + brands.unshift({ id: 0, name: 'すべて' }); + return brands; +} + +/** + * カテゴリとブランドの情報を取得します。 + * @returns カテゴリとブランドの情報のタプル。 + */ +export async function fetchCategoriesAndBrands(): Promise< + [CatalogCategoryResponse[], CatalogBrandResponse[]] +> { + 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.getById(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 。 + */ +export async function deleteCatalogItem(id: number) { + await catalogItemsApi.deleteCatalogItem(id); +} 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..6bf6a5278 --- /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') || '""'), + userRole: JSON.parse(sessionStorage.getItem('userRole') || '""'), + }), + actions: { + /** + * アプリケーションにログインします。 + * セッションストレージに認証状態を保存します。 + */ + async signInAsync() { + const response = await UsersApi.getLoginUser(); + const { userName, role } = response.data; + this.userName = userName; + this.userRole = role; + this.authenticationState = true; + sessionStorage.setItem('userName', JSON.stringify(this.userName)); + sessionStorage.setItem('userRole', JSON.stringify(this.userRole)); + sessionStorage.setItem( + 'isAuthenticated', + JSON.stringify(this.authenticationState), + ); + }, + /** + * アプリケーションからログアウトします。 + * セッションストレージから認証状態を削除します。 + */ + async signOutAsync() { + this.userName = ''; + this.userRole = ''; + this.authenticationState = false; + sessionStorage.removeItem('isAuthenticated'); + sessionStorage.removeItem('userName'); + sessionStorage.removeItem('userRole'); + }, + }, + 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..87014d978 --- /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({ + name: yup + .string() + .required('アイテム名は必須です。') + .max(256, '256文字以下で入力してください。'), + description: 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..e01e38059 --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsAddView.spec.ts @@ -0,0 +1,22 @@ +import { describe, it, expect } from 'vitest'; +import { flushPromises, mount } 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'; + +describe('アイテム追加画面のテスト', () => { + it('アイテムを追加できる', async () => { + const pinia = createPinia(); + setActivePinia(pinia); + const customErrorHandler = createCustomErrorHandler(); + const wrapper = mount(ItemsAddView, { + global: { plugins: [pinia, router, customErrorHandler] }, + }); + await flushPromises(); + expect(wrapper.html()).toContain('カタログアイテム追加'); + wrapper.find('button').trigger('click'); + await flushPromises(); + 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..1be0e11bf --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsEditView.spec.ts @@ -0,0 +1,73 @@ +import { describe, it, expect } from 'vitest'; +import { flushPromises, mount } 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'; + +describe('アイテム編集画面_アイテム削除機能のテスト', () => { + it('アイテムを削除できる', async () => { + const pinia = createPinia(); + setActivePinia(pinia); + const customErrorHandler = createCustomErrorHandler(); + router.push({ name: 'catalog/items/edit', params: { itemId: 1 } }); + await router.isReady(); + const wrapper = mount(ItemsEditView, { + global: { plugins: [pinia, router, customErrorHandler] }, + }); + await flushPromises(); + expect(wrapper.html()).toContain('カタログアイテム編集'); + await wrapper.findAll('button')[0].trigger('click'); + expect(wrapper.html()).toContain('カタログアイテムを削除します。'); + await wrapper + .findAllComponents({ name: 'ConfirmationModal' })[0] + .findAll('button')[0] + .trigger('click'); + await flushPromises(); + expect( + wrapper.findAllComponents({ name: 'ConfirmationModal' })[0].isVisible(), + ).toBeFalsy(); + expect(wrapper.html()).toContain('カタログアイテムを削除しました。'); + await wrapper + .findAllComponents({ name: 'NotificationModal' })[0] + .findAll('button')[0] + .trigger('click'); + expect( + wrapper.findAllComponents({ name: 'NotificationModal' })[0].isVisible(), + ).toBeFalsy(); + }); +}); + +describe('アイテム編集画面_アイテム更新機能のテスト', () => { + it('アイテムを更新できる', async () => { + const pinia = createPinia(); + setActivePinia(pinia); + const customErrorHandler = createCustomErrorHandler(); + router.push({ name: 'catalog/items/edit', params: { itemId: 1 } }); + await router.isReady(); + const wrapper = mount(ItemsEditView, { + global: { plugins: [pinia, router, customErrorHandler] }, + }); + await flushPromises(); + expect(wrapper.html()).toContain('カタログアイテム編集'); + const editButton = wrapper.findAll('button')[1]; + await editButton.trigger('click'); + expect(wrapper.html()).toContain('カタログアイテムを更新します。'); + await wrapper + .findAllComponents({ name: 'ConfirmationModal' })[1] + .findAll('button')[0] + .trigger('click'); + await flushPromises(); + expect( + wrapper.findAllComponents({ name: 'ConfirmationModal' })[1].isVisible(), + ).toBeFalsy(); + expect(wrapper.html()).toContain('カタログアイテムを更新しました。'); + await wrapper + .findAllComponents({ name: 'NotificationModal' })[1] + .findAll('button')[0] + .trigger('click'); + 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..a4196dd4a --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/__tests__/ItemsView.spec.ts @@ -0,0 +1,19 @@ +import { describe, it, expect } from 'vitest'; +import { flushPromises, mount } 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'; + +describe('アイテム一覧画面のテスト', () => { + it('アイテム一覧が表示できる', async () => { + const pinia = createPinia(); + setActivePinia(pinia); + const customErrorHandler = createCustomErrorHandler(); + const wrapper = mount(ItemsView, { + global: { plugins: [pinia, router, customErrorHandler] }, + }); + await flushPromises(); + expect(wrapper.html()).toContain('カタログアイテム一覧'); + }); +}); 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..c1f85519b --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsAddView.vue @@ -0,0 +1,217 @@ + + + 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..74915b6cd --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsEditView.vue @@ -0,0 +1,564 @@ + + + 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..8e27becfa --- /dev/null +++ b/samples/web-csr/dressca-frontend/admin/src/views/catalog/ItemsView.vue @@ -0,0 +1,169 @@ + + + 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/package-lock.json b/samples/web-csr/dressca-frontend/package-lock.json index 05d291c95..d4a4a2b61 100644 --- a/samples/web-csr/dressca-frontend/package-lock.json +++ b/samples/web-csr/dressca-frontend/package-lock.json @@ -8,9 +8,177 @@ "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.3.5", + "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/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" + } + }, + "admin/node_modules/msw": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/msw/-/msw-2.3.5.tgz", + "integrity": "sha512-+GUI4gX5YC5Bv33epBrD+BGdmDvBg2XGruiWnI3GbIbRmMMBeZ5gs3mJ51OWSGHgJKztZ8AtZeYMMNMVrje2/Q==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@bundled-es-modules/cookie": "^2.0.0", + "@bundled-es-modules/statuses": "^1.0.1", + "@bundled-es-modules/tough-cookie": "^0.1.6", + "@inquirer/confirm": "^3.0.0", + "@mswjs/interceptors": "^0.29.0", + "@open-draft/until": "^2.1.0", + "@types/cookie": "^0.6.0", + "@types/statuses": "^2.0.4", + "chalk": "^4.1.2", + "graphql": "^16.8.1", + "headers-polyfill": "^4.0.2", + "is-node-process": "^1.2.0", + "outvariant": "^1.4.2", + "path-to-regexp": "^6.2.0", + "strict-event-emitter": "^0.5.1", + "type-fest": "^4.9.0", + "yargs": "^17.7.2" + }, + "bin": { + "msw": "cli/index.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/mswjs" + }, + "peerDependencies": { + "typescript": ">= 4.7.x" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "admin/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" + }, + "admin/node_modules/type-fest": { + "version": "4.27.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.27.0.tgz", + "integrity": "sha512-3IMSWgP7C5KSQqmo1wjhKrwsvXAtF33jO3QY+Uy++ia7hqvgSK6iXbbg5PbDBc1P2ZbNEDgejOrN4YooXvhwCw==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "admin/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" + } + }, + "admin/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" + } + }, + "admin/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" + } + }, "consumer": { "version": "0.0.0", "dependencies": { @@ -478,6 +646,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, @@ -639,7 +835,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -834,6 +1029,114 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/@inquirer/confirm": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-3.2.0.tgz", + "integrity": "sha512-oOIwPs0Dvq5220Z8lGL/6LHRTEr9TgLHmiI99Rj1PJ1p1czTys+olrgBqZk4E2qC0YTzeHprxSQmoHioVdJ7Lw==", + "license": "MIT", + "dependencies": { + "@inquirer/core": "^9.1.0", + "@inquirer/type": "^1.5.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/core": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-9.2.1.tgz", + "integrity": "sha512-F2VBt7W/mwqEU4bL0RnHNZmC/OxzNx9cOYxHqnXX3MP6ruYvZUZAW9imgN9+h/uBT/oP8Gh888J2OZSbjSeWcg==", + "license": "MIT", + "dependencies": { + "@inquirer/figures": "^1.0.6", + "@inquirer/type": "^2.0.0", + "@types/mute-stream": "^0.0.4", + "@types/node": "^22.5.5", + "@types/wrap-ansi": "^3.0.0", + "ansi-escapes": "^4.3.2", + "cli-width": "^4.1.0", + "mute-stream": "^1.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/@inquirer/type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-2.0.0.tgz", + "integrity": "sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==", + "license": "MIT", + "dependencies": { + "mute-stream": "^1.0.0" + }, + "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": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.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.8", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.8.tgz", + "integrity": "sha512-tKd+jsmhq21AP1LhexC0pPwsCxEhGgAkg28byjJAd+xhmIs8LUX8JbUc3vBf3PhLxWiB5EvyBE5X7JSPAqMAqg==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/type": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.5.5.tgz", + "integrity": "sha512-MzICLu4yS7V8AA61sANROZ9vT1H3ooca5dSmI1FjZkzq7o/koMsRfQSzRtFo+F3Ao4Sf1C0bpLKejpKB/+j6MA==", + "license": "MIT", + "dependencies": { + "mute-stream": "^1.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@inquirer/type/node_modules/mute-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "dev": true, @@ -969,6 +1272,23 @@ "node": ">=8" } }, + "node_modules/@mswjs/interceptors": { + "version": "0.29.1", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.29.1.tgz", + "integrity": "sha512-3rDakgJZ77+RiQUuSK69t1F0m8BQKA8Vh5DCS5V0DWvNY67zob2JhhQrhCO0AKLGINTRSFd1tBaHcJTkhefoSw==", + "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.2.1", + "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", @@ -1112,6 +1432,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", @@ -1218,7 +1560,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "android" @@ -1231,7 +1572,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "android" @@ -1244,7 +1584,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "darwin" @@ -1257,7 +1596,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "darwin" @@ -1270,7 +1608,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1283,7 +1620,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1296,7 +1632,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1309,7 +1644,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1322,7 +1656,6 @@ "cpu": [ "ppc64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1335,7 +1668,6 @@ "cpu": [ "riscv64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1348,7 +1680,6 @@ "cpu": [ "s390x" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1373,7 +1704,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -1386,7 +1716,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "win32" @@ -1399,7 +1728,6 @@ "cpu": [ "ia32" ], - "dev": true, "optional": true, "os": [ "win32" @@ -1412,7 +1740,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "win32" @@ -1462,11 +1789,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", @@ -1492,11 +1824,19 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/mute-stream": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz", + "integrity": "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/node": { "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" } @@ -1518,9 +1858,20 @@ "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/wrap-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz", + "integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==", "license": "MIT" }, "node_modules/@types/yauzl": { @@ -1774,6 +2125,32 @@ "dev": true, "license": "ISC" }, + "node_modules/@vee-validate/yup": { + "version": "4.14.7", + "resolved": "https://registry.npmjs.org/@vee-validate/yup/-/yup-4.14.7.tgz", + "integrity": "sha512-sMLkSXbVWIFK0BE8gEp2Gcdd3aqpTggBjbkrYmcdgyHBeYoPmhBHhUpkXDFhmsckie2xv6lNTicGO5oJt71N1Q==", + "license": "MIT", + "dependencies": { + "type-fest": "^4.8.3", + "vee-validate": "4.14.7", + "yup": "^1.3.2" + }, + "peerDependencies": { + "yup": "^1.3.2" + } + }, + "node_modules/@vee-validate/yup/node_modules/type-fest": { + "version": "4.27.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.27.0.tgz", + "integrity": "sha512-3IMSWgP7C5KSQqmo1wjhKrwsvXAtF33jO3QY+Uy++ia7hqvgSK6iXbbg5PbDBc1P2ZbNEDgejOrN4YooXvhwCw==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@vitejs/plugin-vue": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.1.4.tgz", @@ -1811,7 +2188,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", @@ -1826,7 +2202,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", @@ -1852,7 +2227,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" } @@ -1861,7 +2235,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" }, @@ -1873,7 +2246,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" @@ -1886,7 +2258,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", @@ -1900,7 +2271,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" }, @@ -1912,7 +2282,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", @@ -2513,9 +2882,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" @@ -2567,7 +2940,6 @@ }, "node_modules/ansi-escapes": { "version": "4.3.2", - "dev": true, "license": "MIT", "dependencies": { "type-fest": "^0.21.3" @@ -2581,7 +2953,6 @@ }, "node_modules/ansi-regex": { "version": "5.0.1", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2589,7 +2960,6 @@ }, "node_modules/ansi-styles": { "version": "4.3.0", - "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -2847,7 +3217,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" } @@ -3167,7 +3536,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" } @@ -3245,7 +3613,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", @@ -3259,7 +3626,6 @@ }, "node_modules/chalk": { "version": "4.1.2", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -3281,7 +3647,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" } @@ -3445,7 +3810,6 @@ }, "node_modules/color-convert": { "version": "2.0.1", - "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -3456,7 +3820,6 @@ }, "node_modules/color-name": { "version": "1.1.4", - "dev": true, "license": "MIT" }, "node_modules/colord": { @@ -3607,6 +3970,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", @@ -3707,7 +4079,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" }, @@ -3861,7 +4233,7 @@ }, "node_modules/data-urls": { "version": "5.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "whatwg-mimetype": "^4.0.0", @@ -3955,7 +4327,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" }, @@ -3970,14 +4341,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" } @@ -4468,7 +4838,6 @@ }, "node_modules/esbuild": { "version": "0.21.5", - "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { @@ -4507,7 +4876,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" @@ -5339,7 +5707,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" } @@ -5678,7 +6045,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": [ @@ -5737,7 +6103,6 @@ }, "node_modules/get-caller-file": { "version": "2.0.5", - "dev": true, "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" @@ -6040,6 +6405,15 @@ "dev": true, "license": "MIT" }, + "node_modules/graphql": { + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz", + "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==", + "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", @@ -6052,7 +6426,6 @@ }, "node_modules/has-flag": { "version": "4.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -6127,6 +6500,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", @@ -6135,7 +6514,7 @@ }, "node_modules/html-encoding-sniffer": { "version": "4.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "whatwg-encoding": "^3.1.1" @@ -6180,7 +6559,7 @@ }, "node_modules/http-proxy-agent": { "version": "7.0.2", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "agent-base": "^7.1.0", @@ -6208,7 +6587,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" @@ -6574,7 +6953,6 @@ }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -6656,6 +7034,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, @@ -6700,7 +7084,7 @@ }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/is-regex": { @@ -7048,7 +7432,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", @@ -7088,7 +7472,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" }, @@ -7098,7 +7482,7 @@ }, "node_modules/jsdom/node_modules/xml-name-validator": { "version": "5.0.0", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "engines": { "node": ">=18" @@ -7428,8 +7812,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", @@ -7581,8 +7964,250 @@ "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.6.5", + "resolved": "https://registry.npmjs.org/msw/-/msw-2.6.5.tgz", + "integrity": "sha512-PnlnTpUlOrj441kYQzzFhzMzMCGFT6a2jKUBG7zSpLkYS5oh8Arrbc0dL8/rNAtxaoBy0EVs2mFqj2qdmWK7lQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "peer": true, + "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", + "chalk": "^4.1.2", + "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", + "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/@inquirer/confirm": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-5.0.2.tgz", + "integrity": "sha512-KJLUHOaKnNCYzwVbryj3TNBxyZIrr56fR5N45v6K9IPrbT6B7DcudBMfylkV1A8PUdJE15mybkEQyp2/ZUpxUA==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@inquirer/core": "^10.1.0", + "@inquirer/type": "^3.0.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + } + }, + "node_modules/msw/node_modules/@inquirer/core": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-10.1.0.tgz", + "integrity": "sha512-I+ETk2AL+yAVbvuKx5AJpQmoaWhpiTFOg/UJb7ZkMAK4blmtG8ATh5ct+T/8xNld0CZG/2UhtkdMwpgvld92XQ==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@inquirer/figures": "^1.0.8", + "@inquirer/type": "^3.0.1", + "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/msw/node_modules/@inquirer/type": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-3.0.1.tgz", + "integrity": "sha512-+ksJMIy92sOAiAccGpcKZUc3bYO07cADnscIxHBknEm3uNts3movSmBofc1908BNy5edKscxYeAdaX1NXkHS6A==", + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + } + }, + "node_modules/msw/node_modules/@mswjs/interceptors": { + "version": "0.37.1", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.37.1.tgz", + "integrity": "sha512-SvE+tSpcX884RJrPCskXxoS965Ky/pYABDEhWW6oeSRhpUDLrS5nTvT5n1LLSDVDYvty4imVmXsy+3/ROVuknA==", + "license": "MIT", + "optional": true, + "peer": true, + "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/msw/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", + "optional": true, + "peer": true, + "engines": { + "node": ">= 12" + } + }, + "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", + "optional": true, + "peer": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/msw/node_modules/cliui/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", + "optional": true, + "peer": true, + "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/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", + "optional": true, + "peer": true, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "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", + "optional": true, + "peer": true + }, + "node_modules/msw/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", + "optional": true, + "peer": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/msw/node_modules/type-fest": { + "version": "4.27.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.27.0.tgz", + "integrity": "sha512-3IMSWgP7C5KSQqmo1wjhKrwsvXAtF33jO3QY+Uy++ia7hqvgSK6iXbbg5PbDBc1P2ZbNEDgejOrN4YooXvhwCw==", + "license": "(MIT OR CC0-1.0)", + "optional": true, + "peer": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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", + "optional": true, + "peer": true, + "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", + "optional": true, + "peer": true, + "engines": { + "node": ">=12" + } }, "node_modules/muggle-string": { "version": "0.4.1", @@ -7806,7 +8431,7 @@ }, "node_modules/nwsapi": { "version": "2.2.12", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/object-assign": { @@ -8005,6 +8630,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, @@ -8123,7 +8754,7 @@ }, "node_modules/parse5": { "version": "7.1.2", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "entities": "^4.4.0" @@ -8207,14 +8838,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" } @@ -8728,8 +9357,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", @@ -8742,7 +9370,6 @@ }, "node_modules/punycode": { "version": "2.3.1", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -8766,8 +9393,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", @@ -8902,7 +9528,6 @@ }, "node_modules/require-directory": { "version": "2.1.1", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -8921,8 +9546,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", @@ -9001,7 +9625,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" }, @@ -9039,7 +9662,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -9047,7 +9669,7 @@ }, "node_modules/rrweb-cssom": { "version": "0.7.1", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/run-async": { @@ -9146,12 +9768,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" @@ -9248,7 +9870,6 @@ }, "node_modules/siginfo": { "version": "2.0.0", - "dev": true, "license": "ISC" }, "node_modules/signal-exit": { @@ -9392,7 +10013,6 @@ }, "node_modules/stackback": { "version": "0.0.2", - "dev": true, "license": "MIT" }, "node_modules/start-server-and-test": { @@ -9460,9 +10080,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": { @@ -9473,6 +10101,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, @@ -9483,7 +10117,6 @@ }, "node_modules/string-width": { "version": "4.2.3", - "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -9515,7 +10148,6 @@ }, "node_modules/string-width/node_modules/emoji-regex": { "version": "8.0.0", - "dev": true, "license": "MIT" }, "node_modules/string.prototype.includes": { @@ -9625,7 +10257,6 @@ }, "node_modules/strip-ansi": { "version": "6.0.1", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -10013,7 +10644,6 @@ }, "node_modules/supports-color": { "version": "7.2.0", - "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -10058,7 +10688,7 @@ }, "node_modules/symbol-tree": { "version": "3.2.4", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/synckit": { @@ -10225,20 +10855,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" } @@ -10247,7 +10874,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" } @@ -10256,7 +10882,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" } @@ -10265,7 +10890,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" }, @@ -10277,7 +10902,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", @@ -10306,7 +10931,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", @@ -10321,14 +10945,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" @@ -10426,7 +11049,6 @@ }, "node_modules/type-fest": { "version": "0.21.3", - "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" @@ -10557,8 +11179,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", @@ -10619,7 +11240,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" @@ -10640,9 +11260,9 @@ } }, "node_modules/vee-validate": { - "version": "4.14.6", - "resolved": "https://registry.npmjs.org/vee-validate/-/vee-validate-4.14.6.tgz", - "integrity": "sha512-5w6e+YqJFLfzRR6gmRZgE6ZIVZ5nW1UAQdAlu78Oy3CFVrhTraqMMsfDC/Kmz7CNtCpIYaXxC8oKfr2hAiTnew==", + "version": "4.14.7", + "resolved": "https://registry.npmjs.org/vee-validate/-/vee-validate-4.14.7.tgz", + "integrity": "sha512-XVb1gBFJR57equ11HEI8uxNqFJkwvCP/b+p+saDPQYaW7k45cdF5jsYPEJud1o29GD6h2y7Awm7Qfm89yKi74A==", "license": "MIT", "dependencies": { "@vue/devtools-api": "^7.5.2", @@ -10691,7 +11311,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", @@ -10750,7 +11369,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", @@ -10771,7 +11389,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", @@ -10972,7 +11589,7 @@ }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "xml-name-validator": "^5.0.0" @@ -10983,7 +11600,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" @@ -11018,7 +11635,7 @@ }, "node_modules/webidl-conversions": { "version": "7.0.0", - "dev": true, + "devOptional": true, "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -11026,7 +11643,7 @@ }, "node_modules/whatwg-encoding": { "version": "3.1.1", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "iconv-lite": "0.6.3" @@ -11037,7 +11654,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" @@ -11048,7 +11665,7 @@ }, "node_modules/whatwg-mimetype": { "version": "4.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=18" @@ -11056,7 +11673,7 @@ }, "node_modules/whatwg-url": { "version": "14.0.0", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "tr46": "^5.0.0", @@ -11165,7 +11782,6 @@ }, "node_modules/why-is-node-running": { "version": "2.3.0", - "dev": true, "license": "MIT", "dependencies": { "siginfo": "^2.0.0", @@ -11188,7 +11804,6 @@ }, "node_modules/wrap-ansi": { "version": "6.2.0", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -11250,7 +11865,7 @@ }, "node_modules/ws": { "version": "8.18.0", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=10.0.0" @@ -11278,12 +11893,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" @@ -11352,6 +11966,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" ] }