diff --git a/azure-pipelines-production.yml b/azure-pipelines-production.yml index 5c57493..b35783a 100644 --- a/azure-pipelines-production.yml +++ b/azure-pipelines-production.yml @@ -12,6 +12,7 @@ jobs: - checkout: self clean: true fetchDepth: 1 + persistCredentials: true - script: | git fetch origin main:main if git merge-base --is-ancestor $(Build.SourceVersion) main; then diff --git a/azure-pipelines-staging.yml b/azure-pipelines-staging.yml index 4495b2c..ba3c32c 100644 --- a/azure-pipelines-staging.yml +++ b/azure-pipelines-staging.yml @@ -15,6 +15,7 @@ jobs: - checkout: self clean: true fetchDepth: 1 + persistCredentials: true - script: | git fetch origin main:main if git merge-base --is-ancestor $(Build.SourceVersion) main; then diff --git a/configurations/azure/dev-network-rg.json b/configurations/azure/dev-network-rg.json index 19cc407..9cb0408 100644 --- a/configurations/azure/dev-network-rg.json +++ b/configurations/azure/dev-network-rg.json @@ -11,7 +11,7 @@ "networkInterfaces_pep_odms_app_dev_nic_6b27b52b_0703_4bfa_b69a_66b82ec6ca3e_name": { "type": "String" }, - "networkInterfaces_pep_odms_app_test_nic_e7e4687e_685e_4023_bbab_a16ccfe8822b_name": { + "networkInterfaces_pep_odms_app_test_nic_714ca5c0_83a1_42fb_b8e4_8a2b5a2660ed_name": { "type": "String" }, "networkInterfaces_pep_odms_staapp_dev_nic_a67c70a7_750f_47d4_9844_b82b66095ef1_name": { @@ -436,6 +436,141 @@ "rules": [ { "ruleId": "942440" + }, + { + "ruleId": "942100" + }, + { + "ruleId": "942110" + }, + { + "ruleId": "942120" + }, + { + "ruleId": "942130" + }, + { + "ruleId": "942140" + }, + { + "ruleId": "942150" + }, + { + "ruleId": "942160" + }, + { + "ruleId": "942170" + }, + { + "ruleId": "942180" + }, + { + "ruleId": "942190" + }, + { + "ruleId": "942200" + }, + { + "ruleId": "942210" + }, + { + "ruleId": "942220" + }, + { + "ruleId": "942230" + }, + { + "ruleId": "942240" + }, + { + "ruleId": "942250" + }, + { + "ruleId": "942251" + }, + { + "ruleId": "942270" + }, + { + "ruleId": "942280" + }, + { + "ruleId": "942290" + }, + { + "ruleId": "942300" + }, + { + "ruleId": "942310" + }, + { + "ruleId": "942320" + }, + { + "ruleId": "942330" + }, + { + "ruleId": "942340" + }, + { + "ruleId": "942350" + }, + { + "ruleId": "942360" + }, + { + "ruleId": "942361" + }, + { + "ruleId": "942370" + }, + { + "ruleId": "942380" + }, + { + "ruleId": "942390" + }, + { + "ruleId": "942400" + }, + { + "ruleId": "942410" + }, + { + "ruleId": "942420" + }, + { + "ruleId": "942421" + }, + { + "ruleId": "942430" + }, + { + "ruleId": "942431" + }, + { + "ruleId": "942432" + }, + { + "ruleId": "942450" + }, + { + "ruleId": "942460" + }, + { + "ruleId": "942470" + }, + { + "ruleId": "942480" + }, + { + "ruleId": "942490" + }, + { + "ruleId": "942500" + }, + { + "ruleId": "942260" } ] } @@ -1739,7 +1874,7 @@ ], "kind": "Regular", "location": "japaneast", - "name": "[parameters('networkInterfaces_pep_odms_app_test_nic_e7e4687e_685e_4023_bbab_a16ccfe8822b_name')]", + "name": "[parameters('networkInterfaces_pep_odms_app_test_nic_714ca5c0_83a1_42fb_b8e4_8a2b5a2660ed_name')]", "properties": { "disableTcpStateTracking": false, "dnsSettings": { @@ -1749,9 +1884,9 @@ "enableIPForwarding": false, "ipConfigurations": [ { - "etag": "W/\"4ae02394-b8c4-4949-b8c9-afa8f9a4816c\"", - "id": "[concat(resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_pep_odms_app_test_nic_e7e4687e_685e_4023_bbab_a16ccfe8822b_name')), '/ipConfigurations/privateEndpointIpConfig.2c5fae85-4959-4d63-ae7b-569ad00b2fdc')]", - "name": "privateEndpointIpConfig.2c5fae85-4959-4d63-ae7b-569ad00b2fdc", + "etag": "W/\"de5f333a-686a-419a-be07-4fb339cbf7b8\"", + "id": "[concat(resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_pep_odms_app_test_nic_714ca5c0_83a1_42fb_b8e4_8a2b5a2660ed_name')), '/ipConfigurations/privateEndpointIpConfig.474c2657-ac02-4810-8202-004da3c9cd93')]", + "name": "privateEndpointIpConfig.474c2657-ac02-4810-8202-004da3c9cd93", "properties": { "primary": true, "privateIPAddress": "10.1.1.9", @@ -2047,7 +2182,7 @@ } ], "metadata": { - "creator": "created by private endpoint pep-odms-app-test with resource guid 78a4dbd3-7b3f-436e-a7ae-3aba5cea7341" + "creator": "created by private endpoint pep-odms-app-test with resource guid f272f317-2526-4bbe-bfe9-18083902e925" }, "ttl": 10 }, @@ -2066,7 +2201,7 @@ } ], "metadata": { - "creator": "created by private endpoint pep-odms-app-test with resource guid 78a4dbd3-7b3f-436e-a7ae-3aba5cea7341" + "creator": "created by private endpoint pep-odms-app-test with resource guid f272f317-2526-4bbe-bfe9-18083902e925" }, "ttl": 10 }, @@ -2298,8 +2433,8 @@ "manualPrivateLinkServiceConnections": [], "privateLinkServiceConnections": [ { - "id": "[concat(resourceId('Microsoft.Network/privateEndpoints', parameters('privateEndpoints_pep_odms_app_test_name')), concat('/privateLinkServiceConnections/', parameters('privateEndpoints_pep_odms_app_test_name'), '-81c1'))]", - "name": "[concat(parameters('privateEndpoints_pep_odms_app_test_name'), '-81c1')]", + "id": "[concat(resourceId('Microsoft.Network/privateEndpoints', parameters('privateEndpoints_pep_odms_app_test_name')), concat('/privateLinkServiceConnections/', parameters('privateEndpoints_pep_odms_app_test_name'), '-bd85'))]", + "name": "[concat(parameters('privateEndpoints_pep_odms_app_test_name'), '-bd85')]", "properties": { "groupIds": [ "sites" @@ -11148,6 +11283,10 @@ "properties": {} } ], + "sslPolicy": { + "policyName": "AppGwSslPolicy20220101", + "policyType": "Predefined" + }, "sslProfiles": [], "trustedClientCertificates": [], "trustedRootCertificates": [], diff --git a/configurations/azure/stg-network-rg.json b/configurations/azure/stg-network-rg.json index 402aae2..539e374 100644 --- a/configurations/azure/stg-network-rg.json +++ b/configurations/azure/stg-network-rg.json @@ -414,6 +414,141 @@ "rules": [ { "ruleId": "942440" + }, + { + "ruleId": "942100" + }, + { + "ruleId": "942110" + }, + { + "ruleId": "942120" + }, + { + "ruleId": "942130" + }, + { + "ruleId": "942140" + }, + { + "ruleId": "942150" + }, + { + "ruleId": "942160" + }, + { + "ruleId": "942170" + }, + { + "ruleId": "942180" + }, + { + "ruleId": "942190" + }, + { + "ruleId": "942200" + }, + { + "ruleId": "942210" + }, + { + "ruleId": "942220" + }, + { + "ruleId": "942230" + }, + { + "ruleId": "942240" + }, + { + "ruleId": "942250" + }, + { + "ruleId": "942251" + }, + { + "ruleId": "942260" + }, + { + "ruleId": "942270" + }, + { + "ruleId": "942280" + }, + { + "ruleId": "942290" + }, + { + "ruleId": "942300" + }, + { + "ruleId": "942310" + }, + { + "ruleId": "942320" + }, + { + "ruleId": "942330" + }, + { + "ruleId": "942340" + }, + { + "ruleId": "942350" + }, + { + "ruleId": "942360" + }, + { + "ruleId": "942361" + }, + { + "ruleId": "942370" + }, + { + "ruleId": "942380" + }, + { + "ruleId": "942390" + }, + { + "ruleId": "942400" + }, + { + "ruleId": "942410" + }, + { + "ruleId": "942420" + }, + { + "ruleId": "942421" + }, + { + "ruleId": "942430" + }, + { + "ruleId": "942431" + }, + { + "ruleId": "942432" + }, + { + "ruleId": "942450" + }, + { + "ruleId": "942460" + }, + { + "ruleId": "942470" + }, + { + "ruleId": "942480" + }, + { + "ruleId": "942490" + }, + { + "ruleId": "942500" } ] } @@ -813,7 +948,7 @@ "direction": "Inbound", "priority": 903, "protocol": "TCP", - "sourceAddressPrefix": "211.125.140.74", + "sourceAddressPrefix": "211.125.140.76", "sourceAddressPrefixes": [], "sourcePortRange": "*", "sourcePortRanges": [] @@ -1353,7 +1488,7 @@ "direction": "Inbound", "priority": 903, "protocol": "TCP", - "sourceAddressPrefix": "211.125.140.74", + "sourceAddressPrefix": "211.125.140.76", "sourceAddressPrefixes": [], "sourcePortRange": "*", "sourcePortRanges": [] @@ -10880,6 +11015,10 @@ "properties": {} } ], + "sslPolicy": { + "policyName": "AppGwSslPolicy20220101", + "policyType": "Predefined" + }, "sslProfiles": [], "trustedClientCertificates": [], "trustedRootCertificates": [], diff --git a/dictation_client/openapitools.json b/dictation_client/openapitools.json index cd53ff4..3015568 100644 --- a/dictation_client/openapitools.json +++ b/dictation_client/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "6.6.0" + "version": "7.0.0" } } diff --git a/dictation_client/src/api/.openapi-generator/VERSION b/dictation_client/src/api/.openapi-generator/VERSION index cd802a1..4122521 100644 --- a/dictation_client/src/api/.openapi-generator/VERSION +++ b/dictation_client/src/api/.openapi-generator/VERSION @@ -1 +1 @@ -6.6.0 \ No newline at end of file +7.0.0 \ No newline at end of file diff --git a/dictation_client/src/api/api.ts b/dictation_client/src/api/api.ts index ea4d026..e0430ca 100644 --- a/dictation_client/src/api/api.ts +++ b/dictation_client/src/api/api.ts @@ -5,2454 +5,2531 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 - * + * * * 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, AxiosRequestConfig } from "axios"; -import globalAxios from "axios"; + +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } 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"; -import type { RequestArgs } from "./base"; +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from "./base"; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** - * + * * @export * @interface AccessTokenResponse */ export interface AccessTokenResponse { - /** - * - * @type {string} - * @memberof AccessTokenResponse - */ - accessToken: string; + /** + * + * @type {string} + * @memberof AccessTokenResponse + */ + 'accessToken': string; } /** - * + * * @export * @interface Account */ export interface Account { - /** - * - * @type {number} - * @memberof Account - */ - accountId: number; - /** - * - * @type {string} - * @memberof Account - */ - companyName: string; + /** + * + * @type {number} + * @memberof Account + */ + 'accountId': number; + /** + * + * @type {string} + * @memberof Account + */ + 'companyName': string; } /** - * + * * @export * @interface ActivateCardLicensesRequest */ export interface ActivateCardLicensesRequest { - /** - * - * @type {string} - * @memberof ActivateCardLicensesRequest - */ - cardLicenseKey: string; + /** + * + * @type {string} + * @memberof ActivateCardLicensesRequest + */ + 'cardLicenseKey': string; } /** - * + * * @export * @interface AllocatableLicenseInfo */ export interface AllocatableLicenseInfo { - /** - * - * @type {number} - * @memberof AllocatableLicenseInfo - */ - licenseId: number; - /** - * - * @type {string} - * @memberof AllocatableLicenseInfo - */ - expiryDate: string; + /** + * + * @type {number} + * @memberof AllocatableLicenseInfo + */ + 'licenseId': number; + /** + * + * @type {string} + * @memberof AllocatableLicenseInfo + */ + 'expiryDate': string; } /** - * + * * @export * @interface AllocateLicenseRequest */ export interface AllocateLicenseRequest { - /** - * ユーザーID - * @type {number} - * @memberof AllocateLicenseRequest - */ - userId: number; - /** - * 割り当てるライセンスのID - * @type {number} - * @memberof AllocateLicenseRequest - */ - newLicenseId: number; + /** + * ユーザーID + * @type {number} + * @memberof AllocateLicenseRequest + */ + 'userId': number; + /** + * 割り当てるライセンスのID + * @type {number} + * @memberof AllocateLicenseRequest + */ + 'newLicenseId': number; } /** - * + * * @export * @interface Assignee */ export interface Assignee { - /** - * TypistID(TypistIDかTypistGroupIDのどちらかに値が入る) - * @type {number} - * @memberof Assignee - */ - typistUserId?: number; - /** - * TypistGroupID(TypistGroupIDかTypistIDのどちらかに値が入る) - * @type {number} - * @memberof Assignee - */ - typistGroupId?: number; - /** - * Typist名 / TypistGroup名 - * @type {string} - * @memberof Assignee - */ - typistName: string; + /** + * TypistID(TypistIDかTypistGroupIDのどちらかに値が入る) + * @type {number} + * @memberof Assignee + */ + 'typistUserId'?: number; + /** + * TypistGroupID(TypistGroupIDかTypistIDのどちらかに値が入る) + * @type {number} + * @memberof Assignee + */ + 'typistGroupId'?: number; + /** + * Typist名 / TypistGroup名 + * @type {string} + * @memberof Assignee + */ + 'typistName': string; } /** - * + * * @export * @interface AudioDownloadLocationResponse */ export interface AudioDownloadLocationResponse { - /** - * Blob StorageにアクセスするためのSASトークン入りのアクセスURL - * @type {string} - * @memberof AudioDownloadLocationResponse - */ - url: string; + /** + * Blob StorageにアクセスするためのSASトークン入りのアクセスURL + * @type {string} + * @memberof AudioDownloadLocationResponse + */ + 'url': string; } /** - * + * * @export * @interface AudioNextResponse */ export interface AudioNextResponse { - /** - * ODMS Cloud上の次の音声ファイルID(存在しなければundefind) - * @type {number} - * @memberof AudioNextResponse - */ - nextFileId?: number; + /** + * ODMS Cloud上の次の音声ファイルID(存在しなければundefind) + * @type {number} + * @memberof AudioNextResponse + */ + 'nextFileId'?: number; } /** - * + * * @export * @interface AudioOptionItem */ export interface AudioOptionItem { - /** - * - * @type {string} - * @memberof AudioOptionItem - */ - optionItemLabel: string; - /** - * - * @type {string} - * @memberof AudioOptionItem - */ - optionItemValue: string; + /** + * + * @type {string} + * @memberof AudioOptionItem + */ + 'optionItemLabel': string; + /** + * + * @type {string} + * @memberof AudioOptionItem + */ + 'optionItemValue': string; } /** - * + * * @export * @interface AudioUploadFinishedRequest */ export interface AudioUploadFinishedRequest { - /** - * アップロード先Blob Storage(ファイル名含む) - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - url: string; - /** - * 自分自身(ログイン認証)したAuthorID - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - authorId: string; - /** - * 音声ファイル名 - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - fileName: string; - /** - * 音声ファイルの録音時間(ミリ秒の整数値) - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - duration: string; - /** - * 音声ファイルの録音作成日時(開始日時)(yyyy-mm-ddThh:mm:ss.sss) - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - createdDate: string; - /** - * 音声ファイルの録音作成終了日時(yyyy-mm-ddThh:mm:ss.sss) - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - finishedDate: string; - /** - * 音声ファイルのアップロード日時(yyyy-mm-ddThh:mm:ss.sss) - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - uploadedDate: string; - /** - * 音声ファイルのファイルサイズ(Byte) - * @type {number} - * @memberof AudioUploadFinishedRequest - */ - fileSize: number; - /** - * 優先度 \"00\":Normal / \"01\":High - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - priority: string; - /** - * 録音形式: DSS/DS2(SP)/DS2(QP) - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - audioFormat: string; - /** - * - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - comment: string; - /** - * - * @type {string} - * @memberof AudioUploadFinishedRequest - */ - workType: string; - /** - * 音声ファイルに紐づくOption Itemの一覧(10個固定) - * @type {Array} - * @memberof AudioUploadFinishedRequest - */ - optionItemList: Array; - /** - * - * @type {boolean} - * @memberof AudioUploadFinishedRequest - */ - isEncrypted: boolean; + /** + * アップロード先Blob Storage(ファイル名含む) + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'url': string; + /** + * 自分自身(ログイン認証)したAuthorID + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'authorId': string; + /** + * 音声ファイル名 + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'fileName': string; + /** + * 音声ファイルの録音時間(ミリ秒の整数値) + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'duration': string; + /** + * 音声ファイルの録音作成日時(開始日時)(yyyy-mm-ddThh:mm:ss.sss) + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'createdDate': string; + /** + * 音声ファイルの録音作成終了日時(yyyy-mm-ddThh:mm:ss.sss) + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'finishedDate': string; + /** + * 音声ファイルのアップロード日時(yyyy-mm-ddThh:mm:ss.sss) + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'uploadedDate': string; + /** + * 音声ファイルのファイルサイズ(Byte) + * @type {number} + * @memberof AudioUploadFinishedRequest + */ + 'fileSize': number; + /** + * 優先度 \"00\":Normal / \"01\":High + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'priority': string; + /** + * 録音形式: DSS/DS2(SP)/DS2(QP) + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'audioFormat': string; + /** + * + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'comment': string; + /** + * + * @type {string} + * @memberof AudioUploadFinishedRequest + */ + 'workType': string; + /** + * 音声ファイルに紐づくOption Itemの一覧(10個固定) + * @type {Array} + * @memberof AudioUploadFinishedRequest + */ + 'optionItemList': Array; + /** + * + * @type {boolean} + * @memberof AudioUploadFinishedRequest + */ + 'isEncrypted': boolean; } /** - * + * * @export * @interface AudioUploadFinishedResponse */ export interface AudioUploadFinishedResponse { - /** - * 8桁固定の数字 - * @type {string} - * @memberof AudioUploadFinishedResponse - */ - jobNumber: string; + /** + * 8桁固定の数字 + * @type {string} + * @memberof AudioUploadFinishedResponse + */ + 'jobNumber': string; } /** - * + * * @export * @interface AudioUploadLocationResponse */ export interface AudioUploadLocationResponse { - /** - * Blob StorageにアクセスするためのSASトークン入りのアクセスURL - * @type {string} - * @memberof AudioUploadLocationResponse - */ - url: string; + /** + * Blob StorageにアクセスするためのSASトークン入りのアクセスURL + * @type {string} + * @memberof AudioUploadLocationResponse + */ + 'url': string; } /** - * + * + * @export + * @interface CancelIssueRequest + */ +export interface CancelIssueRequest { + /** + * 注文元アカウントID + * @type {number} + * @memberof CancelIssueRequest + */ + 'orderedAccountId': number; + /** + * POナンバー + * @type {string} + * @memberof CancelIssueRequest + */ + 'poNumber': string; +} +/** + * + * @export + * @interface CancelOrderRequest + */ +export interface CancelOrderRequest { + /** + * + * @type {string} + * @memberof CancelOrderRequest + */ + 'poNumber': string; +} +/** + * * @export * @interface ConfirmRequest */ export interface ConfirmRequest { - /** - * - * @type {string} - * @memberof ConfirmRequest - */ - token: string; + /** + * + * @type {string} + * @memberof ConfirmRequest + */ + 'token': string; } /** - * + * * @export * @interface CreateAccountRequest */ export interface CreateAccountRequest { - /** - * - * @type {string} - * @memberof CreateAccountRequest - */ - companyName: string; - /** - * 国名(ISO 3166-1 alpha-2) - * @type {string} - * @memberof CreateAccountRequest - */ - country: string; - /** - * - * @type {number} - * @memberof CreateAccountRequest - */ - dealerAccountId?: number; - /** - * - * @type {string} - * @memberof CreateAccountRequest - */ - adminName: string; - /** - * - * @type {string} - * @memberof CreateAccountRequest - */ - adminMail: string; - /** - * - * @type {string} - * @memberof CreateAccountRequest - */ - adminPassword: string; - /** - * 同意済み利用規約のバージョン - * @type {string} - * @memberof CreateAccountRequest - */ - acceptedTermsVersion: string; - /** - * reCAPTCHA Token - * @type {string} - * @memberof CreateAccountRequest - */ - token: string; + /** + * + * @type {string} + * @memberof CreateAccountRequest + */ + 'companyName': string; + /** + * 国名(ISO 3166-1 alpha-2) + * @type {string} + * @memberof CreateAccountRequest + */ + 'country': string; + /** + * + * @type {number} + * @memberof CreateAccountRequest + */ + 'dealerAccountId'?: number; + /** + * + * @type {string} + * @memberof CreateAccountRequest + */ + 'adminName': string; + /** + * + * @type {string} + * @memberof CreateAccountRequest + */ + 'adminMail': string; + /** + * + * @type {string} + * @memberof CreateAccountRequest + */ + 'adminPassword': string; + /** + * 同意済み利用規約のバージョン + * @type {string} + * @memberof CreateAccountRequest + */ + 'acceptedTermsVersion': string; + /** + * reCAPTCHA Token + * @type {string} + * @memberof CreateAccountRequest + */ + 'token': string; } /** - * + * * @export * @interface CreateOrdersRequest */ export interface CreateOrdersRequest { - /** - * - * @type {string} - * @memberof CreateOrdersRequest - */ - poNumber: string; - /** - * - * @type {number} - * @memberof CreateOrdersRequest - */ - orderCount: number; + /** + * + * @type {string} + * @memberof CreateOrdersRequest + */ + 'poNumber': string; + /** + * + * @type {number} + * @memberof CreateOrdersRequest + */ + 'orderCount': number; } /** - * + * * @export * @interface CreatePartnerAccountRequest */ export interface CreatePartnerAccountRequest { - /** - * - * @type {string} - * @memberof CreatePartnerAccountRequest - */ - companyName: string; - /** - * 国名(ISO 3166-1 alpha-2) - * @type {string} - * @memberof CreatePartnerAccountRequest - */ - country: string; - /** - * - * @type {string} - * @memberof CreatePartnerAccountRequest - */ - adminName: string; - /** - * - * @type {string} - * @memberof CreatePartnerAccountRequest - */ - email: string; + /** + * + * @type {string} + * @memberof CreatePartnerAccountRequest + */ + 'companyName': string; + /** + * 国名(ISO 3166-1 alpha-2) + * @type {string} + * @memberof CreatePartnerAccountRequest + */ + 'country': string; + /** + * + * @type {string} + * @memberof CreatePartnerAccountRequest + */ + 'adminName': string; + /** + * + * @type {string} + * @memberof CreatePartnerAccountRequest + */ + 'email': string; } /** - * + * + * @export + * @interface CreateTypistGroupRequest + */ +export interface CreateTypistGroupRequest { + /** + * + * @type {string} + * @memberof CreateTypistGroupRequest + */ + 'typistGroupName': string; + /** + * + * @type {Array} + * @memberof CreateTypistGroupRequest + */ + 'typistIds': Array; +} +/** + * * @export * @interface Dealer */ export interface Dealer { - /** - * アカウントID - * @type {number} - * @memberof Dealer - */ - id: number; - /** - * 会社名 - * @type {string} - * @memberof Dealer - */ - name: string; - /** - * 国名(ISO 3166-1 alpha-2) - * @type {string} - * @memberof Dealer - */ - country: string; + /** + * アカウントID + * @type {number} + * @memberof Dealer + */ + 'id': number; + /** + * 会社名 + * @type {string} + * @memberof Dealer + */ + 'name': string; + /** + * 国名(ISO 3166-1 alpha-2) + * @type {string} + * @memberof Dealer + */ + 'country': string; } /** - * + * + * @export + * @interface DeallocateLicenseRequest + */ +export interface DeallocateLicenseRequest { + /** + * ユーザーID + * @type {number} + * @memberof DeallocateLicenseRequest + */ + 'userId': number; +} +/** + * * @export * @interface ErrorResponse */ export interface ErrorResponse { - /** - * - * @type {string} - * @memberof ErrorResponse - */ - message: string; - /** - * - * @type {string} - * @memberof ErrorResponse - */ - code: string; + /** + * + * @type {string} + * @memberof ErrorResponse + */ + 'message': string; + /** + * + * @type {string} + * @memberof ErrorResponse + */ + 'code': string; } /** - * + * * @export * @interface GetAllocatableLicensesResponse */ export interface GetAllocatableLicensesResponse { - /** - * - * @type {Array} - * @memberof GetAllocatableLicensesResponse - */ - allocatableLicenses: Array; + /** + * + * @type {Array} + * @memberof GetAllocatableLicensesResponse + */ + 'allocatableLicenses': Array; } /** - * + * * @export * @interface GetDealersResponse */ export interface GetDealersResponse { - /** - * - * @type {Array} - * @memberof GetDealersResponse - */ - dealers: Array; + /** + * + * @type {Array} + * @memberof GetDealersResponse + */ + 'dealers': Array; } /** - * + * * @export * @interface GetLicenseSummaryRequest */ export interface GetLicenseSummaryRequest { - /** - * - * @type {number} - * @memberof GetLicenseSummaryRequest - */ - accountId: number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryRequest + */ + 'accountId': number; } /** - * + * * @export * @interface GetLicenseSummaryResponse */ export interface GetLicenseSummaryResponse { - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - totalLicense: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - allocatedLicense: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - reusableLicense: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - freeLicense: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - expiringWithin14daysLicense: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - issueRequesting: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - numberOfRequesting: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - shortage: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - storageSize: number; - /** - * - * @type {number} - * @memberof GetLicenseSummaryResponse - */ - usedSize: number; - /** - * - * @type {boolean} - * @memberof GetLicenseSummaryResponse - */ - isStorageAvailable: boolean; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'totalLicense': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'allocatedLicense': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'reusableLicense': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'freeLicense': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'expiringWithin14daysLicense': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'issueRequesting': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'numberOfRequesting': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'shortage': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'storageSize': number; + /** + * + * @type {number} + * @memberof GetLicenseSummaryResponse + */ + 'usedSize': number; + /** + * + * @type {boolean} + * @memberof GetLicenseSummaryResponse + */ + 'isStorageAvailable': boolean; } /** - * + * * @export * @interface GetMyAccountResponse */ export interface GetMyAccountResponse { - /** - * - * @type {Account} - * @memberof GetMyAccountResponse - */ - account: Account; + /** + * + * @type {Account} + * @memberof GetMyAccountResponse + */ + 'account': Account; } /** - * + * * @export * @interface GetOrderHistoriesRequest */ export interface GetOrderHistoriesRequest { - /** - * 取得件数 - * @type {number} - * @memberof GetOrderHistoriesRequest - */ - limit: number; - /** - * 開始位置 - * @type {number} - * @memberof GetOrderHistoriesRequest - */ - offset: number; - /** - * アカウントID - * @type {number} - * @memberof GetOrderHistoriesRequest - */ - accountId: number; + /** + * 取得件数 + * @type {number} + * @memberof GetOrderHistoriesRequest + */ + 'limit': number; + /** + * 開始位置 + * @type {number} + * @memberof GetOrderHistoriesRequest + */ + 'offset': number; + /** + * アカウントID + * @type {number} + * @memberof GetOrderHistoriesRequest + */ + 'accountId': number; } /** - * + * * @export * @interface GetOrderHistoriesResponse */ export interface GetOrderHistoriesResponse { - /** - * 合計件数 - * @type {number} - * @memberof GetOrderHistoriesResponse - */ - total: number; - /** - * - * @type {Array} - * @memberof GetOrderHistoriesResponse - */ - orderHistories: Array; + /** + * 合計件数 + * @type {number} + * @memberof GetOrderHistoriesResponse + */ + 'total': number; + /** + * + * @type {Array} + * @memberof GetOrderHistoriesResponse + */ + 'orderHistories': Array; } /** - * + * * @export * @interface GetPartnerLicensesRequest */ export interface GetPartnerLicensesRequest { - /** - * - * @type {number} - * @memberof GetPartnerLicensesRequest - */ - limit: number; - /** - * - * @type {number} - * @memberof GetPartnerLicensesRequest - */ - offset: number; - /** - * - * @type {number} - * @memberof GetPartnerLicensesRequest - */ - accountId: number; + /** + * + * @type {number} + * @memberof GetPartnerLicensesRequest + */ + 'limit': number; + /** + * + * @type {number} + * @memberof GetPartnerLicensesRequest + */ + 'offset': number; + /** + * + * @type {number} + * @memberof GetPartnerLicensesRequest + */ + 'accountId': number; } /** - * + * * @export * @interface GetPartnerLicensesResponse */ export interface GetPartnerLicensesResponse { - /** - * - * @type {number} - * @memberof GetPartnerLicensesResponse - */ - total: number; - /** - * - * @type {PartnerLicenseInfo} - * @memberof GetPartnerLicensesResponse - */ - ownPartnerLicense: PartnerLicenseInfo; - /** - * - * @type {Array} - * @memberof GetPartnerLicensesResponse - */ - childrenPartnerLicenses: Array; + /** + * + * @type {number} + * @memberof GetPartnerLicensesResponse + */ + 'total': number; + /** + * + * @type {PartnerLicenseInfo} + * @memberof GetPartnerLicensesResponse + */ + 'ownPartnerLicense': PartnerLicenseInfo; + /** + * + * @type {Array} + * @memberof GetPartnerLicensesResponse + */ + 'childrenPartnerLicenses': Array; } /** - * + * * @export * @interface GetRelationsResponse */ export interface GetRelationsResponse { - /** - * ログインしたユーザーのAuthorID(Authorでない場合は空文字) - * @type {string} - * @memberof GetRelationsResponse - */ - authorId: string; - /** - * 属しているアカウントのAuthorID List(全て) - * @type {Array} - * @memberof GetRelationsResponse - */ - authorIdList: Array; - /** - * アカウントに設定されているWorktypeIDのリスト(最大20個) - * @type {Array} - * @memberof GetRelationsResponse - */ - workTypeList: Array; - /** - * ユーザーが音声ファイルを暗号化するかどうか - * @type {boolean} - * @memberof GetRelationsResponse - */ - isEncrypted: boolean; - /** - * ユーザーが暗号化を掛ける場合のパスワード - * @type {string} - * @memberof GetRelationsResponse - */ - encryptionPassword: string | null; - /** - * アカウントがデフォルトで利用するWorkTypeID(アカウントに紐づくWorkTypeIDから一つ指定) - * @type {string} - * @memberof GetRelationsResponse - */ - activeWorktype: string; - /** - * 録音形式: DSS/DS2(SP)/DS2(QP): DS2固定 - * @type {string} - * @memberof GetRelationsResponse - */ - audioFormat: string; - /** - * デバイス上で自動的にWorkTypeの選択画面を表示するかどうかのユーザーごとの設定(Authorでない場合はfalse) - * @type {boolean} - * @memberof GetRelationsResponse - */ - prompt: boolean; + /** + * ログインしたユーザーのAuthorID(Authorでない場合は空文字) + * @type {string} + * @memberof GetRelationsResponse + */ + 'authorId': string; + /** + * 属しているアカウントのAuthorID List(全て) + * @type {Array} + * @memberof GetRelationsResponse + */ + 'authorIdList': Array; + /** + * アカウントに設定されているWorktypeIDのリスト(最大20個) + * @type {Array} + * @memberof GetRelationsResponse + */ + 'workTypeList': Array; + /** + * ユーザーが音声ファイルを暗号化するかどうか + * @type {boolean} + * @memberof GetRelationsResponse + */ + 'isEncrypted': boolean; + /** + * ユーザーが暗号化を掛ける場合のパスワード + * @type {string} + * @memberof GetRelationsResponse + */ + 'encryptionPassword': string | null; + /** + * アカウントがデフォルトで利用するWorkTypeID(アカウントに紐づくWorkTypeIDから一つ指定) + * @type {string} + * @memberof GetRelationsResponse + */ + 'activeWorktype': string; + /** + * 録音形式: DSS/DS2(SP)/DS2(QP): DS2固定 + * @type {string} + * @memberof GetRelationsResponse + */ + 'audioFormat': string; + /** + * デバイス上で自動的にWorkTypeの選択画面を表示するかどうかのユーザーごとの設定(Authorでない場合はfalse) + * @type {boolean} + * @memberof GetRelationsResponse + */ + 'prompt': boolean; } /** - * + * * @export * @interface GetSortCriteriaResponse */ export interface GetSortCriteriaResponse { - /** - * ASC/DESC - * @type {string} - * @memberof GetSortCriteriaResponse - */ - direction: string; - /** - * JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE - * @type {string} - * @memberof GetSortCriteriaResponse - */ - paramName: string; + /** + * ASC/DESC + * @type {string} + * @memberof GetSortCriteriaResponse + */ + 'direction': string; + /** + * JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE + * @type {string} + * @memberof GetSortCriteriaResponse + */ + 'paramName': string; } /** - * + * + * @export + * @interface GetTypistGroupResponse + */ +export interface GetTypistGroupResponse { + /** + * + * @type {string} + * @memberof GetTypistGroupResponse + */ + 'typistGroupName': string; + /** + * + * @type {Array} + * @memberof GetTypistGroupResponse + */ + 'typistIds': Array; +} +/** + * * @export * @interface GetTypistGroupsResponse */ export interface GetTypistGroupsResponse { - /** - * - * @type {Array} - * @memberof GetTypistGroupsResponse - */ - typistGroups: Array; + /** + * + * @type {Array} + * @memberof GetTypistGroupsResponse + */ + 'typistGroups': Array; } /** - * + * * @export * @interface GetTypistsResponse */ export interface GetTypistsResponse { - /** - * - * @type {Array} - * @memberof GetTypistsResponse - */ - typists: Array; + /** + * + * @type {Array} + * @memberof GetTypistsResponse + */ + 'typists': Array; } /** - * + * * @export * @interface GetUsersResponse */ export interface GetUsersResponse { - /** - * - * @type {Array} - * @memberof GetUsersResponse - */ - users: Array; + /** + * + * @type {Array} + * @memberof GetUsersResponse + */ + 'users': Array; } /** - * + * + * @export + * @interface GetWorkTypesResponse + */ +export interface GetWorkTypesResponse { + /** + * + * @type {Array} + * @memberof GetWorkTypesResponse + */ + 'workTypes': Array; +} +/** + * * @export * @interface IssueCardLicensesRequest */ export interface IssueCardLicensesRequest { - /** - * - * @type {number} - * @memberof IssueCardLicensesRequest - */ - createCount: number; + /** + * + * @type {number} + * @memberof IssueCardLicensesRequest + */ + 'createCount': number; } /** - * + * * @export * @interface IssueCardLicensesResponse */ export interface IssueCardLicensesResponse { - /** - * - * @type {Array} - * @memberof IssueCardLicensesResponse - */ - cardLicenseKeys: Array; + /** + * + * @type {Array} + * @memberof IssueCardLicensesResponse + */ + 'cardLicenseKeys': Array; } /** - * + * * @export * @interface IssueLicenseRequest */ export interface IssueLicenseRequest { - /** - * 注文元アカウントID - * @type {number} - * @memberof IssueLicenseRequest - */ - orderedAccountId: number; - /** - * POナンバー - * @type {string} - * @memberof IssueLicenseRequest - */ - poNumber: string; + /** + * 注文元アカウントID + * @type {number} + * @memberof IssueLicenseRequest + */ + 'orderedAccountId': number; + /** + * POナンバー + * @type {string} + * @memberof IssueLicenseRequest + */ + 'poNumber': string; } /** - * + * * @export * @interface LicenseOrder */ export interface LicenseOrder { - /** - * 注文日付 - * @type {string} - * @memberof LicenseOrder - */ - orderDate: string; - /** - * 発行日付 - * @type {string} - * @memberof LicenseOrder - */ - issueDate: string; - /** - * 注文数 - * @type {number} - * @memberof LicenseOrder - */ - numberOfOrder: number; - /** - * POナンバー - * @type {string} - * @memberof LicenseOrder - */ - poNumber: string; - /** - * 注文状態 - * @type {string} - * @memberof LicenseOrder - */ - status: string; + /** + * 注文日付 + * @type {string} + * @memberof LicenseOrder + */ + 'orderDate': string; + /** + * 発行日付 + * @type {string} + * @memberof LicenseOrder + */ + 'issueDate': string; + /** + * 注文数 + * @type {number} + * @memberof LicenseOrder + */ + 'numberOfOrder': number; + /** + * POナンバー + * @type {string} + * @memberof LicenseOrder + */ + 'poNumber': string; + /** + * 注文状態 + * @type {string} + * @memberof LicenseOrder + */ + 'status': string; } /** - * + * * @export * @interface OptionItem */ export interface OptionItem { - /** - * Option Itemのラベル - * @type {string} - * @memberof OptionItem - */ - label: string; - /** - * 項目タイプ 1:Blank/2:Default/3:前の値 - * @type {number} - * @memberof OptionItem - */ - initialValueType: number; - /** - * typeでDefaultを選択した場合のデフォルト値 - * @type {string} - * @memberof OptionItem - */ - defaultValue: string; + /** + * Option Itemのラベル + * @type {string} + * @memberof OptionItem + */ + 'label': string; + /** + * 項目タイプ 1:Blank/2:Default/3:前の値 + * @type {number} + * @memberof OptionItem + */ + 'initialValueType': number; + /** + * typeでDefaultを選択した場合のデフォルト値 + * @type {string} + * @memberof OptionItem + */ + 'defaultValue': string; } /** - * + * * @export * @interface OptionItemList */ export interface OptionItemList { - /** - * - * @type {string} - * @memberof OptionItemList - */ - workTypeId: string; - /** - * 1WorkTypeIDにつき、10個まで登録可能 - * @type {Array} - * @memberof OptionItemList - */ - optionItemList: Array; + /** + * + * @type {string} + * @memberof OptionItemList + */ + 'workTypeId': string; + /** + * 1WorkTypeIDにつき、10個まで登録可能 + * @type {Array} + * @memberof OptionItemList + */ + 'optionItemList': Array; } /** - * + * * @export * @interface PartnerLicenseInfo */ export interface PartnerLicenseInfo { - /** - * アカウントID - * @type {number} - * @memberof PartnerLicenseInfo - */ - accountId: number; - /** - * 階層 - * @type {number} - * @memberof PartnerLicenseInfo - */ - tier: number; - /** - * アカウント名 - * @type {string} - * @memberof PartnerLicenseInfo - */ - companyName: string; - /** - * 保有している有効期限が未設定あるいは有効期限内のライセンス数 - * @type {number} - * @memberof PartnerLicenseInfo - */ - stockLicense: number; - /** - * 子アカウントからの、未発行状態あるいは発行キャンセルされた注文の総ライセンス数 - * @type {number} - * @memberof PartnerLicenseInfo - */ - issuedRequested: number; - /** - * 不足数({Stock license} - {Issue Requested}) - * @type {number} - * @memberof PartnerLicenseInfo - */ - shortage: number; - /** - * 未発行状態あるいは発行キャンセルされた注文の総ライセンス数(=IssueRequestingのStatusの注文の総ライセンス数) - * @type {number} - * @memberof PartnerLicenseInfo - */ - issueRequesting: number; + /** + * アカウントID + * @type {number} + * @memberof PartnerLicenseInfo + */ + 'accountId': number; + /** + * 階層 + * @type {number} + * @memberof PartnerLicenseInfo + */ + 'tier': number; + /** + * アカウント名 + * @type {string} + * @memberof PartnerLicenseInfo + */ + 'companyName': string; + /** + * 保有している有効期限が未設定あるいは有効期限内のライセンス数 + * @type {number} + * @memberof PartnerLicenseInfo + */ + 'stockLicense': number; + /** + * 子アカウントからの、未発行状態あるいは発行キャンセルされた注文の総ライセンス数 + * @type {number} + * @memberof PartnerLicenseInfo + */ + 'issuedRequested': number; + /** + * 不足数({Stock license} - {Issue Requested}) + * @type {number} + * @memberof PartnerLicenseInfo + */ + 'shortage': number; + /** + * 未発行状態あるいは発行キャンセルされた注文の総ライセンス数(=IssueRequestingのStatusの注文の総ライセンス数) + * @type {number} + * @memberof PartnerLicenseInfo + */ + 'issueRequesting': number; } /** - * + * * @export * @interface PostCheckoutPermissionRequest */ export interface PostCheckoutPermissionRequest { - /** - * 文字起こしに着手可能(チェックアウト可能)にしたい、グループ個人の一覧 - * @type {Array} - * @memberof PostCheckoutPermissionRequest - */ - assignees: Array; + /** + * 文字起こしに着手可能(チェックアウト可能)にしたい、グループ個人の一覧 + * @type {Array} + * @memberof PostCheckoutPermissionRequest + */ + 'assignees': Array; } /** - * + * * @export * @interface PostSortCriteriaRequest */ export interface PostSortCriteriaRequest { - /** - * ASC/DESC - * @type {string} - * @memberof PostSortCriteriaRequest - */ - direction: string; - /** - * JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE - * @type {string} - * @memberof PostSortCriteriaRequest - */ - paramName: string; + /** + * ASC/DESC + * @type {string} + * @memberof PostSortCriteriaRequest + */ + 'direction': string; + /** + * JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE + * @type {string} + * @memberof PostSortCriteriaRequest + */ + 'paramName': string; } /** - * + * * @export * @interface PostUpdateUserRequest */ export interface PostUpdateUserRequest { - /** - * - * @type {number} - * @memberof PostUpdateUserRequest - */ - id: number; - /** - * none/author/typist - * @type {string} - * @memberof PostUpdateUserRequest - */ - role: string; - /** - * - * @type {string} - * @memberof PostUpdateUserRequest - */ - authorId?: string; - /** - * - * @type {boolean} - * @memberof PostUpdateUserRequest - */ - autoRenew: boolean; - /** - * - * @type {boolean} - * @memberof PostUpdateUserRequest - */ - licenseAlart: boolean; - /** - * - * @type {boolean} - * @memberof PostUpdateUserRequest - */ - notification: boolean; - /** - * - * @type {boolean} - * @memberof PostUpdateUserRequest - */ - encryption?: boolean; - /** - * - * @type {string} - * @memberof PostUpdateUserRequest - */ - encryptionPassword?: string; - /** - * - * @type {boolean} - * @memberof PostUpdateUserRequest - */ - prompt?: boolean; + /** + * + * @type {number} + * @memberof PostUpdateUserRequest + */ + 'id': number; + /** + * none/author/typist + * @type {string} + * @memberof PostUpdateUserRequest + */ + 'role': string; + /** + * + * @type {string} + * @memberof PostUpdateUserRequest + */ + 'authorId'?: string; + /** + * + * @type {boolean} + * @memberof PostUpdateUserRequest + */ + 'autoRenew': boolean; + /** + * + * @type {boolean} + * @memberof PostUpdateUserRequest + */ + 'licenseAlart': boolean; + /** + * + * @type {boolean} + * @memberof PostUpdateUserRequest + */ + 'notification': boolean; + /** + * + * @type {boolean} + * @memberof PostUpdateUserRequest + */ + 'encryption'?: boolean; + /** + * + * @type {string} + * @memberof PostUpdateUserRequest + */ + 'encryptionPassword'?: string; + /** + * + * @type {boolean} + * @memberof PostUpdateUserRequest + */ + 'prompt'?: boolean; } /** - * + * * @export * @interface RegisterRequest */ export interface RegisterRequest { - /** - * wns or apns - * @type {string} - * @memberof RegisterRequest - */ - pns: string; - /** - * wnsのチャネルURI or apnsのデバイストークン - * @type {string} - * @memberof RegisterRequest - */ - handler: string; + /** + * wns or apns + * @type {string} + * @memberof RegisterRequest + */ + 'pns': string; + /** + * wnsのチャネルURI or apnsのデバイストークン + * @type {string} + * @memberof RegisterRequest + */ + 'handler': string; } /** - * + * * @export * @interface SignupRequest */ export interface SignupRequest { - /** - * - * @type {string} - * @memberof SignupRequest - */ - name: string; - /** - * none/author/typist - * @type {string} - * @memberof SignupRequest - */ - role: string; - /** - * - * @type {string} - * @memberof SignupRequest - */ - authorId?: string; - /** - * - * @type {string} - * @memberof SignupRequest - */ - email: string; - /** - * - * @type {boolean} - * @memberof SignupRequest - */ - autoRenew: boolean; - /** - * - * @type {boolean} - * @memberof SignupRequest - */ - licenseAlert: boolean; - /** - * - * @type {boolean} - * @memberof SignupRequest - */ - notification: boolean; - /** - * - * @type {boolean} - * @memberof SignupRequest - */ - encryption?: boolean; - /** - * - * @type {string} - * @memberof SignupRequest - */ - encryptionPassword?: string; - /** - * - * @type {boolean} - * @memberof SignupRequest - */ - prompt?: boolean; + /** + * + * @type {string} + * @memberof SignupRequest + */ + 'name': string; + /** + * none/author/typist + * @type {string} + * @memberof SignupRequest + */ + 'role': string; + /** + * + * @type {string} + * @memberof SignupRequest + */ + 'authorId'?: string; + /** + * + * @type {string} + * @memberof SignupRequest + */ + 'email': string; + /** + * + * @type {boolean} + * @memberof SignupRequest + */ + 'autoRenew': boolean; + /** + * + * @type {boolean} + * @memberof SignupRequest + */ + 'licenseAlert': boolean; + /** + * + * @type {boolean} + * @memberof SignupRequest + */ + 'notification': boolean; + /** + * + * @type {boolean} + * @memberof SignupRequest + */ + 'encryption'?: boolean; + /** + * + * @type {string} + * @memberof SignupRequest + */ + 'encryptionPassword'?: string; + /** + * + * @type {boolean} + * @memberof SignupRequest + */ + 'prompt'?: boolean; } /** - * + * * @export * @interface Task */ export interface Task { - /** - * ODMS Cloud上の音声ファイルID - * @type {number} - * @memberof Task - */ - audioFileId: number; - /** - * AuthorID - * @type {string} - * @memberof Task - */ - authorId: string; - /** - * - * @type {string} - * @memberof Task - */ - workType: string; - /** - * 音声ファイルに紐づくOption Itemの一覧(10個固定) - * @type {Array} - * @memberof Task - */ - optionItemList: Array; - /** - * 音声ファイルのBlob Storage上での保存場所(ファイル名含む)のURL - * @type {string} - * @memberof Task - */ - url: string; - /** - * 音声ファイル名 - * @type {string} - * @memberof Task - */ - fileName: string; - /** - * 音声ファイルの録音時間(ミリ秒の整数値) - * @type {string} - * @memberof Task - */ - audioDuration: string; - /** - * 音声ファイルの録音開始日時(yyyy-mm-ddThh:mm:ss.sss) - * @type {string} - * @memberof Task - */ - audioCreatedDate: string; - /** - * 音声ファイルの録音終了日時(yyyy-mm-ddThh:mm:ss.sss) - * @type {string} - * @memberof Task - */ - audioFinishedDate: string; - /** - * 音声ファイルのアップロード日時(yyyy-mm-ddThh:mm:ss.sss) - * @type {string} - * @memberof Task - */ - audioUploadedDate: string; - /** - * 音声ファイルのファイルサイズ(Byte) - * @type {number} - * @memberof Task - */ - fileSize: number; - /** - * 音声ファイルの優先度 \"00\":Normal / \"01\":High - * @type {string} - * @memberof Task - */ - priority: string; - /** - * 録音形式: DSS/DS2(SP)/DS2(QP) - * @type {string} - * @memberof Task - */ - audioFormat: string; - /** - * コメント - * @type {string} - * @memberof Task - */ - comment: string; - /** - * - * @type {boolean} - * @memberof Task - */ - isEncrypted: boolean; - /** - * JOBナンバー - * @type {string} - * @memberof Task - */ - jobNumber: string; - /** - * - * @type {TaskTypist} - * @memberof Task - */ - typist?: TaskTypist; - /** - * 文字起こしに着手できる(チェックアウト可能な)、タスクにアサインされているグループ/個人の一覧 - * @type {Array} - * @memberof Task - */ - assignees: Array; - /** - * 音声ファイルのファイルステータス Uploaded / Pending / InProgress / Finished / Backup - * @type {string} - * @memberof Task - */ - status: string; - /** - * 文字起こし開始日時(yyyy-mm-ddThh:mm:ss.sss) - * @type {string} - * @memberof Task - */ - transcriptionStartedDate?: string; - /** - * 文字起こし終了日時(yyyy-mm-ddThh:mm:ss.sss) - * @type {string} - * @memberof Task - */ - transcriptionFinishedDate?: string; + /** + * ODMS Cloud上の音声ファイルID + * @type {number} + * @memberof Task + */ + 'audioFileId': number; + /** + * AuthorID + * @type {string} + * @memberof Task + */ + 'authorId': string; + /** + * + * @type {string} + * @memberof Task + */ + 'workType': string; + /** + * 音声ファイルに紐づくOption Itemの一覧(10個固定) + * @type {Array} + * @memberof Task + */ + 'optionItemList': Array; + /** + * 音声ファイルのBlob Storage上での保存場所(ファイル名含む)のURL + * @type {string} + * @memberof Task + */ + 'url': string; + /** + * 音声ファイル名 + * @type {string} + * @memberof Task + */ + 'fileName': string; + /** + * 音声ファイルの録音時間(ミリ秒の整数値) + * @type {string} + * @memberof Task + */ + 'audioDuration': string; + /** + * 音声ファイルの録音開始日時(yyyy-mm-ddThh:mm:ss.sss) + * @type {string} + * @memberof Task + */ + 'audioCreatedDate': string; + /** + * 音声ファイルの録音終了日時(yyyy-mm-ddThh:mm:ss.sss) + * @type {string} + * @memberof Task + */ + 'audioFinishedDate': string; + /** + * 音声ファイルのアップロード日時(yyyy-mm-ddThh:mm:ss.sss) + * @type {string} + * @memberof Task + */ + 'audioUploadedDate': string; + /** + * 音声ファイルのファイルサイズ(Byte) + * @type {number} + * @memberof Task + */ + 'fileSize': number; + /** + * 音声ファイルの優先度 \"00\":Normal / \"01\":High + * @type {string} + * @memberof Task + */ + 'priority': string; + /** + * 録音形式: DSS/DS2(SP)/DS2(QP) + * @type {string} + * @memberof Task + */ + 'audioFormat': string; + /** + * コメント + * @type {string} + * @memberof Task + */ + 'comment': string; + /** + * + * @type {boolean} + * @memberof Task + */ + 'isEncrypted': boolean; + /** + * JOBナンバー + * @type {string} + * @memberof Task + */ + 'jobNumber': string; + /** + * + * @type {Typist} + * @memberof Task + */ + 'typist'?: Typist; + /** + * 文字起こしに着手できる(チェックアウト可能な)、タスクにアサインされているグループ/個人の一覧 + * @type {Array} + * @memberof Task + */ + 'assignees': Array; + /** + * 音声ファイルのファイルステータス Uploaded / Pending / InProgress / Finished / Backup + * @type {string} + * @memberof Task + */ + 'status': string; + /** + * 文字起こし開始日時(yyyy-mm-ddThh:mm:ss.sss) + * @type {string} + * @memberof Task + */ + 'transcriptionStartedDate'?: string; + /** + * 文字起こし終了日時(yyyy-mm-ddThh:mm:ss.sss) + * @type {string} + * @memberof Task + */ + 'transcriptionFinishedDate'?: string; } /** - * 割り当てられたユーザー - * @export - * @interface TaskTypist - */ -export interface TaskTypist { - /** - * TypistのユーザーID - * @type {number} - * @memberof TaskTypist - */ - id: number; - /** - * Typistのユーザー名 - * @type {string} - * @memberof TaskTypist - */ - name: string; -} -/** - * + * * @export * @interface TasksResponse */ export interface TasksResponse { - /** - * タスクの取得件数(指定しない場合はデフォルト値) - * @type {number} - * @memberof TasksResponse - */ - limit: number; - /** - * オフセット(何件目から取得するか 設定しない場合はデフォルト値) - * @type {number} - * @memberof TasksResponse - */ - offset: number; - /** - * タスクの総件数 - * @type {number} - * @memberof TasksResponse - */ - total: number; - /** - * 音声ファイル/タスク一覧 - * @type {Array} - * @memberof TasksResponse - */ - tasks: Array; + /** + * タスクの取得件数(指定しない場合はデフォルト値) + * @type {number} + * @memberof TasksResponse + */ + 'limit': number; + /** + * オフセット(何件目から取得するか 設定しない場合はデフォルト値) + * @type {number} + * @memberof TasksResponse + */ + 'offset': number; + /** + * タスクの総件数 + * @type {number} + * @memberof TasksResponse + */ + 'total': number; + /** + * 音声ファイル/タスク一覧 + * @type {Array} + * @memberof TasksResponse + */ + 'tasks': Array; } /** - * + * * @export * @interface TemplateDownloadLocationResponse */ export interface TemplateDownloadLocationResponse { - /** - * - * @type {string} - * @memberof TemplateDownloadLocationResponse - */ - url: string; + /** + * + * @type {string} + * @memberof TemplateDownloadLocationResponse + */ + 'url': string; } /** - * + * * @export * @interface TokenRequest */ export interface TokenRequest { - /** - * - * @type {string} - * @memberof TokenRequest - */ - idToken: string; - /** - * web or mobile or desktop - * @type {string} - * @memberof TokenRequest - */ - type: string; + /** + * + * @type {string} + * @memberof TokenRequest + */ + 'idToken': string; + /** + * web or mobile or desktop + * @type {string} + * @memberof TokenRequest + */ + 'type': string; } /** - * + * * @export * @interface TokenResponse */ export interface TokenResponse { - /** - * - * @type {string} - * @memberof TokenResponse - */ - refreshToken: string; - /** - * - * @type {string} - * @memberof TokenResponse - */ - accessToken: string; + /** + * + * @type {string} + * @memberof TokenResponse + */ + 'refreshToken': string; + /** + * + * @type {string} + * @memberof TokenResponse + */ + 'accessToken': string; } /** - * + * * @export * @interface Typist */ export interface Typist { - /** - * TypistのユーザーID - * @type {number} - * @memberof Typist - */ - id: number; - /** - * Typistのユーザー名 - * @type {string} - * @memberof Typist - */ - name: string; + /** + * TypistのユーザーID + * @type {number} + * @memberof Typist + */ + 'id': number; + /** + * Typistのユーザー名 + * @type {string} + * @memberof Typist + */ + 'name': string; } /** - * + * * @export * @interface TypistGroup */ export interface TypistGroup { - /** - * TypistGroupのID - * @type {number} - * @memberof TypistGroup - */ - id: number; - /** - * TypistGroup名 - * @type {string} - * @memberof TypistGroup - */ - name: string; + /** + * TypistGroupのID + * @type {number} + * @memberof TypistGroup + */ + 'id': number; + /** + * TypistGroup名 + * @type {string} + * @memberof TypistGroup + */ + 'name': string; } /** - * + * + * @export + * @interface UpdateTypistGroupRequest + */ +export interface UpdateTypistGroupRequest { + /** + * + * @type {string} + * @memberof UpdateTypistGroupRequest + */ + 'typistGroupName': string; + /** + * + * @type {Array} + * @memberof UpdateTypistGroupRequest + */ + 'typistIds': Array; +} +/** + * * @export * @interface User */ export interface User { - /** - * - * @type {number} - * @memberof User - */ - id: number; - /** - * - * @type {string} - * @memberof User - */ - name: string; - /** - * none/author/typist - * @type {string} - * @memberof User - */ - role: string; - /** - * - * @type {string} - * @memberof User - */ - authorId?: string; - /** - * - * @type {Array} - * @memberof User - */ - typistGroupName: Array; - /** - * - * @type {string} - * @memberof User - */ - email: string; - /** - * - * @type {boolean} - * @memberof User - */ - emailVerified: boolean; - /** - * - * @type {boolean} - * @memberof User - */ - autoRenew: boolean; - /** - * - * @type {boolean} - * @memberof User - */ - licenseAlert: boolean; - /** - * - * @type {boolean} - * @memberof User - */ - notification: boolean; - /** - * - * @type {boolean} - * @memberof User - */ - encryption: boolean; - /** - * - * @type {boolean} - * @memberof User - */ - prompt: boolean; - /** - * - * @type {string} - * @memberof User - */ - expiration?: string; - /** - * - * @type {number} - * @memberof User - */ - remaining?: number; - /** - * Normal/NoLicense/Alert/Renew - * @type {string} - * @memberof User - */ - licenseStatus: string; + /** + * + * @type {number} + * @memberof User + */ + 'id': number; + /** + * + * @type {string} + * @memberof User + */ + 'name': string; + /** + * none/author/typist + * @type {string} + * @memberof User + */ + 'role': string; + /** + * + * @type {string} + * @memberof User + */ + 'authorId'?: string; + /** + * + * @type {Array} + * @memberof User + */ + 'typistGroupName': Array; + /** + * + * @type {string} + * @memberof User + */ + 'email': string; + /** + * + * @type {boolean} + * @memberof User + */ + 'emailVerified': boolean; + /** + * + * @type {boolean} + * @memberof User + */ + 'autoRenew': boolean; + /** + * + * @type {boolean} + * @memberof User + */ + 'licenseAlert': boolean; + /** + * + * @type {boolean} + * @memberof User + */ + 'notification': boolean; + /** + * + * @type {boolean} + * @memberof User + */ + 'encryption': boolean; + /** + * + * @type {boolean} + * @memberof User + */ + 'prompt': boolean; + /** + * + * @type {string} + * @memberof User + */ + 'expiration'?: string; + /** + * + * @type {number} + * @memberof User + */ + 'remaining'?: number; + /** + * Normal/NoLicense/Alert/Renew + * @type {string} + * @memberof User + */ + 'licenseStatus': string; +} +/** + * + * @export + * @interface WorkType + */ +export interface WorkType { + /** + * WorkTypeのID + * @type {number} + * @memberof WorkType + */ + 'id': number; + /** + * WorkTypeID + * @type {string} + * @memberof WorkType + */ + 'workTypeId': string; + /** + * WorkTypeの説明 + * @type {string} + * @memberof WorkType + */ + 'description'?: string; } /** * AccountsApi - axios parameter creator * @export */ -export const AccountsApiAxiosParamCreator = function ( - configuration?: Configuration -) { - return { - /** - * - * @summary - * @param {CreateAccountRequest} createAccountRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createAccount: async ( - createAccountRequest: CreateAccountRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'createAccountRequest' is not null or undefined - assertParamExists( - "createAccount", - "createAccountRequest", - createAccountRequest - ); - const localVarPath = `/accounts`; - // 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; - } +export const AccountsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * ライセンス発行をキャンセルします + * @summary + * @param {CancelIssueRequest} cancelIssueRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelIssue: async (cancelIssueRequest: CancelIssueRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'cancelIssueRequest' is not null or undefined + assertParamExists('cancelIssue', 'cancelIssueRequest', cancelIssueRequest) + const localVarPath = `/accounts/issue/cancel`; + // 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; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - localVarHeaderParameter["Content-Type"] = "application/json"; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - createAccountRequest, - localVarRequestOptions, - configuration - ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {CreatePartnerAccountRequest} createPartnerAccountRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createPartnerAccount: async ( - createPartnerAccountRequest: CreatePartnerAccountRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'createPartnerAccountRequest' is not null or undefined - assertParamExists( - "createPartnerAccount", - "createPartnerAccountRequest", - createPartnerAccountRequest - ); - const localVarPath = `/accounts/partner`; - // 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; - } + + localVarHeaderParameter['Content-Type'] = 'application/json'; - const localVarRequestOptions = { - method: "POST", - ...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}; + localVarRequestOptions.data = serializeDataIfNeeded(cancelIssueRequest, localVarRequestOptions, configuration) - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {CreateAccountRequest} createAccountRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createAccount: async (createAccountRequest: CreateAccountRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'createAccountRequest' is not null or undefined + assertParamExists('createAccount', 'createAccountRequest', createAccountRequest) + const localVarPath = `/accounts`; + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + const localVarRequestOptions = { method: 'POST', ...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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - createPartnerAccountRequest, - localVarRequestOptions, - configuration - ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getDealers: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/accounts/dealers`; - // 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; - } + + localVarHeaderParameter['Content-Type'] = 'application/json'; - 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}; + localVarRequestOptions.data = serializeDataIfNeeded(createAccountRequest, localVarRequestOptions, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {CreatePartnerAccountRequest} createPartnerAccountRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createPartnerAccount: async (createPartnerAccountRequest: CreatePartnerAccountRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'createPartnerAccountRequest' is not null or undefined + assertParamExists('createPartnerAccount', 'createPartnerAccountRequest', createPartnerAccountRequest) + const localVarPath = `/accounts/partner`; + // 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; + } - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定したアカウントのライセンス集計情報を取得します - * @summary - * @param {GetLicenseSummaryRequest} getLicenseSummaryRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getLicenseSummary: async ( - getLicenseSummaryRequest: GetLicenseSummaryRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'getLicenseSummaryRequest' is not null or undefined - assertParamExists( - "getLicenseSummary", - "getLicenseSummaryRequest", - getLicenseSummaryRequest - ); - const localVarPath = `/accounts/licenses/summary`; - // 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; - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - localVarHeaderParameter["Content-Type"] = "application/json"; + + localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - getLicenseSummaryRequest, - localVarRequestOptions, - configuration - ); + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(createPartnerAccountRequest, localVarRequestOptions, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * ログインしているユーザーのアカウント情報を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getMyAccount: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/accounts/me`; - // 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; - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーのアカウント配下にタイピストグループを追加します + * @summary + * @param {CreateTypistGroupRequest} createTypistGroupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createTypistGroup: async (createTypistGroupRequest: CreateTypistGroupRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'createTypistGroupRequest' is not null or undefined + assertParamExists('createTypistGroup', 'createTypistGroupRequest', createTypistGroupRequest) + const localVarPath = `/accounts/typist-groups`; + // 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; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {GetOrderHistoriesRequest} getOrderHistoriesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getOrderHistories: async ( - getOrderHistoriesRequest: GetOrderHistoriesRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'getOrderHistoriesRequest' is not null or undefined - assertParamExists( - "getOrderHistories", - "getOrderHistoriesRequest", - getOrderHistoriesRequest - ); - const localVarPath = `/accounts/order-histories`; - // 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; - } + + localVarHeaderParameter['Content-Type'] = 'application/json'; - const localVarRequestOptions = { - method: "POST", - ...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}; + localVarRequestOptions.data = serializeDataIfNeeded(createTypistGroupRequest, localVarRequestOptions, configuration) - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getDealers: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/accounts/dealers`; + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + 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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - getOrderHistoriesRequest, - localVarRequestOptions, - configuration - ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {GetPartnerLicensesRequest} getPartnerLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getPartnerLicenses: async ( - getPartnerLicensesRequest: GetPartnerLicensesRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'getPartnerLicensesRequest' is not null or undefined - assertParamExists( - "getPartnerLicenses", - "getPartnerLicensesRequest", - getPartnerLicensesRequest - ); - const localVarPath = `/accounts/partner-licenses`; - // 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; - } + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定したアカウントのライセンス集計情報を取得します + * @summary + * @param {GetLicenseSummaryRequest} getLicenseSummaryRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getLicenseSummary: async (getLicenseSummaryRequest: GetLicenseSummaryRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'getLicenseSummaryRequest' is not null or undefined + assertParamExists('getLicenseSummary', 'getLicenseSummaryRequest', getLicenseSummaryRequest) + const localVarPath = `/accounts/licenses/summary`; + // 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; + } - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - localVarHeaderParameter["Content-Type"] = "application/json"; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - getPartnerLicensesRequest, - localVarRequestOptions, - configuration - ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * ログインしているユーザーのアカウント配下のタイピストグループ一覧を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTypistGroups: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/accounts/typist-groups`; - // 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; - } + + localVarHeaderParameter['Content-Type'] = 'application/json'; - 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}; + localVarRequestOptions.data = serializeDataIfNeeded(getLicenseSummaryRequest, localVarRequestOptions, configuration) - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーのアカウント情報を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMyAccount: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/accounts/me`; + // 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; + } - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * ログインしているユーザーのアカウント配下のタイピスト一覧を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTypists: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/accounts/typists`; - // 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; - } + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - const localVarRequestOptions = { - method: "GET", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {GetOrderHistoriesRequest} getOrderHistoriesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderHistories: async (getOrderHistoriesRequest: GetOrderHistoriesRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'getOrderHistoriesRequest' is not null or undefined + assertParamExists('getOrderHistories', 'getOrderHistoriesRequest', getOrderHistoriesRequest) + const localVarPath = `/accounts/order-histories`; + // 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; + } - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {IssueLicenseRequest} issueLicenseRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - issueLicense: async ( - issueLicenseRequest: IssueLicenseRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'issueLicenseRequest' is not null or undefined - assertParamExists( - "issueLicense", - "issueLicenseRequest", - issueLicenseRequest - ); - const localVarPath = `/accounts/licenses/issue`; - // 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; - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - localVarHeaderParameter["Content-Type"] = "application/json"; + + localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - issueLicenseRequest, - localVarRequestOptions, - configuration - ); + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(getOrderHistoriesRequest, localVarRequestOptions, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {GetPartnerLicensesRequest} getPartnerLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPartnerLicenses: async (getPartnerLicensesRequest: GetPartnerLicensesRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'getPartnerLicensesRequest' is not null or undefined + assertParamExists('getPartnerLicenses', 'getPartnerLicensesRequest', getPartnerLicensesRequest) + const localVarPath = `/accounts/partner-licenses`; + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(getPartnerLicensesRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを取得します + * @summary + * @param {number} typistGroupId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTypistGroup: async (typistGroupId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'typistGroupId' is not null or undefined + assertParamExists('getTypistGroup', 'typistGroupId', typistGroupId) + const localVarPath = `/accounts/typist-groups/{typistGroupId}` + .replace(`{${"typistGroupId"}}`, encodeURIComponent(String(typistGroupId))); + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーのアカウント配下のタイピストグループ一覧を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTypistGroups: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/accounts/typist-groups`; + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーのアカウント配下のタイピスト一覧を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTypists: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/accounts/typists`; + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorktypes: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/accounts/worktypes`; + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {IssueLicenseRequest} issueLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + issueLicense: async (issueLicenseRequest: IssueLicenseRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'issueLicenseRequest' is not null or undefined + assertParamExists('issueLicense', 'issueLicenseRequest', issueLicenseRequest) + const localVarPath = `/accounts/licenses/issue`; + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(issueLicenseRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを更新します + * @summary + * @param {number} typistGroupId + * @param {UpdateTypistGroupRequest} updateTypistGroupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateTypistGroup: async (typistGroupId: number, updateTypistGroupRequest: UpdateTypistGroupRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'typistGroupId' is not null or undefined + assertParamExists('updateTypistGroup', 'typistGroupId', typistGroupId) + // verify required parameter 'updateTypistGroupRequest' is not null or undefined + assertParamExists('updateTypistGroup', 'updateTypistGroupRequest', updateTypistGroupRequest) + const localVarPath = `/accounts/typist-groups/{typistGroupId}` + .replace(`{${"typistGroupId"}}`, encodeURIComponent(String(typistGroupId))); + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(updateTypistGroupRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } }; /** * AccountsApi - functional programming interface * @export */ -export const AccountsApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = AccountsApiAxiosParamCreator(configuration); - return { - /** - * - * @summary - * @param {CreateAccountRequest} createAccountRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createAccount( - createAccountRequest: CreateAccountRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.createAccount( - createAccountRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {CreatePartnerAccountRequest} createPartnerAccountRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createPartnerAccount( - createPartnerAccountRequest: CreatePartnerAccountRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.createPartnerAccount( - createPartnerAccountRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getDealers( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.getDealers( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定したアカウントのライセンス集計情報を取得します - * @summary - * @param {GetLicenseSummaryRequest} getLicenseSummaryRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getLicenseSummary( - getLicenseSummaryRequest: GetLicenseSummaryRequest, - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.getLicenseSummary( - getLicenseSummaryRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * ログインしているユーザーのアカウント情報を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getMyAccount( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.getMyAccount( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {GetOrderHistoriesRequest} getOrderHistoriesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getOrderHistories( - getOrderHistoriesRequest: GetOrderHistoriesRequest, - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.getOrderHistories( - getOrderHistoriesRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {GetPartnerLicensesRequest} getPartnerLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getPartnerLicenses( - getPartnerLicensesRequest: GetPartnerLicensesRequest, - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.getPartnerLicenses( - getPartnerLicensesRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * ログインしているユーザーのアカウント配下のタイピストグループ一覧を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getTypistGroups( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.getTypistGroups( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * ログインしているユーザーのアカウント配下のタイピスト一覧を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getTypists( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.getTypists( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {IssueLicenseRequest} issueLicenseRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async issueLicense( - issueLicenseRequest: IssueLicenseRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.issueLicense( - issueLicenseRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - }; +export const AccountsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = AccountsApiAxiosParamCreator(configuration) + return { + /** + * ライセンス発行をキャンセルします + * @summary + * @param {CancelIssueRequest} cancelIssueRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async cancelIssue(cancelIssueRequest: CancelIssueRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.cancelIssue(cancelIssueRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {CreateAccountRequest} createAccountRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createAccount(createAccountRequest: CreateAccountRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createAccount(createAccountRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {CreatePartnerAccountRequest} createPartnerAccountRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createPartnerAccount(createPartnerAccountRequest: CreatePartnerAccountRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createPartnerAccount(createPartnerAccountRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーのアカウント配下にタイピストグループを追加します + * @summary + * @param {CreateTypistGroupRequest} createTypistGroupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createTypistGroup(createTypistGroupRequest: CreateTypistGroupRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createTypistGroup(createTypistGroupRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getDealers(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getDealers(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定したアカウントのライセンス集計情報を取得します + * @summary + * @param {GetLicenseSummaryRequest} getLicenseSummaryRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getLicenseSummary(getLicenseSummaryRequest: GetLicenseSummaryRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getLicenseSummary(getLicenseSummaryRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーのアカウント情報を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getMyAccount(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getMyAccount(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {GetOrderHistoriesRequest} getOrderHistoriesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getOrderHistories(getOrderHistoriesRequest: GetOrderHistoriesRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderHistories(getOrderHistoriesRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {GetPartnerLicensesRequest} getPartnerLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getPartnerLicenses(getPartnerLicensesRequest: GetPartnerLicensesRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getPartnerLicenses(getPartnerLicensesRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを取得します + * @summary + * @param {number} typistGroupId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getTypistGroup(typistGroupId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getTypistGroup(typistGroupId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーのアカウント配下のタイピストグループ一覧を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getTypistGroups(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getTypistGroups(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーのアカウント配下のタイピスト一覧を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getTypists(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getTypists(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getWorktypes(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getWorktypes(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {IssueLicenseRequest} issueLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async issueLicense(issueLicenseRequest: IssueLicenseRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.issueLicense(issueLicenseRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを更新します + * @summary + * @param {number} typistGroupId + * @param {UpdateTypistGroupRequest} updateTypistGroupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateTypistGroup(typistGroupId: number, updateTypistGroupRequest: UpdateTypistGroupRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateTypistGroup(typistGroupId, updateTypistGroupRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } }; /** * AccountsApi - factory interface * @export */ -export const AccountsApiFactory = function ( - configuration?: Configuration, - basePath?: string, - axios?: AxiosInstance -) { - const localVarFp = AccountsApiFp(configuration); - return { - /** - * - * @summary - * @param {CreateAccountRequest} createAccountRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createAccount( - createAccountRequest: CreateAccountRequest, - options?: any - ): AxiosPromise { - return localVarFp - .createAccount(createAccountRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {CreatePartnerAccountRequest} createPartnerAccountRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createPartnerAccount( - createPartnerAccountRequest: CreatePartnerAccountRequest, - options?: any - ): AxiosPromise { - return localVarFp - .createPartnerAccount(createPartnerAccountRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getDealers(options?: any): AxiosPromise { - return localVarFp - .getDealers(options) - .then((request) => request(axios, basePath)); - }, - /** - * 指定したアカウントのライセンス集計情報を取得します - * @summary - * @param {GetLicenseSummaryRequest} getLicenseSummaryRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getLicenseSummary( - getLicenseSummaryRequest: GetLicenseSummaryRequest, - options?: any - ): AxiosPromise { - return localVarFp - .getLicenseSummary(getLicenseSummaryRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * ログインしているユーザーのアカウント情報を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getMyAccount(options?: any): AxiosPromise { - return localVarFp - .getMyAccount(options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {GetOrderHistoriesRequest} getOrderHistoriesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getOrderHistories( - getOrderHistoriesRequest: GetOrderHistoriesRequest, - options?: any - ): AxiosPromise { - return localVarFp - .getOrderHistories(getOrderHistoriesRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {GetPartnerLicensesRequest} getPartnerLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getPartnerLicenses( - getPartnerLicensesRequest: GetPartnerLicensesRequest, - options?: any - ): AxiosPromise { - return localVarFp - .getPartnerLicenses(getPartnerLicensesRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * ログインしているユーザーのアカウント配下のタイピストグループ一覧を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTypistGroups(options?: any): AxiosPromise { - return localVarFp - .getTypistGroups(options) - .then((request) => request(axios, basePath)); - }, - /** - * ログインしているユーザーのアカウント配下のタイピスト一覧を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTypists(options?: any): AxiosPromise { - return localVarFp - .getTypists(options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {IssueLicenseRequest} issueLicenseRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - issueLicense( - issueLicenseRequest: IssueLicenseRequest, - options?: any - ): AxiosPromise { - return localVarFp - .issueLicense(issueLicenseRequest, options) - .then((request) => request(axios, basePath)); - }, - }; +export const AccountsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = AccountsApiFp(configuration) + return { + /** + * ライセンス発行をキャンセルします + * @summary + * @param {CancelIssueRequest} cancelIssueRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelIssue(cancelIssueRequest: CancelIssueRequest, options?: any): AxiosPromise { + return localVarFp.cancelIssue(cancelIssueRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {CreateAccountRequest} createAccountRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createAccount(createAccountRequest: CreateAccountRequest, options?: any): AxiosPromise { + return localVarFp.createAccount(createAccountRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {CreatePartnerAccountRequest} createPartnerAccountRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createPartnerAccount(createPartnerAccountRequest: CreatePartnerAccountRequest, options?: any): AxiosPromise { + return localVarFp.createPartnerAccount(createPartnerAccountRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーのアカウント配下にタイピストグループを追加します + * @summary + * @param {CreateTypistGroupRequest} createTypistGroupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createTypistGroup(createTypistGroupRequest: CreateTypistGroupRequest, options?: any): AxiosPromise { + return localVarFp.createTypistGroup(createTypistGroupRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getDealers(options?: any): AxiosPromise { + return localVarFp.getDealers(options).then((request) => request(axios, basePath)); + }, + /** + * 指定したアカウントのライセンス集計情報を取得します + * @summary + * @param {GetLicenseSummaryRequest} getLicenseSummaryRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getLicenseSummary(getLicenseSummaryRequest: GetLicenseSummaryRequest, options?: any): AxiosPromise { + return localVarFp.getLicenseSummary(getLicenseSummaryRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーのアカウント情報を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMyAccount(options?: any): AxiosPromise { + return localVarFp.getMyAccount(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {GetOrderHistoriesRequest} getOrderHistoriesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderHistories(getOrderHistoriesRequest: GetOrderHistoriesRequest, options?: any): AxiosPromise { + return localVarFp.getOrderHistories(getOrderHistoriesRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {GetPartnerLicensesRequest} getPartnerLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPartnerLicenses(getPartnerLicensesRequest: GetPartnerLicensesRequest, options?: any): AxiosPromise { + return localVarFp.getPartnerLicenses(getPartnerLicensesRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを取得します + * @summary + * @param {number} typistGroupId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTypistGroup(typistGroupId: number, options?: any): AxiosPromise { + return localVarFp.getTypistGroup(typistGroupId, options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーのアカウント配下のタイピストグループ一覧を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTypistGroups(options?: any): AxiosPromise { + return localVarFp.getTypistGroups(options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーのアカウント配下のタイピスト一覧を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTypists(options?: any): AxiosPromise { + return localVarFp.getTypists(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorktypes(options?: any): AxiosPromise { + return localVarFp.getWorktypes(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {IssueLicenseRequest} issueLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + issueLicense(issueLicenseRequest: IssueLicenseRequest, options?: any): AxiosPromise { + return localVarFp.issueLicense(issueLicenseRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを更新します + * @summary + * @param {number} typistGroupId + * @param {UpdateTypistGroupRequest} updateTypistGroupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateTypistGroup(typistGroupId: number, updateTypistGroupRequest: UpdateTypistGroupRequest, options?: any): AxiosPromise { + return localVarFp.updateTypistGroup(typistGroupId, updateTypistGroupRequest, options).then((request) => request(axios, basePath)); + }, + }; }; /** @@ -2462,361 +2539,322 @@ export const AccountsApiFactory = function ( * @extends {BaseAPI} */ export class AccountsApi extends BaseAPI { - /** - * - * @summary - * @param {CreateAccountRequest} createAccountRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public createAccount( - createAccountRequest: CreateAccountRequest, - options?: AxiosRequestConfig - ) { - return AccountsApiFp(this.configuration) - .createAccount(createAccountRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ライセンス発行をキャンセルします + * @summary + * @param {CancelIssueRequest} cancelIssueRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public cancelIssue(cancelIssueRequest: CancelIssueRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).cancelIssue(cancelIssueRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {CreatePartnerAccountRequest} createPartnerAccountRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public createPartnerAccount( - createPartnerAccountRequest: CreatePartnerAccountRequest, - options?: AxiosRequestConfig - ) { - return AccountsApiFp(this.configuration) - .createPartnerAccount(createPartnerAccountRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {CreateAccountRequest} createAccountRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public createAccount(createAccountRequest: CreateAccountRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).createAccount(createAccountRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public getDealers(options?: AxiosRequestConfig) { - return AccountsApiFp(this.configuration) - .getDealers(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {CreatePartnerAccountRequest} createPartnerAccountRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public createPartnerAccount(createPartnerAccountRequest: CreatePartnerAccountRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).createPartnerAccount(createPartnerAccountRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定したアカウントのライセンス集計情報を取得します - * @summary - * @param {GetLicenseSummaryRequest} getLicenseSummaryRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public getLicenseSummary( - getLicenseSummaryRequest: GetLicenseSummaryRequest, - options?: AxiosRequestConfig - ) { - return AccountsApiFp(this.configuration) - .getLicenseSummary(getLicenseSummaryRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ログインしているユーザーのアカウント配下にタイピストグループを追加します + * @summary + * @param {CreateTypistGroupRequest} createTypistGroupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public createTypistGroup(createTypistGroupRequest: CreateTypistGroupRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).createTypistGroup(createTypistGroupRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * ログインしているユーザーのアカウント情報を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public getMyAccount(options?: AxiosRequestConfig) { - return AccountsApiFp(this.configuration) - .getMyAccount(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getDealers(options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getDealers(options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {GetOrderHistoriesRequest} getOrderHistoriesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public getOrderHistories( - getOrderHistoriesRequest: GetOrderHistoriesRequest, - options?: AxiosRequestConfig - ) { - return AccountsApiFp(this.configuration) - .getOrderHistories(getOrderHistoriesRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定したアカウントのライセンス集計情報を取得します + * @summary + * @param {GetLicenseSummaryRequest} getLicenseSummaryRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getLicenseSummary(getLicenseSummaryRequest: GetLicenseSummaryRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getLicenseSummary(getLicenseSummaryRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {GetPartnerLicensesRequest} getPartnerLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public getPartnerLicenses( - getPartnerLicensesRequest: GetPartnerLicensesRequest, - options?: AxiosRequestConfig - ) { - return AccountsApiFp(this.configuration) - .getPartnerLicenses(getPartnerLicensesRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ログインしているユーザーのアカウント情報を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getMyAccount(options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getMyAccount(options).then((request) => request(this.axios, this.basePath)); + } - /** - * ログインしているユーザーのアカウント配下のタイピストグループ一覧を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public getTypistGroups(options?: AxiosRequestConfig) { - return AccountsApiFp(this.configuration) - .getTypistGroups(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {GetOrderHistoriesRequest} getOrderHistoriesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getOrderHistories(getOrderHistoriesRequest: GetOrderHistoriesRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getOrderHistories(getOrderHistoriesRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * ログインしているユーザーのアカウント配下のタイピスト一覧を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public getTypists(options?: AxiosRequestConfig) { - return AccountsApiFp(this.configuration) - .getTypists(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {GetPartnerLicensesRequest} getPartnerLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getPartnerLicenses(getPartnerLicensesRequest: GetPartnerLicensesRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getPartnerLicenses(getPartnerLicensesRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {IssueLicenseRequest} issueLicenseRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AccountsApi - */ - public issueLicense( - issueLicenseRequest: IssueLicenseRequest, - options?: AxiosRequestConfig - ) { - return AccountsApiFp(this.configuration) - .issueLicense(issueLicenseRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを取得します + * @summary + * @param {number} typistGroupId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getTypistGroup(typistGroupId: number, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getTypistGroup(typistGroupId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * ログインしているユーザーのアカウント配下のタイピストグループ一覧を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getTypistGroups(options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getTypistGroups(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * ログインしているユーザーのアカウント配下のタイピスト一覧を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getTypists(options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getTypists(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public getWorktypes(options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).getWorktypes(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary + * @param {IssueLicenseRequest} issueLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public issueLicense(issueLicenseRequest: IssueLicenseRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).issueLicense(issueLicenseRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを更新します + * @summary + * @param {number} typistGroupId + * @param {UpdateTypistGroupRequest} updateTypistGroupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AccountsApi + */ + public updateTypistGroup(typistGroupId: number, updateTypistGroupRequest: UpdateTypistGroupRequest, options?: AxiosRequestConfig) { + return AccountsApiFp(this.configuration).updateTypistGroup(typistGroupId, updateTypistGroupRequest, options).then((request) => request(this.axios, this.basePath)); + } } + + /** * AuthApi - axios parameter creator * @export */ -export const AuthApiAxiosParamCreator = function ( - configuration?: Configuration -) { - return { - /** - * リフレッシュトークンを元にアクセストークンを再生成します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accessToken: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/auth/accessToken`; - // 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; - } +export const AuthApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * リフレッシュトークンを元にアクセストークンを再生成します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + accessToken: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/auth/accessToken`; + // 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; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します - * @summary - * @param {TokenRequest} tokenRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - token: async ( - tokenRequest: TokenRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'tokenRequest' is not null or undefined - assertParamExists("token", "tokenRequest", tokenRequest); - const localVarPath = `/auth/token`; - // 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; - } + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します + * @summary + * @param {TokenRequest} tokenRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + token: async (tokenRequest: TokenRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'tokenRequest' is not null or undefined + assertParamExists('token', 'tokenRequest', tokenRequest) + const localVarPath = `/auth/token`; + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + const localVarRequestOptions = { method: 'POST', ...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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - tokenRequest, - localVarRequestOptions, - configuration - ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(tokenRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } }; /** * AuthApi - functional programming interface * @export */ -export const AuthApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = AuthApiAxiosParamCreator(configuration); - return { - /** - * リフレッシュトークンを元にアクセストークンを再生成します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async accessToken( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.accessToken( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します - * @summary - * @param {TokenRequest} tokenRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async token( - tokenRequest: TokenRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.token( - tokenRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - }; +export const AuthApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = AuthApiAxiosParamCreator(configuration) + return { + /** + * リフレッシュトークンを元にアクセストークンを再生成します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async accessToken(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.accessToken(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します + * @summary + * @param {TokenRequest} tokenRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async token(tokenRequest: TokenRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.token(tokenRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } }; /** * AuthApi - factory interface * @export */ -export const AuthApiFactory = function ( - configuration?: Configuration, - basePath?: string, - axios?: AxiosInstance -) { - const localVarFp = AuthApiFp(configuration); - return { - /** - * リフレッシュトークンを元にアクセストークンを再生成します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accessToken(options?: any): AxiosPromise { - return localVarFp - .accessToken(options) - .then((request) => request(axios, basePath)); - }, - /** - * AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します - * @summary - * @param {TokenRequest} tokenRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - token( - tokenRequest: TokenRequest, - options?: any - ): AxiosPromise { - return localVarFp - .token(tokenRequest, options) - .then((request) => request(axios, basePath)); - }, - }; +export const AuthApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = AuthApiFp(configuration) + return { + /** + * リフレッシュトークンを元にアクセストークンを再生成します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + accessToken(options?: any): AxiosPromise { + return localVarFp.accessToken(options).then((request) => request(axios, basePath)); + }, + /** + * AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します + * @summary + * @param {TokenRequest} tokenRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + token(tokenRequest: TokenRequest, options?: any): AxiosPromise { + return localVarFp.token(tokenRequest, options).then((request) => request(axios, basePath)); + }, + }; }; /** @@ -2826,138 +2864,108 @@ export const AuthApiFactory = function ( * @extends {BaseAPI} */ export class AuthApi extends BaseAPI { - /** - * リフレッシュトークンを元にアクセストークンを再生成します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AuthApi - */ - public accessToken(options?: AxiosRequestConfig) { - return AuthApiFp(this.configuration) - .accessToken(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * リフレッシュトークンを元にアクセストークンを再生成します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AuthApi + */ + public accessToken(options?: AxiosRequestConfig) { + return AuthApiFp(this.configuration).accessToken(options).then((request) => request(this.axios, this.basePath)); + } - /** - * AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します - * @summary - * @param {TokenRequest} tokenRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AuthApi - */ - public token(tokenRequest: TokenRequest, options?: AxiosRequestConfig) { - return AuthApiFp(this.configuration) - .token(tokenRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します + * @summary + * @param {TokenRequest} tokenRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AuthApi + */ + public token(tokenRequest: TokenRequest, options?: AxiosRequestConfig) { + return AuthApiFp(this.configuration).token(tokenRequest, options).then((request) => request(this.axios, this.basePath)); + } } + + /** * DefaultApi - axios parameter creator * @export */ -export const DefaultApiAxiosParamCreator = function ( - configuration?: Configuration -) { - return { - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - checkHealth: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/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; - } +export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkHealth: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/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; + 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, - }; - }, - }; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } }; /** * DefaultApi - functional programming interface * @export */ -export const DefaultApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration); - return { - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async checkHealth( - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.checkHealth( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - }; +export const DefaultApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration) + return { + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async checkHealth(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.checkHealth(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } }; /** * DefaultApi - factory interface * @export */ -export const DefaultApiFactory = function ( - configuration?: Configuration, - basePath?: string, - axios?: AxiosInstance -) { - const localVarFp = DefaultApiFp(configuration); - return { - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - checkHealth(options?: any): AxiosPromise { - return localVarFp - .checkHealth(options) - .then((request) => request(axios, basePath)); - }, - }; +export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = DefaultApiFp(configuration) + return { + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkHealth(options?: any): AxiosPromise { + return localVarFp.checkHealth(options).then((request) => request(axios, basePath)); + }, + }; }; /** @@ -2967,416 +2975,285 @@ export const DefaultApiFactory = function ( * @extends {BaseAPI} */ export class DefaultApi extends BaseAPI { - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof DefaultApi - */ - public checkHealth(options?: AxiosRequestConfig) { - return DefaultApiFp(this.configuration) - .checkHealth(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public checkHealth(options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).checkHealth(options).then((request) => request(this.axios, this.basePath)); + } } + + /** * FilesApi - axios parameter creator * @export */ -export const FilesApiAxiosParamCreator = function ( - configuration?: Configuration -) { - return { - /** - * 指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します - * @summary - * @param {number} audioFileId ODMSCloud上で管理する音声ファイルのID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - downloadLocation: async ( - audioFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("downloadLocation", "audioFileId", audioFileId); - const localVarPath = `/files/audio/download-location`; - // 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; - } +export const FilesApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * 指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します + * @summary + * @param {number} audioFileId ODMSCloud上で管理する音声ファイルのID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + downloadLocation: async (audioFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('downloadLocation', 'audioFileId', audioFileId) + const localVarPath = `/files/audio/download-location`; + // 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; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - if (audioFileId !== undefined) { - localVarQueryParameter["audioFileId"] = audioFileId; - } + if (audioFileId !== undefined) { + localVarQueryParameter['audioFileId'] = audioFileId; + } - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します - * @summary - * @param {number} audioFileId 文字起こし対象の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - downloadTemplateLocation: async ( - audioFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("downloadTemplateLocation", "audioFileId", audioFileId); - const localVarPath = `/files/template/download-location`; - // 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; - } + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const localVarRequestOptions = { - method: "GET", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します + * @summary + * @param {number} audioFileId 文字起こし対象の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + downloadTemplateLocation: async (audioFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('downloadTemplateLocation', 'audioFileId', audioFileId) + const localVarPath = `/files/template/download-location`; + // 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; + } - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - if (audioFileId !== undefined) { - localVarQueryParameter["audioFileId"] = audioFileId; - } + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + if (audioFileId !== undefined) { + localVarQueryParameter['audioFileId'] = audioFileId; + } - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します - * @summary - * @param {AudioUploadFinishedRequest} audioUploadFinishedRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - uploadFinished: async ( - audioUploadFinishedRequest: AudioUploadFinishedRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioUploadFinishedRequest' is not null or undefined - assertParamExists( - "uploadFinished", - "audioUploadFinishedRequest", - audioUploadFinishedRequest - ); - const localVarPath = `/files/audio/upload-finished`; - // 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; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します + * @summary + * @param {AudioUploadFinishedRequest} audioUploadFinishedRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFinished: async (audioUploadFinishedRequest: AudioUploadFinishedRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioUploadFinishedRequest' is not null or undefined + assertParamExists('uploadFinished', 'audioUploadFinishedRequest', audioUploadFinishedRequest) + const localVarPath = `/files/audio/upload-finished`; + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + const localVarRequestOptions = { method: 'POST', ...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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - audioUploadFinishedRequest, - localVarRequestOptions, - configuration - ); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - uploadLocation: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/files/audio/upload-location`; - // 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; + + localVarHeaderParameter['Content-Type'] = 'application/json'; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(audioUploadFinishedRequest, localVarRequestOptions, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadLocation: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/files/audio/upload-location`; + // 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; + } - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } }; /** * FilesApi - functional programming interface * @export */ -export const FilesApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = FilesApiAxiosParamCreator(configuration); - return { - /** - * 指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します - * @summary - * @param {number} audioFileId ODMSCloud上で管理する音声ファイルのID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async downloadLocation( - audioFileId: number, - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.downloadLocation(audioFileId, options); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します - * @summary - * @param {number} audioFileId 文字起こし対象の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async downloadTemplateLocation( - audioFileId: number, - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.downloadTemplateLocation( - audioFileId, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します - * @summary - * @param {AudioUploadFinishedRequest} audioUploadFinishedRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async uploadFinished( - audioUploadFinishedRequest: AudioUploadFinishedRequest, - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFinished( - audioUploadFinishedRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async uploadLocation( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.uploadLocation( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - }; +export const FilesApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = FilesApiAxiosParamCreator(configuration) + return { + /** + * 指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します + * @summary + * @param {number} audioFileId ODMSCloud上で管理する音声ファイルのID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async downloadLocation(audioFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.downloadLocation(audioFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します + * @summary + * @param {number} audioFileId 文字起こし対象の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async downloadTemplateLocation(audioFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.downloadTemplateLocation(audioFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します + * @summary + * @param {AudioUploadFinishedRequest} audioUploadFinishedRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async uploadFinished(audioUploadFinishedRequest: AudioUploadFinishedRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFinished(audioUploadFinishedRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async uploadLocation(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadLocation(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } }; /** * FilesApi - factory interface * @export */ -export const FilesApiFactory = function ( - configuration?: Configuration, - basePath?: string, - axios?: AxiosInstance -) { - const localVarFp = FilesApiFp(configuration); - return { - /** - * 指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します - * @summary - * @param {number} audioFileId ODMSCloud上で管理する音声ファイルのID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - downloadLocation( - audioFileId: number, - options?: any - ): AxiosPromise { - return localVarFp - .downloadLocation(audioFileId, options) - .then((request) => request(axios, basePath)); - }, - /** - * 指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します - * @summary - * @param {number} audioFileId 文字起こし対象の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - downloadTemplateLocation( - audioFileId: number, - options?: any - ): AxiosPromise { - return localVarFp - .downloadTemplateLocation(audioFileId, options) - .then((request) => request(axios, basePath)); - }, - /** - * アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します - * @summary - * @param {AudioUploadFinishedRequest} audioUploadFinishedRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - uploadFinished( - audioUploadFinishedRequest: AudioUploadFinishedRequest, - options?: any - ): AxiosPromise { - return localVarFp - .uploadFinished(audioUploadFinishedRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - uploadLocation(options?: any): AxiosPromise { - return localVarFp - .uploadLocation(options) - .then((request) => request(axios, basePath)); - }, - }; +export const FilesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = FilesApiFp(configuration) + return { + /** + * 指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します + * @summary + * @param {number} audioFileId ODMSCloud上で管理する音声ファイルのID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + downloadLocation(audioFileId: number, options?: any): AxiosPromise { + return localVarFp.downloadLocation(audioFileId, options).then((request) => request(axios, basePath)); + }, + /** + * 指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します + * @summary + * @param {number} audioFileId 文字起こし対象の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + downloadTemplateLocation(audioFileId: number, options?: any): AxiosPromise { + return localVarFp.downloadTemplateLocation(audioFileId, options).then((request) => request(axios, basePath)); + }, + /** + * アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します + * @summary + * @param {AudioUploadFinishedRequest} audioUploadFinishedRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFinished(audioUploadFinishedRequest: AudioUploadFinishedRequest, options?: any): AxiosPromise { + return localVarFp.uploadFinished(audioUploadFinishedRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadLocation(options?: any): AxiosPromise { + return localVarFp.uploadLocation(options).then((request) => request(axios, basePath)); + }, + }; }; /** @@ -3386,482 +3263,380 @@ export const FilesApiFactory = function ( * @extends {BaseAPI} */ export class FilesApi extends BaseAPI { - /** - * 指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します - * @summary - * @param {number} audioFileId ODMSCloud上で管理する音声ファイルのID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof FilesApi - */ - public downloadLocation(audioFileId: number, options?: AxiosRequestConfig) { - return FilesApiFp(this.configuration) - .downloadLocation(audioFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します + * @summary + * @param {number} audioFileId ODMSCloud上で管理する音声ファイルのID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FilesApi + */ + public downloadLocation(audioFileId: number, options?: AxiosRequestConfig) { + return FilesApiFp(this.configuration).downloadLocation(audioFileId, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します - * @summary - * @param {number} audioFileId 文字起こし対象の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof FilesApi - */ - public downloadTemplateLocation( - audioFileId: number, - options?: AxiosRequestConfig - ) { - return FilesApiFp(this.configuration) - .downloadTemplateLocation(audioFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します + * @summary + * @param {number} audioFileId 文字起こし対象の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FilesApi + */ + public downloadTemplateLocation(audioFileId: number, options?: AxiosRequestConfig) { + return FilesApiFp(this.configuration).downloadTemplateLocation(audioFileId, options).then((request) => request(this.axios, this.basePath)); + } - /** - * アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します - * @summary - * @param {AudioUploadFinishedRequest} audioUploadFinishedRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof FilesApi - */ - public uploadFinished( - audioUploadFinishedRequest: AudioUploadFinishedRequest, - options?: AxiosRequestConfig - ) { - return FilesApiFp(this.configuration) - .uploadFinished(audioUploadFinishedRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します + * @summary + * @param {AudioUploadFinishedRequest} audioUploadFinishedRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FilesApi + */ + public uploadFinished(audioUploadFinishedRequest: AudioUploadFinishedRequest, options?: AxiosRequestConfig) { + return FilesApiFp(this.configuration).uploadFinished(audioUploadFinishedRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof FilesApi - */ - public uploadLocation(options?: AxiosRequestConfig) { - return FilesApiFp(this.configuration) - .uploadLocation(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FilesApi + */ + public uploadLocation(options?: AxiosRequestConfig) { + return FilesApiFp(this.configuration).uploadLocation(options).then((request) => request(this.axios, this.basePath)); + } } + + /** * LicensesApi - axios parameter creator * @export */ -export const LicensesApiAxiosParamCreator = function ( - configuration?: Configuration -) { - return { - /** - * - * @summary - * @param {ActivateCardLicensesRequest} activateCardLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - activateCardLicenses: async ( - activateCardLicensesRequest: ActivateCardLicensesRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'activateCardLicensesRequest' is not null or undefined - assertParamExists( - "activateCardLicenses", - "activateCardLicensesRequest", - activateCardLicensesRequest - ); - const localVarPath = `/licenses/cards/activate`; - // 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; - } +export const LicensesApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary + * @param {ActivateCardLicensesRequest} activateCardLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + activateCardLicenses: async (activateCardLicensesRequest: ActivateCardLicensesRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'activateCardLicensesRequest' is not null or undefined + assertParamExists('activateCardLicenses', 'activateCardLicensesRequest', activateCardLicensesRequest) + const localVarPath = `/licenses/cards/activate`; + // 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; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - localVarHeaderParameter["Content-Type"] = "application/json"; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - activateCardLicensesRequest, - localVarRequestOptions, - configuration - ); + + localVarHeaderParameter['Content-Type'] = 'application/json'; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {CreateOrdersRequest} createOrdersRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createOrders: async ( - createOrdersRequest: CreateOrdersRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'createOrdersRequest' is not null or undefined - assertParamExists( - "createOrders", - "createOrdersRequest", - createOrdersRequest - ); - const localVarPath = `/licenses/orders`; - // 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; - } + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(activateCardLicensesRequest, localVarRequestOptions, configuration) - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ライセンス注文をキャンセルします + * @summary + * @param {CancelOrderRequest} cancelOrderRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelOrder: async (cancelOrderRequest: CancelOrderRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'cancelOrderRequest' is not null or undefined + assertParamExists('cancelOrder', 'cancelOrderRequest', cancelOrderRequest) + const localVarPath = `/licenses/orders/cancel`; + // 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; + } - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - localVarHeaderParameter["Content-Type"] = "application/json"; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - createOrdersRequest, - localVarRequestOptions, - configuration - ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 割り当て可能なライセンスを取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllocatableLicenses: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/licenses/allocatable`; - // 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; - } + + localVarHeaderParameter['Content-Type'] = 'application/json'; - 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}; + localVarRequestOptions.data = serializeDataIfNeeded(cancelOrderRequest, localVarRequestOptions, configuration) - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {CreateOrdersRequest} createOrdersRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOrders: async (createOrdersRequest: CreateOrdersRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'createOrdersRequest' is not null or undefined + assertParamExists('createOrders', 'createOrdersRequest', createOrdersRequest) + const localVarPath = `/licenses/orders`; + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + const localVarRequestOptions = { method: 'POST', ...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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - localVarRequestOptions, - configuration - ); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {IssueCardLicensesRequest} issueCardLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - issueCardLicenses: async ( - issueCardLicensesRequest: IssueCardLicensesRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'issueCardLicensesRequest' is not null or undefined - assertParamExists( - "issueCardLicenses", - "issueCardLicensesRequest", - issueCardLicensesRequest - ); - const localVarPath = `/licenses/cards`; - // 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'; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(createOrdersRequest, localVarRequestOptions, configuration) - localVarHeaderParameter["Content-Type"] = "application/json"; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 割り当て可能なライセンスを取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAllocatableLicenses: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/licenses/allocatable`; + // 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; + } - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - issueCardLicensesRequest, - localVarRequestOptions, - configuration - ); + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {IssueCardLicensesRequest} issueCardLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + issueCardLicenses: async (issueCardLicensesRequest: IssueCardLicensesRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'issueCardLicensesRequest' is not null or undefined + assertParamExists('issueCardLicenses', 'issueCardLicensesRequest', issueCardLicensesRequest) + const localVarPath = `/licenses/cards`; + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(issueCardLicensesRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } }; /** * LicensesApi - functional programming interface * @export */ -export const LicensesApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = LicensesApiAxiosParamCreator(configuration); - return { - /** - * - * @summary - * @param {ActivateCardLicensesRequest} activateCardLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async activateCardLicenses( - activateCardLicensesRequest: ActivateCardLicensesRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.activateCardLicenses( - activateCardLicensesRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {CreateOrdersRequest} createOrdersRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createOrders( - createOrdersRequest: CreateOrdersRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.createOrders( - createOrdersRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 割り当て可能なライセンスを取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getAllocatableLicenses( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.getAllocatableLicenses(options); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {IssueCardLicensesRequest} issueCardLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async issueCardLicenses( - issueCardLicensesRequest: IssueCardLicensesRequest, - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.issueCardLicenses( - issueCardLicensesRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - }; +export const LicensesApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = LicensesApiAxiosParamCreator(configuration) + return { + /** + * + * @summary + * @param {ActivateCardLicensesRequest} activateCardLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async activateCardLicenses(activateCardLicensesRequest: ActivateCardLicensesRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.activateCardLicenses(activateCardLicensesRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ライセンス注文をキャンセルします + * @summary + * @param {CancelOrderRequest} cancelOrderRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async cancelOrder(cancelOrderRequest: CancelOrderRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.cancelOrder(cancelOrderRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {CreateOrdersRequest} createOrdersRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createOrders(createOrdersRequest: CreateOrdersRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createOrders(createOrdersRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 割り当て可能なライセンスを取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getAllocatableLicenses(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getAllocatableLicenses(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {IssueCardLicensesRequest} issueCardLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async issueCardLicenses(issueCardLicensesRequest: IssueCardLicensesRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.issueCardLicenses(issueCardLicensesRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } }; /** * LicensesApi - factory interface * @export */ -export const LicensesApiFactory = function ( - configuration?: Configuration, - basePath?: string, - axios?: AxiosInstance -) { - const localVarFp = LicensesApiFp(configuration); - return { - /** - * - * @summary - * @param {ActivateCardLicensesRequest} activateCardLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - activateCardLicenses( - activateCardLicensesRequest: ActivateCardLicensesRequest, - options?: any - ): AxiosPromise { - return localVarFp - .activateCardLicenses(activateCardLicensesRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {CreateOrdersRequest} createOrdersRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createOrders( - createOrdersRequest: CreateOrdersRequest, - options?: any - ): AxiosPromise { - return localVarFp - .createOrders(createOrdersRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * 割り当て可能なライセンスを取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllocatableLicenses( - options?: any - ): AxiosPromise { - return localVarFp - .getAllocatableLicenses(options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {IssueCardLicensesRequest} issueCardLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - issueCardLicenses( - issueCardLicensesRequest: IssueCardLicensesRequest, - options?: any - ): AxiosPromise { - return localVarFp - .issueCardLicenses(issueCardLicensesRequest, options) - .then((request) => request(axios, basePath)); - }, - }; +export const LicensesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = LicensesApiFp(configuration) + return { + /** + * + * @summary + * @param {ActivateCardLicensesRequest} activateCardLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + activateCardLicenses(activateCardLicensesRequest: ActivateCardLicensesRequest, options?: any): AxiosPromise { + return localVarFp.activateCardLicenses(activateCardLicensesRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ライセンス注文をキャンセルします + * @summary + * @param {CancelOrderRequest} cancelOrderRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelOrder(cancelOrderRequest: CancelOrderRequest, options?: any): AxiosPromise { + return localVarFp.cancelOrder(cancelOrderRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {CreateOrdersRequest} createOrdersRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOrders(createOrdersRequest: CreateOrdersRequest, options?: any): AxiosPromise { + return localVarFp.createOrders(createOrdersRequest, options).then((request) => request(axios, basePath)); + }, + /** + * 割り当て可能なライセンスを取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAllocatableLicenses(options?: any): AxiosPromise { + return localVarFp.getAllocatableLicenses(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {IssueCardLicensesRequest} issueCardLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + issueCardLicenses(issueCardLicensesRequest: IssueCardLicensesRequest, options?: any): AxiosPromise { + return localVarFp.issueCardLicenses(issueCardLicensesRequest, options).then((request) => request(axios, basePath)); + }, + }; }; /** @@ -3871,198 +3646,156 @@ export const LicensesApiFactory = function ( * @extends {BaseAPI} */ export class LicensesApi extends BaseAPI { - /** - * - * @summary - * @param {ActivateCardLicensesRequest} activateCardLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof LicensesApi - */ - public activateCardLicenses( - activateCardLicensesRequest: ActivateCardLicensesRequest, - options?: AxiosRequestConfig - ) { - return LicensesApiFp(this.configuration) - .activateCardLicenses(activateCardLicensesRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {ActivateCardLicensesRequest} activateCardLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LicensesApi + */ + public activateCardLicenses(activateCardLicensesRequest: ActivateCardLicensesRequest, options?: AxiosRequestConfig) { + return LicensesApiFp(this.configuration).activateCardLicenses(activateCardLicensesRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {CreateOrdersRequest} createOrdersRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof LicensesApi - */ - public createOrders( - createOrdersRequest: CreateOrdersRequest, - options?: AxiosRequestConfig - ) { - return LicensesApiFp(this.configuration) - .createOrders(createOrdersRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ライセンス注文をキャンセルします + * @summary + * @param {CancelOrderRequest} cancelOrderRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LicensesApi + */ + public cancelOrder(cancelOrderRequest: CancelOrderRequest, options?: AxiosRequestConfig) { + return LicensesApiFp(this.configuration).cancelOrder(cancelOrderRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 割り当て可能なライセンスを取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof LicensesApi - */ - public getAllocatableLicenses(options?: AxiosRequestConfig) { - return LicensesApiFp(this.configuration) - .getAllocatableLicenses(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {CreateOrdersRequest} createOrdersRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LicensesApi + */ + public createOrders(createOrdersRequest: CreateOrdersRequest, options?: AxiosRequestConfig) { + return LicensesApiFp(this.configuration).createOrders(createOrdersRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {IssueCardLicensesRequest} issueCardLicensesRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof LicensesApi - */ - public issueCardLicenses( - issueCardLicensesRequest: IssueCardLicensesRequest, - options?: AxiosRequestConfig - ) { - return LicensesApiFp(this.configuration) - .issueCardLicenses(issueCardLicensesRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 割り当て可能なライセンスを取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LicensesApi + */ + public getAllocatableLicenses(options?: AxiosRequestConfig) { + return LicensesApiFp(this.configuration).getAllocatableLicenses(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary + * @param {IssueCardLicensesRequest} issueCardLicensesRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LicensesApi + */ + public issueCardLicenses(issueCardLicensesRequest: IssueCardLicensesRequest, options?: AxiosRequestConfig) { + return LicensesApiFp(this.configuration).issueCardLicenses(issueCardLicensesRequest, options).then((request) => request(this.axios, this.basePath)); + } } + + /** * NotificationApi - axios parameter creator * @export */ -export const NotificationApiAxiosParamCreator = function ( - configuration?: Configuration -) { - return { - /** - * - * @summary - * @param {RegisterRequest} registerRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - register: async ( - registerRequest: RegisterRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'registerRequest' is not null or undefined - assertParamExists("register", "registerRequest", registerRequest); - const localVarPath = `/notification/register`; - // 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; - } +export const NotificationApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary + * @param {RegisterRequest} registerRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + register: async (registerRequest: RegisterRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'registerRequest' is not null or undefined + assertParamExists('register', 'registerRequest', registerRequest) + const localVarPath = `/notification/register`; + // 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; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - localVarHeaderParameter["Content-Type"] = "application/json"; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - registerRequest, - localVarRequestOptions, - configuration - ); + + localVarHeaderParameter['Content-Type'] = 'application/json'; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(registerRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } }; /** * NotificationApi - functional programming interface * @export */ -export const NotificationApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = - NotificationApiAxiosParamCreator(configuration); - return { - /** - * - * @summary - * @param {RegisterRequest} registerRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async register( - registerRequest: RegisterRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.register( - registerRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - }; +export const NotificationApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = NotificationApiAxiosParamCreator(configuration) + return { + /** + * + * @summary + * @param {RegisterRequest} registerRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async register(registerRequest: RegisterRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.register(registerRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } }; /** * NotificationApi - factory interface * @export */ -export const NotificationApiFactory = function ( - configuration?: Configuration, - basePath?: string, - axios?: AxiosInstance -) { - const localVarFp = NotificationApiFp(configuration); - return { - /** - * - * @summary - * @param {RegisterRequest} registerRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - register( - registerRequest: RegisterRequest, - options?: any - ): AxiosPromise { - return localVarFp - .register(registerRequest, options) - .then((request) => request(axios, basePath)); - }, - }; +export const NotificationApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = NotificationApiFp(configuration) + return { + /** + * + * @summary + * @param {RegisterRequest} registerRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + register(registerRequest: RegisterRequest, options?: any): AxiosPromise { + return localVarFp.register(registerRequest, options).then((request) => request(axios, basePath)); + }, + }; }; /** @@ -4072,910 +3805,619 @@ export const NotificationApiFactory = function ( * @extends {BaseAPI} */ export class NotificationApi extends BaseAPI { - /** - * - * @summary - * @param {RegisterRequest} registerRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof NotificationApi - */ - public register( - registerRequest: RegisterRequest, - options?: AxiosRequestConfig - ) { - return NotificationApiFp(this.configuration) - .register(registerRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {RegisterRequest} registerRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof NotificationApi + */ + public register(registerRequest: RegisterRequest, options?: AxiosRequestConfig) { + return NotificationApiFp(this.configuration).register(registerRequest, options).then((request) => request(this.axios, this.basePath)); + } } + + /** * TasksApi - axios parameter creator * @export */ -export const TasksApiAxiosParamCreator = function ( - configuration?: Configuration -) { - return { - /** - * 指定した文字起こしタスクをバックアップします(ステータスをBackupにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - backup: async ( - audioFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("backup", "audioFileId", audioFileId); - const localVarPath = `/tasks/{audioFileId}/backup`.replace( - `{${"audioFileId"}}`, - encodeURIComponent(String(audioFileId)) - ); - // 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; - } +export const TasksApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * 指定した文字起こしタスクをバックアップします(ステータスをBackupにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + backup: async (audioFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('backup', 'audioFileId', audioFileId) + const localVarPath = `/tasks/{audioFileId}/backup` + .replace(`{${"audioFileId"}}`, encodeURIComponent(String(audioFileId))); + // 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; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - cancel: async ( - audioFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("cancel", "audioFileId", audioFileId); - const localVarPath = `/tasks/{audioFileId}/cancel`.replace( - `{${"audioFileId"}}`, - encodeURIComponent(String(audioFileId)) - ); - // 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; - } + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancel: async (audioFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('cancel', 'audioFileId', audioFileId) + const localVarPath = `/tasks/{audioFileId}/cancel` + .replace(`{${"audioFileId"}}`, encodeURIComponent(String(audioFileId))); + // 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; + } - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + const localVarRequestOptions = { method: 'POST', ...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, - }; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定した文字起こしタスクのチェックアウト候補を変更します。 - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {PostCheckoutPermissionRequest} postCheckoutPermissionRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - changeCheckoutPermission: async ( - audioFileId: number, - postCheckoutPermissionRequest: PostCheckoutPermissionRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("changeCheckoutPermission", "audioFileId", audioFileId); - // verify required parameter 'postCheckoutPermissionRequest' is not null or undefined - assertParamExists( - "changeCheckoutPermission", - "postCheckoutPermissionRequest", - postCheckoutPermissionRequest - ); - const localVarPath = `/tasks/{audioFileId}/checkout-permission`.replace( - `{${"audioFileId"}}`, - encodeURIComponent(String(audioFileId)) - ); - // 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; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定した文字起こしタスクのチェックアウト候補を変更します。 + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {PostCheckoutPermissionRequest} postCheckoutPermissionRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + changeCheckoutPermission: async (audioFileId: number, postCheckoutPermissionRequest: PostCheckoutPermissionRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('changeCheckoutPermission', 'audioFileId', audioFileId) + // verify required parameter 'postCheckoutPermissionRequest' is not null or undefined + assertParamExists('changeCheckoutPermission', 'postCheckoutPermissionRequest', postCheckoutPermissionRequest) + const localVarPath = `/tasks/{audioFileId}/checkout-permission` + .replace(`{${"audioFileId"}}`, encodeURIComponent(String(audioFileId))); + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + const localVarRequestOptions = { method: 'POST', ...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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - postCheckoutPermissionRequest, - localVarRequestOptions, - configuration - ); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定した文字起こしタスクをチェックインします(ステータスをFinishedにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - checkin: async ( - audioFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("checkin", "audioFileId", audioFileId); - const localVarPath = `/tasks/{audioFileId}/checkin`.replace( - `{${"audioFileId"}}`, - encodeURIComponent(String(audioFileId)) - ); - // 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'; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(postCheckoutPermissionRequest, localVarRequestOptions, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定した文字起こしタスクをチェックインします(ステータスをFinishedにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkin: async (audioFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('checkin', 'audioFileId', audioFileId) + const localVarPath = `/tasks/{audioFileId}/checkin` + .replace(`{${"audioFileId"}}`, encodeURIComponent(String(audioFileId))); + // 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; + } - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - checkout: async ( - audioFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("checkout", "audioFileId", audioFileId); - const localVarPath = `/tasks/{audioFileId}/checkout`.replace( - `{${"audioFileId"}}`, - encodeURIComponent(String(audioFileId)) - ); - // 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; - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します - * @summary - * @param {number} endedFileId 文字起こし完了したタスクの音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getNextAudioFile: async ( - endedFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'endedFileId' is not null or undefined - assertParamExists("getNextAudioFile", "endedFileId", endedFileId); - const localVarPath = `/tasks/next`; - // 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; - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkout: async (audioFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('checkout', 'audioFileId', audioFileId) + const localVarPath = `/tasks/{audioFileId}/checkout` + .replace(`{${"audioFileId"}}`, encodeURIComponent(String(audioFileId))); + // 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; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - if (endedFileId !== undefined) { - localVarQueryParameter["endedFileId"] = endedFileId; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + + 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} [limit] タスクの取得件数(指定しない場合はデフォルト値) - * @param {number} [offset] オフセット(何件目から取得するか 設定しない場合はデフォルト値) - * @param {string} [status] 取得対象とするタスクのステータス。カンマ(,)区切りで複数指定可能。設定されない場合はすべてのステータスを取得対象とする。許容するステータスの値は次の通り: Uploaded / Pending / InProgress / Finished / Backup - * @param {string} [direction] ASC/DESC - * @param {string} [paramName] JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTasks: async ( - limit?: number, - offset?: number, - status?: string, - direction?: string, - paramName?: string, - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/tasks`; - // 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; - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します + * @summary + * @param {number} endedFileId 文字起こし完了したタスクの音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getNextAudioFile: async (endedFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'endedFileId' is not null or undefined + assertParamExists('getNextAudioFile', 'endedFileId', endedFileId) + const localVarPath = `/tasks/next`; + // 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; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - if (limit !== undefined) { - localVarQueryParameter["limit"] = limit; - } + if (endedFileId !== undefined) { + localVarQueryParameter['endedFileId'] = endedFileId; + } - if (offset !== undefined) { - localVarQueryParameter["offset"] = offset; - } - if (status !== undefined) { - localVarQueryParameter["status"] = status; - } + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - if (direction !== undefined) { - localVarQueryParameter["direction"] = direction; - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 音声ファイル・文字起こしタスク情報をページ指定して取得します + * @summary + * @param {number} [limit] タスクの取得件数(指定しない場合はデフォルト値) + * @param {number} [offset] オフセット(何件目から取得するか 設定しない場合はデフォルト値) + * @param {string} [status] 取得対象とするタスクのステータス。カンマ(,)区切りで複数指定可能。設定されない場合はすべてのステータスを取得対象とする。許容するステータスの値は次の通り: Uploaded / Pending / InProgress / Finished / Backup + * @param {string} [direction] ASC/DESC + * @param {string} [paramName] JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTasks: async (limit?: number, offset?: number, status?: string, direction?: string, paramName?: string, options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/tasks`; + // 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; + } - if (paramName !== undefined) { - localVarQueryParameter["paramName"] = paramName; - } + 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, - }; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定した文字起こしタスクを差し戻します(ステータスをPendingにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - sendBack: async ( - audioFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("sendBack", "audioFileId", audioFileId); - const localVarPath = `/tasks/{audioFileId}/send-back`.replace( - `{${"audioFileId"}}`, - encodeURIComponent(String(audioFileId)) - ); - // 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; - } + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit; + } - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset; + } - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + if (status !== undefined) { + localVarQueryParameter['status'] = status; + } - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + if (direction !== undefined) { + localVarQueryParameter['direction'] = direction; + } - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * 指定した文字起こしタスクを一時中断します(ステータスをPendingにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - suspend: async ( - audioFileId: number, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'audioFileId' is not null or undefined - assertParamExists("suspend", "audioFileId", audioFileId); - const localVarPath = `/tasks/{audioFileId}/suspend`.replace( - `{${"audioFileId"}}`, - encodeURIComponent(String(audioFileId)) - ); - // 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; - } + if (paramName !== undefined) { + localVarQueryParameter['paramName'] = paramName; + } - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定した文字起こしタスクを差し戻します(ステータスをPendingにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + sendBack: async (audioFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('sendBack', 'audioFileId', audioFileId) + const localVarPath = `/tasks/{audioFileId}/send-back` + .replace(`{${"audioFileId"}}`, encodeURIComponent(String(audioFileId))); + // 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; + } - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 指定した文字起こしタスクを一時中断します(ステータスをPendingにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + suspend: async (audioFileId: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'audioFileId' is not null or undefined + assertParamExists('suspend', 'audioFileId', audioFileId) + const localVarPath = `/tasks/{audioFileId}/suspend` + .replace(`{${"audioFileId"}}`, encodeURIComponent(String(audioFileId))); + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } }; /** * TasksApi - functional programming interface * @export */ -export const TasksApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = TasksApiAxiosParamCreator(configuration); - return { - /** - * 指定した文字起こしタスクをバックアップします(ステータスをBackupにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async backup( - audioFileId: number, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.backup( - audioFileId, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async cancel( - audioFileId: number, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.cancel( - audioFileId, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定した文字起こしタスクのチェックアウト候補を変更します。 - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {PostCheckoutPermissionRequest} postCheckoutPermissionRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async changeCheckoutPermission( - audioFileId: number, - postCheckoutPermissionRequest: PostCheckoutPermissionRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.changeCheckoutPermission( - audioFileId, - postCheckoutPermissionRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定した文字起こしタスクをチェックインします(ステータスをFinishedにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async checkin( - audioFileId: number, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.checkin( - audioFileId, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async checkout( - audioFileId: number, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.checkout( - audioFileId, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します - * @summary - * @param {number} endedFileId 文字起こし完了したタスクの音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getNextAudioFile( - endedFileId: number, - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.getNextAudioFile(endedFileId, options); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 音声ファイル・文字起こしタスク情報をページ指定して取得します - * @summary - * @param {number} [limit] タスクの取得件数(指定しない場合はデフォルト値) - * @param {number} [offset] オフセット(何件目から取得するか 設定しない場合はデフォルト値) - * @param {string} [status] 取得対象とするタスクのステータス。カンマ(,)区切りで複数指定可能。設定されない場合はすべてのステータスを取得対象とする。許容するステータスの値は次の通り: Uploaded / Pending / InProgress / Finished / Backup - * @param {string} [direction] ASC/DESC - * @param {string} [paramName] JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getTasks( - limit?: number, - offset?: number, - status?: string, - direction?: string, - paramName?: string, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.getTasks( - limit, - offset, - status, - direction, - paramName, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定した文字起こしタスクを差し戻します(ステータスをPendingにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async sendBack( - audioFileId: number, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.sendBack( - audioFileId, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * 指定した文字起こしタスクを一時中断します(ステータスをPendingにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async suspend( - audioFileId: number, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.suspend( - audioFileId, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - }; +export const TasksApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = TasksApiAxiosParamCreator(configuration) + return { + /** + * 指定した文字起こしタスクをバックアップします(ステータスをBackupにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async backup(audioFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.backup(audioFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async cancel(audioFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.cancel(audioFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定した文字起こしタスクのチェックアウト候補を変更します。 + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {PostCheckoutPermissionRequest} postCheckoutPermissionRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async changeCheckoutPermission(audioFileId: number, postCheckoutPermissionRequest: PostCheckoutPermissionRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.changeCheckoutPermission(audioFileId, postCheckoutPermissionRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定した文字起こしタスクをチェックインします(ステータスをFinishedにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async checkin(audioFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.checkin(audioFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async checkout(audioFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.checkout(audioFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します + * @summary + * @param {number} endedFileId 文字起こし完了したタスクの音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getNextAudioFile(endedFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getNextAudioFile(endedFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 音声ファイル・文字起こしタスク情報をページ指定して取得します + * @summary + * @param {number} [limit] タスクの取得件数(指定しない場合はデフォルト値) + * @param {number} [offset] オフセット(何件目から取得するか 設定しない場合はデフォルト値) + * @param {string} [status] 取得対象とするタスクのステータス。カンマ(,)区切りで複数指定可能。設定されない場合はすべてのステータスを取得対象とする。許容するステータスの値は次の通り: Uploaded / Pending / InProgress / Finished / Backup + * @param {string} [direction] ASC/DESC + * @param {string} [paramName] JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getTasks(limit?: number, offset?: number, status?: string, direction?: string, paramName?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getTasks(limit, offset, status, direction, paramName, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定した文字起こしタスクを差し戻します(ステータスをPendingにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async sendBack(audioFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.sendBack(audioFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * 指定した文字起こしタスクを一時中断します(ステータスをPendingにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async suspend(audioFileId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.suspend(audioFileId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } }; /** * TasksApi - factory interface * @export */ -export const TasksApiFactory = function ( - configuration?: Configuration, - basePath?: string, - axios?: AxiosInstance -) { - const localVarFp = TasksApiFp(configuration); - return { - /** - * 指定した文字起こしタスクをバックアップします(ステータスをBackupにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - backup(audioFileId: number, options?: any): AxiosPromise { - return localVarFp - .backup(audioFileId, options) - .then((request) => request(axios, basePath)); - }, - /** - * 指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - cancel(audioFileId: number, options?: any): AxiosPromise { - return localVarFp - .cancel(audioFileId, options) - .then((request) => request(axios, basePath)); - }, - /** - * 指定した文字起こしタスクのチェックアウト候補を変更します。 - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {PostCheckoutPermissionRequest} postCheckoutPermissionRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - changeCheckoutPermission( - audioFileId: number, - postCheckoutPermissionRequest: PostCheckoutPermissionRequest, - options?: any - ): AxiosPromise { - return localVarFp - .changeCheckoutPermission( - audioFileId, - postCheckoutPermissionRequest, - options - ) - .then((request) => request(axios, basePath)); - }, - /** - * 指定した文字起こしタスクをチェックインします(ステータスをFinishedにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - checkin(audioFileId: number, options?: any): AxiosPromise { - return localVarFp - .checkin(audioFileId, options) - .then((request) => request(axios, basePath)); - }, - /** - * 指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - checkout(audioFileId: number, options?: any): AxiosPromise { - return localVarFp - .checkout(audioFileId, options) - .then((request) => request(axios, basePath)); - }, - /** - * 指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します - * @summary - * @param {number} endedFileId 文字起こし完了したタスクの音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getNextAudioFile( - endedFileId: number, - options?: any - ): AxiosPromise { - return localVarFp - .getNextAudioFile(endedFileId, options) - .then((request) => request(axios, basePath)); - }, - /** - * 音声ファイル・文字起こしタスク情報をページ指定して取得します - * @summary - * @param {number} [limit] タスクの取得件数(指定しない場合はデフォルト値) - * @param {number} [offset] オフセット(何件目から取得するか 設定しない場合はデフォルト値) - * @param {string} [status] 取得対象とするタスクのステータス。カンマ(,)区切りで複数指定可能。設定されない場合はすべてのステータスを取得対象とする。許容するステータスの値は次の通り: Uploaded / Pending / InProgress / Finished / Backup - * @param {string} [direction] ASC/DESC - * @param {string} [paramName] JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTasks( - limit?: number, - offset?: number, - status?: string, - direction?: string, - paramName?: string, - options?: any - ): AxiosPromise { - return localVarFp - .getTasks(limit, offset, status, direction, paramName, options) - .then((request) => request(axios, basePath)); - }, - /** - * 指定した文字起こしタスクを差し戻します(ステータスをPendingにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - sendBack(audioFileId: number, options?: any): AxiosPromise { - return localVarFp - .sendBack(audioFileId, options) - .then((request) => request(axios, basePath)); - }, - /** - * 指定した文字起こしタスクを一時中断します(ステータスをPendingにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - suspend(audioFileId: number, options?: any): AxiosPromise { - return localVarFp - .suspend(audioFileId, options) - .then((request) => request(axios, basePath)); - }, - }; +export const TasksApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = TasksApiFp(configuration) + return { + /** + * 指定した文字起こしタスクをバックアップします(ステータスをBackupにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + backup(audioFileId: number, options?: any): AxiosPromise { + return localVarFp.backup(audioFileId, options).then((request) => request(axios, basePath)); + }, + /** + * 指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancel(audioFileId: number, options?: any): AxiosPromise { + return localVarFp.cancel(audioFileId, options).then((request) => request(axios, basePath)); + }, + /** + * 指定した文字起こしタスクのチェックアウト候補を変更します。 + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {PostCheckoutPermissionRequest} postCheckoutPermissionRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + changeCheckoutPermission(audioFileId: number, postCheckoutPermissionRequest: PostCheckoutPermissionRequest, options?: any): AxiosPromise { + return localVarFp.changeCheckoutPermission(audioFileId, postCheckoutPermissionRequest, options).then((request) => request(axios, basePath)); + }, + /** + * 指定した文字起こしタスクをチェックインします(ステータスをFinishedにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkin(audioFileId: number, options?: any): AxiosPromise { + return localVarFp.checkin(audioFileId, options).then((request) => request(axios, basePath)); + }, + /** + * 指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkout(audioFileId: number, options?: any): AxiosPromise { + return localVarFp.checkout(audioFileId, options).then((request) => request(axios, basePath)); + }, + /** + * 指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します + * @summary + * @param {number} endedFileId 文字起こし完了したタスクの音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getNextAudioFile(endedFileId: number, options?: any): AxiosPromise { + return localVarFp.getNextAudioFile(endedFileId, options).then((request) => request(axios, basePath)); + }, + /** + * 音声ファイル・文字起こしタスク情報をページ指定して取得します + * @summary + * @param {number} [limit] タスクの取得件数(指定しない場合はデフォルト値) + * @param {number} [offset] オフセット(何件目から取得するか 設定しない場合はデフォルト値) + * @param {string} [status] 取得対象とするタスクのステータス。カンマ(,)区切りで複数指定可能。設定されない場合はすべてのステータスを取得対象とする。許容するステータスの値は次の通り: Uploaded / Pending / InProgress / Finished / Backup + * @param {string} [direction] ASC/DESC + * @param {string} [paramName] JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTasks(limit?: number, offset?: number, status?: string, direction?: string, paramName?: string, options?: any): AxiosPromise { + return localVarFp.getTasks(limit, offset, status, direction, paramName, options).then((request) => request(axios, basePath)); + }, + /** + * 指定した文字起こしタスクを差し戻します(ステータスをPendingにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + sendBack(audioFileId: number, options?: any): AxiosPromise { + return localVarFp.sendBack(audioFileId, options).then((request) => request(axios, basePath)); + }, + /** + * 指定した文字起こしタスクを一時中断します(ステータスをPendingにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + suspend(audioFileId: number, options?: any): AxiosPromise { + return localVarFp.suspend(audioFileId, options).then((request) => request(axios, basePath)); + }, + }; }; /** @@ -4985,985 +4427,727 @@ export const TasksApiFactory = function ( * @extends {BaseAPI} */ export class TasksApi extends BaseAPI { - /** - * 指定した文字起こしタスクをバックアップします(ステータスをBackupにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public backup(audioFileId: number, options?: AxiosRequestConfig) { - return TasksApiFp(this.configuration) - .backup(audioFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した文字起こしタスクをバックアップします(ステータスをBackupにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public backup(audioFileId: number, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).backup(audioFileId, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public cancel(audioFileId: number, options?: AxiosRequestConfig) { - return TasksApiFp(this.configuration) - .cancel(audioFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public cancel(audioFileId: number, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).cancel(audioFileId, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定した文字起こしタスクのチェックアウト候補を変更します。 - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {PostCheckoutPermissionRequest} postCheckoutPermissionRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public changeCheckoutPermission( - audioFileId: number, - postCheckoutPermissionRequest: PostCheckoutPermissionRequest, - options?: AxiosRequestConfig - ) { - return TasksApiFp(this.configuration) - .changeCheckoutPermission( - audioFileId, - postCheckoutPermissionRequest, - options - ) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した文字起こしタスクのチェックアウト候補を変更します。 + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {PostCheckoutPermissionRequest} postCheckoutPermissionRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public changeCheckoutPermission(audioFileId: number, postCheckoutPermissionRequest: PostCheckoutPermissionRequest, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).changeCheckoutPermission(audioFileId, postCheckoutPermissionRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定した文字起こしタスクをチェックインします(ステータスをFinishedにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public checkin(audioFileId: number, options?: AxiosRequestConfig) { - return TasksApiFp(this.configuration) - .checkin(audioFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した文字起こしタスクをチェックインします(ステータスをFinishedにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public checkin(audioFileId: number, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).checkin(audioFileId, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public checkout(audioFileId: number, options?: AxiosRequestConfig) { - return TasksApiFp(this.configuration) - .checkout(audioFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public checkout(audioFileId: number, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).checkout(audioFileId, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します - * @summary - * @param {number} endedFileId 文字起こし完了したタスクの音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public getNextAudioFile(endedFileId: number, options?: AxiosRequestConfig) { - return TasksApiFp(this.configuration) - .getNextAudioFile(endedFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します + * @summary + * @param {number} endedFileId 文字起こし完了したタスクの音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public getNextAudioFile(endedFileId: number, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).getNextAudioFile(endedFileId, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 音声ファイル・文字起こしタスク情報をページ指定して取得します - * @summary - * @param {number} [limit] タスクの取得件数(指定しない場合はデフォルト値) - * @param {number} [offset] オフセット(何件目から取得するか 設定しない場合はデフォルト値) - * @param {string} [status] 取得対象とするタスクのステータス。カンマ(,)区切りで複数指定可能。設定されない場合はすべてのステータスを取得対象とする。許容するステータスの値は次の通り: Uploaded / Pending / InProgress / Finished / Backup - * @param {string} [direction] ASC/DESC - * @param {string} [paramName] JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public getTasks( - limit?: number, - offset?: number, - status?: string, - direction?: string, - paramName?: string, - options?: AxiosRequestConfig - ) { - return TasksApiFp(this.configuration) - .getTasks(limit, offset, status, direction, paramName, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 音声ファイル・文字起こしタスク情報をページ指定して取得します + * @summary + * @param {number} [limit] タスクの取得件数(指定しない場合はデフォルト値) + * @param {number} [offset] オフセット(何件目から取得するか 設定しない場合はデフォルト値) + * @param {string} [status] 取得対象とするタスクのステータス。カンマ(,)区切りで複数指定可能。設定されない場合はすべてのステータスを取得対象とする。許容するステータスの値は次の通り: Uploaded / Pending / InProgress / Finished / Backup + * @param {string} [direction] ASC/DESC + * @param {string} [paramName] JOB_NUMBER/STATUS/ENCRYPTION/AUTHOR_ID/WORK_TYPE/FILE_NAME/FILE_LENGTH/FILE_SIZE/RECORDING_STARTED_DATE/RECORDING_FINISHED_DATE/UPLOAD_DATE/TRANSCRIPTION_STARTED_DATE/TRANSCRIPTION_FINISHED_DATE + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public getTasks(limit?: number, offset?: number, status?: string, direction?: string, paramName?: string, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).getTasks(limit, offset, status, direction, paramName, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定した文字起こしタスクを差し戻します(ステータスをPendingにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public sendBack(audioFileId: number, options?: AxiosRequestConfig) { - return TasksApiFp(this.configuration) - .sendBack(audioFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した文字起こしタスクを差し戻します(ステータスをPendingにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public sendBack(audioFileId: number, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).sendBack(audioFileId, options).then((request) => request(this.axios, this.basePath)); + } - /** - * 指定した文字起こしタスクを一時中断します(ステータスをPendingにします) - * @summary - * @param {number} audioFileId ODMS Cloud上の音声ファイルID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public suspend(audioFileId: number, options?: AxiosRequestConfig) { - return TasksApiFp(this.configuration) - .suspend(audioFileId, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * 指定した文字起こしタスクを一時中断します(ステータスをPendingにします) + * @summary + * @param {number} audioFileId ODMS Cloud上の音声ファイルID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TasksApi + */ + public suspend(audioFileId: number, options?: AxiosRequestConfig) { + return TasksApiFp(this.configuration).suspend(audioFileId, options).then((request) => request(this.axios, this.basePath)); + } } + + /** * UsersApi - axios parameter creator * @export */ -export const UsersApiAxiosParamCreator = function ( - configuration?: Configuration -) { - return { - /** - * ライセンスを割り当てます - * @summary - * @param {AllocateLicenseRequest} allocateLicenseRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocateLicense: async ( - allocateLicenseRequest: AllocateLicenseRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'allocateLicenseRequest' is not null or undefined - assertParamExists( - "allocateLicense", - "allocateLicenseRequest", - allocateLicenseRequest - ); - const localVarPath = `/users/license/allocate`; - // 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; - } +export const UsersApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * ライセンスを割り当てます + * @summary + * @param {AllocateLicenseRequest} allocateLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocateLicense: async (allocateLicenseRequest: AllocateLicenseRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'allocateLicenseRequest' is not null or undefined + assertParamExists('allocateLicense', 'allocateLicenseRequest', allocateLicenseRequest) + const localVarPath = `/users/license/allocate`; + // 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; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - localVarHeaderParameter["Content-Type"] = "application/json"; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - allocateLicenseRequest, - localVarRequestOptions, - configuration - ); + + localVarHeaderParameter['Content-Type'] = 'application/json'; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {ConfirmRequest} confirmRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - confirmUser: async ( - confirmRequest: ConfirmRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'confirmRequest' is not null or undefined - assertParamExists("confirmUser", "confirmRequest", confirmRequest); - const localVarPath = `/users/confirm`; - // 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; - } + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(allocateLicenseRequest, localVarRequestOptions, configuration) - const localVarRequestOptions = { - method: "POST", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {ConfirmRequest} confirmRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + confirmUser: async (confirmRequest: ConfirmRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'confirmRequest' is not null or undefined + assertParamExists('confirmUser', 'confirmRequest', confirmRequest) + const localVarPath = `/users/confirm`; + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + const localVarRequestOptions = { method: 'POST', ...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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - confirmRequest, - localVarRequestOptions, - configuration - ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {ConfirmRequest} confirmRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - confirmUserAndInitPassword: async ( - confirmRequest: ConfirmRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'confirmRequest' is not null or undefined - assertParamExists( - "confirmUserAndInitPassword", - "confirmRequest", - confirmRequest - ); - const localVarPath = `/users/confirm/initpassword`; - // 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; - } + + localVarHeaderParameter['Content-Type'] = 'application/json'; - const localVarRequestOptions = { - method: "POST", - ...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}; + localVarRequestOptions.data = serializeDataIfNeeded(confirmRequest, localVarRequestOptions, configuration) - localVarHeaderParameter["Content-Type"] = "application/json"; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {ConfirmRequest} confirmRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + confirmUserAndInitPassword: async (confirmRequest: ConfirmRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'confirmRequest' is not null or undefined + assertParamExists('confirmUserAndInitPassword', 'confirmRequest', confirmRequest) + const localVarPath = `/users/confirm/initpassword`; + // 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; + } - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - confirmRequest, - localVarRequestOptions, - configuration - ); + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * ログインしているユーザーに関連する各種情報を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRelations: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/users/relations`; - // 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; + + localVarHeaderParameter['Content-Type'] = 'application/json'; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(confirmRequest, localVarRequestOptions, configuration) - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ライセンス割り当てを解除します + * @summary + * @param {DeallocateLicenseRequest} deallocateLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deallocateLicense: async (deallocateLicenseRequest: DeallocateLicenseRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'deallocateLicenseRequest' is not null or undefined + assertParamExists('deallocateLicense', 'deallocateLicenseRequest', deallocateLicenseRequest) + const localVarPath = `/users/license/deallocate`; + // 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; + } - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * ログインしているユーザーのタスクソート条件を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getSortCriteria: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/users/sort-criteria`; - // 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; - const localVarRequestOptions = { - method: "GET", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = - baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + + localVarHeaderParameter['Content-Type'] = 'application/json'; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getUsers: async ( - options: AxiosRequestConfig = {} - ): Promise => { - const localVarPath = `/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; - } + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(deallocateLicenseRequest, localVarRequestOptions, configuration) - const localVarRequestOptions = { - method: "GET", - ...baseOptions, - ...options, - }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーに関連する各種情報を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRelations: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/users/relations`; + // 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; + } - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + 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, - }; + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary - * @param {SignupRequest} signupRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - signup: async ( - signupRequest: SignupRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'signupRequest' is not null or undefined - assertParamExists("signup", "signupRequest", signupRequest); - const localVarPath = `/users/signup`; - // 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; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーのタスクソート条件を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSortCriteria: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/users/sort-criteria`; + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + 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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - signupRequest, - localVarRequestOptions, - configuration - ); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * ログインしているユーザーのタスクソート条件を更新します - * @summary - * @param {PostSortCriteriaRequest} postSortCriteriaRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateSortCriteria: async ( - postSortCriteriaRequest: PostSortCriteriaRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'postSortCriteriaRequest' is not null or undefined - assertParamExists( - "updateSortCriteria", - "postSortCriteriaRequest", - postSortCriteriaRequest - ); - const localVarPath = `/users/sort-criteria`; - // 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; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUsers: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + 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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - postSortCriteriaRequest, - localVarRequestOptions, - configuration - ); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * ユーザーの情報を更新します - * @summary - * @param {PostUpdateUserRequest} postUpdateUserRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateUser: async ( - postUpdateUserRequest: PostUpdateUserRequest, - options: AxiosRequestConfig = {} - ): Promise => { - // verify required parameter 'postUpdateUserRequest' is not null or undefined - assertParamExists( - "updateUser", - "postUpdateUserRequest", - postUpdateUserRequest - ); - const localVarPath = `/users/update`; - // 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; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - // authentication bearer required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary + * @param {SignupRequest} signupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signup: async (signupRequest: SignupRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'signupRequest' is not null or undefined + assertParamExists('signup', 'signupRequest', signupRequest) + const localVarPath = `/users/signup`; + // 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; + } - localVarHeaderParameter["Content-Type"] = "application/json"; + const localVarRequestOptions = { method: 'POST', ...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, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - postUpdateUserRequest, - localVarRequestOptions, - configuration - ); + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(signupRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ログインしているユーザーのタスクソート条件を更新します + * @summary + * @param {PostSortCriteriaRequest} postSortCriteriaRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateSortCriteria: async (postSortCriteriaRequest: PostSortCriteriaRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'postSortCriteriaRequest' is not null or undefined + assertParamExists('updateSortCriteria', 'postSortCriteriaRequest', postSortCriteriaRequest) + const localVarPath = `/users/sort-criteria`; + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(postSortCriteriaRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * ユーザーの情報を更新します + * @summary + * @param {PostUpdateUserRequest} postUpdateUserRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser: async (postUpdateUserRequest: PostUpdateUserRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'postUpdateUserRequest' is not null or undefined + assertParamExists('updateUser', 'postUpdateUserRequest', postUpdateUserRequest) + const localVarPath = `/users/update`; + // 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; + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(postUpdateUserRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } }; /** * UsersApi - functional programming interface * @export */ -export const UsersApiFp = function (configuration?: Configuration) { - const localVarAxiosParamCreator = UsersApiAxiosParamCreator(configuration); - return { - /** - * ライセンスを割り当てます - * @summary - * @param {AllocateLicenseRequest} allocateLicenseRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async allocateLicense( - allocateLicenseRequest: AllocateLicenseRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.allocateLicense( - allocateLicenseRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {ConfirmRequest} confirmRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async confirmUser( - confirmRequest: ConfirmRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.confirmUser( - confirmRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {ConfirmRequest} confirmRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async confirmUserAndInitPassword( - confirmRequest: ConfirmRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.confirmUserAndInitPassword( - confirmRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * ログインしているユーザーに関連する各種情報を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getRelations( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.getRelations( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * ログインしているユーザーのタスクソート条件を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getSortCriteria( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.getSortCriteria( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getUsers( - options?: AxiosRequestConfig - ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.getUsers( - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * - * @summary - * @param {SignupRequest} signupRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async signup( - signupRequest: SignupRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.signup( - signupRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * ログインしているユーザーのタスクソート条件を更新します - * @summary - * @param {PostSortCriteriaRequest} postSortCriteriaRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async updateSortCriteria( - postSortCriteriaRequest: PostSortCriteriaRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = - await localVarAxiosParamCreator.updateSortCriteria( - postSortCriteriaRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - /** - * ユーザーの情報を更新します - * @summary - * @param {PostUpdateUserRequest} postUpdateUserRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async updateUser( - postUpdateUserRequest: PostUpdateUserRequest, - options?: AxiosRequestConfig - ): Promise< - (axios?: AxiosInstance, basePath?: string) => AxiosPromise - > { - const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser( - postUpdateUserRequest, - options - ); - return createRequestFunction( - localVarAxiosArgs, - globalAxios, - BASE_PATH, - configuration - ); - }, - }; +export const UsersApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UsersApiAxiosParamCreator(configuration) + return { + /** + * ライセンスを割り当てます + * @summary + * @param {AllocateLicenseRequest} allocateLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async allocateLicense(allocateLicenseRequest: AllocateLicenseRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.allocateLicense(allocateLicenseRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {ConfirmRequest} confirmRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async confirmUser(confirmRequest: ConfirmRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.confirmUser(confirmRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {ConfirmRequest} confirmRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async confirmUserAndInitPassword(confirmRequest: ConfirmRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.confirmUserAndInitPassword(confirmRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ライセンス割り当てを解除します + * @summary + * @param {DeallocateLicenseRequest} deallocateLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deallocateLicense(deallocateLicenseRequest: DeallocateLicenseRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deallocateLicense(deallocateLicenseRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーに関連する各種情報を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getRelations(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getRelations(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーのタスクソート条件を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getSortCriteria(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getSortCriteria(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUsers(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getUsers(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary + * @param {SignupRequest} signupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async signup(signupRequest: SignupRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.signup(signupRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ログインしているユーザーのタスクソート条件を更新します + * @summary + * @param {PostSortCriteriaRequest} postSortCriteriaRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateSortCriteria(postSortCriteriaRequest: PostSortCriteriaRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateSortCriteria(postSortCriteriaRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * ユーザーの情報を更新します + * @summary + * @param {PostUpdateUserRequest} postUpdateUserRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateUser(postUpdateUserRequest: PostUpdateUserRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(postUpdateUserRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } }; /** * UsersApi - factory interface * @export */ -export const UsersApiFactory = function ( - configuration?: Configuration, - basePath?: string, - axios?: AxiosInstance -) { - const localVarFp = UsersApiFp(configuration); - return { - /** - * ライセンスを割り当てます - * @summary - * @param {AllocateLicenseRequest} allocateLicenseRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocateLicense( - allocateLicenseRequest: AllocateLicenseRequest, - options?: any - ): AxiosPromise { - return localVarFp - .allocateLicense(allocateLicenseRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {ConfirmRequest} confirmRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - confirmUser( - confirmRequest: ConfirmRequest, - options?: any - ): AxiosPromise { - return localVarFp - .confirmUser(confirmRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {ConfirmRequest} confirmRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - confirmUserAndInitPassword( - confirmRequest: ConfirmRequest, - options?: any - ): AxiosPromise { - return localVarFp - .confirmUserAndInitPassword(confirmRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * ログインしているユーザーに関連する各種情報を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRelations(options?: any): AxiosPromise { - return localVarFp - .getRelations(options) - .then((request) => request(axios, basePath)); - }, - /** - * ログインしているユーザーのタスクソート条件を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getSortCriteria(options?: any): AxiosPromise { - return localVarFp - .getSortCriteria(options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getUsers(options?: any): AxiosPromise { - return localVarFp - .getUsers(options) - .then((request) => request(axios, basePath)); - }, - /** - * - * @summary - * @param {SignupRequest} signupRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - signup(signupRequest: SignupRequest, options?: any): AxiosPromise { - return localVarFp - .signup(signupRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * ログインしているユーザーのタスクソート条件を更新します - * @summary - * @param {PostSortCriteriaRequest} postSortCriteriaRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateSortCriteria( - postSortCriteriaRequest: PostSortCriteriaRequest, - options?: any - ): AxiosPromise { - return localVarFp - .updateSortCriteria(postSortCriteriaRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * ユーザーの情報を更新します - * @summary - * @param {PostUpdateUserRequest} postUpdateUserRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateUser( - postUpdateUserRequest: PostUpdateUserRequest, - options?: any - ): AxiosPromise { - return localVarFp - .updateUser(postUpdateUserRequest, options) - .then((request) => request(axios, basePath)); - }, - }; +export const UsersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UsersApiFp(configuration) + return { + /** + * ライセンスを割り当てます + * @summary + * @param {AllocateLicenseRequest} allocateLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocateLicense(allocateLicenseRequest: AllocateLicenseRequest, options?: any): AxiosPromise { + return localVarFp.allocateLicense(allocateLicenseRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {ConfirmRequest} confirmRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + confirmUser(confirmRequest: ConfirmRequest, options?: any): AxiosPromise { + return localVarFp.confirmUser(confirmRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {ConfirmRequest} confirmRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + confirmUserAndInitPassword(confirmRequest: ConfirmRequest, options?: any): AxiosPromise { + return localVarFp.confirmUserAndInitPassword(confirmRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ライセンス割り当てを解除します + * @summary + * @param {DeallocateLicenseRequest} deallocateLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deallocateLicense(deallocateLicenseRequest: DeallocateLicenseRequest, options?: any): AxiosPromise { + return localVarFp.deallocateLicense(deallocateLicenseRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーに関連する各種情報を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRelations(options?: any): AxiosPromise { + return localVarFp.getRelations(options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーのタスクソート条件を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSortCriteria(options?: any): AxiosPromise { + return localVarFp.getSortCriteria(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUsers(options?: any): AxiosPromise { + return localVarFp.getUsers(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary + * @param {SignupRequest} signupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signup(signupRequest: SignupRequest, options?: any): AxiosPromise { + return localVarFp.signup(signupRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ログインしているユーザーのタスクソート条件を更新します + * @summary + * @param {PostSortCriteriaRequest} postSortCriteriaRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateSortCriteria(postSortCriteriaRequest: PostSortCriteriaRequest, options?: any): AxiosPromise { + return localVarFp.updateSortCriteria(postSortCriteriaRequest, options).then((request) => request(axios, basePath)); + }, + /** + * ユーザーの情報を更新します + * @summary + * @param {PostUpdateUserRequest} postUpdateUserRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(postUpdateUserRequest: PostUpdateUserRequest, options?: any): AxiosPromise { + return localVarFp.updateUser(postUpdateUserRequest, options).then((request) => request(axios, basePath)); + }, + }; }; /** @@ -5973,141 +5157,123 @@ export const UsersApiFactory = function ( * @extends {BaseAPI} */ export class UsersApi extends BaseAPI { - /** - * ライセンスを割り当てます - * @summary - * @param {AllocateLicenseRequest} allocateLicenseRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public allocateLicense( - allocateLicenseRequest: AllocateLicenseRequest, - options?: AxiosRequestConfig - ) { - return UsersApiFp(this.configuration) - .allocateLicense(allocateLicenseRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ライセンスを割り当てます + * @summary + * @param {AllocateLicenseRequest} allocateLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public allocateLicense(allocateLicenseRequest: AllocateLicenseRequest, options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).allocateLicense(allocateLicenseRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {ConfirmRequest} confirmRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public confirmUser( - confirmRequest: ConfirmRequest, - options?: AxiosRequestConfig - ) { - return UsersApiFp(this.configuration) - .confirmUser(confirmRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {ConfirmRequest} confirmRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public confirmUser(confirmRequest: ConfirmRequest, options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).confirmUser(confirmRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {ConfirmRequest} confirmRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public confirmUserAndInitPassword( - confirmRequest: ConfirmRequest, - options?: AxiosRequestConfig - ) { - return UsersApiFp(this.configuration) - .confirmUserAndInitPassword(confirmRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {ConfirmRequest} confirmRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public confirmUserAndInitPassword(confirmRequest: ConfirmRequest, options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).confirmUserAndInitPassword(confirmRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * ログインしているユーザーに関連する各種情報を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public getRelations(options?: AxiosRequestConfig) { - return UsersApiFp(this.configuration) - .getRelations(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ライセンス割り当てを解除します + * @summary + * @param {DeallocateLicenseRequest} deallocateLicenseRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public deallocateLicense(deallocateLicenseRequest: DeallocateLicenseRequest, options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).deallocateLicense(deallocateLicenseRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * ログインしているユーザーのタスクソート条件を取得します - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public getSortCriteria(options?: AxiosRequestConfig) { - return UsersApiFp(this.configuration) - .getSortCriteria(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ログインしているユーザーに関連する各種情報を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public getRelations(options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).getRelations(options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public getUsers(options?: AxiosRequestConfig) { - return UsersApiFp(this.configuration) - .getUsers(options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ログインしているユーザーのタスクソート条件を取得します + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public getSortCriteria(options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).getSortCriteria(options).then((request) => request(this.axios, this.basePath)); + } - /** - * - * @summary - * @param {SignupRequest} signupRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public signup(signupRequest: SignupRequest, options?: AxiosRequestConfig) { - return UsersApiFp(this.configuration) - .signup(signupRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public getUsers(options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).getUsers(options).then((request) => request(this.axios, this.basePath)); + } - /** - * ログインしているユーザーのタスクソート条件を更新します - * @summary - * @param {PostSortCriteriaRequest} postSortCriteriaRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public updateSortCriteria( - postSortCriteriaRequest: PostSortCriteriaRequest, - options?: AxiosRequestConfig - ) { - return UsersApiFp(this.configuration) - .updateSortCriteria(postSortCriteriaRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * + * @summary + * @param {SignupRequest} signupRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public signup(signupRequest: SignupRequest, options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).signup(signupRequest, options).then((request) => request(this.axios, this.basePath)); + } - /** - * ユーザーの情報を更新します - * @summary - * @param {PostUpdateUserRequest} postUpdateUserRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public updateUser( - postUpdateUserRequest: PostUpdateUserRequest, - options?: AxiosRequestConfig - ) { - return UsersApiFp(this.configuration) - .updateUser(postUpdateUserRequest, options) - .then((request) => request(this.axios, this.basePath)); - } + /** + * ログインしているユーザーのタスクソート条件を更新します + * @summary + * @param {PostSortCriteriaRequest} postSortCriteriaRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public updateSortCriteria(postSortCriteriaRequest: PostSortCriteriaRequest, options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).updateSortCriteria(postSortCriteriaRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * ユーザーの情報を更新します + * @summary + * @param {PostUpdateUserRequest} postUpdateUserRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UsersApi + */ + public updateUser(postUpdateUserRequest: PostUpdateUserRequest, options?: AxiosRequestConfig) { + return UsersApiFp(this.configuration).updateUser(postUpdateUserRequest, options).then((request) => request(this.axios, this.basePath)); + } } + + + diff --git a/dictation_client/src/api/common.ts b/dictation_client/src/api/common.ts index c6c9897..0e1c39c 100644 --- a/dictation_client/src/api/common.ts +++ b/dictation_client/src/api/common.ts @@ -144,7 +144,7 @@ export const toPathString = function (url: URL) { */ 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: (configuration?.basePath || basePath) + axiosArgs.url}; + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || axios.defaults.baseURL || basePath) + axiosArgs.url}; return axios.request(axiosRequestArgs); }; } diff --git a/dictation_client/src/common/errors/code.ts b/dictation_client/src/common/errors/code.ts index d2de6df..241d0be 100644 --- a/dictation_client/src/common/errors/code.ts +++ b/dictation_client/src/common/errors/code.ts @@ -46,4 +46,9 @@ export const errorCodes = [ "E010804", // ライセンス数不足エラー "E010805", // ライセンス有効期限切れエラー "E010806", // ライセンス割り当て不可エラー + "E010807", // ライセンス割り当て解除不可エラー + "E010808", // ライセンス注文キャンセル不可エラー + "E010809", // ライセンス発行キャンセル不可エラー(ステータスが変えられている場合) + "E010810", // ライセンス発行キャンセル不可エラー(発行から一定期間経過した場合) + "E010811", // ライセンス発行キャンセル不可エラー(発行したライセンスが割り当てされている場合) ] as const; diff --git a/dictation_client/src/features/license/licenseOrderHistory/licenseOrderHistorySlice.ts b/dictation_client/src/features/license/licenseOrderHistory/licenseOrderHistorySlice.ts index 27d5771..b00f781 100644 --- a/dictation_client/src/features/license/licenseOrderHistory/licenseOrderHistorySlice.ts +++ b/dictation_client/src/features/license/licenseOrderHistory/licenseOrderHistorySlice.ts @@ -1,6 +1,11 @@ import { PayloadAction, createSlice } from "@reduxjs/toolkit"; import { LicenseOrderHistoryState } from "./state"; -import { getLicenseOrderHistoriesAsync, issueLicenseAsync } from "./operations"; +import { + getLicenseOrderHistoriesAsync, + issueLicenseAsync, + cancelOrderAsync, + cancelIssueAsync, +} from "./operations"; import { LIMIT_ORDER_HISORY_NUM } from "./constants"; const initialState: LicenseOrderHistoryState = { @@ -61,6 +66,24 @@ export const licenseOrderHistorySlice = createSlice({ builder.addCase(issueLicenseAsync.rejected, (state) => { state.apps.isLoading = false; }); + builder.addCase(cancelOrderAsync.pending, (state) => { + state.apps.isLoading = true; + }); + builder.addCase(cancelOrderAsync.fulfilled, (state) => { + state.apps.isLoading = false; + }); + builder.addCase(cancelOrderAsync.rejected, (state) => { + state.apps.isLoading = false; + }); + builder.addCase(cancelIssueAsync.pending, (state) => { + state.apps.isLoading = true; + }); + builder.addCase(cancelIssueAsync.fulfilled, (state) => { + state.apps.isLoading = false; + }); + builder.addCase(cancelIssueAsync.rejected, (state) => { + state.apps.isLoading = false; + }); }, }); diff --git a/dictation_client/src/features/license/licenseOrderHistory/operations.ts b/dictation_client/src/features/license/licenseOrderHistory/operations.ts index c6dfd9f..1252700 100644 --- a/dictation_client/src/features/license/licenseOrderHistory/operations.ts +++ b/dictation_client/src/features/license/licenseOrderHistory/operations.ts @@ -2,7 +2,7 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; import type { RootState } from "app/store"; import { getTranslationID } from "translation"; import { openSnackbar } from "features/ui/uiSlice"; -import { AccountsApi } from "../../../api/api"; +import { AccountsApi, LicensesApi } from "../../../api/api"; import { Configuration } from "../../../api/configuration"; import { ErrorObject, createErrorObject } from "../../../common/errors"; import { OrderHistoryView } from "./types"; @@ -141,3 +141,137 @@ export const issueLicenseAsync = createAsyncThunk< return thunkApi.rejectWithValue({ error }); } }); + +export const cancelOrderAsync = createAsyncThunk< + { + /* Empty Object */ + }, + { + // パラメータ + poNumber: string; + }, + { + // rejectした時の返却値の型 + rejectValue: { + error: ErrorObject; + }; + } +>("licenses/cancelOrderAsync", async (args, thunkApi) => { + const { poNumber } = args; + // apiのConfigurationを取得する + const { getState } = thunkApi; + const state = getState() as RootState; + const { configuration, accessToken } = state.auth; + const config = new Configuration(configuration); + const licensesApi = new LicensesApi(config); + + try { + await licensesApi.cancelOrder( + { + poNumber, + }, + { + headers: { authorization: `Bearer ${accessToken}` }, + } + ); + thunkApi.dispatch( + openSnackbar({ + level: "info", + message: getTranslationID("common.message.success"), + }) + ); + return {}; + } catch (e) { + // e ⇒ errorObjectに変換" + const error = createErrorObject(e); + + let errorMessage = getTranslationID("common.message.internalServerError"); + + if (error.code === "E010808") { + errorMessage = getTranslationID( + "orderHistoriesPage.message.alreadyLicenseIssueOrCancel" + ); + } + thunkApi.dispatch( + openSnackbar({ + level: "error", + message: errorMessage, + }) + ); + + return thunkApi.rejectWithValue({ error }); + } +}); + +export const cancelIssueAsync = createAsyncThunk< + { + /* Empty Object */ + }, + { + // パラメータ + orderedAccountId: number; + poNumber: string; + }, + { + // rejectした時の返却値の型 + rejectValue: { + error: ErrorObject; + }; + } +>("licenses/cancelIssueAsync", async (args, thunkApi) => { + const { orderedAccountId, poNumber } = args; + // apiのConfigurationを取得する + const { getState } = thunkApi; + const state = getState() as RootState; + const { configuration, accessToken } = state.auth; + const config = new Configuration(configuration); + const accountsApi = new AccountsApi(config); + + try { + await accountsApi.cancelIssue( + { + orderedAccountId, + poNumber, + }, + { + headers: { authorization: `Bearer ${accessToken}` }, + } + ); + thunkApi.dispatch( + openSnackbar({ + level: "info", + message: getTranslationID("common.message.success"), + }) + ); + return {}; + } catch (e) { + // e ⇒ errorObjectに変換" + const error = createErrorObject(e); + + let errorMessage = getTranslationID("common.message.internalServerError"); + + if (error.code === "E000108") { + errorMessage = getTranslationID("common.message.permissionDeniedError"); + } else if (error.code === "E010809") { + errorMessage = getTranslationID( + "orderHistoriesPage.message.alreadyLicenseStatusChanged" + ); + } else if (error.code === "E010810") { + errorMessage = getTranslationID( + "orderHistoriesPage.message.expiredSinceIssued" + ); + } else if (error.code === "E010811") { + errorMessage = getTranslationID( + "orderHistoriesPage.message.alreadyLicenseAllocated" + ); + } + thunkApi.dispatch( + openSnackbar({ + level: "error", + message: errorMessage, + }) + ); + + return thunkApi.rejectWithValue({ error }); + } +}); diff --git a/dictation_client/src/features/user/operations.ts b/dictation_client/src/features/user/operations.ts index 1cd1819..225fbfe 100644 --- a/dictation_client/src/features/user/operations.ts +++ b/dictation_client/src/features/user/operations.ts @@ -306,3 +306,67 @@ export const allocateLicenseAsync = createAsyncThunk< return thunkApi.rejectWithValue({ error }); } }); + +export const deallocateLicenseAsync = createAsyncThunk< + // 正常時の戻り値の型 + { + /* Empty Object */ + }, + // 引数 + { + userId: number; + }, + { + // rejectした時の返却値の型 + rejectValue: { + error: ErrorObject; + }; + } +>("users/deallocateLicenseAsync", async (args, thunkApi) => { + const { userId } = args; + + // apiのConfigurationを取得する + const { getState } = thunkApi; + const state = getState() as RootState; + const { configuration, accessToken } = state.auth; + const config = new Configuration(configuration); + const usersApi = new UsersApi(config); + + try { + await usersApi.deallocateLicense( + { + userId, + }, + { + headers: { authorization: `Bearer ${accessToken}` }, + } + ); + thunkApi.dispatch( + openSnackbar({ + level: "info", + message: getTranslationID("common.message.success"), + }) + ); + return {}; + } catch (e) { + // e ⇒ errorObjectに変換 + const error = createErrorObject(e); + + let errorMessage = getTranslationID("common.message.internalServerError"); + + if (error.code === "E010807") { + errorMessage = getTranslationID( + "userListPage.message.alreadyLicenseDeallocatedError" + ); + } + + thunkApi.dispatch( + openSnackbar({ + level: "error", + message: errorMessage, + }) + ); + + return thunkApi.rejectWithValue({ error }); + } +}); diff --git a/dictation_client/src/features/user/userSlice.ts b/dictation_client/src/features/user/userSlice.ts index a3270ca..6d64137 100644 --- a/dictation_client/src/features/user/userSlice.ts +++ b/dictation_client/src/features/user/userSlice.ts @@ -6,6 +6,7 @@ import { listUsersAsync, updateUserAsync, getAllocatableLicensesAsync, + deallocateLicenseAsync, } from "./operations"; import { RoleType, UserView } from "./types"; @@ -298,6 +299,15 @@ export const userSlice = createSlice({ builder.addCase(getAllocatableLicensesAsync.rejected, (state) => { state.apps.isLoading = false; }); + builder.addCase(deallocateLicenseAsync.pending, (state) => { + state.apps.isLoading = true; + }); + builder.addCase(deallocateLicenseAsync.fulfilled, (state) => { + state.apps.isLoading = false; + }); + builder.addCase(deallocateLicenseAsync.rejected, (state) => { + state.apps.isLoading = false; + }); }, }); diff --git a/dictation_client/src/features/workflow/typistGroup/operations.ts b/dictation_client/src/features/workflow/typistGroup/operations.ts index 1bc4422..e741635 100644 --- a/dictation_client/src/features/workflow/typistGroup/operations.ts +++ b/dictation_client/src/features/workflow/typistGroup/operations.ts @@ -2,7 +2,14 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; import type { RootState } from "app/store"; import { openSnackbar } from "features/ui/uiSlice"; import { getTranslationID } from "translation"; -import { AccountsApi, GetTypistGroupsResponse } from "../../../api/api"; +import { + AccountsApi, + GetTypistGroupsResponse, + GetTypistsResponse, + CreateTypistGroupRequest, + Typist, + TypistGroup, +} from "../../../api/api"; import { Configuration } from "../../../api/configuration"; import { ErrorObject, createErrorObject } from "../../../common/errors"; @@ -15,7 +22,7 @@ export const listTypistGroupsAsync = createAsyncThunk< error: ErrorObject; }; } ->("dictations/listTypistGroupsAsync", async (args, thunkApi) => { +>("workflow/listTypistGroupsAsync", async (args, thunkApi) => { // apiのConfigurationを取得する const { getState } = thunkApi; const state = getState() as RootState; @@ -41,3 +48,205 @@ export const listTypistGroupsAsync = createAsyncThunk< return thunkApi.rejectWithValue({ error }); } }); + +export const listTypistsAsync = createAsyncThunk< + GetTypistsResponse, + void, + { + // rejectした時の返却値の型 + rejectValue: { + error: ErrorObject; + }; + } +>("workflow/listTypistsAsync", async (args, thunkApi) => { + // apiのConfigurationを取得する + const { getState } = thunkApi; + const state = getState() as RootState; + const { configuration, accessToken } = state.auth; + const config = new Configuration(configuration); + const accountsApi = new AccountsApi(config); + + try { + const typists = await accountsApi.getTypists({ + headers: { authorization: `Bearer ${accessToken}` }, + }); + + return typists.data; + } catch (e) { + // e ⇒ errorObjectに変換" + const error = createErrorObject(e); + thunkApi.dispatch( + openSnackbar({ + level: "error", + message: getTranslationID("common.message.internalServerError"), + }) + ); + return thunkApi.rejectWithValue({ error }); + } +}); + +export const createTypistGroupAsync = createAsyncThunk< + { + /* Empty Object */ + }, + CreateTypistGroupRequest, + { + // rejectした時の返却値の型 + rejectValue: { + error: ErrorObject; + }; + } +>("workflow/createTypistGroupAsync", async (args, thunkApi) => { + // apiのConfigurationを取得する + const { getState } = thunkApi; + const state = getState() as RootState; + const { configuration, accessToken } = state.auth; + const config = new Configuration(configuration); + const accountsApi = new AccountsApi(config); + + try { + await accountsApi.createTypistGroup(args, { + headers: { authorization: `Bearer ${accessToken}` }, + }); + thunkApi.dispatch( + openSnackbar({ + level: "info", + message: getTranslationID("common.message.success"), + }) + ); + return {}; + } catch (e) { + // e ⇒ errorObjectに変換" + const error = createErrorObject(e); + + const message = + error.statusCode === 400 + ? getTranslationID("typistGroupSetting.message.groupSaveFailedError") + : getTranslationID("common.message.internalServerError"); + + thunkApi.dispatch( + openSnackbar({ + level: "error", + message, + }) + ); + return thunkApi.rejectWithValue({ error }); + } +}); + +export const getTypistGroupAsync = createAsyncThunk< + { + typists: Typist[]; + typistGroup: TypistGroup; + selectedTypistIds: number[]; + }, + { typistGroupId: number }, + { + // rejectした時の返却値の型 + rejectValue: { + error: ErrorObject; + }; + } +>("workflow/getTypistGroupAsync", async (args, thunkApi) => { + const { typistGroupId } = args; + // apiのConfigurationを取得する + const { getState } = thunkApi; + const state = getState() as RootState; + const { configuration, accessToken } = state.auth; + const config = new Configuration(configuration); + const accountsApi = new AccountsApi(config); + + try { + // タイピスト取得処理が別にあるが、storeの状態を意識せずに処理を行うためにここで取得する + const { typists } = ( + await accountsApi.getTypists({ + headers: { authorization: `Bearer ${accessToken}` }, + }) + ).data; + const { typistGroupName, typistIds } = ( + await accountsApi.getTypistGroup(typistGroupId, { + headers: { authorization: `Bearer ${accessToken}` }, + }) + ).data; + return { + typists, + typistGroup: { id: typistGroupId, name: typistGroupName }, + selectedTypistIds: typistIds, + }; + } catch (e) { + // e ⇒ errorObjectに変換" + const error = createErrorObject(e); + + const message = getTranslationID("common.message.internalServerError"); + + thunkApi.dispatch( + openSnackbar({ + level: "error", + message, + }) + ); + return thunkApi.rejectWithValue({ error }); + } +}); + +export const updateTypistGroupAsync = createAsyncThunk< + { + /* Empty Object */ + }, + void, + { + // rejectした時の返却値の型 + rejectValue: { + error: ErrorObject; + }; + } +>("workflow/updateTypistGroupAsync", async (args, thunkApi) => { + // apiのConfigurationを取得する + const { getState } = thunkApi; + const state = getState() as RootState; + const { configuration, accessToken } = state.auth; + const { updateTypistGroupId, selectedTypists, groupName } = + state.typistGroup.apps; + const config = new Configuration(configuration); + const accountsApi = new AccountsApi(config); + if (!updateTypistGroupId) { + throw new Error("updateTypistGroupId is undefined."); + } + + try { + await accountsApi.updateTypistGroup( + updateTypistGroupId, + { + typistGroupName: groupName, + typistIds: selectedTypists.map((x) => x.id), + }, + { + headers: { authorization: `Bearer ${accessToken}` }, + } + ); + + thunkApi.dispatch( + openSnackbar({ + level: "info", + message: getTranslationID("common.message.success"), + }) + ); + return {}; + } catch (e) { + // e ⇒ errorObjectに変換" + const error = createErrorObject(e); + + const message = + error.statusCode === 400 + ? getTranslationID("typistGroupSetting.message.groupSaveFailedError") + : getTranslationID("common.message.internalServerError"); + + thunkApi.dispatch( + openSnackbar({ + level: "error", + message, + }) + ); + return thunkApi.rejectWithValue({ error }); + } +}); diff --git a/dictation_client/src/features/workflow/typistGroup/selectors.ts b/dictation_client/src/features/workflow/typistGroup/selectors.ts index 8b37741..3cd824d 100644 --- a/dictation_client/src/features/workflow/typistGroup/selectors.ts +++ b/dictation_client/src/features/workflow/typistGroup/selectors.ts @@ -5,3 +5,25 @@ export const selectTypistGroups = (state: RootState) => export const selectIsLoading = (state: RootState) => state.typistGroup.apps.isLoading; + +export const selectTypists = (state: RootState) => + state.typistGroup.domain.typists; + +export const selectPoolTypists = (state: RootState) => + state.typistGroup.domain.typists.filter( + (t) => !state.typistGroup.apps.selectedTypists.some((x) => t.id === x.id) + ); + +export const selectSelectedTypists = (state: RootState) => + state.typistGroup.apps.selectedTypists; + +export const selectGroupName = (state: RootState) => + state.typistGroup.apps.groupName; + +export const selectAddGroupErrors = (state: RootState) => { + const hasErrorEmptyGroupName = state.typistGroup.apps.groupName === ""; + const hasErrorSelectedTypistsEmpty = + state.typistGroup.apps.selectedTypists.length === 0; + + return { hasErrorEmptyGroupName, hasErrorSelectedTypistsEmpty }; +}; diff --git a/dictation_client/src/features/workflow/typistGroup/state.ts b/dictation_client/src/features/workflow/typistGroup/state.ts index a714e0b..d38d238 100644 --- a/dictation_client/src/features/workflow/typistGroup/state.ts +++ b/dictation_client/src/features/workflow/typistGroup/state.ts @@ -1,4 +1,4 @@ -import { TypistGroup } from "../../../api/api"; +import { Typist, TypistGroup } from "../../../api/api"; export interface TypistGroupState { apps: Apps; @@ -7,8 +7,12 @@ export interface TypistGroupState { export interface Apps { isLoading: boolean; + selectedTypists: Typist[]; + groupName: string; + updateTypistGroupId?: number; } export interface Domain { typistGroups: TypistGroup[]; + typists: Typist[]; } diff --git a/dictation_client/src/features/workflow/typistGroup/typistGroupSlice.ts b/dictation_client/src/features/workflow/typistGroup/typistGroupSlice.ts index 02feb96..1574a3f 100644 --- a/dictation_client/src/features/workflow/typistGroup/typistGroupSlice.ts +++ b/dictation_client/src/features/workflow/typistGroup/typistGroupSlice.ts @@ -1,20 +1,61 @@ -import { createSlice } from "@reduxjs/toolkit"; +import { PayloadAction, createSlice } from "@reduxjs/toolkit"; +import { Typist } from "api"; import { TypistGroupState } from "./state"; -import { listTypistGroupsAsync } from "./operations"; +import { + getTypistGroupAsync, + listTypistGroupsAsync, + listTypistsAsync, + updateTypistGroupAsync, +} from "./operations"; const initialState: TypistGroupState = { apps: { isLoading: false, + selectedTypists: [], + groupName: "", }, domain: { typistGroups: [], + typists: [], }, }; export const typistGroupSlice = createSlice({ name: "typistGroup", initialState, - reducers: {}, + reducers: { + cleanupTypistGroup: (state) => { + state.apps.groupName = ""; + state.apps.selectedTypists = []; + state.apps.updateTypistGroupId = undefined; + state.domain.typists = []; + }, + addSelectedTypist: (state, action: PayloadAction<{ typist: Typist }>) => { + const { typist } = action.payload; + + const selectedTypists = [...state.apps.selectedTypists, typist]; + if (!state.apps.selectedTypists.find((x) => x.id === typist.id)) { + state.apps.selectedTypists = selectedTypists.sort( + (a, b) => a.id - b.id + ); + } + }, + removeSelectedTypist: ( + state, + action: PayloadAction<{ typist: Typist }> + ) => { + const { typist } = action.payload; + + const selectedTypists = state.apps.selectedTypists.filter( + (x) => x.id !== typist.id + ); + state.apps.selectedTypists = selectedTypists.sort((a, b) => a.id - b.id); + }, + changeGroupName: (state, action: PayloadAction<{ groupName: string }>) => { + const { groupName } = action.payload; + state.apps.groupName = groupName; + }, + }, extraReducers: (builder) => { builder.addCase(listTypistGroupsAsync.pending, (state) => { state.apps.isLoading = true; @@ -26,7 +67,53 @@ export const typistGroupSlice = createSlice({ builder.addCase(listTypistGroupsAsync.rejected, (state) => { state.apps.isLoading = false; }); + builder.addCase(listTypistsAsync.pending, (state) => { + state.apps.isLoading = true; + }); + builder.addCase(listTypistsAsync.fulfilled, (state, action) => { + state.domain.typists = action.payload.typists; + state.apps.isLoading = false; + }); + builder.addCase(listTypistsAsync.rejected, (state) => { + state.apps.isLoading = false; + }); + builder.addCase(getTypistGroupAsync.rejected, (state) => { + state.apps.isLoading = false; + }); + builder.addCase(getTypistGroupAsync.pending, (state) => { + state.apps.isLoading = true; + }); + builder.addCase(getTypistGroupAsync.fulfilled, (state, action) => { + const { typistGroup, selectedTypistIds, typists } = action.payload; + // 対象タイピストグループのID・名前を設定 + state.apps.updateTypistGroupId = typistGroup.id; + state.apps.groupName = typistGroup.name; + + // 選択済みのタイピストを設定 + state.apps.selectedTypists = typists + .filter((x) => selectedTypistIds.includes(x.id)) + .sort((a, b) => a.id - b.id); + // すべてのタイピストを設定 + state.domain.typists = typists; + state.apps.isLoading = false; + }); + builder.addCase(updateTypistGroupAsync.pending, (state) => { + state.apps.isLoading = true; + }); + builder.addCase(updateTypistGroupAsync.fulfilled, (state) => { + state.apps.isLoading = false; + }); + builder.addCase(updateTypistGroupAsync.rejected, (state) => { + state.apps.isLoading = false; + }); }, }); +export const { + cleanupTypistGroup, + addSelectedTypist, + removeSelectedTypist, + changeGroupName, +} = typistGroupSlice.actions; + export default typistGroupSlice.reducer; diff --git a/dictation_client/src/pages/LicensePage/licenseOrderHistory.tsx b/dictation_client/src/pages/LicensePage/licenseOrderHistory.tsx index ce8beb8..8b82ca7 100644 --- a/dictation_client/src/pages/LicensePage/licenseOrderHistory.tsx +++ b/dictation_client/src/pages/LicensePage/licenseOrderHistory.tsx @@ -1,6 +1,8 @@ /* eslint-disable jsx-a11y/control-has-associated-label */ import React, { useCallback, useEffect } from "react"; import { UpdateTokenTimer } from "components/auth/updateTokenTimer"; +import { isApproveTier } from "features/auth/utils"; +import { TIERS } from "components/auth/constants"; import Footer from "components/footer"; import Header from "components/header"; import styles from "styles/app.module.scss"; @@ -18,9 +20,11 @@ import { selectTotal, selectTotalPage, issueLicenseAsync, + cancelOrderAsync, selectOffset, savePageInfo, selectCompanyName, + cancelIssueAsync, } from "features/license/licenseOrderHistory"; import { selectSelectedRow } from "features/license/partnerLicense"; import undo from "../../assets/images/undo.svg"; @@ -85,6 +89,49 @@ export const LicenseOrderHistory: React.FC = ( [dispatch] ); + // Order Cancelボタンを押下時の処理 + const onCancelOrder = useCallback( + async (poNumber: string) => { + // ダイアログ確認 + // eslint-disable-next-line no-alert + if (window.confirm(t(getTranslationID("common.message.dialogConfirm")))) { + // ライセンス注文キャンセルAPIの呼び出し + const { meta } = await dispatch( + cancelOrderAsync({ + poNumber, + }) + ); + if (meta.requestStatus === "fulfilled") { + UpdateHistoriesList(); + } + } + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [dispatch] + ); + + // Issue Cancelボタンを押下時の処理 + const onCancelIssue = useCallback( + async (orderedAccountId: number, poNumber: string) => { + // ダイアログ確認 + // eslint-disable-next-line no-alert + if (window.confirm(t(getTranslationID("common.message.dialogConfirm")))) { + // ライセンス発行キャンセルAPIの呼び出し + const { meta } = await dispatch( + cancelIssueAsync({ + orderedAccountId, + poNumber, + }) + ); + if (meta.requestStatus === "fulfilled") { + UpdateHistoriesList(); + } + } + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [dispatch] + ); + // ページネーションのボタンクリック時のアクション const movePage = (targetOffset: number) => { dispatch( @@ -207,12 +254,16 @@ export const LicenseOrderHistory: React.FC = ( className={`${styles.menuAction} ${styles.inTable}`} >
  • + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */} { + onCancelOrder(x.poNumber); + }} > {t( getTranslationID( @@ -231,7 +282,12 @@ export const LicenseOrderHistory: React.FC = ( {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} 1 && + isApproveTier([ + (selectedRow.tier - 1).toString(), + ]) ? styles.isActive : "" }`} @@ -248,12 +304,21 @@ export const LicenseOrderHistory: React.FC = (
  • + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} { + event.preventDefault(); + onCancelIssue( + selectedRow.accountId, + x.poNumber + ); + }} > {t( getTranslationID( @@ -345,4 +410,10 @@ export const LicenseOrderHistory: React.FC = ( ); }; +// isIssueCanceボタンが表示できる階層かどうかを判定する +const isIssueCancelVisibleTier = (selectedRowsTier: number) => + // 自アカウントが階層1または2、かつ対象が階層5の場合ボタン表示 + isApproveTier([TIERS.TIER1, TIERS.TIER2]) && + TIERS.TIER5 === selectedRowsTier.toString(); + export default LicenseOrderHistory; diff --git a/dictation_client/src/pages/TypistGroupSettingPage/addTypistGroupPopup.tsx b/dictation_client/src/pages/TypistGroupSettingPage/addTypistGroupPopup.tsx new file mode 100644 index 0000000..484522b --- /dev/null +++ b/dictation_client/src/pages/TypistGroupSettingPage/addTypistGroupPopup.tsx @@ -0,0 +1,203 @@ +import React, { useCallback, useEffect, useState } from "react"; +import styles from "styles/app.module.scss"; +import { useDispatch, useSelector } from "react-redux"; +import { Typist } from "api"; +import { AppDispatch } from "app/store"; +import { getTranslationID } from "translation"; +import { useTranslation } from "react-i18next"; +import { + addSelectedTypist, + listTypistsAsync, + removeSelectedTypist, + selectPoolTypists, + selectSelectedTypists, + selectGroupName, + changeGroupName, + selectAddGroupErrors, + cleanupTypistGroup, +} from "features/workflow/typistGroup"; +import { + createTypistGroupAsync, + listTypistGroupsAsync, +} from "features/workflow/typistGroup/operations"; +import { openSnackbar } from "features/ui"; +import close from "../../assets/images/close.svg"; + +interface AddTypistGroupPopupProps { + onClose: (isChanged: boolean) => void; + isOpen: boolean; +} + +export const AddTypistGroupPopup: React.FC = ( + props +) => { + const { onClose, isOpen } = props; + const dispatch: AppDispatch = useDispatch(); + const [t] = useTranslation(); + + const [isPushAddButton, setIsPushAddButton] = useState(false); + + const poolTypists = useSelector(selectPoolTypists); + const selectedTypists = useSelector(selectSelectedTypists); + const groupName = useSelector(selectGroupName); + + const { hasErrorEmptyGroupName, hasErrorSelectedTypistsEmpty } = + useSelector(selectAddGroupErrors); + + // 開閉時のみ実行 + useEffect(() => { + if (isOpen) { + dispatch(listTypistsAsync()); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isOpen]); + + // ポップアップを閉じる処理 + const closePopup = useCallback(() => { + setIsPushAddButton(false); + onClose(false); + dispatch(cleanupTypistGroup()); + }, [dispatch, onClose]); + + // グループ追加を実行 + const addTypistGroup = useCallback(async () => { + setIsPushAddButton(true); + // 入力チェック + if (hasErrorEmptyGroupName || hasErrorSelectedTypistsEmpty) { + if (hasErrorSelectedTypistsEmpty) { + dispatch( + openSnackbar({ + level: "error", + message: t( + getTranslationID( + "typistGroupSetting.message.selectedTypistEmptyError" + ) + ), + }) + ); + } + return; + } + + // グループ追加APIを実行 + const { meta } = await dispatch( + createTypistGroupAsync({ + typistGroupName: groupName, + typistIds: selectedTypists.map((typist) => typist.id), + }) + ); + setIsPushAddButton(false); + if (meta.requestStatus === "fulfilled") { + closePopup(); + dispatch(listTypistGroupsAsync()); + } + }, [ + t, + closePopup, + dispatch, + groupName, + selectedTypists, + hasErrorEmptyGroupName, + hasErrorSelectedTypistsEmpty, + ]); + + return ( +
    +
    +

    + {t(getTranslationID("typistGroupSetting.label.addTypistGroup"))} + +

    +
    +
    +
    +
    {t(getTranslationID("typistGroupSetting.label.groupName"))}
    +
    + + dispatch(changeGroupName({ groupName: e.target.value })) + } + /> + {isPushAddButton && hasErrorEmptyGroupName && ( + + {t(getTranslationID("common.message.inputEmptyError"))} + + )} +
    +
    + {t(getTranslationID("typistGroupSetting.label.transcriptionist"))} +
    +
    +
      +
    • + {t(getTranslationID("typistGroupSetting.label.selected"))} +
    • + {selectedTypists.map((typist: Typist) => ( +
    • + dispatch(removeSelectedTypist({ typist }))} + /> + +
    • + ))} +
    +

    +

      +
    • + {t(getTranslationID("typistGroupSetting.label.pool"))} +
    • + {poolTypists.map((typist: Typist) => ( +
    • + dispatch(addSelectedTypist({ typist }))} + /> + +
    • + ))} +
    +
    +
    + +
    +
    +
    +
    +
    + ); +}; diff --git a/dictation_client/src/pages/TypistGroupSettingPage/editTypistGroupPopup.tsx b/dictation_client/src/pages/TypistGroupSettingPage/editTypistGroupPopup.tsx new file mode 100644 index 0000000..a20c6c7 --- /dev/null +++ b/dictation_client/src/pages/TypistGroupSettingPage/editTypistGroupPopup.tsx @@ -0,0 +1,197 @@ +import React, { useCallback, useEffect, useState } from "react"; +import styles from "styles/app.module.scss"; +import { useDispatch, useSelector } from "react-redux"; +import { Typist } from "api"; +import { AppDispatch } from "app/store"; +import { getTranslationID } from "translation"; +import { useTranslation } from "react-i18next"; +import { + addSelectedTypist, + cleanupTypistGroup, + removeSelectedTypist, + selectPoolTypists, + selectSelectedTypists, + selectGroupName, + changeGroupName, + selectAddGroupErrors, +} from "features/workflow/typistGroup"; +import { + getTypistGroupAsync, + listTypistGroupsAsync, + updateTypistGroupAsync, +} from "features/workflow/typistGroup/operations"; +import { openSnackbar } from "features/ui"; +import close from "../../assets/images/close.svg"; + +interface EditTypistGroupPopupProps { + onClose: (isChanged: boolean) => void; + isOpen: boolean; + typistGroupId: number; +} + +export const EditTypistGroupPopup: React.FC = ( + props +) => { + const { onClose, isOpen, typistGroupId } = props; + const dispatch: AppDispatch = useDispatch(); + const [t] = useTranslation(); + + const [isPushEditButton, setIsPushEditButton] = useState(false); + + const poolTypists = useSelector(selectPoolTypists); + const selectedTypists = useSelector(selectSelectedTypists); + const groupName = useSelector(selectGroupName); + + const { hasErrorEmptyGroupName, hasErrorSelectedTypistsEmpty } = + useSelector(selectAddGroupErrors); + + // 表示時のみ実行 + useEffect(() => { + if (isOpen) { + dispatch(getTypistGroupAsync({ typistGroupId })); + } + }, [dispatch, isOpen, typistGroupId]); + + // ポップアップを閉じる処理 + const closePopup = useCallback(() => { + setIsPushEditButton(false); + onClose(false); + dispatch(cleanupTypistGroup()); + }, [dispatch, onClose]); + + // グループ更新を実行 + const editTypistGroup = useCallback(async () => { + setIsPushEditButton(true); + // 入力チェック + if (hasErrorEmptyGroupName || hasErrorSelectedTypistsEmpty) { + if (hasErrorSelectedTypistsEmpty) { + dispatch( + openSnackbar({ + level: "error", + message: t( + getTranslationID( + "typistGroupSetting.message.selectedTypistEmptyError" + ) + ), + }) + ); + } + return; + } + + // グループ追加APIを実行 + const { meta } = await dispatch(updateTypistGroupAsync()); + setIsPushEditButton(false); + if (meta.requestStatus === "fulfilled") { + closePopup(); + dispatch(listTypistGroupsAsync()); + dispatch(cleanupTypistGroup()); + } + }, [ + t, + closePopup, + dispatch, + hasErrorEmptyGroupName, + hasErrorSelectedTypistsEmpty, + ]); + + return ( +
    +
    +

    + {t(getTranslationID("typistGroupSetting.label.editTypistGroup"))} + +

    +
    +
    +
    +
    {t(getTranslationID("typistGroupSetting.label.groupName"))}
    +
    + + dispatch(changeGroupName({ groupName: e.target.value })) + } + /> + {isPushEditButton && hasErrorEmptyGroupName && ( + + {t(getTranslationID("common.message.inputEmptyError"))} + + )} +
    +
    + {t(getTranslationID("typistGroupSetting.label.transcriptionist"))} +
    +
    +
      +
    • + {t(getTranslationID("typistGroupSetting.label.selected"))} +
    • + {selectedTypists.map((typist: Typist) => ( +
    • + dispatch(removeSelectedTypist({ typist }))} + /> + +
    • + ))} +
    +

    +

      +
    • + {t(getTranslationID("typistGroupSetting.label.pool"))} +
    • + {poolTypists.map((typist: Typist) => ( +
    • + dispatch(addSelectedTypist({ typist }))} + /> + +
    • + ))} +
    +
    +
    + +
    +
    +
    +
    +
    + ); +}; diff --git a/dictation_client/src/pages/TypistGroupSettingPage/index.tsx b/dictation_client/src/pages/TypistGroupSettingPage/index.tsx index 73f7c90..2d17ff1 100644 --- a/dictation_client/src/pages/TypistGroupSettingPage/index.tsx +++ b/dictation_client/src/pages/TypistGroupSettingPage/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import React, { useCallback, useEffect, useState } from "react"; import Header from "components/header"; import Footer from "components/footer"; import styles from "styles/app.module.scss"; @@ -15,6 +15,8 @@ import { import { AppDispatch } from "app/store"; import { useTranslation } from "react-i18next"; import { getTranslationID } from "translation"; +import { AddTypistGroupPopup } from "./addTypistGroupPopup"; +import { EditTypistGroupPopup } from "./editTypistGroupPopup"; const TypistGroupSettingPage: React.FC = (): JSX.Element => { const dispatch: AppDispatch = useDispatch(); @@ -23,95 +25,135 @@ const TypistGroupSettingPage: React.FC = (): JSX.Element => { const isLoading = useSelector(selectIsLoading); const typistGroup = useSelector(selectTypistGroups); + const [isAddPopupOpen, setIsAddPopupOpen] = useState(false); + const [isEditPopupOpen, setIsEditPopupOpen] = useState(false); + const [editTypistGroupId, setEditTypistGroupId] = useState(NaN); + const onAddPopupOpen = useCallback(() => { + // typist一覧を取得 + setIsAddPopupOpen(true); + }, [setIsAddPopupOpen]); + + const onEditPopupOpen = useCallback( + (typistGroupId: number) => { + setEditTypistGroupId(typistGroupId); + setIsEditPopupOpen(true); + }, + [setIsEditPopupOpen] + ); + useEffect(() => { dispatch(listTypistGroupsAsync()); }, [dispatch]); return ( -
    -
    - -
    -
    -
    -

    - {t(getTranslationID("workflowPage.label.title"))} -

    -

    {` ${t( - getTranslationID("typistGroupSetting.label.title") - )}`}

    -
    - -
    -
    - - - - - - - - {!isLoading && typistGroup.length === 0 ? ( -

    - {t(getTranslationID("common.message.listEmpty"))} -

    - ) : ( - typistGroup.map((group) => ( - - - - - )) - )} -
    - {t(getTranslationID("typistGroupSetting.label.groupName"))} - {/** empty th */}
    {group.name} - -
    - {isLoading && ( - Loading - )} + <> + { + setIsAddPopupOpen(false); + }} + isOpen={isAddPopupOpen} + /> + { + setIsEditPopupOpen(false); + }} + isOpen={isEditPopupOpen} + typistGroupId={editTypistGroupId} + /> +
    +
    + +
    +
    +
    +

    + {t(getTranslationID("workflowPage.label.title"))} +

    +

    {` ${t( + getTranslationID("typistGroupSetting.label.title") + )}`}

    -
    -
    -
    -
    -
    + +
    +
    + + + + + + + + {!isLoading && typistGroup.length === 0 ? ( +

    + {t(getTranslationID("common.message.listEmpty"))} +

    + ) : ( + typistGroup.map((group) => ( + + + + + )) + )} +
    + {t( + getTranslationID("typistGroupSetting.label.groupName") + )} + {/** empty th */}
    {group.name} + +
    + {isLoading && ( + Loading + )} +
    +
    + + +
    + + ); }; diff --git a/dictation_client/src/pages/UserListPage/index.tsx b/dictation_client/src/pages/UserListPage/index.tsx index 9a04273..fa274e8 100644 --- a/dictation_client/src/pages/UserListPage/index.tsx +++ b/dictation_client/src/pages/UserListPage/index.tsx @@ -9,6 +9,7 @@ import { listUsersAsync, selectUserViews, selectIsLoading, + deallocateLicenseAsync, } from "features/user"; import { useTranslation } from "react-i18next"; import { getTranslationID } from "translation"; @@ -57,6 +58,24 @@ const UserListPage: React.FC = (): JSX.Element => { [setIsAllocateLicensePopupOpen, dispatch] ); + const onLicenseDeallocation = useCallback( + async (userId: number) => { + // ダイアログ確認 + if ( + /* eslint-disable-next-line no-alert */ + !window.confirm(t(getTranslationID("common.message.dialogConfirm"))) + ) { + return; + } + + const { meta } = await dispatch(deallocateLicenseAsync({ userId })); + if (meta.requestStatus === "fulfilled") { + dispatch(listUsersAsync()); + } + }, + [dispatch, t] + ); + useEffect(() => { // ユーザ一覧取得処理を呼び出す dispatch(listUsersAsync()); @@ -196,7 +215,18 @@ const UserListPage: React.FC = (): JSX.Element => {
  • - + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */} + { + onLicenseDeallocation(user.id); + }} + > {t( getTranslationID( "userListPage.label.licenseDeallocation" diff --git a/dictation_client/src/translation/de.json b/dictation_client/src/translation/de.json index a8407fd..8e2df7e 100644 --- a/dictation_client/src/translation/de.json +++ b/dictation_client/src/translation/de.json @@ -1,13 +1,14 @@ { "common": { "message": { - "inputEmptyError": "(de)Error Message", + "inputEmptyError": "(de)この項目の入力は必須です。入力してください。", "passwordIncorrectError": "(de)Error Message", "emailIncorrectError": "(de)Error Message", "internalServerError": "(de)処理に失敗しました。時間をおいて再実行しても解決しない場合はシステム管理者にお問い合わせください。", "listEmpty": "(de)検索結果が0件です。", "dialogConfirm": "(de)操作を実行しますか?", - "success": "(de)処理に成功しました。" + "success": "(de)処理に成功しました。", + "permissionDeniedError": "(de)操作を実行する権限がありません。" }, "label": { "cancel": "(de)Cancel", @@ -113,7 +114,8 @@ "authorIdConflictError": "(de)このAuthor IDは既に登録されています。他のAuthor IDで登録してください。", "authorIdIncorrectError": "(de)Author IDの形式が不正です。Author IDは半角英数字(大文字)と\"_\"のみ入力可能です。", "roleChangeError": "(de)Roleの変更に失敗しました。画面を更新して再度ユーザー情報を取得してください。", - "encryptionPasswordCorrectError": "(de)EncryptionPasswordがルールを満たしていません。" + "encryptionPasswordCorrectError": "(de)EncryptionPasswordがルールを満たしていません。", + "alreadyLicenseDeallocatedError": "(de)すでにライセンス割り当てが解除されています。画面を更新して再度ご確認下さい。" }, "label": { "title": "(de)User", @@ -235,7 +237,7 @@ "deleteDictation": "(de)Delete Dictation", "selectedTranscriptionist": "(de)Selected", "poolTranscriptionist": "(de)Pool", - "saveChanges": "(de)Save changes" + "saveChanges": "(de)Save" } }, "cardLicenseIssuePopupPage": { @@ -328,7 +330,11 @@ }, "message": { "notEnoughOfNumberOfLicense": "(de)ライセンスが不足しているため、発行することができませんでした。ライセンスの注文を行ってください。", - "alreadyIssueLicense": "(de)すでに発行済みの注文です。画面を更新してください。" + "alreadyIssueLicense": "(de)すでに発行済みの注文です。画面を更新してください。", + "alreadyLicenseIssueOrCancel": "(de)ライセンス注文のキャンセルに失敗しました。選択された注文はすでに発行またはキャンセルされています。画面を更新して再度ご確認ください。", + "alreadyLicenseStatusChanged": "(de)ライセンス発行のキャンセルに失敗しました。選択された注文の状態が変更されています。画面を更新して再度ご確認ください。", + "expiredSinceIssued": "(de)発行日から一定期間経過しているため、発行キャンセルできません。", + "alreadyLicenseAllocated": "(de)発行したライセンスがすでに割り当てられたため、発行キャンセルできません。" } }, "allocateLicensePopupPage": { @@ -364,7 +370,19 @@ "return": "(de)Return", "addGroup": "(de)Add Group", "groupName": "(de)Group Name", - "edit": "(de)Edit" + "edit": "(de)Edit", + "addTypistGroup": "(de)Add Transcriptionist Group", + "transcriptionist": "(de)Transcriptionist", + "selected": "(de)Selected", + "pool": "(de)Pool", + "add": "(de)Add", + "remove": "(de)Remove", + "editTypistGroup": "(de)Edit Transcriptionist Group", + "save": "(de)Save" + }, + "message": { + "selectedTypistEmptyError": "(de)TranscriptionistがいないTranscriptionistGroupは保存できません。1名以上をTranscriptionistとして選択してください。", + "groupSaveFailedError": "(de)TypistGroupの保存に失敗しました。画面を更新し、再度実行してください" } } -} \ No newline at end of file +} diff --git a/dictation_client/src/translation/en.json b/dictation_client/src/translation/en.json index 723c04f..47be47a 100644 --- a/dictation_client/src/translation/en.json +++ b/dictation_client/src/translation/en.json @@ -1,13 +1,14 @@ { "common": { "message": { - "inputEmptyError": "Error Message", + "inputEmptyError": "この項目の入力は必須です。入力してください。", "passwordIncorrectError": "Error Message", "emailIncorrectError": "Error Message", "internalServerError": "処理に失敗しました。時間をおいて再実行しても解決しない場合はシステム管理者にお問い合わせください。", "listEmpty": "検索結果が0件です。", "dialogConfirm": "操作を実行しますか?", - "success": "処理に成功しました。" + "success": "処理に成功しました。", + "permissionDeniedError": "操作を実行する権限がありません。" }, "label": { "cancel": "Cancel", @@ -113,7 +114,8 @@ "authorIdConflictError": "このAuthor IDは既に登録されています。他のAuthor IDで登録してください。", "authorIdIncorrectError": "Author IDの形式が不正です。Author IDは半角英数字(大文字)と\"_\"のみ入力可能です。", "roleChangeError": "Roleの変更に失敗しました。画面を更新して再度ユーザー情報を取得してください。", - "encryptionPasswordCorrectError": "EncryptionPasswordがルールを満たしていません。" + "encryptionPasswordCorrectError": "EncryptionPasswordがルールを満たしていません。", + "alreadyLicenseDeallocatedError": "すでにライセンス割り当てが解除されています。画面を更新して再度ご確認下さい。" }, "label": { "title": "User", @@ -235,7 +237,7 @@ "deleteDictation": "Delete Dictation", "selectedTranscriptionist": "Selected", "poolTranscriptionist": "Pool", - "saveChanges": "Save changes" + "saveChanges": "Save" } }, "cardLicenseIssuePopupPage": { @@ -328,7 +330,11 @@ }, "message": { "notEnoughOfNumberOfLicense": "ライセンスが不足しているため、発行することができませんでした。ライセンスの注文を行ってください。", - "alreadyIssueLicense": "すでに発行済みの注文です。画面を更新してください。" + "alreadyIssueLicense": "すでに発行済みの注文です。画面を更新してください。", + "alreadyLicenseIssueOrCancel": "ライセンス注文のキャンセルに失敗しました。選択された注文はすでに発行またはキャンセルされています。画面を更新して再度ご確認ください。", + "alreadyLicenseStatusChanged": "ライセンス発行のキャンセルに失敗しました。選択された注文の状態が変更されています。画面を更新して再度ご確認ください。", + "expiredSinceIssued": "発行日から一定期間経過しているため、発行キャンセルできません。", + "alreadyLicenseAllocated": "発行したライセンスがすでに割り当てられたため、発行キャンセルできません。" } }, "allocateLicensePopupPage": { @@ -364,7 +370,19 @@ "return": "Return", "addGroup": "Add Group", "groupName": "Group Name", - "edit": "Edit" + "edit": "Edit", + "addTypistGroup": "Add Transcriptionist Group", + "transcriptionist": "Transcriptionist", + "selected": "Selected", + "pool": "Pool", + "add": "Add", + "remove": "Remove", + "editTypistGroup": "Edit Transcriptionist Group", + "save": "Save" + }, + "message": { + "selectedTypistEmptyError": "TranscriptionistがいないTranscriptionistGroupは保存できません。1名以上をTranscriptionistとして選択してください。", + "groupSaveFailedError": "TypistGroupの保存に失敗しました。画面を更新し、再度実行してください" } } -} \ No newline at end of file +} diff --git a/dictation_client/src/translation/es.json b/dictation_client/src/translation/es.json index 6affad2..5fcb345 100644 --- a/dictation_client/src/translation/es.json +++ b/dictation_client/src/translation/es.json @@ -1,13 +1,14 @@ { "common": { "message": { - "inputEmptyError": "(es)Error Message", + "inputEmptyError": "(es)この項目の入力は必須です。入力してください。", "passwordIncorrectError": "(es)Error Message", "emailIncorrectError": "(es)Error Message", "internalServerError": "(es)処理に失敗しました。時間をおいて再実行しても解決しない場合はシステム管理者にお問い合わせください。", "listEmpty": "(es)検索結果が0件です。", "dialogConfirm": "(es)操作を実行しますか?", - "success": "(es)処理に成功しました。" + "success": "(es)処理に成功しました。", + "permissionDeniedError": "(es)操作を実行する権限がありません。" }, "label": { "cancel": "(es)Cancel", @@ -113,7 +114,8 @@ "authorIdConflictError": "(es)このAuthor IDは既に登録されています。他のAuthor IDで登録してください。", "authorIdIncorrectError": "(es)Author IDの形式が不正です。Author IDは半角英数字(大文字)と\"_\"のみ入力可能です。", "roleChangeError": "(es)Roleの変更に失敗しました。画面を更新して再度ユーザー情報を取得してください。", - "encryptionPasswordCorrectError": "(es)EncryptionPasswordがルールを満たしていません。" + "encryptionPasswordCorrectError": "(es)EncryptionPasswordがルールを満たしていません。", + "alreadyLicenseDeallocatedError": "(es)すでにライセンス割り当てが解除されています。画面を更新して再度ご確認下さい。" }, "label": { "title": "(es)User", @@ -235,7 +237,7 @@ "deleteDictation": "(es)Delete Dictation", "selectedTranscriptionist": "(es)Selected", "poolTranscriptionist": "(es)Pool", - "saveChanges": "(es)Save changes" + "saveChanges": "(es)Save" } }, "cardLicenseIssuePopupPage": { @@ -328,7 +330,11 @@ }, "message": { "notEnoughOfNumberOfLicense": "(es)ライセンスが不足しているため、発行することができませんでした。ライセンスの注文を行ってください。", - "alreadyIssueLicense": "(es)すでに発行済みの注文です。画面を更新してください。" + "alreadyIssueLicense": "(es)すでに発行済みの注文です。画面を更新してください。", + "alreadyLicenseIssueOrCancel": "(es)ライセンス注文のキャンセルに失敗しました。選択された注文はすでに発行またはキャンセルされています。画面を更新して再度ご確認ください。", + "alreadyLicenseStatusChanged": "(es)ライセンス発行のキャンセルに失敗しました。選択された注文の状態が変更されています。画面を更新して再度ご確認ください。", + "expiredSinceIssued": "(es)発行日から一定期間経過しているため、発行キャンセルできません。", + "alreadyLicenseAllocated": "(es)発行したライセンスがすでに割り当てられたため、発行キャンセルできません。" } }, "allocateLicensePopupPage": { @@ -364,7 +370,19 @@ "return": "(es)Return", "addGroup": "(es)Add Group", "groupName": "(es)Group Name", - "edit": "(es)Edit" + "edit": "(es)Edit", + "addTypistGroup": "(es)Add Transcriptionist Group", + "transcriptionist": "(es)Transcriptionist", + "selected": "(es)Selected", + "pool": "(es)Pool", + "add": "(es)Add", + "remove": "(es)Remove", + "editTypistGroup": "(es)Edit Transcriptionist Group", + "save": "(es)Save" + }, + "message": { + "selectedTypistEmptyError": "(es)TranscriptionistがいないTranscriptionistGroupは保存できません。1名以上をTranscriptionistとして選択してください。", + "groupSaveFailedError": "(es)TypistGroupの保存に失敗しました。画面を更新し、再度実行してください" } } -} \ No newline at end of file +} diff --git a/dictation_client/src/translation/fr.json b/dictation_client/src/translation/fr.json index ade9c18..82274c8 100644 --- a/dictation_client/src/translation/fr.json +++ b/dictation_client/src/translation/fr.json @@ -1,13 +1,14 @@ { "common": { "message": { - "inputEmptyError": "(fr)Error Message", + "inputEmptyError": "(fr)この項目の入力は必須です。入力してください。", "passwordIncorrectError": "(fr)Error Message", "emailIncorrectError": "(fr)Error Message", "internalServerError": "(fr)処理に失敗しました。時間をおいて再実行しても解決しない場合はシステム管理者にお問い合わせください。", "listEmpty": "(fr)検索結果が0件です。", "dialogConfirm": "(fr)操作を実行しますか?", - "success": "(fr)処理に成功しました。" + "success": "(fr)処理に成功しました。", + "permissionDeniedError": "(fr)操作を実行する権限がありません。" }, "label": { "cancel": "(fr)Cancel", @@ -113,7 +114,8 @@ "authorIdConflictError": "(fr)このAuthor IDは既に登録されています。他のAuthor IDで登録してください。", "authorIdIncorrectError": "(fr)Author IDの形式が不正です。Author IDは半角英数字(大文字)と\"_\"のみ入力可能です。", "roleChangeError": "(fr)Roleの変更に失敗しました。画面を更新して再度ユーザー情報を取得してください。", - "encryptionPasswordCorrectError": "(fr)EncryptionPasswordがルールを満たしていません。" + "encryptionPasswordCorrectError": "(fr)EncryptionPasswordがルールを満たしていません。", + "alreadyLicenseDeallocatedError": "(fr)すでにライセンス割り当てが解除されています。画面を更新して再度ご確認下さい。" }, "label": { "title": "(fr)User", @@ -235,7 +237,7 @@ "deleteDictation": "(fr)Delete Dictation", "selectedTranscriptionist": "(fr)Selected", "poolTranscriptionist": "(fr)Pool", - "saveChanges": "(fr)Save changes" + "saveChanges": "(fr)Save" } }, "cardLicenseIssuePopupPage": { @@ -328,7 +330,11 @@ }, "message": { "notEnoughOfNumberOfLicense": "(fr)ライセンスが不足しているため、発行することができませんでした。ライセンスの注文を行ってください。", - "alreadyIssueLicense": "(fr)すでに発行済みの注文です。画面を更新してください。" + "alreadyIssueLicense": "(fr)すでに発行済みの注文です。画面を更新してください。", + "alreadyLicenseIssueOrCancel": "(fr)ライセンス注文のキャンセルに失敗しました。選択された注文はすでに発行またはキャンセルされています。画面を更新して再度ご確認ください。", + "alreadyLicenseStatusChanged": "(fr)ライセンス発行のキャンセルに失敗しました。選択された注文の状態が変更されています。画面を更新して再度ご確認ください。", + "expiredSinceIssued": "(fr)発行日から一定期間経過しているため、発行キャンセルできません。", + "alreadyLicenseAllocated": "(fr)発行したライセンスがすでに割り当てられたため、発行キャンセルできません。" } }, "allocateLicensePopupPage": { @@ -364,7 +370,19 @@ "return": "(fr)Return", "addGroup": "(fr)Add Group", "groupName": "(fr)Group Name", - "edit": "(fr)Edit" + "edit": "(fr)Edit", + "addTypistGroup": "(fr)Add Transcriptionist Group", + "transcriptionist": "(fr)Transcriptionist", + "selected": "(fr)Selected", + "pool": "(fr)Pool", + "add": "(fr)Add", + "remove": "(fr)Remove", + "editTypistGroup": "(fr)Edit Transcriptionist Group", + "save": "(fr)Save" + }, + "message": { + "selectedTypistEmptyError": "(fr)TranscriptionistがいないTranscriptionistGroupは保存できません。1名以上をTranscriptionistとして選択してください。", + "groupSaveFailedError": "(fr)TypistGroupの保存に失敗しました。画面を更新し、再度実行してください" } } -} \ No newline at end of file +} diff --git a/dictation_server/db/migrations/030-drop_licenses_history.sql b/dictation_server/db/migrations/030-drop_licenses_history.sql new file mode 100644 index 0000000..a6da691 --- /dev/null +++ b/dictation_server/db/migrations/030-drop_licenses_history.sql @@ -0,0 +1,16 @@ +-- +migrate Up +DROP TABLE IF EXISTS `licenses_history`; + +-- +migrate Down +CREATE TABLE IF NOT EXISTS `licenses_history` ( + `id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY COMMENT 'ライセンス履歴ID', + `user_id` BIGINT UNSIGNED NOT NULL COMMENT 'ユーザID', + `license_id` BIGINT UNSIGNED NOT NULL COMMENT 'ライセンスID', + `allocated` BOOLEAN NOT NULL COMMENT '割り当てたか', + `executed_at` TIMESTAMP NOT NULL COMMENT '実施日時', + `exchange_type` VARCHAR(255) NOT NULL COMMENT 'ライセンス切り替え種別(なし/トライアル→通常/紙→通常)', + `created_at` TIMESTAMP DEFAULT now() COMMENT '作成時刻', + `created_by` VARCHAR(255) COMMENT '作成者', + `updated_at` TIMESTAMP DEFAULT now() on UPDATE now() COMMENT '更新時刻', + `updated_by` VARCHAR(255) COMMENT '更新者' +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; diff --git a/dictation_server/db/migrations/031-create_worktypes.sql b/dictation_server/db/migrations/031-create_worktypes.sql new file mode 100644 index 0000000..e7bda77 --- /dev/null +++ b/dictation_server/db/migrations/031-create_worktypes.sql @@ -0,0 +1,16 @@ +-- +migrate Up +CREATE TABLE IF NOT EXISTS `worktypes` ( + `id` BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY COMMENT 'worktypeの内部ID', + `account_id` BIGINT UNSIGNED NOT NULL COMMENT 'アカウントID', + `custom_worktype_id` VARCHAR(255) NOT NULL COMMENT 'ユーザーが決めるWorktypeID', + `description` VARCHAR(255) COMMENT 'Worktypeの説明', + `deleted_at` TIMESTAMP COMMENT '削除時刻', + `created_by` VARCHAR(255) COMMENT '作成者', + `created_at` TIMESTAMP DEFAULT now() COMMENT '作成時刻', + `updated_by` VARCHAR(255) COMMENT '更新者', + `updated_at` TIMESTAMP DEFAULT now() on UPDATE now() COMMENT '更新時刻', + UNIQUE custom_worktype_id_index (custom_worktype_id, account_id) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; + +-- +migrate Down +DROP TABLE `worktypes`; \ No newline at end of file diff --git a/dictation_server/src/api/odms/openapi.json b/dictation_server/src/api/odms/openapi.json index 0b3195b..9c9111f 100644 --- a/dictation_server/src/api/odms/openapi.json +++ b/dictation_server/src/api/odms/openapi.json @@ -354,6 +354,120 @@ "security": [{ "bearer": [] }] } }, + "/accounts/typist-groups/{typistGroupId}": { + "get": { + "operationId": "getTypistGroup", + "summary": "", + "description": "ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを取得します", + "parameters": [ + { + "name": "typistGroupId", + "required": true, + "in": "path", + "schema": { "type": "number" } + } + ], + "responses": { + "200": { + "description": "成功時のレスポンス", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetTypistGroupResponse" + } + } + } + }, + "400": { + "description": "グループが存在しない場合", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "401": { + "description": "認証エラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "500": { + "description": "想定外のサーバーエラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + } + }, + "tags": ["accounts"], + "security": [{ "bearer": [] }] + }, + "post": { + "operationId": "updateTypistGroup", + "summary": "", + "description": "ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを更新します", + "parameters": [ + { + "name": "typistGroupId", + "required": true, + "in": "path", + "schema": { "type": "number" } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateTypistGroupRequest" + } + } + } + }, + "responses": { + "200": { + "description": "成功時のレスポンス", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTypistGroupResponse" + } + } + } + }, + "400": { + "description": "グループ名が空の場合/ユーザーが存在しない場合", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "401": { + "description": "認証エラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "500": { + "description": "想定外のサーバーエラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + } + }, + "tags": ["accounts"], + "security": [{ "bearer": [] }] + } + }, "/accounts/partner": { "post": { "operationId": "createPartnerAccount", @@ -582,6 +696,148 @@ "tags": ["accounts"] } }, + "/accounts/issue/cancel": { + "post": { + "operationId": "cancelIssue", + "summary": "", + "description": "ライセンス発行をキャンセルします", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/CancelIssueRequest" } + } + } + }, + "responses": { + "200": { + "description": "成功時のレスポンス", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/CancelIssueResponse" } + } + } + }, + "400": { + "description": "対象注文のステータスが発行済以外/発行日から15日以降/ライセンスをユーザに割り当てている", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "401": { + "description": "認証エラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "500": { + "description": "想定外のサーバーエラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + } + }, + "tags": ["accounts"], + "security": [{ "bearer": [] }] + } + }, + "/accounts/worktypes": { + "get": { + "operationId": "getWorktypes", + "summary": "", + "parameters": [], + "responses": { + "200": { + "description": "成功時のレスポンス", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetWorktypesResponse" + } + } + } + }, + "401": { + "description": "認証エラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "500": { + "description": "想定外のサーバーエラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + } + }, + "tags": ["accounts"], + "security": [{ "bearer": [] }] + }, + "post": { + "operationId": "createWorktype", + "summary": "", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateWorktypesRequest" + } + } + } + }, + "responses": { + "200": { + "description": "成功時のレスポンス", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateWorktypeResponse" + } + } + } + }, + "400": { + "description": "WorktypeIDが重複 / WorktypeIDが空 / WorktypeIDが20件登録済み", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "401": { + "description": "認証エラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "500": { + "description": "想定外のサーバーエラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + } + }, + "tags": ["accounts"], + "security": [{ "bearer": [] }] + } + }, "/users/confirm": { "post": { "operationId": "confirmUser", @@ -2020,6 +2276,58 @@ "security": [{ "bearer": [] }] } }, + "/licenses/orders/cancel": { + "post": { + "operationId": "cancelOrder", + "summary": "", + "description": "ライセンス注文をキャンセルします", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/CancelOrderRequest" } + } + } + }, + "responses": { + "200": { + "description": "成功時のレスポンス", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/CancelOrderResponse" } + } + } + }, + "400": { + "description": "対象注文のステータスが発行待ち状態でないとき", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "401": { + "description": "認証エラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + }, + "500": { + "description": "想定外のサーバーエラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + } + }, + "tags": ["licenses"], + "security": [{ "bearer": [] }] + } + }, "/notification/register": { "post": { "operationId": "register", @@ -2231,6 +2539,14 @@ }, "required": ["typistGroups"] }, + "GetTypistGroupResponse": { + "type": "object", + "properties": { + "typistGroupName": { "type": "string" }, + "typistIds": { "type": "array", "items": { "type": "integer" } } + }, + "required": ["typistGroupName", "typistIds"] + }, "CreateTypistGroupRequest": { "type": "object", "properties": { @@ -2242,12 +2558,28 @@ "typistIds": { "minItems": 1, "type": "array", - "items": { "type": "string" } + "items": { "type": "integer" } } }, "required": ["typistGroupName", "typistIds"] }, "CreateTypistGroupResponse": { "type": "object", "properties": {} }, + "UpdateTypistGroupRequest": { + "type": "object", + "properties": { + "typistGroupName": { + "type": "string", + "minLength": 1, + "maxLength": 50 + }, + "typistIds": { + "minItems": 1, + "type": "array", + "items": { "type": "integer" } + } + }, + "required": ["typistGroupName", "typistIds"] + }, "CreatePartnerAccountRequest": { "type": "object", "properties": { @@ -2391,6 +2723,50 @@ }, "required": ["dealers"] }, + "CancelIssueRequest": { + "type": "object", + "properties": { + "orderedAccountId": { + "type": "number", + "description": "注文元アカウントID" + }, + "poNumber": { "type": "string", "description": "POナンバー" } + }, + "required": ["orderedAccountId", "poNumber"] + }, + "CancelIssueResponse": { "type": "object", "properties": {} }, + "Worktype": { + "type": "object", + "properties": { + "id": { "type": "number", "description": "WorktypeのID" }, + "worktypeId": { "type": "string", "description": "WorktypeID" }, + "description": { "type": "string", "description": "Worktypeの説明" } + }, + "required": ["id", "worktypeId"] + }, + "GetWorktypesResponse": { + "type": "object", + "properties": { + "worktypes": { + "type": "array", + "items": { "$ref": "#/components/schemas/Worktype" } + } + }, + "required": ["worktypes"] + }, + "CreateWorktypesRequest": { + "type": "object", + "properties": { + "worktypeId": { + "type": "string", + "minLength": 1, + "description": "WorktypeID" + }, + "description": { "type": "string", "description": "Worktypeの説明" } + }, + "required": ["worktypeId"] + }, + "CreateWorktypeResponse": { "type": "object", "properties": {} }, "ConfirmRequest": { "type": "object", "properties": { "token": { "type": "string" } }, @@ -2929,6 +3305,12 @@ }, "required": ["allocatableLicenses"] }, + "CancelOrderRequest": { + "type": "object", + "properties": { "poNumber": { "type": "string" } }, + "required": ["poNumber"] + }, + "CancelOrderResponse": { "type": "object", "properties": {} }, "RegisterRequest": { "type": "object", "properties": { diff --git a/dictation_server/src/app.module.ts b/dictation_server/src/app.module.ts index 172cb56..a5cd069 100644 --- a/dictation_server/src/app.module.ts +++ b/dictation_server/src/app.module.ts @@ -40,6 +40,7 @@ import { CheckoutPermissionsRepositoryModule } from './repositories/checkout_per import { UserGroupsRepositoryModule } from './repositories/user_groups/user_groups.repository.module'; import { SortCriteriaRepositoryModule } from './repositories/sort_criteria/sort_criteria.repository.module'; import { TemplateFilesRepositoryModule } from './repositories/template_files/template_files.repository.module'; +import { WorktypesRepositoryModule } from './repositories/worktypes/worktypes.repository.module'; @Module({ imports: [ @@ -94,6 +95,7 @@ import { TemplateFilesRepositoryModule } from './repositories/template_files/tem BlobstorageModule, AuthGuardsModule, SortCriteriaRepositoryModule, + WorktypesRepositoryModule, ], controllers: [ HealthController, diff --git a/dictation_server/src/common/error/code.ts b/dictation_server/src/common/error/code.ts index 43aec9f..7692f36 100644 --- a/dictation_server/src/common/error/code.ts +++ b/dictation_server/src/common/error/code.ts @@ -46,4 +46,7 @@ export const ErrorCodes = [ 'E010804', // ライセンス不足エラー 'E010805', // ライセンス有効期限切れエラー 'E010806', // ライセンス割り当て不可エラー + 'E010807', // ライセンス割り当て解除済みエラー + 'E010808', // ライセンス注文キャンセル不可エラー + 'E010908', // タイピストグループ不在エラー ] as const; diff --git a/dictation_server/src/common/error/message.ts b/dictation_server/src/common/error/message.ts index e41ba72..5b2338b 100644 --- a/dictation_server/src/common/error/message.ts +++ b/dictation_server/src/common/error/message.ts @@ -35,4 +35,7 @@ export const errors: Errors = { E010804: 'License shortage Error', E010805: 'License is expired Error', E010806: 'License is unavailable Error', + E010807: 'License is already deallocated Error', + E010808: 'Order cancel failed Error', + E010908: 'Typist Group not exist Error', }; diff --git a/dictation_server/src/common/test/modules.ts b/dictation_server/src/common/test/modules.ts index bd4df33..ed77ffc 100644 --- a/dictation_server/src/common/test/modules.ts +++ b/dictation_server/src/common/test/modules.ts @@ -17,6 +17,7 @@ import { LicensesRepositoryModule } from '../../repositories/licenses/licenses.r import { AudioFilesRepositoryModule } from '../../repositories/audio_files/audio_files.repository.module'; import { AudioOptionItemsRepositoryModule } from '../../repositories/audio_option_items/audio_option_items.repository.module'; import { CheckoutPermissionsRepositoryModule } from '../../repositories/checkout_permissions/checkout_permissions.repository.module'; +import { WorktypesRepositoryModule } from '../../repositories/worktypes/worktypes.repository.module'; import { NotificationModule } from '../../features//notification/notification.module'; import { NotificationhubModule } from '../../gateways/notificationhub/notificationhub.module'; import { BlobstorageModule } from '../../gateways/blobstorage/blobstorage.module'; @@ -63,6 +64,7 @@ export const makeTestingModule = async ( BlobstorageModule, AuthGuardsModule, SortCriteriaRepositoryModule, + WorktypesRepositoryModule, ], providers: [ AuthService, diff --git a/dictation_server/src/common/test/utility.ts b/dictation_server/src/common/test/utility.ts new file mode 100644 index 0000000..a2f1005 --- /dev/null +++ b/dictation_server/src/common/test/utility.ts @@ -0,0 +1,363 @@ +import { v4 as uuidv4 } from 'uuid'; +import { DataSource } from 'typeorm'; +import { User } from '../../repositories/users/entity/user.entity'; +import { Account } from '../../repositories/accounts/entity/account.entity'; +import { ADMIN_ROLES, USER_ROLES } from '../../constants'; + +type InitialTestDBState = { + tier1Accounts: { account: Account; users: User[] }[]; + tier2Accounts: { account: Account; users: User[] }[]; + tier3Accounts: { account: Account; users: User[] }[]; + tier4Accounts: { account: Account; users: User[] }[]; + tier5Accounts: { account: Account; users: User[] }[]; +}; + +// 上書きされたら困る項目を除外したAccount型 +type OverrideAccount = Omit< + Account, + 'id' | 'primary_admin_user_id' | 'secondary_admin_user_id' | 'user' +>; + +// 上書きされたら困る項目を除外したUser型 +type OverrideUser = Omit< + User, + 'id' | 'account' | 'license' | 'userGroupMembers' +>; + +type AccountDefault = { [K in keyof OverrideAccount]?: OverrideAccount[K] }; +type UserDefault = { [K in keyof OverrideUser]?: OverrideUser[K] }; + +/** + * テスト ユーティリティ: 1~4階層のアカウントとその管理者ユーザーを作成します + * @param dataSource データソース + * @returns 作成されたデータセット + */ +export const makeHierarchicalAccounts = async ( + datasource: DataSource, +): Promise => { + const state: InitialTestDBState = { + tier1Accounts: [], + tier2Accounts: [], + tier3Accounts: [], + tier4Accounts: [], + tier5Accounts: [], + }; + + // 第1階層を作成 + { + const { account, admin } = await makeTestAccount(datasource, { + tier: 1, + company_name: 'OMDS', + }); + + state.tier1Accounts.push({ + account: account, + users: [admin], + }); + } + // 第2階層を作成 + { + const { account: tier1 } = state.tier1Accounts.slice().shift(); + { + const { account, admin } = await makeTestAccount(datasource, { + tier: 2, + parent_account_id: tier1.id, + company_name: 'OMDS_US', + }); + state.tier2Accounts.push({ + account: account, + users: [admin], + }); + } + { + const { account, admin } = await makeTestAccount(datasource, { + tier: 2, + parent_account_id: tier1.id, + company_name: 'OMDS_EU', + }); + state.tier2Accounts.push({ + account: account, + users: [admin], + }); + } + } + + // 第3階層を作成 + { + for (const v of state.tier2Accounts) { + { + const { account, admin } = await makeTestAccount(datasource, { + tier: 3, + parent_account_id: v.account.id, + company_name: `Agency_${v.account.id}_01`, + }); + state.tier3Accounts.push({ + account: account, + users: [admin], + }); + } + { + const { account, admin } = await makeTestAccount(datasource, { + tier: 3, + parent_account_id: v.account.id, + company_name: `Agency_${v.account.id}_02`, + }); + state.tier3Accounts.push({ + account: account, + users: [admin], + }); + } + } + // 第4階層を作成 + for (const v of state.tier3Accounts) { + { + const { account, admin } = await makeTestAccount(datasource, { + tier: 4, + parent_account_id: v.account.id, + company_name: `Distributor_${v.account.id}_01`, + }); + state.tier4Accounts.push({ + account: account, + users: [admin], + }); + } + { + const { account, admin } = await makeTestAccount(datasource, { + tier: 4, + parent_account_id: v.account.id, + company_name: `Distributor_${v.account.id}_02`, + }); + state.tier4Accounts.push({ + account: account, + users: [admin], + }); + } + } + } + + return state; +}; + +/** + * テスト ユーティリティ: 指定したプロパティを上書きしたアカウントとその管理者ユーザーを作成する + * @param dataSource データソース + * @param defaultUserValue Account型と同等かつoptionalなプロパティを持つ上書き箇所指定用オブジェクト + * @param defaultAdminUserValue User型と同等かつoptionalなプロパティを持つ上書き箇所指定用オブジェクト(account_id等の所属関係が破壊される上書きは無視する) + * @returns 作成したアカウント + */ +export const makeTestAccount = async ( + datasource: DataSource, + defaultAccountValue?: AccountDefault, + defaultAdminUserValue?: UserDefault, +): Promise<{ account: Account; admin: User }> => { + let accountId: number; + let userId: number; + { + const d = defaultAccountValue; + const { identifiers } = await datasource.getRepository(Account).insert({ + tier: d?.tier ?? 1, + parent_account_id: d?.parent_account_id ?? undefined, + country: d?.country ?? 'US', + delegation_permission: d?.delegation_permission ?? false, + locked: d?.locked ?? false, + company_name: d?.company_name ?? 'test inc.', + verified: d?.verified ?? true, + deleted_at: d?.deleted_at ?? '', + created_by: d?.created_by ?? 'test_runner', + created_at: d?.created_at ?? new Date(), + updated_by: d?.updated_by ?? 'updater', + updated_at: d?.updated_at ?? new Date(), + }); + const result = identifiers.pop() as Account; + accountId = result.id; + } + { + const d = defaultAdminUserValue; + const { identifiers } = await datasource.getRepository(User).insert({ + external_id: d?.external_id ?? uuidv4(), + account_id: accountId, + role: d?.role ?? 'admin none', + author_id: d?.author_id ?? undefined, + accepted_terms_version: d?.accepted_terms_version ?? '1.0', + email_verified: d?.email_verified ?? true, + auto_renew: d?.auto_renew ?? true, + license_alert: d?.license_alert ?? true, + notification: d?.notification ?? true, + encryption: d?.encryption ?? true, + encryption_password: d?.encryption_password ?? 'password', + prompt: d?.prompt ?? true, + deleted_at: d?.deleted_at ?? '', + created_by: d?.created_by ?? 'test_runner', + created_at: d?.created_at ?? new Date(), + updated_by: d?.updated_by ?? 'updater', + updated_at: d?.updated_at ?? new Date(), + }); + + const result = identifiers.pop() as User; + userId = result.id; + } + + // Accountの管理者を設定する + await datasource.getRepository(Account).update( + { id: accountId }, + { + primary_admin_user_id: userId, + }, + ); + + const account = await datasource.getRepository(Account).findOne({ + where: { + id: accountId, + }, + }); + + const admin = await datasource.getRepository(User).findOne({ + where: { + id: userId, + }, + }); + + return { + account: account, + admin: admin, + }; +}; + +/** + * テスト ユーティリティ: 指定したプロパティを上書きした管理者ユーザーの存在しないアカウントを作成する + * @param dataSource データソース + * @param defaultUserValue Account型と同等かつoptionalなプロパティを持つ上書き箇所指定用オブジェクト + * @returns 作成したアカウント + */ +export const makeTestSimpleAccount = async ( + datasource: DataSource, + defaultAccountValue?: AccountDefault, +): Promise => { + const d = defaultAccountValue; + const { identifiers } = await datasource.getRepository(Account).insert({ + tier: d?.tier ?? 1, + parent_account_id: d?.parent_account_id ?? undefined, + country: d?.country ?? 'US', + delegation_permission: d?.delegation_permission ?? false, + locked: d?.locked ?? false, + company_name: d?.company_name ?? 'test inc.', + verified: d?.verified ?? true, + deleted_at: d?.deleted_at ?? '', + created_by: d?.created_by ?? 'test_runner', + created_at: d?.created_at ?? new Date(), + updated_by: d?.updated_by ?? 'updater', + updated_at: d?.updated_at ?? new Date(), + }); + const result = identifiers.pop() as Account; + + const account = await datasource.getRepository(Account).findOne({ + where: { + id: result.id, + }, + }); + + return account; +}; + +/** + * テスト ユーティリティ: 指定したプロパティを上書きしたユーザーを作成する + * @param dataSource データソース + * @param defaultUserValue User型と同等かつoptionalなプロパティを持つ上書き箇所指定用オブジェクト + * @returns 作成したユーザー + */ +export const makeTestUser = async ( + datasource: DataSource, + defaultUserValue?: UserDefault, +): Promise => { + const d = defaultUserValue; + const { identifiers } = await datasource.getRepository(User).insert({ + account_id: d?.account_id ?? -1, + external_id: d?.external_id ?? uuidv4(), + role: d?.role ?? `${ADMIN_ROLES.STANDARD} ${USER_ROLES.NONE}`, + author_id: d?.author_id, + accepted_terms_version: d?.accepted_terms_version, + email_verified: d?.email_verified ?? true, + auto_renew: d?.auto_renew ?? true, + license_alert: d?.license_alert ?? true, + notification: d?.notification ?? true, + encryption: d?.encryption ?? true, + encryption_password: d?.encryption_password, + prompt: d?.prompt ?? true, + created_by: d?.created_by ?? 'test_runner', + created_at: d?.created_at ?? new Date(), + updated_by: d?.updated_by ?? 'updater', + updated_at: d?.updated_at ?? new Date(), + }); + const result = identifiers.pop() as User; + + return await datasource.getRepository(User).findOne({ + where: { + id: result.id, + }, + }); +}; + +/** + * テスト ユーティリティ: 指定IDのアカウントを取得する + * @param dataSource データソース + * @param id アカウントID + * @returns 該当アカウント + */ +export const getAccount = async (dataSource: DataSource, id: number) => { + return await dataSource.getRepository(Account).findOne({ + where: { id: id }, + }); +}; + +/** + * テスト ユーティリティ: すべてのアカウントを取得する + * @param dataSource データソース + * @returns 該当アカウント一覧 + */ +export const getAccounts = async ( + dataSource: DataSource, +): Promise => { + return await dataSource.getRepository(Account).find(); +}; + +/** + * テスト ユーティリティ: 指定ExternalIdのユーザーを取得する + * @param dataSource データソース + * @param externalId 外部ID + * @returns 該当ユーザー + */ +export const getUserFromExternalId = async ( + dataSource: DataSource, + externalId: string, +) => { + return await dataSource.getRepository(User).findOne({ + where: { external_id: externalId }, + }); +}; + +/** + * テスト ユーティリティ: 指定Idのユーザーを取得する + * @param dataSource データソース + * @param externalId 外部ID + * @returns 該当ユーザー + */ +export const getUser = async ( + datasource: DataSource, + id: number, +): Promise => { + const user = await datasource.getRepository(User).findOne({ + where: { + id: id, + }, + }); + return user; +}; + +/** + * テスト ユーティリティ: すべてのユーザーを取得する + * @param dataSource データソース + * @returns 該当ユーザー一覧 + */ +export const getUsers = async (dataSource: DataSource): Promise => { + return await dataSource.getRepository(User).find(); +}; diff --git a/dictation_server/src/common/validators/IsUnique.validator.ts b/dictation_server/src/common/validators/IsUnique.validator.ts new file mode 100644 index 0000000..21ad6f0 --- /dev/null +++ b/dictation_server/src/common/validators/IsUnique.validator.ts @@ -0,0 +1,36 @@ +import { + ValidatorConstraint, + ValidatorConstraintInterface, + ValidationArguments, + ValidationOptions, + registerDecorator, +} from 'class-validator'; + +@ValidatorConstraint() +export class IsUniqueArray implements ValidatorConstraintInterface { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + validate(arr: any[], args: ValidationArguments) { + return arr.length === new Set(arr).size; + } + + defaultMessage(args: ValidationArguments) { + return `${args.property} should be an array of unique values`; + } +} +/** + * 配列内の値がすべてユニークであるかをチェックする + * @param [validationOptions] + * @returns + */ +export function IsUnique(validationOptions?: ValidationOptions) { + return function (object: object, propertyName: string) { + registerDecorator({ + name: 'isUnique', + target: object.constructor, + propertyName: propertyName, + constraints: [], + options: validationOptions, + validator: IsUniqueArray, + }); + }; +} diff --git a/dictation_server/src/common/validators/admin.validator.ts b/dictation_server/src/common/validators/admin.validator.ts index 296ba7e..7a023cd 100644 --- a/dictation_server/src/common/validators/admin.validator.ts +++ b/dictation_server/src/common/validators/admin.validator.ts @@ -1,5 +1,6 @@ import { registerDecorator, ValidationOptions } from 'class-validator'; +// TODO タスク 2502: バリデータをクラスを使用した記述に統一するで修正する export const IsAdminPasswordvalid = (validationOptions?: ValidationOptions) => { return (object: any, propertyName: string) => { registerDecorator({ diff --git a/dictation_server/src/common/validators/assignees.validator.ts b/dictation_server/src/common/validators/assignees.validator.ts index fb760ec..5f9b100 100644 --- a/dictation_server/src/common/validators/assignees.validator.ts +++ b/dictation_server/src/common/validators/assignees.validator.ts @@ -4,6 +4,7 @@ import { ValidationArguments, } from 'class-validator'; import { Assignee } from '../../features/tasks/types/types'; +// TODO タスク 2502: バリデータをクラスを使用した記述に統一するで修正する /** * Validations options * @param [validationOptions] diff --git a/dictation_server/src/common/validators/encryptionPassword.validator.ts b/dictation_server/src/common/validators/encryptionPassword.validator.ts index 7e47547..8492628 100644 --- a/dictation_server/src/common/validators/encryptionPassword.validator.ts +++ b/dictation_server/src/common/validators/encryptionPassword.validator.ts @@ -4,7 +4,7 @@ import { ValidationOptions, } from 'class-validator'; import { SignupRequest } from '../../features/users/types/types'; - +// TODO タスク 2502: バリデータをクラスを使用した記述に統一するで修正する export const IsPasswordvalid = (validationOptions?: ValidationOptions) => { return (object: any, propertyName: string) => { registerDecorator({ @@ -35,7 +35,7 @@ export const IsPasswordvalid = (validationOptions?: ValidationOptions) => { }); }; }; - +// TODO タスク 2502: バリデータをクラスを使用した記述に統一するで修正する export const IsEncryptionPasswordPresent = ( validationOptions?: ValidationOptions, ) => { diff --git a/dictation_server/src/common/validators/roleAuthor.validator.ts b/dictation_server/src/common/validators/roleAuthor.validator.ts index c68964f..67efa15 100644 --- a/dictation_server/src/common/validators/roleAuthor.validator.ts +++ b/dictation_server/src/common/validators/roleAuthor.validator.ts @@ -9,6 +9,7 @@ import { } from '../../features/users/types/types'; import { USER_ROLES } from '../../constants'; +// TODO タスク 2502: バリデータをクラスを使用した記述に統一するで修正する export const IsRoleAuthorDataValid = < T extends SignupRequest | PostUpdateUserRequest, >( diff --git a/dictation_server/src/constants/index.ts b/dictation_server/src/constants/index.ts index cdf2352..98bd997 100644 --- a/dictation_server/src/constants/index.ts +++ b/dictation_server/src/constants/index.ts @@ -89,16 +89,14 @@ export const USER_ROLES = { } as const; /** - * ライセンス注文ステータス(発行待ち) - * @const {string} + * ライセンス注文状態 + * @const {string[]} */ -export const LICENSE_STATUS_ISSUE_REQUESTING = 'Issue Requesting'; - -/** - * ライセンス注文ステータス(発行済み) - * @const {string} - */ -export const LICENSE_STATUS_ISSUED = 'Issued'; +export const LICENSE_ISSUE_STATUS = { + ISSUE_REQUESTING: 'Issue Requesting', + ISSUED: 'Issued', + CANCELED: 'Order Canceled', +}; /** * ライセンス種別 diff --git a/dictation_server/src/features/accounts/accounts.controller.ts b/dictation_server/src/features/accounts/accounts.controller.ts index 1fec4f0..b77c935 100644 --- a/dictation_server/src/features/accounts/accounts.controller.ts +++ b/dictation_server/src/features/accounts/accounts.controller.ts @@ -6,6 +6,7 @@ import { Get, Req, UseGuards, + Param, } from '@nestjs/common'; import { ApiOperation, @@ -35,6 +36,15 @@ import { GetDealersResponse, CreateTypistGroupResponse, CreateTypistGroupRequest, + GetTypistGroupResponse, + GetTypistGroupRequest, + UpdateTypistGroupRequest, + UpdateTypistGroupRequestParam, + CancelIssueRequest, + CancelIssueResponse, + GetWorktypesResponse, + CreateWorktypeResponse, + CreateWorktypesRequest, } from './types/types'; import { USER_ROLES, ADMIN_ROLES, TIERS } from '../../constants'; import { AuthGuard } from '../../common/guards/auth/authguards'; @@ -127,9 +137,6 @@ export class AccountsController { @Req() req: Request, @Body() body: GetLicenseSummaryRequest, ): Promise { - console.log(req.header('Authorization')); - console.log(body); - const response = await this.accountService.getLicenseSummary( body.accountId, ); @@ -165,8 +172,6 @@ export class AccountsController { @UseGuards(RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN] })) @Get('me') async getMyAccount(@Req() req: Request): Promise { - console.log(req.header('Authorization')); - // アクセストークン取得 const accessToken = retrieveAuthorizationToken(req); const payload = jwt.decode(accessToken, { json: true }) as AccessToken; @@ -199,8 +204,6 @@ export class AccountsController { @UseGuards(AuthGuard) @Get('typists') async getTypists(@Req() req: Request): Promise { - console.log(req.header('Authorization')); - // アクセストークン取得 const accessToken = retrieveAuthorizationToken(req); const payload = jwt.decode(accessToken, { json: true }) as AccessToken; @@ -233,8 +236,6 @@ export class AccountsController { @UseGuards(AuthGuard) @Get('typist-groups') async getTypistGroups(@Req() req: Request): Promise { - console.log(req.header('Authorization')); - // アクセストークン取得 const accessToken = retrieveAuthorizationToken(req); const payload = jwt.decode(accessToken, { json: true }) as AccessToken; @@ -245,6 +246,56 @@ export class AccountsController { return { typistGroups }; } + @ApiResponse({ + status: HttpStatus.OK, + type: GetTypistGroupResponse, + description: '成功時のレスポンス', + }) + @ApiResponse({ + status: HttpStatus.BAD_REQUEST, + description: 'グループが存在しない場合', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.UNAUTHORIZED, + description: '認証エラー', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.INTERNAL_SERVER_ERROR, + description: '想定外のサーバーエラー', + type: ErrorResponse, + }) + @ApiOperation({ + operationId: 'getTypistGroup', + description: + 'ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを取得します', + }) + @ApiBearerAuth() + @UseGuards(AuthGuard) + @UseGuards(RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN] })) + @Get('typist-groups/:typistGroupId') + async getTypistGroup( + @Req() req: Request, + @Param() param: GetTypistGroupRequest, + ): Promise { + const { typistGroupId } = param; + + // アクセストークン取得 + const accessToken = retrieveAuthorizationToken(req); + const { userId } = jwt.decode(accessToken, { json: true }) as AccessToken; + + const context = makeContext(userId); + + const typistGroup = await this.accountService.getTypistGroup( + context, + userId, + typistGroupId, + ); + + return typistGroup; + } + @ApiResponse({ status: HttpStatus.OK, type: CreateTypistGroupResponse, @@ -278,9 +329,70 @@ export class AccountsController { @Req() req: Request, @Body() body: CreateTypistGroupRequest, ): Promise { + const { typistGroupName, typistIds } = body; // アクセストークン取得 const accessToken = retrieveAuthorizationToken(req); - const payload = jwt.decode(accessToken, { json: true }) as AccessToken; + const { userId } = jwt.decode(accessToken, { json: true }) as AccessToken; + const context = makeContext(userId); + await this.accountService.createTypistGroup( + context, + userId, + typistGroupName, + typistIds, + ); + return {}; + } + + @ApiResponse({ + status: HttpStatus.OK, + type: CreateTypistGroupResponse, + description: '成功時のレスポンス', + }) + @ApiResponse({ + status: HttpStatus.BAD_REQUEST, + description: 'グループ名が空の場合/ユーザーが存在しない場合', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.UNAUTHORIZED, + description: '認証エラー', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.INTERNAL_SERVER_ERROR, + description: '想定外のサーバーエラー', + type: ErrorResponse, + }) + @ApiOperation({ + operationId: 'updateTypistGroup', + description: + 'ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを更新します', + }) + @ApiBearerAuth() + @UseGuards(AuthGuard) + @UseGuards(RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN] })) + @Post('typist-groups/:typistGroupId') + async updateTypistGroup( + @Req() req: Request, + @Body() body: UpdateTypistGroupRequest, + @Param() param: UpdateTypistGroupRequestParam, + ): Promise { + const { typistGroupName, typistIds } = body; + const { typistGroupId } = param; + + // アクセストークン取得 + const accessToken = retrieveAuthorizationToken(req); + const { userId } = jwt.decode(accessToken, { json: true }) as AccessToken; + + const context = makeContext(userId); + + await this.accountService.updateTypistGroup( + context, + userId, + typistGroupId, + typistGroupName, + typistIds, + ); return {}; } @@ -446,8 +558,6 @@ export class AccountsController { @Req() req: Request, @Body() body: IssueLicenseRequest, ): Promise { - console.log(req.header('Authorization')); - console.log(body); const { orderedAccountId, poNumber } = body; const token = retrieveAuthorizationToken(req); @@ -479,4 +589,127 @@ export class AccountsController { async getDealers(): Promise { return await this.accountService.getDealers(); } + + @Post('/issue/cancel') + @ApiResponse({ + status: HttpStatus.OK, + type: CancelIssueResponse, + description: '成功時のレスポンス', + }) + @ApiResponse({ + status: HttpStatus.BAD_REQUEST, + description: + '対象注文のステータスが発行済以外/発行日から15日以降/ライセンスをユーザに割り当てている', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.UNAUTHORIZED, + description: '認証エラー', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.INTERNAL_SERVER_ERROR, + description: '想定外のサーバーエラー', + type: ErrorResponse, + }) + @ApiOperation({ + operationId: 'cancelIssue', + description: 'ライセンス発行をキャンセルします', + }) + @ApiBearerAuth() + @UseGuards(AuthGuard) + @UseGuards( + RoleGuard.requireds({ + roles: [ADMIN_ROLES.ADMIN], + tiers: [TIERS.TIER1, TIERS.TIER2], + }), + ) + async cancelIssue( + @Req() req: Request, + @Body() body: CancelIssueRequest, + ): Promise { + const token = retrieveAuthorizationToken(req); + const payload = jwt.decode(token, { json: true }) as AccessToken; + + const context = makeContext(payload.userId); + + // TODO: 発行キャンセル処理(仮)。API実装のタスク(2498)で本実装 + // await this.accountService.cancelIssue( + // context, + // body.poNumber, + // body.orderedAccountId, + // ); + return {}; + } + + @Get('/worktypes') + @ApiResponse({ + status: HttpStatus.OK, + type: GetWorktypesResponse, + description: '成功時のレスポンス', + }) + @ApiResponse({ + status: HttpStatus.UNAUTHORIZED, + description: '認証エラー', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.INTERNAL_SERVER_ERROR, + description: '想定外のサーバーエラー', + type: ErrorResponse, + }) + @ApiOperation({ operationId: 'getWorktypes' }) + @ApiBearerAuth() + @UseGuards(AuthGuard) + @UseGuards(RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN] })) + async getWorktypes(@Req() req: Request): Promise { + const token = retrieveAuthorizationToken(req); + const { userId } = jwt.decode(token, { json: true }) as AccessToken; + + const context = makeContext(userId); + const worktypes = await this.accountService.getWorktypes(context, userId); + + return worktypes; + } + + @Post('/worktypes') + @ApiResponse({ + status: HttpStatus.OK, + type: CreateWorktypeResponse, + description: '成功時のレスポンス', + }) + @ApiResponse({ + status: HttpStatus.BAD_REQUEST, + description: 'WorktypeIDが重複 / WorktypeIDが空 / WorktypeIDが20件登録済み', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.UNAUTHORIZED, + description: '認証エラー', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.INTERNAL_SERVER_ERROR, + description: '想定外のサーバーエラー', + type: ErrorResponse, + }) + @ApiOperation({ operationId: 'createWorktype' }) + @ApiBearerAuth() + @UseGuards(AuthGuard) + @UseGuards(RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN] })) + async createWorktype( + @Req() req: Request, + @Body() body: CreateWorktypesRequest, + ): Promise { + const { worktypeId, description } = body; + const token = retrieveAuthorizationToken(req); + const { userId } = jwt.decode(token, { json: true }) as AccessToken; + + const context = makeContext(userId); + console.log(context.trackingId); + console.log(worktypeId); + console.log(description); + + return {}; + } } diff --git a/dictation_server/src/features/accounts/accounts.module.ts b/dictation_server/src/features/accounts/accounts.module.ts index 02991ab..4b43415 100644 --- a/dictation_server/src/features/accounts/accounts.module.ts +++ b/dictation_server/src/features/accounts/accounts.module.ts @@ -8,6 +8,7 @@ import { AccountsService } from './accounts.service'; import { AdB2cModule } from '../../gateways/adb2c/adb2c.module'; import { UserGroupsRepositoryModule } from '../../repositories/user_groups/user_groups.repository.module'; import { BlobstorageModule } from '../../gateways/blobstorage/blobstorage.module'; +import { WorktypesRepositoryModule } from '../../repositories/worktypes/worktypes.repository.module'; @Module({ imports: [ @@ -15,6 +16,7 @@ import { BlobstorageModule } from '../../gateways/blobstorage/blobstorage.module UsersRepositoryModule, LicensesRepositoryModule, UserGroupsRepositoryModule, + WorktypesRepositoryModule, SendGridModule, AdB2cModule, BlobstorageModule, diff --git a/dictation_server/src/features/accounts/accounts.service.spec.ts b/dictation_server/src/features/accounts/accounts.service.spec.ts index 1879e68..ba206d0 100644 --- a/dictation_server/src/features/accounts/accounts.service.spec.ts +++ b/dictation_server/src/features/accounts/accounts.service.spec.ts @@ -9,26 +9,32 @@ import { makeDefaultSendGridlValue, makeDefaultUserGroupsRepositoryMockValue, makeDefaultUsersRepositoryMockValue, + makeDefaultWorktypesRepositoryMockValue, } from './test/accounts.service.mock'; import { makeDefaultConfigValue } from '../users/test/users.service.mock'; import { - createAccount, createLicense, createLicenseOrder, - createUser, createLicenseSetExpiryDateAndStatus, - getAccount, - getUserFromExternalID, - getAccounts, - getUsers, + createWorktype, getSortCriteria, - createAccountAndAdminUser, + getTypistGroup, + getTypistGroupMember, + getWorktypes, } from './test/utility'; import { DataSource } from 'typeorm'; import { makeTestingModule } from '../../common/test/modules'; +import { + makeTestAccount, + getAccount, + getAccounts, + getUserFromExternalId, + getUsers, + makeTestUser, +} from '../../common/test/utility'; import { AccountsService } from './accounts.service'; import { Context, makeContext } from '../../common/log'; -import { TIERS } from '../../constants'; +import { TIERS, USER_ROLES } from '../../constants'; import { License } from '../../repositories/licenses/entity/license.entity'; import { overrideAccountsRepositoryService, @@ -38,6 +44,8 @@ import { } from '../../common/test/overrides'; import { AdB2cService } from '../../gateways/adb2c/adb2c.service'; import { BlobstorageService } from '../../gateways/blobstorage/blobstorage.service'; +import { UserGroupsRepositoryService } from '../../repositories/user_groups/user_groups.repository.service'; +import { WorktypesRepositoryService } from '../../repositories/worktypes/worktypes.repository.service'; describe('createAccount', () => { let source: DataSource = null; @@ -109,7 +117,7 @@ describe('createAccount', () => { // DB内が想定通りになっているか確認 const account = await getAccount(source, accountId); - const user = await getUserFromExternalID(source, externalUserId); + const user = await getUserFromExternalId(source, externalUserId); expect(account.company_name).toBe(companyName); expect(account.country).toBe(country); expect(account.parent_account_id).toBe(dealerAccountId); @@ -713,8 +721,11 @@ describe('createPartnerAccount', () => { const adminExternalId = 'ADMIN0001'; // 第一階層のアカウントを作成 - const { accountId: parentAccountId, tier } = - await createAccountAndAdminUser(source, adminExternalId); + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: adminExternalId }, + ); const context = makeContext('uuid'); const companyName = 'test_company_name'; @@ -757,7 +768,7 @@ describe('createPartnerAccount', () => { email, adminName, adminExternalId, - tier, + parent.tier, ); // DB上に作成されたデータが想定通りであるか確認 @@ -765,14 +776,14 @@ describe('createPartnerAccount', () => { const accounts = await getAccounts(source); expect(accounts.length).toBe(2); - const createdUser = await getUserFromExternalID( + const createdUser = await getUserFromExternalId( source, pertnerExternalId, ); const createdAccount = await getAccount(source, accountId); expect(createdAccount.company_name).toBe(companyName); expect(createdAccount.country).toBe(country); - expect(createdAccount.parent_account_id).toBe(parentAccountId); + expect(createdAccount.parent_account_id).toBe(parent.id); expect(createdAccount.tier).toBe(2); expect(createdAccount.primary_admin_user_id).toBe(createdUser.id); expect(createdAccount.secondary_admin_user_id).toBe(null); @@ -785,7 +796,11 @@ describe('createPartnerAccount', () => { const adminExternalId = 'ADMIN0001'; // 第一階層のアカウントを作成 - const { tier } = await createAccountAndAdminUser(source, adminExternalId); + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: adminExternalId }, + ); const context = makeContext('uuid'); const companyName = 'test_company_name'; @@ -830,7 +845,7 @@ describe('createPartnerAccount', () => { email, adminName, adminExternalId, - tier, + parent.tier, ); } catch (e) { if (e instanceof HttpException) { @@ -857,7 +872,11 @@ describe('createPartnerAccount', () => { const adminExternalId = 'ADMIN0001'; // 第一階層のアカウントを作成 - const { tier } = await createAccountAndAdminUser(source, adminExternalId); + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: adminExternalId }, + ); const context = makeContext('uuid'); const companyName = 'test_company_name'; @@ -909,7 +928,7 @@ describe('createPartnerAccount', () => { email, adminName, adminExternalId, - tier, + parent.tier, ); } catch (e) { if (e instanceof HttpException) { @@ -940,7 +959,11 @@ describe('createPartnerAccount', () => { const adminExternalId = 'ADMIN0001'; // 第一階層のアカウントを作成 - const { tier } = await createAccountAndAdminUser(source, adminExternalId); + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: adminExternalId }, + ); const context = makeContext('uuid'); const companyName = 'test_company_name'; @@ -992,7 +1015,7 @@ describe('createPartnerAccount', () => { email, adminName, adminExternalId, - tier, + parent.tier, ); } catch (e) { if (e instanceof HttpException) { @@ -1023,7 +1046,12 @@ describe('createPartnerAccount', () => { const parentExternalId = 'parent_external_id'; - await createAccountAndAdminUser(source, parentExternalId); + // 第一階層のアカウントを作成 + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: parentExternalId }, + ); const context = makeContext(parentExternalId); const partnerExternalId = 'partner_external_id'; @@ -1082,7 +1110,7 @@ describe('createPartnerAccount', () => { { const accounts = await getAccounts(source); expect(accounts.length).toBe(1); - expect(accounts[0].tier).toBe(1); + expect(accounts[0].tier).toBe(parent.tier); const users = await getUsers(source); expect(users.length).toBe(1); expect(users[0].external_id).toBe(parentExternalId); @@ -1098,7 +1126,12 @@ describe('createPartnerAccount', () => { const parentExternalId = 'parent_external_id'; - await createAccountAndAdminUser(source, parentExternalId); + // 第一階層のアカウントを作成 + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: parentExternalId }, + ); const context = makeContext(parentExternalId); const partnerExternalId = 'partner_external_id'; @@ -1163,8 +1196,8 @@ describe('createPartnerAccount', () => { // リカバリ処理が失敗した場合、DB上のデータは削除されない const accounts = await getAccounts(source); expect(accounts.length).toBe(2); - expect(accounts[0].tier).toBe(1); - expect(accounts[1].tier).toBe(2); + expect(accounts[0].tier).toBe(parent.tier); + expect(accounts[1].tier).toBe(parent.tier + 1); const users = await getUsers(source); expect(users.length).toBe(2); expect(users[0].external_id).toBe(parentExternalId); @@ -1183,7 +1216,12 @@ describe('createPartnerAccount', () => { const parentExternalId = 'parent_external_id'; - await createAccountAndAdminUser(source, parentExternalId); + // 第一階層のアカウントを作成 + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: parentExternalId }, + ); const context = makeContext(parentExternalId); const partnerExternalId = 'partner_external_id'; @@ -1244,7 +1282,7 @@ describe('createPartnerAccount', () => { // DB上に作成されたデータが想定通りであるか確認 const accounts = await getAccounts(source); expect(accounts.length).toBe(1); - expect(accounts[0].tier).toBe(1); + expect(accounts[0].tier).toBe(parent.tier); const users = await getUsers(source); expect(users.length).toBe(1); expect(users[0].external_id).toBe(parentExternalId); @@ -1268,7 +1306,12 @@ describe('createPartnerAccount', () => { const parentExternalId = 'parent_external_id'; - await createAccountAndAdminUser(source, parentExternalId); + // 第一階層のアカウントを作成 + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: parentExternalId }, + ); const context = makeContext(parentExternalId); const partnerExternalId = 'partner_external_id'; @@ -1334,8 +1377,8 @@ describe('createPartnerAccount', () => { // リカバリ処理が失敗したため、DB上のデータは削除されていない const accounts = await getAccounts(source); expect(accounts.length).toBe(2); - expect(accounts[0].tier).toBe(1); - expect(accounts[1].tier).toBe(2); + expect(accounts[0].tier).toBe(parent.tier); + expect(accounts[1].tier).toBe(parent.tier + 1); const users = await getUsers(source); expect(users.length).toBe(2); expect(users[0].external_id).toBe(parentExternalId); @@ -1357,7 +1400,11 @@ describe('createPartnerAccount', () => { const adminExternalId = 'ADMIN0001'; // 第一階層のアカウントを作成 - const { tier } = await createAccountAndAdminUser(source, adminExternalId); + const { account: parent } = await makeTestAccount( + source, + { tier: 1 }, + { external_id: adminExternalId }, + ); const context = makeContext('uuid'); const companyName = 'test_company_name'; @@ -1403,7 +1450,7 @@ describe('createPartnerAccount', () => { email, adminName, adminExternalId, - tier, + parent.tier, ); } catch (e) { if (e instanceof HttpException) { @@ -1438,6 +1485,8 @@ describe('AccountsService', () => { const blobStorageMockValue = makeBlobStorageServiceMockValue(); const licensesRepositoryMockValue = makeDefaultLicensesRepositoryMockValue(); + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const service = await makeAccountsServiceMock( accountsRepositoryMockValue, usersRepositoryMockValue, @@ -1447,6 +1496,7 @@ describe('AccountsService', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); expect(await service.getLicenseSummary(accountId)).toEqual( expectedAccountLisenceCounts, @@ -1467,6 +1517,8 @@ describe('AccountsService', () => { const blobStorageMockValue = makeBlobStorageServiceMockValue(); const licensesRepositoryMockValue = makeDefaultLicensesRepositoryMockValue(); + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const service = await makeAccountsServiceMock( accountsRepositoryMockValue, usersRepositoryMockValue, @@ -1476,6 +1528,7 @@ describe('AccountsService', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); await expect(service.getLicenseSummary(accountId)).rejects.toEqual( new HttpException( @@ -1498,6 +1551,8 @@ describe('AccountsService', () => { const blobStorageMockValue = makeBlobStorageServiceMockValue(); const licensesRepositoryMockValue = makeDefaultLicensesRepositoryMockValue(); + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const service = await makeAccountsServiceMock( accountsRepositoryMockValue, usersRepositoryMockValue, @@ -1507,6 +1562,7 @@ describe('AccountsService', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); expect(await service.getTypists(externalId)).toEqual([ { id: 1, name: 'Typist1' }, @@ -1528,6 +1584,8 @@ describe('AccountsService', () => { const blobStorageMockValue = makeBlobStorageServiceMockValue(); const licensesRepositoryMockValue = makeDefaultLicensesRepositoryMockValue(); + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const service = await makeAccountsServiceMock( accountsRepositoryMockValue, usersRepositoryMockValue, @@ -1537,6 +1595,7 @@ describe('AccountsService', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); await expect(service.getTypists(externalId)).rejects.toEqual( new HttpException( @@ -1559,6 +1618,8 @@ describe('AccountsService', () => { const blobStorageMockValue = makeBlobStorageServiceMockValue(); const licensesRepositoryMockValue = makeDefaultLicensesRepositoryMockValue(); + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const service = await makeAccountsServiceMock( accountsRepositoryMockValue, usersRepositoryMockValue, @@ -1568,6 +1629,7 @@ describe('AccountsService', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); await expect(service.getTypists(externalId)).rejects.toEqual( new HttpException( @@ -1590,6 +1652,8 @@ describe('AccountsService', () => { const blobStorageMockValue = makeBlobStorageServiceMockValue(); const licensesRepositoryMockValue = makeDefaultLicensesRepositoryMockValue(); + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const service = await makeAccountsServiceMock( accountsRepositoryMockValue, usersRepositoryMockValue, @@ -1599,6 +1663,7 @@ describe('AccountsService', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); expect(await service.getTypistGroups(externalId)).toEqual([ @@ -1620,6 +1685,8 @@ describe('AccountsService', () => { const blobStorageMockValue = makeBlobStorageServiceMockValue(); const licensesRepositoryMockValue = makeDefaultLicensesRepositoryMockValue(); + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const service = await makeAccountsServiceMock( accountsRepositoryMockValue, usersRepositoryMockValue, @@ -1629,6 +1696,7 @@ describe('AccountsService', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); await expect(service.getTypistGroups(externalId)).rejects.toEqual( @@ -1652,6 +1720,8 @@ describe('AccountsService', () => { const blobStorageMockValue = makeBlobStorageServiceMockValue(); const licensesRepositoryMockValue = makeDefaultLicensesRepositoryMockValue(); + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const service = await makeAccountsServiceMock( accountsRepositoryMockValue, usersRepositoryMockValue, @@ -1661,6 +1731,7 @@ describe('AccountsService', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); await expect(service.getTypistGroups(externalId)).rejects.toEqual( @@ -1708,38 +1779,45 @@ describe('getPartnerAccount', () => { const module = await makeTestingModule(source); // 親アカウントと子アカウント2つ作成 - const { accountId: parentAccountId } = await createAccount( - source, - 0, - 1, - 'PARENTCORP', - ); - const { accountId: childAccountId1 } = await createAccount( - source, - parentAccountId, - 2, - 'CHILDCORP1', - ); - const { accountId: childAccountId2 } = await createAccount( - source, - parentAccountId, - 2, - 'CHILDCORP2', - ); + const { id: parentAccountId } = ( + await makeTestAccount(source, { + parent_account_id: 0, + tier: 1, + company_name: 'PARENTCORP', + }) + ).account; + + const { id: childAccountId1 } = ( + await makeTestAccount(source, { + parent_account_id: parentAccountId, + tier: 2, + company_name: 'CHILDCORP1', + }) + ).account; + + const { id: childAccountId2 } = ( + await makeTestAccount(source, { + parent_account_id: parentAccountId, + tier: 2, + company_name: 'CHILDCORP2', + }) + ).account; // 第二にリクエストを投げる用の第三を作成 - const { accountId: childAccountId3 } = await createAccount( - source, - childAccountId1, - 3, - 'CHILDCORP3', - ); - const { accountId: childAccountId4 } = await createAccount( - source, - childAccountId2, - 3, - 'CHILDCORP4', - ); + const { id: childAccountId3 } = ( + await makeTestAccount(source, { + parent_account_id: childAccountId1, + tier: 3, + company_name: 'CHILDCORP3', + }) + ).account; + const { id: childAccountId4 } = ( + await makeTestAccount(source, { + parent_account_id: childAccountId2, + tier: 3, + company_name: 'CHILDCORP4', + }) + ).account; // 所有ライセンスを追加(親:3、子1:1、子2:2) await createLicense(source, parentAccountId); @@ -1815,30 +1893,34 @@ describe('getPartnerAccount', () => { const module = await makeTestingModule(source); // 親アカウントと子アカウント2つ作成 - const { accountId: parentAccountId } = await createAccount( - source, - 0, - 4, - 'PARENTCORP', - ); - const { accountId: childAccountId1 } = await createAccount( - source, - parentAccountId, - 5, - 'CHILDCORP1', - ); - const { accountId: childAccountId2 } = await createAccount( - source, - parentAccountId, - 5, - 'CHILDCORP2', - ); - const { accountId: childAccountId3 } = await createAccount( - source, - parentAccountId, - 5, - 'CHILDCORP3', - ); + const { id: parentAccountId } = ( + await makeTestAccount(source, { + parent_account_id: 0, + tier: 4, + company_name: 'PARENTCORP', + }) + ).account; + const { id: childAccountId1 } = ( + await makeTestAccount(source, { + parent_account_id: parentAccountId, + tier: 5, + company_name: 'CHILDCORP1', + }) + ).account; + const { id: childAccountId2 } = ( + await makeTestAccount(source, { + parent_account_id: parentAccountId, + tier: 5, + company_name: 'CHILDCORP2', + }) + ).account; + const { id: childAccountId3 } = ( + await makeTestAccount(source, { + parent_account_id: parentAccountId, + tier: 5, + company_name: 'CHILDCORP3', + }) + ).account; // 有効期限が14日後のライセンスを追加(5ライセンス) const expiryDate = new Date(); @@ -1999,6 +2081,8 @@ describe('getOrderHistories', () => { const limit = 0; const offset = 0; const accountId = 0; + const worktypesRepositoryMockValue = + makeDefaultWorktypesRepositoryMockValue(); const usersRepositoryMockValue = makeDefaultUsersRepositoryMockValue(); usersRepositoryMockValue.findTypistUsers = new Error(); const userGroupsRepositoryMockValue = @@ -2023,6 +2107,7 @@ describe('getOrderHistories', () => { sendGridMockValue, blobStorageMockValue, licensesRepositoryMockValue, + worktypesRepositoryMockValue, ); await expect( service.getOrderHistories(limit, offset, accountId), @@ -2058,25 +2143,26 @@ describe('issueLicense', () => { const service = module.get(AccountsService); const now = new Date(); // 親と子アカウントを作成する - const { accountId: parentAccountId } = await createAccount( - source, - 0, - 2, - 'PARENTCORP', - ); - const { accountId: childAccountId } = await createAccount( - source, - parentAccountId, - 3, - 'CHILDCORP1', - ); + const { id: parentAccountId } = ( + await makeTestAccount(source, { + parent_account_id: 0, + tier: 2, + company_name: 'PARENTCORP', + }) + ).account; + const { id: childAccountId } = ( + await makeTestAccount(source, { + parent_account_id: parentAccountId, + tier: 3, + company_name: 'CHILDCORP1', + }) + ).account; // 親と子のユーザーを作成する - const { externalId } = await createUser( - source, - parentAccountId, - 'userId-parent', - 'admin', - ); + const { external_id: externalId } = await makeTestUser(source, { + account_id: parentAccountId, + external_id: 'userId-parent', + role: 'admin', + }); // 親のライセンスを作成する(3個) await createLicense(source, parentAccountId); @@ -2117,26 +2203,26 @@ describe('issueLicense', () => { const service = module.get(AccountsService); const now = new Date(); // 親と子アカウントを作成する - const { accountId: parentAccountId } = await createAccount( - source, - 0, - 2, - 'PARENTCORP', - ); - const { accountId: childAccountId } = await createAccount( - source, - parentAccountId, - 3, - 'CHILDCORP1', - ); + const { id: parentAccountId } = ( + await makeTestAccount(source, { + parent_account_id: 0, + tier: 2, + company_name: 'PARENTCORP', + }) + ).account; + const { id: childAccountId } = ( + await makeTestAccount(source, { + parent_account_id: parentAccountId, + tier: 3, + company_name: 'CHILDCORP1', + }) + ).account; // 親と子のユーザーを作成する - const { externalId } = await createUser( - source, - parentAccountId, - 'userId-parent', - 'admin', - ); - + const { external_id: externalId } = await makeTestUser(source, { + account_id: parentAccountId, + external_id: 'userId-parent', + role: 'admin', + }); // 親のライセンスを作成する(3個) await createLicense(source, parentAccountId); await createLicense(source, parentAccountId); @@ -2174,25 +2260,26 @@ describe('issueLicense', () => { const service = module.get(AccountsService); const now = new Date(); // 親と子アカウントを作成する - const { accountId: parentAccountId } = await createAccount( - source, - 0, - 2, - 'PARENTCORP', - ); - const { accountId: childAccountId } = await createAccount( - source, - parentAccountId, - 3, - 'CHILDCORP1', - ); + const { id: parentAccountId } = ( + await makeTestAccount(source, { + parent_account_id: 0, + tier: 2, + company_name: 'PARENTCORP', + }) + ).account; + const { id: childAccountId } = ( + await makeTestAccount(source, { + parent_account_id: parentAccountId, + tier: 3, + company_name: 'CHILDCORP1', + }) + ).account; // 親と子のユーザーを作成する - const { externalId } = await createUser( - source, - parentAccountId, - 'userId-parent', - 'admin', - ); + const { external_id: externalId } = await makeTestUser(source, { + account_id: parentAccountId, + external_id: 'userId-parent', + role: 'admin', + }); // 親のライセンスを作成する(3個) await createLicense(source, parentAccountId); @@ -2238,24 +2325,30 @@ describe('getDealers', () => { }); it('Dealerを取得できる', async () => { const module = await makeTestingModule(source); - const { accountId: accountId_1 } = await createAccount( - source, - 1, - TIERS.TIER4, - 'DEALER_1', - ); - const { accountId: accountId_2 } = await createAccount( - source, - 2, - TIERS.TIER4, - 'DEALER_2', - ); - const { accountId: accountId_3 } = await createAccount( - source, - 3, - TIERS.TIER4, - 'DEALER_3', - ); + const { id: accountId_1 } = ( + await makeTestAccount(source, { + parent_account_id: 1, + tier: TIERS.TIER4, + country: 'JP', + company_name: 'DEALER_1', + }) + ).account; + const { id: accountId_2 } = ( + await makeTestAccount(source, { + parent_account_id: 2, + tier: TIERS.TIER4, + country: 'JP', + company_name: 'DEALER_2', + }) + ).account; + const { id: accountId_3 } = ( + await makeTestAccount(source, { + parent_account_id: 3, + tier: TIERS.TIER4, + country: 'JP', + company_name: 'DEALER_3', + }) + ).account; const service = module.get(AccountsService); expect(await service.getDealers()).toEqual({ @@ -2288,3 +2381,885 @@ describe('getDealers', () => { }); }); }); + +describe('createTypistGroup', () => { + let source: DataSource = null; + beforeEach(async () => { + source = new DataSource({ + type: 'sqlite', + database: ':memory:', + logging: false, + entities: [__dirname + '/../../**/*.entity{.ts,.js}'], + synchronize: true, // trueにすると自動的にmigrationが行われるため注意 + }); + return source.initialize(); + }); + + afterEach(async () => { + await source.destroy(); + source = null; + }); + it('TypistGroupを作成できる', async () => { + const module = await makeTestingModule(source); + const adminExternalId = 'admin-external-id'; + // 第五階層のアカウント作成 + const { id: accountId } = ( + await makeTestAccount( + source, + { tier: 5 }, + { external_id: adminExternalId }, + ) + ).account; + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: typiptUserExternalId, + role: 'typist', + }); + userIds.push(userId); + } + //作成したデータを確認 + { + const accounts = await getAccounts(source); + expect(accounts.length).toBe(1); + expect(accounts[0].id).toBe(accountId); + const users = await getUsers(source); + expect(users.length).toBe(4); + } + const service = module.get(AccountsService); + const typistGroupName = 'typist-group-name'; + const typistUserIds = userIds; + const context = makeContext(adminExternalId); + await service.createTypistGroup( + context, + adminExternalId, + typistGroupName, + typistUserIds, + ); + //実行結果を確認 + { + const typistGroups = await getTypistGroup(source, accountId); + expect(typistGroups.length).toBe(1); + expect(typistGroups[0].name).toBe(typistGroupName); + + const typistGroupUsers = await getTypistGroupMember( + source, + typistGroups[0].id, + ); + expect(typistGroupUsers.length).toBe(3); + expect(typistGroupUsers.map((user) => user.user_id)).toEqual(userIds); + } + }); + + it('typistIdsにRole:typist以外のユーザーが含まれていた場合、400エラーを返却する', async () => { + const module = await makeTestingModule(source); + const adminExternalId = 'admin-external-id'; + // 第五階層のアカウント作成 + const { id: accountId } = ( + await makeTestAccount( + source, + { tier: 5 }, + { external_id: adminExternalId }, + ) + ).account; + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: typiptUserExternalId, + role: + typiptUserExternalId === 'typist-user-external-id3' + ? 'none' + : 'typist', //typist-user-external-id3のみRole:none, + }); + userIds.push(userId); + } + //作成したデータを確認 + { + const accounts = await getAccounts(source); + expect(accounts.length).toBe(1); + expect(accounts[0].id).toBe(accountId); + const users = await getUsers(source); + expect(users.length).toBe(4); + expect(users.filter((user) => user.role === 'typist').length).toBe(2); + } + const service = module.get(AccountsService); + const typistGroupName = 'typist-group-name'; + const typistUserIds = userIds; + const context = makeContext(adminExternalId); + await expect( + service.createTypistGroup( + context, + adminExternalId, + typistGroupName, + typistUserIds, + ), + ).rejects.toEqual( + new HttpException(makeErrorResponse('E010204'), HttpStatus.BAD_REQUEST), + ); + }); + it('typistIdsに存在しないユーザーが含まれていた場合、400エラーを返却する', async () => { + const module = await makeTestingModule(source); + const adminExternalId = 'admin-external-id'; + // 第五階層のアカウント作成 + const { id: accountId } = ( + await makeTestAccount( + source, + { tier: 5 }, + { external_id: adminExternalId }, + ) + ).account; + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: typiptUserExternalId, + role: 'typist', + }); + userIds.push(userId); + } + //作成したデータを確認 + { + const accounts = await getAccounts(source); + expect(accounts.length).toBe(1); + expect(accounts[0].id).toBe(accountId); + const users = await getUsers(source); + expect(users.length).toBe(4); + } + const service = module.get(AccountsService); + const typistGroupName = 'typist-group-name'; + const typistUserIds = [...userIds, 9999]; //存在しないユーザーIDを追加 + const context = makeContext(adminExternalId); + await expect( + service.createTypistGroup( + context, + adminExternalId, + typistGroupName, + typistUserIds, + ), + ).rejects.toEqual( + new HttpException(makeErrorResponse('E010204'), HttpStatus.BAD_REQUEST), + ); + }); + it('DBアクセスに失敗した場合、500エラーを返却する', async () => { + const module = await makeTestingModule(source); + const adminExternalId = 'admin-external-id'; + // 第五階層のアカウント作成 + const { id: accountId } = ( + await makeTestAccount( + source, + { tier: 5 }, + { external_id: adminExternalId }, + ) + ).account; + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: typiptUserExternalId, + role: 'typist', + }); + userIds.push(userId); + } + //作成したデータを確認 + { + const accounts = await getAccounts(source); + expect(accounts.length).toBe(1); + expect(accounts[0].id).toBe(accountId); + const users = await getUsers(source); + expect(users.length).toBe(4); + } + const service = module.get(AccountsService); + const typistGroupName = 'typist-group-name'; + const typistUserIds = userIds; + const context = makeContext(adminExternalId); + //DBアクセスに失敗するようにする + const typistGroupService = module.get( + UserGroupsRepositoryService, + ); + typistGroupService.createTypistGroup = jest + .fn() + .mockRejectedValue('DB failed'); + + await expect( + service.createTypistGroup( + context, + adminExternalId, + typistGroupName, + typistUserIds, + ), + ).rejects.toEqual( + new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ), + ); + }); +}); + +describe('getTypistGroup', () => { + let source: DataSource = null; + beforeEach(async () => { + source = new DataSource({ + type: 'sqlite', + database: ':memory:', + logging: false, + entities: [__dirname + '/../../**/*.entity{.ts,.js}'], + synchronize: true, // trueにすると自動的にmigrationが行われるため注意 + }); + return source.initialize(); + }); + + afterEach(async () => { + await source.destroy(); + source = null; + }); + it('指定したIDのTypistGroupを取得できる', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: account.id, + external_id: typiptUserExternalId, + role: USER_ROLES.TYPIST, + }); + userIds.push(userId); + } + + // アカウントにタイピストグループを作成する + const typistGroupName = 'typist-group-name'; + + const service = module.get(AccountsService); + const context = makeContext(admin.external_id); + + await service.createTypistGroup( + context, + admin.external_id, + typistGroupName, + userIds, + ); + + //作成したデータを確認 + + const group = await getTypistGroup(source, account.id); + { + expect(group.length).toBe(1); + expect(group[0].name).toBe(typistGroupName); + const groupUsers = await getTypistGroupMember(source, group[0].id); + expect(groupUsers.length).toBe(3); + expect(groupUsers.map((user) => user.user_id)).toEqual(userIds); + } + + const typistGroup = await service.getTypistGroup( + context, + admin.external_id, + group[0].id, + ); + //実行結果を確認 + { + const typistGroups = await getTypistGroup(source, account.id); + expect(typistGroups.length).toBe(1); + expect(typistGroup.typistGroupName).toBe(typistGroupName); + expect(typistGroup.typistIds.length).toBe(3); + expect(typistGroup.typistIds).toEqual(userIds); + } + }); + + it('指定したタイピストグループIDのタイピストグループが存在しない場合、400エラーを返却する', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: account.id, + external_id: typiptUserExternalId, + role: USER_ROLES.TYPIST, + }); + userIds.push(userId); + } + + // アカウントにタイピストグループを作成する + const typistGroupName = 'typist-group-name'; + const service = module.get(AccountsService); + const context = makeContext(admin.external_id); + await service.createTypistGroup( + context, + admin.external_id, + typistGroupName, + userIds, + ); + + //作成したデータを確認 + { + const group = await getTypistGroup(source, account.id); + expect(group.length).toBe(1); + expect(group[0].name).toBe(typistGroupName); + const groupUsers = await getTypistGroupMember(source, group[0].id); + expect(groupUsers.length).toBe(3); + expect(groupUsers.map((user) => user.user_id)).toEqual(userIds); + } + + try { + await service.getTypistGroup(context, admin.external_id, 999); + } catch (e) { + if (e instanceof HttpException) { + expect(e.getStatus()).toEqual(HttpStatus.BAD_REQUEST); + expect(e.getResponse()).toEqual(makeErrorResponse('E010908')); + } else { + fail(); + } + } + }); + + it('DBアクセスに失敗した場合、500エラーを返却する', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: account.id, + external_id: typiptUserExternalId, + role: USER_ROLES.TYPIST, + }); + userIds.push(userId); + } + + // アカウントにタイピストグループを作成する + const typistGroupName = 'typist-group-name'; + const service = module.get(AccountsService); + const context = makeContext(admin.external_id); + + await service.createTypistGroup( + context, + admin.external_id, + typistGroupName, + userIds, + ); + + //作成したデータを確認 + const group = await getTypistGroup(source, account.id); + { + expect(group.length).toBe(1); + expect(group[0].name).toBe(typistGroupName); + const groupUsers = await getTypistGroupMember(source, group[0].id); + expect(groupUsers.length).toBe(3); + expect(groupUsers.map((user) => user.user_id)).toEqual(userIds); + } + + //DBアクセスに失敗するようにする + const typistGroupService = module.get( + UserGroupsRepositoryService, + ); + typistGroupService.getTypistGroup = jest + .fn() + .mockRejectedValue('DB failed'); + + try { + await service.getTypistGroup(context, admin.external_id, group[0].id); + } catch (e) { + if (e instanceof HttpException) { + expect(e.getStatus()).toEqual(HttpStatus.INTERNAL_SERVER_ERROR); + expect(e.getResponse()).toEqual(makeErrorResponse('E009999')); + } else { + fail(); + } + } + }); +}); + +describe('updateTypistGroup', () => { + let source: DataSource = null; + beforeEach(async () => { + source = new DataSource({ + type: 'sqlite', + database: ':memory:', + logging: false, + entities: [__dirname + '/../../**/*.entity{.ts,.js}'], + synchronize: true, // trueにすると自動的にmigrationが行われるため注意 + }); + return source.initialize(); + }); + + afterEach(async () => { + await source.destroy(); + source = null; + }); + it('TypistGroupを更新できる', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: account.id, + external_id: typiptUserExternalId, + role: USER_ROLES.TYPIST, + }); + userIds.push(userId); + } + + const service = module.get(AccountsService); + const typistUserIds = [userIds[1]]; + const context = makeContext(admin.external_id); + const typistGroupName = 'typist-group-name'; + await service.createTypistGroup( + context, + admin.external_id, + typistGroupName, + [userIds[0]], + ); + + //作成したデータを確認 + const group = await getTypistGroup(source, account.id); + { + const group = await getTypistGroup(source, account.id); + expect(group.length).toBe(1); + expect(group[0].name).toBe(typistGroupName); + const groupUsers = await getTypistGroupMember(source, group[0].id); + expect(groupUsers.length).toBe(1); + expect(groupUsers[0].user_group_id).toEqual(group[0].id); + expect(groupUsers[0].user_id).toEqual(userIds[0]); + } + + const updateTypistGroupName = 'typist-group-name-update'; + + await service.updateTypistGroup( + context, + admin.external_id, + group[0].id, + updateTypistGroupName, + typistUserIds, + ); + //実行結果を確認 + { + const typistGroups = await getTypistGroup(source, account.id); + expect(typistGroups.length).toBe(1); + expect(typistGroups[0].name).toBe(updateTypistGroupName); + + const typistGroupUsers = await getTypistGroupMember( + source, + typistGroups[0].id, + ); + expect(typistGroupUsers.length).toBe(1); + expect(typistGroupUsers[0].user_id).toEqual(userIds[1]); + } + }); + it('typistIdsにRole:typist以外のユーザーが含まれていた場合、400エラーを返却する', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: account.id, + external_id: typiptUserExternalId, + role: + typiptUserExternalId === 'typist-user-external-id3' + ? USER_ROLES.NONE + : USER_ROLES.TYPIST, //typist-user-external-id3のみRole:none + }); + userIds.push(userId); + } + + const typistGroupName = 'typist-group-name'; + const service = module.get(AccountsService); + const typistUserIds = [userIds[2]]; + const context = makeContext(admin.external_id); + + await service.createTypistGroup( + context, + admin.external_id, + typistGroupName, + [userIds[0]], + ); + + //作成したデータを確認 + const group = await getTypistGroup(source, account.id); + { + expect(group.length).toBe(1); + expect(group[0].name).toBe(typistGroupName); + const groupUsers = await getTypistGroupMember(source, group[0].id); + expect(groupUsers.length).toBe(1); + expect(groupUsers[0].user_group_id).toEqual(group[0].id); + expect(groupUsers[0].user_id).toEqual(userIds[0]); + } + + const updateTypistGroupName = 'typist-group-name-update'; + + try { + await service.updateTypistGroup( + context, + admin.external_id, + group[0].id, + updateTypistGroupName, + typistUserIds, + ); + } catch (e) { + if (e instanceof HttpException) { + expect(e.getStatus()).toEqual(HttpStatus.BAD_REQUEST); + expect(e.getResponse()).toEqual(makeErrorResponse('E010204')); + } else { + fail(); + } + } + }); + it('typistIdsに存在しないユーザーが含まれていた場合、400エラーを返却する', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: account.id, + external_id: typiptUserExternalId, + role: USER_ROLES.TYPIST, + }); + userIds.push(userId); + } + + const typistGroupName = 'typist-group-name'; + const service = module.get(AccountsService); + const typistUserIds = [999]; + const context = makeContext(admin.external_id); + await service.createTypistGroup( + context, + admin.external_id, + typistGroupName, + [userIds[0]], + ); + + //作成したデータを確認 + const group = await getTypistGroup(source, account.id); + { + expect(group.length).toBe(1); + expect(group[0].name).toBe(typistGroupName); + const groupUsers = await getTypistGroupMember(source, group[0].id); + expect(groupUsers.length).toBe(1); + expect(groupUsers[0].user_group_id).toEqual(group[0].id); + expect(groupUsers[0].user_id).toEqual(userIds[0]); + } + const updateTypistGroupName = 'typist-group-name-update'; + + try { + await service.updateTypistGroup( + context, + admin.external_id, + group[0].id, + updateTypistGroupName, + typistUserIds, + ); + } catch (e) { + if (e instanceof HttpException) { + expect(e.getStatus()).toEqual(HttpStatus.BAD_REQUEST); + expect(e.getResponse()).toEqual(makeErrorResponse('E010204')); + } else { + fail(); + } + } + }); + it('タイピストグループが存在しない場合、400エラーを返却する', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: account.id, + external_id: typiptUserExternalId, + role: USER_ROLES.TYPIST, + }); + userIds.push(userId); + } + + const typistGroupName = 'typist-group-name'; + const service = module.get(AccountsService); + const typistUserIds = [userIds[1]]; + const context = makeContext(admin.external_id); + await service.createTypistGroup( + context, + admin.external_id, + typistGroupName, + [userIds[0]], + ); + + //作成したデータを確認 + const group = await getTypistGroup(source, account.id); + { + expect(group.length).toBe(1); + expect(group[0].name).toBe(typistGroupName); + const groupUsers = await getTypistGroupMember(source, group[0].id); + expect(groupUsers.length).toBe(1); + expect(groupUsers[0].user_group_id).toEqual(group[0].id); + expect(groupUsers[0].user_id).toEqual(userIds[0]); + } + + const updateTypistGroupName = 'typist-group-name-update'; + + try { + await service.updateTypistGroup( + context, + admin.external_id, + 999, + updateTypistGroupName, + typistUserIds, + ); + } catch (e) { + if (e instanceof HttpException) { + expect(e.getStatus()).toEqual(HttpStatus.BAD_REQUEST); + expect(e.getResponse()).toEqual(makeErrorResponse('E010908')); + } else { + fail(); + } + } + }); + it('DBアクセスに失敗した場合、500エラーを返却する', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + // 作成したアカウントにユーザーを3名追加する + const typiptUserExternalIds = [ + 'typist-user-external-id1', + 'typist-user-external-id2', + 'typist-user-external-id3', + ]; + const userIds: number[] = []; + for (const typiptUserExternalId of typiptUserExternalIds) { + const { id: userId } = await makeTestUser(source, { + account_id: account.id, + external_id: typiptUserExternalId, + role: USER_ROLES.TYPIST, + }); + userIds.push(userId); + } + + const typistGroupName = 'typist-group-name'; + const service = module.get(AccountsService); + const typistUserIds = [userIds[1]]; + const context = makeContext(admin.external_id); + await service.createTypistGroup( + context, + admin.external_id, + typistGroupName, + [userIds[0]], + ); + + //作成したデータを確認 + const group = await getTypistGroup(source, account.id); + { + const group = await getTypistGroup(source, account.id); + expect(group.length).toBe(1); + expect(group[0].name).toBe(typistGroupName); + const groupUsers = await getTypistGroupMember(source, group[0].id); + expect(groupUsers.length).toBe(1); + expect(groupUsers[0].user_group_id).toEqual(group[0].id); + expect(groupUsers[0].user_id).toEqual(userIds[0]); + } + + const updateTypistGroupName = 'typist-group-name-update'; + + //DBアクセスに失敗するようにする + const typistGroupService = module.get( + UserGroupsRepositoryService, + ); + typistGroupService.updateTypistGroup = jest + .fn() + .mockRejectedValue('DB failed'); + + try { + await service.updateTypistGroup( + context, + admin.external_id, + group[0].id, + updateTypistGroupName, + typistUserIds, + ); + } catch (e) { + if (e instanceof HttpException) { + expect(e.getStatus()).toEqual(HttpStatus.INTERNAL_SERVER_ERROR); + expect(e.getResponse()).toEqual(makeErrorResponse('E009999')); + } else { + fail(); + } + } + }); +}); + +describe('getWorktypes', () => { + let source: DataSource = null; + beforeEach(async () => { + source = new DataSource({ + type: 'sqlite', + database: ':memory:', + logging: false, + entities: [__dirname + '/../../**/*.entity{.ts,.js}'], + synchronize: true, // trueにすると自動的にmigrationが行われるため注意 + }); + return source.initialize(); + }); + + afterEach(async () => { + await source.destroy(); + source = null; + }); + + it('アカウント内のWorktypeを取得できる', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + + const service = module.get(AccountsService); + const context = makeContext(admin.external_id); + + await createWorktype(source, account.id, 'worktype1', 'description1'); + await createWorktype(source, account.id, 'worktype2'); + + //作成したデータを確認 + const worktypes = await getWorktypes(source, account.id); + { + expect(worktypes.length).toBe(2); + expect(worktypes[0].custom_worktype_id).toBe('worktype1'); + expect(worktypes[1].custom_worktype_id).toBe('worktype2'); + expect(worktypes[0].description).toBe('description1'); + expect(worktypes[1].description).toBeNull(); + } + + const resWorktypes = await service.getWorktypes(context, admin.external_id); + + //実行結果を確認 + { + expect(resWorktypes.worktypes.length).toBe(2); + expect(resWorktypes.worktypes[0].worktypeId).toBe('worktype1'); + expect(resWorktypes.worktypes[1].worktypeId).toBe('worktype2'); + expect(resWorktypes.worktypes[0].description).toBe('description1'); + expect(resWorktypes.worktypes[1].description).toBe(undefined); + } + }); + + it('アカウント内のWorktypeを取得できる(0件)', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { admin } = await makeTestAccount(source, { tier: 5 }); + + const service = module.get(AccountsService); + const context = makeContext(admin.external_id); + + const resWorktypes = await service.getWorktypes(context, admin.external_id); + + //実行結果を確認 + { + expect(resWorktypes.worktypes.length).toBe(0); + } + }); + + it('DBアクセスに失敗した場合、500エラーを返却する', async () => { + const module = await makeTestingModule(source); + // 第五階層のアカウント作成 + const { account, admin } = await makeTestAccount(source, { tier: 5 }); + + const service = module.get(AccountsService); + const context = makeContext(admin.external_id); + + await createWorktype(source, account.id, 'worktype1', 'description1'); + await createWorktype(source, account.id, 'worktype2'); + + //作成したデータを確認 + const worktypes = await getWorktypes(source, account.id); + { + expect(worktypes.length).toBe(2); + expect(worktypes[0].custom_worktype_id).toBe('worktype1'); + expect(worktypes[1].custom_worktype_id).toBe('worktype2'); + expect(worktypes[0].description).toBe('description1'); + expect(worktypes[1].description).toBeNull(); + } + + //DBアクセスに失敗するようにする + const worktypeService = module.get( + WorktypesRepositoryService, + ); + worktypeService.getWorktypes = jest.fn().mockRejectedValue('DB failed'); + + try { + await service.getWorktypes(context, admin.external_id); + } catch (e) { + if (e instanceof HttpException) { + expect(e.getStatus()).toEqual(HttpStatus.INTERNAL_SERVER_ERROR); + expect(e.getResponse()).toEqual(makeErrorResponse('E009999')); + } else { + fail(); + } + } + }); +}); diff --git a/dictation_server/src/features/accounts/accounts.service.ts b/dictation_server/src/features/accounts/accounts.service.ts index 7c1cc7b..4aa8f2c 100644 --- a/dictation_server/src/features/accounts/accounts.service.ts +++ b/dictation_server/src/features/accounts/accounts.service.ts @@ -21,6 +21,8 @@ import { GetDealersResponse, Dealer, GetMyAccountResponse, + GetTypistGroupResponse, + GetWorktypesResponse, } from './types/types'; import { DateWithZeroTime, @@ -40,6 +42,11 @@ import { OrderNotFoundError, } from '../../repositories/licenses/errors/types'; import { BlobstorageService } from '../../gateways/blobstorage/blobstorage.service'; +import { + TypistGroupNotExistError, + TypistIdInvalidError, +} from '../../repositories/user_groups/errors/types'; +import { WorktypesRepositoryService } from '../../repositories/worktypes/worktypes.repository.service'; @Injectable() export class AccountsService { @@ -48,6 +55,7 @@ export class AccountsService { private readonly licensesRepository: LicensesRepositoryService, private readonly usersRepository: UsersRepositoryService, private readonly userGroupsRepository: UserGroupsRepositoryService, + private readonly worktypesRepository: WorktypesRepositoryService, private readonly adB2cService: AdB2cService, private readonly sendgridService: SendGridService, private readonly blobStorageService: BlobstorageService, @@ -106,8 +114,8 @@ export class AccountsService { }; return licenseSummaryResponse; } catch (e) { - console.log(e); - console.log('get licenseSummary failed'); + this.logger.error(`error=${e}`); + this.logger.error('get licenseSummary failed'); throw new HttpException( makeErrorResponse('E009999'), HttpStatus.INTERNAL_SERVER_ERROR, @@ -415,6 +423,61 @@ export class AccountsService { this.logger.log(`[OUT] ${this.getTypistGroups.name}`); } } + /** + * IDを指定してタイピストグループを取得する + * @param context + * @param externalId + * @param typistGroupId + * @returns typist group + */ + async getTypistGroup( + context: Context, + externalId: string, + typistGroupId: number, + ): Promise { + this.logger.log( + `[IN] [${context.trackingId}] ${this.getTypistGroup.name} | params: { externalId: ${externalId}, typistGroupId: ${typistGroupId} };`, + ); + + try { + const { account_id } = await this.usersRepository.findUserByExternalId( + externalId, + ); + const userGroup = await this.userGroupsRepository.getTypistGroup( + account_id, + typistGroupId, + ); + + return { + typistGroupName: userGroup.name, + typistIds: userGroup.userGroupMembers.map((x) => x.user_id), + }; + } catch (e) { + this.logger.error(`error=${e}`); + if (e instanceof Error) { + switch (e.constructor) { + case TypistGroupNotExistError: + throw new HttpException( + makeErrorResponse('E010908'), + HttpStatus.BAD_REQUEST, + ); + default: + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } + } + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } finally { + this.logger.log( + `[OUT] [${context.trackingId}] ${this.getTypistGroup.name}`, + ); + } + } /** * Gets typists @@ -870,4 +933,162 @@ export class AccountsService { this.logger.log(`[OUT] ${this.getDealers.name}`); } } + /** + * タイピストグループを作成する + * @param context + * @param externalId + * @param typistGroupName + * @param typistIds + * @returns createTypistGroupResponse + **/ + async createTypistGroup( + context: Context, + externalId: string, + typistGroupName: string, + typistIds: number[], + ): Promise { + this.logger.log( + `[IN] [${context.trackingId}] ${this.createTypistGroup.name} | params: { ` + + `externalId: ${externalId}, ` + + `typistGroupName: ${typistGroupName}, ` + + `typistIds: ${typistIds} };`, + ); + try { + // 外部IDをもとにユーザー情報を取得する + const { account_id } = await this.usersRepository.findUserByExternalId( + externalId, + ); + // API実行ユーザーのアカウントIDでタイピストグループを作成し、タイピストグループとtypistIdsのユーザーを紐付ける + await this.userGroupsRepository.createTypistGroup( + typistGroupName, + typistIds, + account_id, + ); + } catch (e) { + this.logger.error(`error=${e}`); + if (e instanceof Error) { + switch (e.constructor) { + case TypistIdInvalidError: + throw new HttpException( + makeErrorResponse('E010204'), + HttpStatus.BAD_REQUEST, + ); + default: + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } + } + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } + } + + /** + * タイピストグループを更新する + * @param context + * @param externalId + * @param typistGroupId + * @param typistGroupName + * @param typistIds + * @returns typist group + */ + async updateTypistGroup( + context: Context, + externalId: string, + typistGroupId: number, + typistGroupName: string, + typistIds: number[], + ): Promise { + this.logger.log( + `[IN] [${context.trackingId}] ${this.updateTypistGroup.name} | params: { typistGroupId: ${typistGroupId}, typistGroupName: ${typistGroupName}, typistIds: ${typistIds} };`, + ); + try { + // 外部IDをもとにユーザー情報を取得する + const { account_id } = await this.usersRepository.findUserByExternalId( + externalId, + ); + + // タイピストグループと所属するタイピストを更新する + await this.userGroupsRepository.updateTypistGroup( + account_id, + typistGroupId, + typistGroupName, + typistIds, + ); + } catch (e) { + this.logger.error(`error=${e}`); + if (e instanceof Error) { + switch (e.constructor) { + // タイピストIDが存在しない場合は400エラーを返す + case TypistIdInvalidError: + throw new HttpException( + makeErrorResponse('E010204'), + HttpStatus.BAD_REQUEST, + ); + // タイピストグループIDが存在しない場合は400エラーを返す + case TypistGroupNotExistError: + throw new HttpException( + makeErrorResponse('E010908'), + HttpStatus.BAD_REQUEST, + ); + default: + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } + } + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } finally { + this.logger.log( + `[OUT] [${context.trackingId}] ${this.updateTypistGroup.name}`, + ); + } + } + + /** + * ワークタイプ一覧を取得します + * @param context + * @param externalId + * @returns worktypes + */ + async getWorktypes( + context: Context, + externalId: string, + ): Promise { + this.logger.log(`[IN] [${context.trackingId}] ${this.getWorktypes.name}`); + try { + // 外部IDをもとにユーザー情報を取得する + const { account_id: accountId } = + await this.usersRepository.findUserByExternalId(externalId); + + // ワークタイプ一覧を取得する + const worktypes = await this.worktypesRepository.getWorktypes(accountId); + + return { + worktypes: worktypes.map((x) => ({ + id: x.id, + worktypeId: x.custom_worktype_id, + description: x.description ?? undefined, + })), + }; + } catch (e) { + this.logger.error(e); + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } finally { + this.logger.log( + `[OUT] [${context.trackingId}] ${this.getWorktypes.name}`, + ); + } + } } diff --git a/dictation_server/src/features/accounts/test/accounts.service.mock.ts b/dictation_server/src/features/accounts/test/accounts.service.mock.ts index c18d259..7d9d664 100644 --- a/dictation_server/src/features/accounts/test/accounts.service.mock.ts +++ b/dictation_server/src/features/accounts/test/accounts.service.mock.ts @@ -16,6 +16,12 @@ import { AdB2cUser } from '../../../gateways/adb2c/types/types'; import { LicensesRepositoryService } from '../../../repositories/licenses/licenses.repository.service'; import { Context } from '../../../common/log'; import { BlobstorageService } from '../../../gateways/blobstorage/blobstorage.service'; +import { Worktype } from '../../../repositories/worktypes/entity/worktype.entity'; +import { WorktypesRepositoryService } from '../../../repositories/worktypes/worktypes.repository.service'; + +export type WorktypesRepositoryMockValue = { + getWorktypes: Worktype[] | Error; +}; export type LicensesRepositoryMockValue = { getLicenseOrderHistoryInfo: @@ -79,6 +85,7 @@ export const makeAccountsServiceMock = async ( sendGridMockValue: SendGridMockValue, blobStorageMockValue: BlobStorageServiceMockValue, licensesRepositoryMockValue: LicensesRepositoryMockValue, + worktypesRepositoryMockValue: WorktypesRepositoryMockValue, ): Promise => { const module: TestingModule = await Test.createTestingModule({ providers: [AccountsService], @@ -107,6 +114,8 @@ export const makeAccountsServiceMock = async ( return makeBlobStorageServiceMock(blobStorageMockValue); case LicensesRepositoryService: return makeLicensesRepositoryMock(licensesRepositoryMockValue); + case WorktypesRepositoryService: + return makeWorktypesRepositoryMock(worktypesRepositoryMockValue); } }) .compile(); @@ -114,6 +123,19 @@ export const makeAccountsServiceMock = async ( return module.get(AccountsService); }; +export const makeWorktypesRepositoryMock = ( + value: WorktypesRepositoryMockValue, +) => { + const { getWorktypes } = value; + + return { + getWorktypes: + getWorktypes instanceof Error + ? jest.fn, []>().mockRejectedValue(getWorktypes) + : jest.fn, []>().mockResolvedValue(getWorktypes), + }; +}; + export const makeAccountsRepositoryMock = ( value: AccountsRepositoryMockValue, ) => { @@ -295,6 +317,13 @@ export const makeBlobStorageServiceMock = ( }; // 個別のテストケースに対応してそれぞれのMockを用意するのは無駄が多いのでテストケース内で個別の値を設定する +export const makeDefaultWorktypesRepositoryMockValue = + (): WorktypesRepositoryMockValue => { + return { + getWorktypes: [], + }; + }; + export const makeDefaultAccountsRepositoryMockValue = (): AccountsRepositoryMockValue => { let licenseSummaryInfo = new LicenseSummaryInfo(); diff --git a/dictation_server/src/features/accounts/test/utility.ts b/dictation_server/src/features/accounts/test/utility.ts index 42d5027..1410c68 100644 --- a/dictation_server/src/features/accounts/test/utility.ts +++ b/dictation_server/src/features/accounts/test/utility.ts @@ -1,167 +1,12 @@ import { DataSource } from 'typeorm'; -import { User } from '../../../repositories/users/entity/user.entity'; -import { Account } from '../../../repositories/accounts/entity/account.entity'; import { License, LicenseOrder, } from '../../../repositories/licenses/entity/license.entity'; import { SortCriteria } from '../../../repositories/sort_criteria/entity/sort_criteria.entity'; - -// TODO: [PBI 2379] 他のUtilityからコピペしてきたもの。後日整理される前提。 -export const createAccountAndAdminUser = async ( - datasource: DataSource, - adminExternalId: string, -): Promise<{ - accountId: number; - adminId: number; - role: string; - tier: number; -}> => { - const { identifiers: account_idf } = await datasource - .getRepository(Account) - .insert({ - tier: 1, - country: 'JP', - delegation_permission: false, - locked: false, - company_name: 'test inc.', - verified: true, - deleted_at: '', - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const account = account_idf.pop() as Account; - - const { identifiers: user_idf } = await datasource - .getRepository(User) - .insert({ - account_id: account.id, - external_id: adminExternalId, - role: 'admin none', - accepted_terms_version: '1.0', - email_verified: true, - auto_renew: true, - license_alert: true, - notification: true, - encryption: true, - encryption_password: 'password', - prompt: true, - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const user = user_idf.pop() as User; - - // Accountの管理者を設定する - await datasource.getRepository(Account).update( - { id: user.account_id }, - { - primary_admin_user_id: user.id, - }, - ); - - const accountResult = await getAccount(datasource, account.id); - const userResult = await getUser(datasource, user.id); - - return { - accountId: account.id, - adminId: user.id, - role: userResult.role, - tier: accountResult.tier, - }; -}; - -export const createAccount = async ( - datasource: DataSource, - parentAccountId: number, - tier: number, - companyName: string, -): Promise<{ accountId: number }> => { - const { identifiers } = await datasource.getRepository(Account).insert({ - parent_account_id: parentAccountId, - tier: tier, - country: 'JP', - delegation_permission: false, - locked: false, - company_name: companyName, - verified: true, - deleted_at: '', - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const account = identifiers.pop() as Account; - return { accountId: account.id }; -}; - -/** - * テスト ユーティリティ: 指定IDのアカウントを取得する - * @param dataSource データソース - * @param id アカウントID - * @returns 該当アカウント - */ -export const getAccount = async (dataSource: DataSource, id: number) => { - return await dataSource.getRepository(Account).findOne({ - where: { id: id }, - }); -}; - -/** - * テスト ユーティリティ: すべてのアカウントを取得する - * @param dataSource データソース - * @returns 該当アカウント一覧 - */ -export const getAccounts = async ( - dataSource: DataSource, -): Promise => { - return await dataSource.getRepository(Account).find(); -}; - -/** - * テスト ユーティリティ: 指定ExternalIdのユーザーを取得する - * @param dataSource データソース - * @param externalId 外部ID - * @returns 該当ユーザー - */ -export const getUserFromExternalID = async ( - dataSource: DataSource, - externalId: string, -) => { - return await dataSource.getRepository(User).findOne({ - where: { external_id: externalId }, - }); -}; - -/** - * テスト ユーティリティ: 指定Idのユーザーを取得する - * @param dataSource データソース - * @param externalId 外部ID - * @returns 該当ユーザー - */ -export const getUser = async ( - datasource: DataSource, - id: number, -): Promise => { - const user = await datasource.getRepository(User).findOne({ - where: { - id: id, - }, - }); - return user; -}; - -/** - * テスト ユーティリティ: すべてのユーザーを取得する - * @param dataSource データソース - * @returns 該当ユーザー一覧 - */ -export const getUsers = async (dataSource: DataSource): Promise => { - return await dataSource.getRepository(User).find(); -}; +import { UserGroup } from '../../../repositories/user_groups/entity/user_group.entity'; +import { UserGroupMember } from '../../../repositories/user_groups/entity/user_group_member.entity'; +import { Worktype } from '../../../repositories/worktypes/entity/worktype.entity'; /** * テスト ユーティリティ: すべてのソート条件を取得する @@ -242,30 +87,58 @@ export const createLicenseOrder = async ( identifiers.pop() as License; }; -export const createUser = async ( +// タイピストグループを取得する +export const getTypistGroup = async ( datasource: DataSource, accountId: number, - external_id: string, - role: string, - author_id?: string | undefined, -): Promise<{ userId: number; externalId: string; authorId: string }> => { - const { identifiers } = await datasource.getRepository(User).insert({ +): Promise => { + return await datasource.getRepository(UserGroup).find({ + where: { + account_id: accountId, + }, + }); +}; +// タイピストグループメンバーを取得する +export const getTypistGroupMember = async ( + datasource: DataSource, + userGroupId: number, +): Promise => { + return await datasource.getRepository(UserGroupMember).find({ + where: { + user_group_id: userGroupId, + }, + }); +}; + +// Worktypeを作成する +export const createWorktype = async ( + datasource: DataSource, + accountId: number, + worktypeId: string, + description?: string, +): Promise => { + const { identifiers } = await datasource.getRepository(Worktype).insert({ account_id: accountId, - external_id: external_id, - role: role, - accepted_terms_version: '1.0', - author_id: author_id, - email_verified: true, - auto_renew: true, - license_alert: true, - notification: true, - encryption: false, - prompt: false, + custom_worktype_id: worktypeId, + description: description ?? null, + deleted_at: null, created_by: 'test_runner', created_at: new Date(), updated_by: 'updater', updated_at: new Date(), }); - const user = identifiers.pop() as User; - return { userId: user.id, externalId: external_id, authorId: author_id }; + const worktype = identifiers.pop() as Worktype; + return worktype; +}; + +// Worktypeを取得する +export const getWorktypes = async ( + datasource: DataSource, + accountId: number, +): Promise => { + return await datasource.getRepository(Worktype).find({ + where: { + account_id: accountId, + }, + }); }; diff --git a/dictation_server/src/features/accounts/types/types.ts b/dictation_server/src/features/accounts/types/types.ts index fb87e37..4ad6f6c 100644 --- a/dictation_server/src/features/accounts/types/types.ts +++ b/dictation_server/src/features/accounts/types/types.ts @@ -8,8 +8,11 @@ import { Min, ArrayMinSize, MinLength, + IsArray, } from 'class-validator'; import { IsAdminPasswordvalid } from '../../../common/validators/admin.validator'; +import { IsUnique } from '../../../common/validators/IsUnique.validator'; +import { Type } from 'class-transformer'; export class CreateAccountRequest { @ApiProperty() @@ -131,18 +134,58 @@ export class GetTypistGroupsResponse { typistGroups: TypistGroup[]; } +export class GetTypistGroupRequest { + @ApiProperty() + @Type(() => Number) + @IsInt() + @Min(0) + typistGroupId: number; +} +export class GetTypistGroupResponse { + @ApiProperty() + typistGroupName: string; + @ApiProperty({ isArray: true, type: 'integer' }) + typistIds: number[]; +} + export class CreateTypistGroupRequest { @ApiProperty({ minLength: 1, maxLength: 50 }) @MinLength(1) @MaxLength(50) typistGroupName: string; - @ApiProperty({ minItems: 1 }) + @ApiProperty({ minItems: 1, isArray: true, type: 'integer' }) @ArrayMinSize(1) + @IsArray() + @IsInt({ each: true }) + @Min(0, { each: true }) + @IsUnique() typistIds: number[]; } export class CreateTypistGroupResponse {} +export class UpdateTypistGroupRequest { + @ApiProperty({ minLength: 1, maxLength: 50 }) + @MinLength(1) + @MaxLength(50) + typistGroupName: string; + @ApiProperty({ minItems: 1, isArray: true, type: 'integer' }) + @ArrayMinSize(1) + @IsArray() + @IsInt({ each: true }) + @Min(0, { each: true }) + @IsUnique() + typistIds: number[]; +} +export class UpdateTypistGroupRequestParam { + @ApiProperty() + @Type(() => Number) + @IsInt() + @Min(0) + typistGroupId: number; +} +export class UpdateTypistGroupResponse {} + export class CreatePartnerAccountRequest { @ApiProperty() companyName: string; @@ -278,3 +321,38 @@ export class GetDealersResponse { @ApiProperty({ type: [Dealer] }) dealers: Dealer[]; } + +export class CancelIssueRequest { + @ApiProperty({ description: '注文元アカウントID' }) + orderedAccountId: number; + + @ApiProperty({ description: 'POナンバー' }) + @Matches(/^[A-Z0-9]+$/) + poNumber: string; +} + +export class CancelIssueResponse {} + +export class Worktype { + @ApiProperty({ description: 'WorktypeのID' }) + id: number; + @ApiProperty({ description: 'WorktypeID' }) + worktypeId: string; + @ApiProperty({ description: 'Worktypeの説明', required: false }) + description?: string; +} + +export class GetWorktypesResponse { + @ApiProperty({ type: [Worktype] }) + worktypes: Worktype[]; +} + +export class CreateWorktypesRequest { + @ApiProperty({ minLength: 1, description: 'WorktypeID' }) + @MinLength(1) + worktypeId: string; + @ApiProperty({ description: 'Worktypeの説明', required: false }) + description?: string; +} + +export class CreateWorktypeResponse {} diff --git a/dictation_server/src/features/auth/auth.controller.ts b/dictation_server/src/features/auth/auth.controller.ts index a3c1742..b0b2f3e 100644 --- a/dictation_server/src/features/auth/auth.controller.ts +++ b/dictation_server/src/features/auth/auth.controller.ts @@ -51,7 +51,6 @@ export class AuthController { operationId: 'token', }) async token(@Body() body: TokenRequest): Promise { - console.log(body); const idToken = await this.authService.getVerifiedIdToken(body.idToken); const isVerified = await this.authService.isVerifiedUser(idToken); diff --git a/dictation_server/src/features/files/files.service.spec.ts b/dictation_server/src/features/files/files.service.spec.ts index 8ef77b5..b981224 100644 --- a/dictation_server/src/features/files/files.service.spec.ts +++ b/dictation_server/src/features/files/files.service.spec.ts @@ -7,14 +7,10 @@ import { makeFilesServiceMock, } from './test/files.service.mock'; import { DataSource } from 'typeorm'; -import { - createAccount, - createTask, - createUser, - makeTestingModuleWithBlob, -} from './test/utility'; +import { createTask, makeTestingModuleWithBlob } from './test/utility'; import { FilesService } from './files.service'; import { makeContext } from '../../common/log'; +import { makeTestSimpleAccount, makeTestUser } from '../../common/test/utility'; describe('音声ファイルアップロードURL取得', () => { it('アップロードSASトークンが乗っているURLを返却する', async () => { @@ -306,14 +302,17 @@ describe('音声ファイルダウンロードURL取得', () => { }); it('ダウンロードSASトークンが乗っているURLを取得できる', async () => { - const { accountId } = await createAccount(source); - const { externalId, userId, authorId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { + external_id: externalId, + id: userId, + author_id: authorId, + } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${userId}`; const { audioFileId } = await createTask( @@ -343,20 +342,18 @@ describe('音声ファイルダウンロードURL取得', () => { }); it('Typistの場合、タスクのステータスが[Inprogress,Pending]以外でエラー', async () => { - const { accountId } = await createAccount(source); - const { externalId, userId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId, id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${authorUserId}`; @@ -388,26 +385,23 @@ describe('音声ファイルダウンロードURL取得', () => { }); it('Typistの場合、自身が担当するタスクでない場合エラー', async () => { - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: otherId } = await createUser( - source, - accountId, - 'other-typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: otherId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'other-typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${authorUserId}`; const { audioFileId } = await createTask( @@ -438,14 +432,13 @@ describe('音声ファイルダウンロードURL取得', () => { }); it('Authorの場合、自身が登録したタスクでない場合エラー', async () => { - const { accountId } = await createAccount(source); - const { externalId, userId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId, id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${userId}`; const { audioFileId } = await createTask( @@ -477,14 +470,13 @@ describe('音声ファイルダウンロードURL取得', () => { }); it('Taskが存在しない場合はエラーとなる', async () => { - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }); const blobParam = makeBlobstorageServiceMockValue(); @@ -503,14 +495,17 @@ describe('音声ファイルダウンロードURL取得', () => { }); it('blobストレージにファイルが存在しない場合はエラーとなる', async () => { - const { accountId } = await createAccount(source); - const { externalId, userId, authorId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { + external_id: externalId, + id: userId, + author_id: authorId, + } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${userId}`; const { audioFileId } = await createTask( @@ -561,13 +556,15 @@ describe('テンプレートファイルダウンロードURL取得', () => { }); it('ダウンロードSASトークンが乗っているURLを取得できる', async () => { - const { accountId } = await createAccount(source); - const { externalId, authorId } = await createUser( + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId, author_id: authorId } = await makeTestUser( source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', + { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }, ); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/Templates`; @@ -598,14 +595,13 @@ describe('テンプレートファイルダウンロードURL取得', () => { }); it('Typistの場合、タスクのステータスが[Inprogress,Pending]以外でエラー', async () => { - const { accountId } = await createAccount(source); - const { externalId, userId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - undefined, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId, id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + author_id: undefined, + }); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/Templates`; const { audioFileId } = await createTask( @@ -636,21 +632,19 @@ describe('テンプレートファイルダウンロードURL取得', () => { }); it('Typistの場合、自身が担当するタスクでない場合エラー', async () => { - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - undefined, - ); - const { userId: otherId } = await createUser( - source, - accountId, - 'other-typist-user-external-id', - 'typist', - undefined, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + author_id: undefined, + }); + const { id: otherId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'other-typist-user-external-id', + role: 'typist', + author_id: undefined, + }); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/Templates`; const { audioFileId } = await createTask( @@ -681,14 +675,13 @@ describe('テンプレートファイルダウンロードURL取得', () => { }); it('Authorの場合、自身が登録したタスクでない場合エラー', async () => { - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/Templates`; const { audioFileId } = await createTask( @@ -720,14 +713,13 @@ describe('テンプレートファイルダウンロードURL取得', () => { }); it('Taskが存在しない場合はエラーとなる', async () => { - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }); const blobParam = makeBlobstorageServiceMockValue(); @@ -746,13 +738,15 @@ describe('テンプレートファイルダウンロードURL取得', () => { }); it('blobストレージにファイルが存在しない場合はエラーとなる', async () => { - const { accountId } = await createAccount(source); - const { externalId, authorId } = await createUser( + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId, author_id: authorId } = await makeTestUser( source, - accountId, - 'author-user-external-id', - 'author', - 'AUTHOR_ID', + { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'AUTHOR_ID', + }, ); const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/Templates`; diff --git a/dictation_server/src/features/files/test/utility.ts b/dictation_server/src/features/files/test/utility.ts index a6ccfdc..61772f6 100644 --- a/dictation_server/src/features/files/test/utility.ts +++ b/dictation_server/src/features/files/test/utility.ts @@ -36,58 +36,8 @@ import { BlobstorageServiceMockValue, makeBlobstorageServiceMock, } from './files.service.mock'; -import { User } from '../../../repositories/users/entity/user.entity'; -import { Account } from '../../../repositories/accounts/entity/account.entity'; import { TemplateFile } from '../../../repositories/template_files/entity/template_file.entity'; -export const createAccount = async ( - datasource: DataSource, -): Promise<{ accountId: number }> => { - const { identifiers } = await datasource.getRepository(Account).insert({ - tier: 5, - country: 'US', - delegation_permission: false, - locked: false, - company_name: 'test inc.', - verified: true, - deleted_at: '', - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const account = identifiers.pop() as Account; - return { accountId: account.id }; -}; - -export const createUser = async ( - datasource: DataSource, - accountId: number, - external_id: string, - role: string, - author_id?: string | undefined, -): Promise<{ userId: number; externalId: string; authorId: string }> => { - const { identifiers } = await datasource.getRepository(User).insert({ - account_id: accountId, - external_id: external_id, - role: role, - accepted_terms_version: '1.0', - author_id: author_id, - email_verified: true, - auto_renew: true, - license_alert: true, - notification: true, - encryption: false, - prompt: false, - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const user = identifiers.pop() as User; - return { userId: user.id, externalId: external_id, authorId: author_id }; -}; - export const createTask = async ( datasource: DataSource, account_id: number, diff --git a/dictation_server/src/features/licenses/licenses.controller.ts b/dictation_server/src/features/licenses/licenses.controller.ts index f599211..d739ccd 100644 --- a/dictation_server/src/features/licenses/licenses.controller.ts +++ b/dictation_server/src/features/licenses/licenses.controller.ts @@ -23,7 +23,8 @@ import { ActivateCardLicensesResponse, ActivateCardLicensesRequest, GetAllocatableLicensesResponse, - GetAllocatableLicensesRequest, + CancelOrderRequest, + CancelOrderResponse, } from './types/types'; import { Request } from 'express'; import { retrieveAuthorizationToken } from '../../common/http/helper'; @@ -72,10 +73,6 @@ export class LicensesController { @Req() req: Request, @Body() body: CreateOrdersRequest, ): Promise { - console.log(req.header('Authorization')); - console.log(body); - - // AuthGuardでチェック済みなのでここでのアクセストークンチェックはしない const accessToken = retrieveAuthorizationToken(req); const payload = jwt.decode(accessToken, { json: true }) as AccessToken; @@ -114,9 +111,6 @@ export class LicensesController { @Req() req: Request, @Body() body: IssueCardLicensesRequest, ): Promise { - console.log(req.header('Authorization')); - console.log(body); - const accessToken = retrieveAuthorizationToken(req); const payload = jwt.decode(accessToken, { json: true }) as AccessToken; @@ -160,9 +154,6 @@ export class LicensesController { @Req() req: Request, @Body() body: ActivateCardLicensesRequest, ): Promise { - console.log(req.header('Authorization')); - console.log(body); - const accessToken = retrieveAuthorizationToken(req); const payload = jwt.decode(accessToken, { json: true }) as AccessToken; @@ -216,4 +207,54 @@ export class LicensesController { return allocatableLicenses; } + + @ApiResponse({ + status: HttpStatus.OK, + type: CancelOrderResponse, + description: '成功時のレスポンス', + }) + @ApiResponse({ + status: HttpStatus.BAD_REQUEST, + description: '対象注文のステータスが発行待ち状態でないとき', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.UNAUTHORIZED, + description: '認証エラー', + type: ErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.INTERNAL_SERVER_ERROR, + description: '想定外のサーバーエラー', + type: ErrorResponse, + }) + @ApiOperation({ + operationId: 'cancelOrder', + description: 'ライセンス注文をキャンセルします', + }) + @ApiBearerAuth() + @UseGuards(AuthGuard) + @UseGuards( + RoleGuard.requireds({ + roles: [ADMIN_ROLES.ADMIN], + tiers: [TIERS.TIER2, TIERS.TIER3, TIERS.TIER4, TIERS.TIER5], + }), + ) + @Post('/orders/cancel') + async cancelOrder( + @Req() req: Request, + @Body() body: CancelOrderRequest, + ): Promise { + const token = retrieveAuthorizationToken(req); + const payload = jwt.decode(token, { json: true }) as AccessToken; + + const context = makeContext(payload.userId); + + await this.licensesService.cancelOrder( + context, + payload.userId, + body.poNumber, + ); + return {}; + } } diff --git a/dictation_server/src/features/licenses/licenses.service.spec.ts b/dictation_server/src/features/licenses/licenses.service.spec.ts index 55e0e96..f14ed0c 100644 --- a/dictation_server/src/features/licenses/licenses.service.spec.ts +++ b/dictation_server/src/features/licenses/licenses.service.spec.ts @@ -23,8 +23,6 @@ import { LicensesService } from './licenses.service'; import { makeTestingModule } from '../../common/test/modules'; import { DataSource } from 'typeorm'; import { - createAccount, - createUser, createCardLicense, createLicense, createCardLicenseIssue, @@ -33,11 +31,17 @@ import { selectCardLicense, selectLicense, selectLicenseAllocationHistory, + createOrder, + selectOrderLicense, } from './test/utility'; import { UsersService } from '../users/users.service'; import { makeContext } from '../../common/log'; -import { IsNotIn } from 'class-validator'; import { LICENSE_ALLOCATED_STATUS, LICENSE_TYPE } from '../../constants'; +import { + makeHierarchicalAccounts, + makeTestSimpleAccount, + makeTestUser, +} from '../../common/test/utility'; describe('LicensesService', () => { it('ライセンス注文が完了する', async () => { @@ -303,16 +307,16 @@ describe('DBテスト', () => { it('カードライセンス発行が完了する(発行数が合っているか確認)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'userId', - 'admin', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const service = module.get(LicensesService); - const issueCount = 1000; + const issueCount = 500; await service.issueCardLicenseKeys(externalId, issueCount); const dbSelectResult = await selectCardLicensesCount(source); expect(dbSelectResult.count).toEqual(issueCount); @@ -321,13 +325,13 @@ describe('DBテスト', () => { it('カードライセンス取り込みが完了する', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'userId', - 'admin', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const cardLicenseKey = 'WZCETXC0Z9PQZ9GKRGGY'; const defaultAccountId = 150; @@ -364,13 +368,13 @@ describe('DBテスト', () => { const module = await makeTestingModule(source); const now = new Date(); - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'userId', - 'admin', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); // ライセンスを作成する // 1件目 @@ -499,8 +503,13 @@ describe('ライセンス割り当て', () => { it('未割当のライセンスに対して、ライセンス割り当てが完了する', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { userId } = await createUser(source, accountId, 'userId', 'admin'); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); await createLicense( source, 1, @@ -544,8 +553,13 @@ describe('ライセンス割り当て', () => { it('再割り当て可能なライセンスに対して、ライセンス割り当てが完了する', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { userId } = await createUser(source, accountId, 'userId', 'admin'); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const date = new Date(); date.setDate(date.getDate() + 30); await createLicense( @@ -585,8 +599,13 @@ describe('ライセンス割り当て', () => { it('未割当のライセンスに対して、別のライセンスが割り当てられているユーザーの割り当てが完了する', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { userId } = await createUser(source, accountId, 'userId', 'admin'); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const date = new Date(); date.setDate(date.getDate() + 30); await createLicense( @@ -661,8 +680,13 @@ describe('ライセンス割り当て', () => { it('割り当て時にライセンス履歴テーブルへの登録が完了する(元がNORMALのとき)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { userId } = await createUser(source, accountId, 'userId', 'admin'); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const date = new Date(); date.setDate(date.getDate() + 30); await createLicense( @@ -701,8 +725,13 @@ describe('ライセンス割り当て', () => { it('割り当て時にライセンス履歴テーブルへの登録が完了する(元がCARDのとき)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { userId } = await createUser(source, accountId, 'userId', 'admin'); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const date = new Date(); date.setDate(date.getDate() + 30); await createLicense( @@ -741,8 +770,13 @@ describe('ライセンス割り当て', () => { it('割り当て時にライセンス履歴テーブルへの登録が完了する(元がTRIALのとき)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { userId } = await createUser(source, accountId, 'userId', 'admin'); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const date = new Date(); date.setDate(date.getDate() + 30); await createLicense( @@ -781,8 +815,13 @@ describe('ライセンス割り当て', () => { it('有効期限が切れているライセンスを割り当てようとした場合、エラーになる', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { userId } = await createUser(source, accountId, 'userId', 'admin'); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const date = new Date(); date.setDate(date.getDate() - 30); await createLicense( @@ -807,8 +846,13 @@ describe('ライセンス割り当て', () => { it('割り当て不可なライセンスを割り当てようとした場合、エラーになる', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { userId } = await createUser(source, accountId, 'userId', 'admin'); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); const date = new Date(); date.setDate(date.getDate() + 30); await createLicense( @@ -844,3 +888,237 @@ describe('ライセンス割り当て', () => { ); }); }); + +describe('ライセンス割り当て解除', () => { + let source: DataSource = null; + beforeEach(async () => { + source = new DataSource({ + type: 'sqlite', + database: ':memory:', + logging: false, + entities: [__dirname + '/../../**/*.entity{.ts,.js}'], + synchronize: true, // trueにすると自動的にmigrationが行われるため注意 + }); + return source.initialize(); + }); + + afterEach(async () => { + await source.destroy(); + source = null; + }); + + it('ライセンスの割り当て解除が完了する', async () => { + const module = await makeTestingModule(source); + + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); + const date = new Date(); + date.setDate(date.getDate() + 30); + await createLicense( + source, + 1, + date, + accountId, + LICENSE_TYPE.NORMAL, + LICENSE_ALLOCATED_STATUS.ALLOCATED, + userId, + ); + await createLicenseAllocationHistory(source, 1, userId, 1, 'NONE'); + + const service = module.get(UsersService); + await service.deallocateLicense(makeContext('trackingId'), userId); + + // 割り当て解除したライセンスの状態確認 + const deallocatedLicense = await selectLicense(source, 1); + expect(deallocatedLicense.license.allocated_user_id).toBe(null); + expect(deallocatedLicense.license.status).toBe( + LICENSE_ALLOCATED_STATUS.REUSABLE, + ); + expect(deallocatedLicense.license.expiry_date).toEqual(date); + + // ライセンス履歴テーブルの状態確認 + const licenseAllocationHistory = await selectLicenseAllocationHistory( + source, + userId, + 1, + ); + expect(licenseAllocationHistory.licenseAllocationHistory.user_id).toBe( + userId, + ); + expect(licenseAllocationHistory.licenseAllocationHistory.license_id).toBe( + 1, + ); + expect(licenseAllocationHistory.licenseAllocationHistory.is_allocated).toBe( + false, + ); + expect( + licenseAllocationHistory.licenseAllocationHistory.switch_from_type, + ).toBe('NONE'); + }); + + it('ライセンスが既に割り当て解除されていた場合、エラーとなる', async () => { + const module = await makeTestingModule(source); + + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + author_id: undefined, + }); + await makeTestUser(source, { + account_id: accountId, + external_id: 'userId2', + role: 'admin', + author_id: undefined, + }); + const date = new Date(); + date.setDate(date.getDate() + 30); + await createLicense( + source, + 1, + date, + accountId, + LICENSE_TYPE.NORMAL, + LICENSE_ALLOCATED_STATUS.ALLOCATED, + 2, + ); + await createLicense( + source, + 2, + date, + accountId, + LICENSE_TYPE.NORMAL, + LICENSE_ALLOCATED_STATUS.REUSABLE, + userId, + ); + await createLicenseAllocationHistory(source, 1, userId, 1, 'NONE'); + + const service = module.get(UsersService); + await expect( + service.deallocateLicense(makeContext('trackingId'), userId), + ).rejects.toEqual( + new HttpException(makeErrorResponse('E010807'), HttpStatus.BAD_REQUEST), + ); + }); +}); + +describe('ライセンス注文キャンセル', () => { + let source: DataSource = null; + beforeEach(async () => { + source = new DataSource({ + type: 'sqlite', + database: ':memory:', + logging: false, + entities: [__dirname + '/../../**/*.entity{.ts,.js}'], + synchronize: true, // trueにすると自動的にmigrationが行われるため注意 + }); + return source.initialize(); + }); + + afterEach(async () => { + await source.destroy(); + source = null; + }); + + it('ライセンス注文のキャンセルが完了する', async () => { + const module = await makeTestingModule(source); + const { tier2Accounts: tier2Accounts } = await makeHierarchicalAccounts( + source, + ); + const poNumber = 'CANCEL_TEST'; + await createOrder( + source, + poNumber, + tier2Accounts[0].account.id, + tier2Accounts[0].account.parent_account_id, + 10, + 'Issue Requesting', + ); + // キャンセル済みの同名poNumoberが存在しても正常に動作することの確認用order + await createOrder( + source, + poNumber, + tier2Accounts[0].account.id, + tier2Accounts[0].account.parent_account_id, + 10, + 'Order Canceled', + ); + + const service = module.get(LicensesService); + await service.cancelOrder( + makeContext('trackingId'), + tier2Accounts[0].users[0].external_id, + poNumber, + ); + + // 割り当て解除したライセンスの状態確認 + const orderRecord = await selectOrderLicense( + source, + tier2Accounts[0].account.id, + poNumber, + ); + expect(orderRecord.orderLicense.canceled_at).toBeDefined(); + expect(orderRecord.orderLicense.status).toBe('Order Canceled'); + }); + + it('ライセンスが既に発行済みの場合、エラーとなる', async () => { + const module = await makeTestingModule(source); + const { tier2Accounts: tier2Accounts } = await makeHierarchicalAccounts( + source, + ); + const poNumber = 'CANCEL_TEST'; + await createOrder( + source, + poNumber, + tier2Accounts[0].account.id, + tier2Accounts[0].account.parent_account_id, + 10, + 'Issued', + ); + + const service = module.get(LicensesService); + await expect( + service.cancelOrder( + makeContext('trackingId'), + tier2Accounts[0].users[0].external_id, + poNumber, + ), + ).rejects.toEqual( + new HttpException(makeErrorResponse('E010808'), HttpStatus.BAD_REQUEST), + ); + }); + + it('ライセンスが既にキャンセル済みの場合、エラーとなる', async () => { + const module = await makeTestingModule(source); + + const { tier2Accounts: tier2Accounts } = await makeHierarchicalAccounts( + source, + ); + const poNumber = 'CANCEL_TEST'; + await createOrder( + source, + poNumber, + tier2Accounts[0].account.id, + tier2Accounts[0].account.parent_account_id, + 10, + 'Order Canceled', + ); + + const service = module.get(LicensesService); + await expect( + service.cancelOrder( + makeContext('trackingId'), + tier2Accounts[0].users[0].external_id, + poNumber, + ), + ).rejects.toEqual( + new HttpException(makeErrorResponse('E010808'), HttpStatus.BAD_REQUEST), + ); + }); +}); diff --git a/dictation_server/src/features/licenses/licenses.service.ts b/dictation_server/src/features/licenses/licenses.service.ts index a60e4fd..2c23bd8 100644 --- a/dictation_server/src/features/licenses/licenses.service.ts +++ b/dictation_server/src/features/licenses/licenses.service.ts @@ -8,6 +8,7 @@ import { PoNumberAlreadyExistError, LicenseNotExistError, LicenseKeyAlreadyActivatedError, + CancelOrderFailedError, } from '../../repositories/licenses/errors/types'; import { LicensesRepositoryService } from '../../repositories/licenses/licenses.repository.service'; import { UserNotFoundError } from '../../repositories/users/errors/types'; @@ -255,4 +256,54 @@ export class LicensesService { ); } } + + /** + * ライセンス注文をキャンセルする + * @param context + * @param externalId + * @param poNumber + */ + async cancelOrder( + context: Context, + externalId: string, + poNumber: string, + ): Promise { + this.logger.log( + `[IN] [${context.trackingId}] ${this.cancelOrder.name} | params: { ` + + `externalId: ${externalId}, ` + + `poNumber: ${poNumber}, };`, + ); + let myAccountId: number; + + try { + // ユーザIDからアカウントIDを取得する + myAccountId = ( + await this.usersRepository.findUserByExternalId(externalId) + ).account_id; + // 注文キャンセル処理 + await this.licensesRepository.cancelOrder(myAccountId, poNumber); + } catch (e) { + this.logger.error(`error=${e}`); + switch (e.constructor) { + case UserNotFoundError: + throw new HttpException( + makeErrorResponse('E010204'), + HttpStatus.BAD_REQUEST, + ); + case CancelOrderFailedError: + throw new HttpException( + makeErrorResponse('E010808'), + HttpStatus.BAD_REQUEST, + ); + default: + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } + } finally { + this.logger.log(`[OUT] [${context.trackingId}] ${this.cancelOrder.name}`); + } + return; + } } diff --git a/dictation_server/src/features/licenses/test/utility.ts b/dictation_server/src/features/licenses/test/utility.ts index 352c974..da636c5 100644 --- a/dictation_server/src/features/licenses/test/utility.ts +++ b/dictation_server/src/features/licenses/test/utility.ts @@ -1,61 +1,12 @@ import { DataSource } from 'typeorm'; -import { User } from '../../../repositories/users/entity/user.entity'; -import { Account } from '../../../repositories/accounts/entity/account.entity'; import { License, CardLicense, CardLicenseIssue, LicenseAllocationHistory, + LicenseOrder, } from '../../../repositories/licenses/entity/license.entity'; -export const createAccount = async ( - datasource: DataSource, -): Promise<{ accountId: number }> => { - const { identifiers } = await datasource.getRepository(Account).insert({ - tier: 1, - country: 'JP', - delegation_permission: false, - locked: false, - company_name: 'test inc.', - verified: true, - deleted_at: '', - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const account = identifiers.pop() as Account; - return { accountId: account.id }; -}; - -export const createUser = async ( - datasource: DataSource, - accountId: number, - external_id: string, - role: string, - author_id?: string | undefined, -): Promise<{ userId: number; externalId: string }> => { - const { identifiers } = await datasource.getRepository(User).insert({ - account_id: accountId, - external_id: external_id, - role: role, - accepted_terms_version: '1.0', - author_id: author_id, - email_verified: true, - auto_renew: true, - license_alert: true, - notification: true, - encryption: false, - prompt: false, - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const user = identifiers.pop() as User; - return { userId: user.id, externalId: external_id }; -}; - export const createLicense = async ( datasource: DataSource, licenseId: number, @@ -144,6 +95,31 @@ export const createLicenseAllocationHistory = async ( identifiers.pop() as LicenseAllocationHistory; }; +export const createOrder = async ( + datasource: DataSource, + poNumber: string, + fromId: number, + toId: number, + quantity: number, + status: string, +): Promise => { + const { identifiers } = await datasource.getRepository(LicenseOrder).insert({ + po_number: poNumber, + from_account_id: fromId, + to_account_id: toId, + ordered_at: new Date(), + issued_at: null, + quantity: quantity, + status: status, + canceled_at: null, + created_by: null, + created_at: new Date(), + updated_by: null, + updated_at: new Date(), + }); + identifiers.pop() as LicenseOrder; +}; + export const selectCardLicensesCount = async ( datasource: DataSource, ): Promise<{ count: number }> => { @@ -193,3 +169,17 @@ export const selectLicenseAllocationHistory = async ( }); return { licenseAllocationHistory }; }; + +export const selectOrderLicense = async ( + datasource: DataSource, + accountId: number, + poNumber: string, +): Promise<{ orderLicense: LicenseOrder }> => { + const orderLicense = await datasource.getRepository(LicenseOrder).findOne({ + where: { + from_account_id: accountId, + po_number: poNumber, + }, + }); + return { orderLicense }; +}; diff --git a/dictation_server/src/features/licenses/types/types.ts b/dictation_server/src/features/licenses/types/types.ts index e0fce77..a75885f 100644 --- a/dictation_server/src/features/licenses/types/types.ts +++ b/dictation_server/src/features/licenses/types/types.ts @@ -55,6 +55,14 @@ export class GetAllocatableLicensesResponse { allocatableLicenses: AllocatableLicenseInfo[]; } +export class CancelOrderRequest { + @ApiProperty() + @Matches(/^[A-Z0-9]+$/) + poNumber: string; +} + +export class CancelOrderResponse {} + // ライセンス算出用に、その日の始まりの時刻(0:00:00.000)の日付を取得する export class DateWithZeroTime extends Date { constructor(...args: any[]) { diff --git a/dictation_server/src/features/tasks/tasks.controller.ts b/dictation_server/src/features/tasks/tasks.controller.ts index 057dece..b2c860e 100644 --- a/dictation_server/src/features/tasks/tasks.controller.ts +++ b/dictation_server/src/features/tasks/tasks.controller.ts @@ -137,9 +137,6 @@ export class TasksController { @Headers() headers, @Query() body: AudioNextRequest, ): Promise { - const { endedFileId } = body; - console.log(endedFileId); - return { nextFileId: 1234 }; } @@ -403,9 +400,6 @@ export class TasksController { @Headers() headers, @Param() params: ChangeStatusRequest, ): Promise { - const { audioFileId } = params; - console.log(audioFileId); - return {}; } @@ -445,9 +439,6 @@ export class TasksController { @Headers() headers, @Param() params: ChangeStatusRequest, ): Promise { - const { audioFileId } = params; - console.log(audioFileId); - return {}; } diff --git a/dictation_server/src/features/tasks/tasks.service.spec.ts b/dictation_server/src/features/tasks/tasks.service.spec.ts index 0d47fe7..6b11396 100644 --- a/dictation_server/src/features/tasks/tasks.service.spec.ts +++ b/dictation_server/src/features/tasks/tasks.service.spec.ts @@ -11,10 +11,8 @@ import { makeErrorResponse } from '../../common/error/makeErrorResponse'; import { TasksService } from './tasks.service'; import { DataSource } from 'typeorm'; import { - createAccount, createCheckoutPermissions, createTask, - createUser, createUserGroup, getCheckoutPermissions, getTask, @@ -22,6 +20,7 @@ import { } from './test/utility'; import { Adb2cTooManyRequestsError } from '../../gateways/adb2c/adb2c.service'; import { makeContext } from '../../common/log'; +import { makeTestSimpleAccount, makeTestUser } from '../../common/test/utility'; describe('TasksService', () => { it('タスク一覧を取得できる(admin)', async () => { @@ -611,13 +610,12 @@ describe('TasksService', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { externalId } = await createUser( - source, - accountId, - 'userId', - 'admin', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'admin', + }); const service = module.get(TasksService); const accessToken = { userId: externalId, role: 'admin', tier: 5 }; @@ -646,14 +644,13 @@ describe('TasksService', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId } = await createUser( - source, - accountId, - 'userId', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); await createTask( source, accountId, @@ -710,21 +707,19 @@ describe('TasksService', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: userId_1 } = await createUser( - source, - accountId, - 'userId_1', - 'author', - 'AUTHOR_ID_1', - ); - const { userId: userId_2 } = await createUser( - source, - accountId, - 'userId_2', - 'author', - 'AUTHOR_ID_2', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: userId_1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId_1', + role: 'author', + author_id: 'AUTHOR_ID_1', + }); + const { id: userId_2 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'userId_2', + role: 'author', + author_id: 'AUTHOR_ID_2', + }); await createTask( source, accountId, @@ -798,26 +793,23 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId_1 } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: typistUserId_2 } = await createUser( - source, - accountId, - 'typist-user-2-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId_1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: typistUserId_2 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-2-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -861,26 +853,23 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId_1 } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: typistUserId_2 } = await createUser( - source, - accountId, - 'typist-user-2-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId_1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: typistUserId_2 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-2-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -930,20 +919,18 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId_1 } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId_1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -981,20 +968,18 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId_1 } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId_1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1035,20 +1020,18 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId_1 } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId_1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1089,20 +1072,18 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const service = module.get(TasksService); await expect( @@ -1125,20 +1106,18 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); await createTask( source, accountId, @@ -1171,20 +1150,18 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); await createTask( source, accountId, @@ -1218,26 +1195,23 @@ describe('changeCheckoutPermission', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId_1 } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: typistUserId_2 } = await createUser( - source, - accountId, - 'typist-user-2-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId_1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: typistUserId_2 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-2-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1300,20 +1274,18 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1368,20 +1340,18 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1436,20 +1406,18 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1498,21 +1466,19 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - 'MY_AUTHOR_ID', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + author_id: 'MY_AUTHOR_ID', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); await createTask( source, accountId, @@ -1544,21 +1510,19 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - 'MY_AUTHOR_ID', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + author_id: 'MY_AUTHOR_ID', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); await createTask( source, accountId, @@ -1590,14 +1554,13 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); await createTask( source, accountId, @@ -1627,14 +1590,13 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); await createTask( source, accountId, @@ -1664,14 +1626,13 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const service = module.get(TasksService); await expect( @@ -1693,14 +1654,13 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); await createTask( source, accountId, @@ -1732,14 +1692,13 @@ describe('checkout', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser( - source, - accountId, - 'none-user-external-id', - 'none', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'none-user-external-id', + role: 'none', + author_id: 'MY_AUTHOR_ID', + }); const service = module.get(TasksService); await expect( @@ -1780,20 +1739,18 @@ describe('checkin', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1829,20 +1786,18 @@ describe('checkin', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1871,21 +1826,23 @@ describe('checkin', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser(source, accountId, 'typist-user-external-id', 'typist'); - const { userId: anotherTypistUserId } = await createUser( - source, - accountId, - 'another-typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: anotherTypistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'another-typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -1915,16 +1872,19 @@ describe('checkin', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser(source, accountId, 'typist-user-external-id', 'typist'); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); - await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const service = module.get(TasksService); @@ -1961,20 +1921,18 @@ describe('suspend', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2006,20 +1964,18 @@ describe('suspend', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2048,21 +2004,23 @@ describe('suspend', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser(source, accountId, 'typist-user-external-id', 'typist'); - const { userId: anotherTypistUserId } = await createUser( - source, - accountId, - 'another-typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: anotherTypistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'another-typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2092,16 +2050,19 @@ describe('suspend', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser(source, accountId, 'typist-user-external-id', 'typist'); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); - await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const service = module.get(TasksService); @@ -2138,20 +2099,18 @@ describe('cancel', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2188,20 +2147,18 @@ describe('cancel', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2238,20 +2195,18 @@ describe('cancel', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2289,20 +2244,18 @@ describe('cancel', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2340,20 +2293,18 @@ describe('cancel', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2385,21 +2336,23 @@ describe('cancel', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser(source, accountId, 'typist-user-external-id', 'typist'); - const { userId: anotherTypistUserId } = await createUser( - source, - accountId, - 'another-typist-user-external-id', - 'typist', - ); - const { userId: authorUserId } = await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); + const { id: anotherTypistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'another-typist-user-external-id', + role: 'typist', + }); + const { id: authorUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const { taskId } = await createTask( source, accountId, @@ -2432,16 +2385,19 @@ describe('cancel', () => { source, notificationhubServiceMockValue, ); - const { accountId } = await createAccount(source); - await createUser(source, accountId, 'typist-user-external-id', 'typist'); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'typist-user-external-id', + role: 'typist', + }); - await createUser( - source, - accountId, - 'author-user-external-id', - 'author', - 'MY_AUTHOR_ID', - ); + await makeTestUser(source, { + account_id: accountId, + external_id: 'author-user-external-id', + role: 'author', + author_id: 'MY_AUTHOR_ID', + }); const service = module.get(TasksService); diff --git a/dictation_server/src/features/tasks/test/utility.ts b/dictation_server/src/features/tasks/test/utility.ts index 50daad3..8c49279 100644 --- a/dictation_server/src/features/tasks/test/utility.ts +++ b/dictation_server/src/features/tasks/test/utility.ts @@ -1,8 +1,6 @@ import { DataSource } from 'typeorm'; import { Test, TestingModule } from '@nestjs/testing'; import { ConfigModule } from '@nestjs/config'; -import { User } from '../../../repositories/users/entity/user.entity'; -import { Account } from '../../../repositories/accounts/entity/account.entity'; import { Task } from '../../../repositories/tasks/entity/task.entity'; import { AudioFile } from '../../../repositories/audio_files/entity/audio_file.entity'; import { CheckoutPermission } from '../../../repositories/checkout_permissions/entity/checkout_permission.entity'; @@ -102,54 +100,6 @@ export const makeTaskTestingModule = async ( } }; -export const createAccount = async ( - datasource: DataSource, -): Promise<{ accountId: number }> => { - const { identifiers } = await datasource.getRepository(Account).insert({ - tier: 1, - country: 'JP', - delegation_permission: false, - locked: false, - company_name: 'test inc.', - verified: true, - deleted_at: '', - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const account = identifiers.pop() as Account; - return { accountId: account.id }; -}; - -export const createUser = async ( - datasource: DataSource, - accountId: number, - external_id: string, - role: string, - author_id?: string | undefined, -): Promise<{ userId: number; externalId: string }> => { - const { identifiers } = await datasource.getRepository(User).insert({ - account_id: accountId, - external_id: external_id, - role: role, - accepted_terms_version: '1.0', - author_id: author_id, - email_verified: true, - auto_renew: true, - license_alert: true, - notification: true, - encryption: false, - prompt: false, - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const user = identifiers.pop() as User; - return { userId: user.id, externalId: external_id }; -}; - export const createTask = async ( datasource: DataSource, account_id: number, diff --git a/dictation_server/src/features/users/test/utility.ts b/dictation_server/src/features/users/test/utility.ts index 4452f61..7f66b68 100644 --- a/dictation_server/src/features/users/test/utility.ts +++ b/dictation_server/src/features/users/test/utility.ts @@ -29,8 +29,6 @@ import { NotificationhubService } from '../../../gateways/notificationhub/notifi import { FilesService } from '../../../features/files/files.service'; import { LicensesService } from '../../../features/licenses/licenses.service'; import { TasksService } from '../../../features/tasks/tasks.service'; -import { User } from '../../../repositories/users/entity/user.entity'; -import { Account } from '../../../repositories/accounts/entity/account.entity'; import { UserGroup } from '../../../repositories/user_groups/entity/user_group.entity'; import { UserGroupMember } from '../../../repositories/user_groups/entity/user_group_member.entity'; import { License } from '../../../repositories/licenses/entity/license.entity'; @@ -38,150 +36,6 @@ import { AdB2cMockValue, makeAdB2cServiceMock } from './users.service.mock'; import { AdB2cService } from '../../../gateways/adb2c/adb2c.service'; import { LICENSE_ALLOCATED_STATUS, LICENSE_TYPE } from '../../../constants'; -export const createAccountAndAdminUser = async ( - datasource: DataSource, - adminExternalId: string, -): Promise<{ - accountId: number; - adminId: number; - role: string; - tier: number; -}> => { - const { identifiers: account_idf } = await datasource - .getRepository(Account) - .insert({ - tier: 1, - country: 'JP', - delegation_permission: false, - locked: false, - company_name: 'test inc.', - verified: true, - deleted_at: '', - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const account = account_idf.pop() as Account; - - const { identifiers: user_idf } = await datasource - .getRepository(User) - .insert({ - account_id: account.id, - external_id: adminExternalId, - role: 'admin none', - accepted_terms_version: '1.0', - email_verified: true, - auto_renew: true, - license_alert: true, - notification: true, - encryption: true, - encryption_password: 'password', - prompt: true, - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const user = user_idf.pop() as User; - - // Accountの管理者を設定する - await datasource.getRepository(Account).update( - { id: user.account_id }, - { - primary_admin_user_id: user.id, - }, - ); - - const accountResult = await getAccount(datasource, account.id); - const userResult = await getUser(datasource, user.id); - - return { - accountId: account.id, - adminId: user.id, - role: userResult.role, - tier: accountResult.tier, - }; -}; - -export const createAccount = async ( - datasource: DataSource, -): Promise<{ accountId: number }> => { - const { identifiers } = await datasource.getRepository(Account).insert({ - tier: 1, - country: 'JP', - delegation_permission: false, - locked: false, - company_name: 'test inc.', - verified: true, - deleted_at: '', - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const account = identifiers.pop() as Account; - return { accountId: account.id }; -}; - -export const createUser = async ( - datasource: DataSource, - accountId: number, - external_id: string, - role: string, - author_id?: string | undefined, - auto_renew?: boolean, - encryption?: boolean | undefined, - encryption_password?: string | undefined, - prompt?: boolean | undefined, - email_verified?: boolean | undefined, -): Promise<{ userId: number; externalId: string }> => { - const { identifiers } = await datasource.getRepository(User).insert({ - account_id: accountId, - external_id: external_id, - role: role, - accepted_terms_version: '1.0', - author_id: author_id, - email_verified: email_verified ?? true, - auto_renew: auto_renew, - license_alert: true, - notification: true, - encryption: encryption ?? false, - encryption_password: encryption_password, - prompt: prompt ?? false, - created_by: 'test_runner', - created_at: new Date(), - updated_by: 'updater', - updated_at: new Date(), - }); - const user = identifiers.pop() as User; - return { userId: user.id, externalId: external_id }; -}; - -/** - * テスト ユーティリティ: 指定IDのアカウントを取得する - * @param dataSource データソース - * @param id アカウントID - * @returns 該当アカウント - */ -export const getAccount = async (dataSource: DataSource, id: number) => { - return await dataSource.getRepository(Account).findOne({ - where: { id: id }, - }); -}; - -export const getUser = async ( - datasource: DataSource, - id: number, -): Promise => { - const user = await datasource.getRepository(User).findOne({ - where: { - id: id, - }, - }); - return user; -}; - export const getLicenses = async ( datasource: DataSource, account_id: number, @@ -194,33 +48,6 @@ export const getLicenses = async ( return licenses; }; -/** - * テスト ユーティリティ: 指定外部IDを持つユーザーを取得する - * @param dataSource データソース - * @param externalId 外部ID - * @returns 該当ユーザー - */ -export const getUserByExternalId = async ( - datasource: DataSource, - externalId: string, -): Promise => { - const user = await datasource.getRepository(User).findOne({ - where: { - external_id: externalId, - }, - }); - return user; -}; - -/** - * テスト ユーティリティ: すべてのユーザーを取得する - * @param dataSource データソース - * @returns 該当ユーザー一覧 - */ -export const getUsers = async (dataSource: DataSource): Promise => { - return await dataSource.getRepository(User).find(); -}; - /** * * @param datasource diff --git a/dictation_server/src/features/users/users.controller.ts b/dictation_server/src/features/users/users.controller.ts index bb7b589..11ff39c 100644 --- a/dictation_server/src/features/users/users.controller.ts +++ b/dictation_server/src/features/users/users.controller.ts @@ -461,13 +461,12 @@ export class UsersController { @Body() body: DeallocateLicenseRequest, @Req() req: Request, ): Promise { - //API実装時に詳細をかいていく - //const accessToken = retrieveAuthorizationToken(req); - //const { userId } = jwt.decode(accessToken, { json: true }) as AccessToken; + const accessToken = retrieveAuthorizationToken(req); + const { userId } = jwt.decode(accessToken, { json: true }) as AccessToken; - //const context = makeContext(userId); + const context = makeContext(userId); - //await this.usersService.deallocateLicense(context, body.userId); + await this.usersService.deallocateLicense(context, body.userId); return {}; } } diff --git a/dictation_server/src/features/users/users.service.spec.ts b/dictation_server/src/features/users/users.service.spec.ts index fa18ab9..04e5068 100644 --- a/dictation_server/src/features/users/users.service.spec.ts +++ b/dictation_server/src/features/users/users.service.spec.ts @@ -11,15 +11,9 @@ import { } from './test/users.service.mock'; import { EmailAlreadyVerifiedError } from '../../repositories/users/errors/types'; import { - createAccount, - createAccountAndAdminUser, createLicense, - createUser, createUserGroup, getLicenses, - getUser, - getUserByExternalId, - getUsers, makeTestingModuleWithAdb2c, } from './test/utility'; import { DataSource } from 'typeorm'; @@ -41,6 +35,14 @@ import { import { NewTrialLicenseExpirationDate } from '../licenses/types/types'; import { License } from '../../repositories/licenses/entity/license.entity'; import { AdB2cService } from '../../gateways/adb2c/adb2c.service'; +import { + getUser, + getUserFromExternalId, + getUsers, + makeTestAccount, + makeTestSimpleAccount, + makeTestUser, +} from '../../common/test/utility'; describe('UsersService.confirmUser', () => { let source: DataSource = null; @@ -60,33 +62,32 @@ describe('UsersService.confirmUser', () => { it('ユーザの仮登録時に払い出されるトークンにより、未認証のユーザが認証済みになり、トライアルライセンスが100件作成される', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - await createUser( - source, - accountId, - 'externalId_user1', - USER_ROLES.NONE, - undefined, - true, - false, - undefined, - false, - false, - ); - const { userId } = await createUser( - source, - accountId, - 'externalId_user2', - USER_ROLES.NONE, - undefined, - true, - false, - undefined, - false, - false, - ); + const { id: accountId } = (await makeTestAccount(source)).account; + const { id: userId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'externalId_user1', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + email_verified: false, + }); + await makeTestUser(source, { + account_id: accountId, + external_id: 'externalId_user2', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + email_verified: false, + }); const service = module.get(UsersService); + // account id:1, user id: 2のトークン const token = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50SWQiOjEsInVzZXJJZCI6MiwiZW1haWwiOiJ4eHhAeHh4Lnh4eCIsImlhdCI6MTAwMDAwMDAwMCwiZXhwIjo5MDAwMDAwMDAwfQ.26L6BdNg-3TbyKT62PswlJ6RPMkcTtHzlDXW2Uo9XbMPVSrl2ObcuS6EcXjFFN2DEfNTKbqX_zevIWMpHOAdLNgGhk528nLrBrNvPASqtTjvW9muxMXpjUdjRVkmVbOylBHWW3YpWL9JEbJQ7rAzWDfaIdPhMovdaxumnZt_UwnlnrdaVPLACW7tkH_laEcAU507iSiM4mqxxG8FuTs34t6PEdwRuzZAQPN2IOPYNSvGNdJYryPacSeSNZ_z1xeBYXLOLQfOBZzyTReYDOhXdikhrNUbxjgnZQlSXBCVMlZ9PH42bHfp-LJIeJzW0yqnF6oLklvJP-fo8eW0k5iDOw'; await service.confirmUser(token); @@ -135,31 +136,29 @@ describe('UsersService.confirmUser', () => { it('ユーザが既に認証済みだった場合、認証済みユーザエラーとなる。', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - await createUser( - source, - accountId, - 'externalId_user1', - USER_ROLES.NONE, - undefined, - true, - false, - undefined, - false, - false, - ); - await createUser( - source, - accountId, - 'externalId_user2', - USER_ROLES.NONE, - undefined, - true, - false, - undefined, - false, - true, //emailを認証済みにする - ); + const { id: accountId } = (await makeTestAccount(source)).account; + await makeTestUser(source, { + account_id: accountId, + external_id: 'externalId_user1', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + email_verified: true, //emailを認証済みにする + }); + await makeTestUser(source, { + account_id: accountId, + external_id: 'externalId_user2', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + email_verified: false, + }); const service = module.get(UsersService); const token = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50SWQiOjEsInVzZXJJZCI6MiwiZW1haWwiOiJ4eHhAeHh4Lnh4eCIsImlhdCI6MTAwMDAwMDAwMCwiZXhwIjo5MDAwMDAwMDAwfQ.26L6BdNg-3TbyKT62PswlJ6RPMkcTtHzlDXW2Uo9XbMPVSrl2ObcuS6EcXjFFN2DEfNTKbqX_zevIWMpHOAdLNgGhk528nLrBrNvPASqtTjvW9muxMXpjUdjRVkmVbOylBHWW3YpWL9JEbJQ7rAzWDfaIdPhMovdaxumnZt_UwnlnrdaVPLACW7tkH_laEcAU507iSiM4mqxxG8FuTs34t6PEdwRuzZAQPN2IOPYNSvGNdJYryPacSeSNZ_z1xeBYXLOLQfOBZzyTReYDOhXdikhrNUbxjgnZQlSXBCVMlZ9PH42bHfp-LJIeJzW0yqnF6oLklvJP-fo8eW0k5iDOw'; @@ -379,11 +378,14 @@ describe('UsersService.createUser', () => { const module = await makeTestingModule(source); const service = module.get(UsersService); const adminExternalId = 'ADMIN0001'; - const { - accountId, - role: adminRole, - tier, - } = await createAccountAndAdminUser(source, adminExternalId); + + const { account, admin } = await makeTestAccount( + source, + {}, + { external_id: adminExternalId }, + ); + const { id: accountId, tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -437,7 +439,7 @@ describe('UsersService.createUser', () => { ).toEqual(undefined); // 追加されたユーザーが正しくDBに登録されていることを確認 - const user = await getUserByExternalId(source, externalId); + const user = await getUserFromExternalId(source, externalId); expect(user).not.toBeNull(); expect(user.account_id).toEqual(accountId); expect(user.role).toEqual(role); @@ -459,11 +461,13 @@ describe('UsersService.createUser', () => { const module = await makeTestingModule(source); const service = module.get(UsersService); const adminExternalId = 'ADMIN0001'; - const { - accountId, - role: adminRole, - tier, - } = await createAccountAndAdminUser(source, adminExternalId); + const { account, admin } = await makeTestAccount( + source, + {}, + { external_id: adminExternalId }, + ); + const { id: accountId, tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -525,7 +529,7 @@ describe('UsersService.createUser', () => { ).toEqual(undefined); // 追加されたユーザーが正しくDBに登録されていることを確認 - const user = await getUserByExternalId(source, externalId); + const user = await getUserFromExternalId(source, externalId); expect(user).not.toBeNull(); expect(user.account_id).toEqual(accountId); expect(user.role).toEqual(role); @@ -547,11 +551,13 @@ describe('UsersService.createUser', () => { const module = await makeTestingModule(source); const service = module.get(UsersService); const adminExternalId = 'ADMIN0001'; - const { - accountId, - role: adminRole, - tier, - } = await createAccountAndAdminUser(source, adminExternalId); + const { account, admin } = await makeTestAccount( + source, + {}, + { external_id: adminExternalId }, + ); + const { id: accountId, tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -612,7 +618,7 @@ describe('UsersService.createUser', () => { ).toEqual(undefined); // 追加されたユーザーが正しくDBに登録されていることを確認 - const user = await getUserByExternalId(source, externalId); + const user = await getUserFromExternalId(source, externalId); expect(user).not.toBeNull(); expect(user.account_id).toEqual(accountId); expect(user.role).toEqual(role); @@ -634,11 +640,13 @@ describe('UsersService.createUser', () => { const module = await makeTestingModule(source); const service = module.get(UsersService); const adminExternalId = 'ADMIN0001'; - const { - accountId, - role: adminRole, - tier, - } = await createAccountAndAdminUser(source, adminExternalId); + const { account, admin } = await makeTestAccount( + source, + {}, + { external_id: adminExternalId }, + ); + const { id: accountId, tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -692,7 +700,7 @@ describe('UsersService.createUser', () => { ).toEqual(undefined); // 追加されたユーザーが正しくDBに登録されていることを確認 - const user = await getUserByExternalId(source, externalId); + const user = await getUserFromExternalId(source, externalId); expect(user).not.toBeNull(); expect(user.account_id).toEqual(accountId); expect(user.role).toEqual(role); @@ -715,10 +723,13 @@ describe('UsersService.createUser', () => { const service = module.get(UsersService); const b2cService = module.get(AdB2cService); const adminExternalId = 'ADMIN0001'; - const { role: adminRole, tier } = await createAccountAndAdminUser( + const { account, admin } = await makeTestAccount( source, - adminExternalId, + {}, + { external_id: adminExternalId }, ); + const { tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -797,11 +808,13 @@ describe('UsersService.createUser', () => { const service = module.get(UsersService); const b2cService = module.get(AdB2cService); const adminExternalId = 'ADMIN0001'; - const { - accountId, - role: adminRole, - tier, - } = await createAccountAndAdminUser(source, adminExternalId); + const { account, admin } = await makeTestAccount( + source, + {}, + { external_id: adminExternalId }, + ); + const { id: accountId, tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -884,10 +897,13 @@ describe('UsersService.createUser', () => { const module = await makeTestingModule(source); const service = module.get(UsersService); const adminExternalId = 'ADMIN0001'; - const { role: adminRole, tier } = await createAccountAndAdminUser( + const { account, admin } = await makeTestAccount( source, - adminExternalId, + {}, + { external_id: adminExternalId }, ); + const { tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -954,10 +970,13 @@ describe('UsersService.createUser', () => { const module = await makeTestingModule(source); const service = module.get(UsersService); const adminExternalId = 'ADMIN0001'; - const { role: adminRole, tier } = await createAccountAndAdminUser( + const { account, admin } = await makeTestAccount( source, - adminExternalId, + {}, + { external_id: adminExternalId }, ); + const { tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -1028,10 +1047,13 @@ describe('UsersService.createUser', () => { const module = await makeTestingModule(source); const service = module.get(UsersService); const adminExternalId = 'ADMIN0001'; - const { role: adminRole, tier } = await createAccountAndAdminUser( + const { account, admin } = await makeTestAccount( source, - adminExternalId, + {}, + { external_id: adminExternalId }, ); + const { tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -1152,11 +1174,13 @@ describe('UsersService.createUser', () => { const service = module.get(UsersService); const b2cService = module.get(AdB2cService); const adminExternalId = 'ADMIN0001'; - const { - accountId, - role: adminRole, - tier, - } = await createAccountAndAdminUser(source, adminExternalId); + const { account, admin } = await makeTestAccount( + source, + {}, + { external_id: adminExternalId }, + ); + const { id: accountId, tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -1248,11 +1272,13 @@ describe('UsersService.createUser', () => { const b2cService = module.get(AdB2cService); const adminExternalId = 'ADMIN0001'; - const { - accountId, - role: adminRole, - tier, - } = await createAccountAndAdminUser(source, adminExternalId); + const { account, admin } = await makeTestAccount( + source, + {}, + { external_id: adminExternalId }, + ); + const { id: accountId, tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -1331,10 +1357,13 @@ describe('UsersService.createUser', () => { const b2cService = module.get(AdB2cService); const adminExternalId = 'ADMIN0001'; - const { role: adminRole, tier } = await createAccountAndAdminUser( + const { account, admin } = await makeTestAccount( source, - adminExternalId, + {}, + { external_id: adminExternalId }, ); + const { tier } = account; + const { role: adminRole } = admin; const token: AccessToken = { userId: adminExternalId, @@ -1433,36 +1462,42 @@ describe('UsersService.getUsers', () => { const adb2cParam = makeDefaultAdB2cMockValue(); const module = await makeTestingModuleWithAdb2c(source, adb2cParam); - const { accountId } = await createAccount(source); - const { externalId: externalId_author, userId: authorUserId } = - await createUser( - source, - accountId, - 'external_id1', - 'author', - 'AUTHOR_ID', - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId_author, id: authorUserId } = + await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: 'author', + author_id: 'AUTHOR_ID', + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); - const { userId: typistUserId } = await createUser( - source, - accountId, - 'external_id2', - 'typist', - undefined, - true, - ); + const { id: typistUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id2', + role: 'typist', + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); await createUserGroup(source, accountId, 'group1', [typistUserId]); - const { userId: noneUserId } = await createUser( - source, - accountId, - 'external_id3', - 'none', - undefined, - true, - ); + const { id: noneUserId } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id3', + role: 'none', + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const service = module.get(UsersService); @@ -1527,31 +1562,40 @@ describe('UsersService.getUsers', () => { const adb2cParam = makeDefaultAdB2cMockValue(); const module = await makeTestingModuleWithAdb2c(source, adb2cParam); - const { accountId } = await createAccount(source); - const { userId: user1, externalId: external_id1 } = await createUser( + const { id: accountId } = await makeTestSimpleAccount(source); + const { id: user1, external_id: external_id1 } = await makeTestUser( source, - accountId, - 'external_id1', - 'author', - 'AUTHOR_ID1', - true, - ); - const { userId: user2 } = await createUser( - source, - accountId, - 'external_id2', - 'author', - 'AUTHOR_ID2', - true, - ); - const { userId: user3 } = await createUser( - source, - accountId, - 'external_id3', - 'author', - 'AUTHOR_ID3', - false, + { + account_id: accountId, + external_id: 'external_id1', + role: 'author', + author_id: 'AUTHOR_ID1', + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }, ); + const { id: user2 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id2', + role: 'author', + author_id: 'AUTHOR_ID2', + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user3 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id3', + role: 'author', + author_id: 'AUTHOR_ID3', + auto_renew: false, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const date1 = new Date(); date1.setDate(date1.getDate() + LICENSE_EXPIRATION_THRESHOLD_DAYS + 1); @@ -1632,15 +1676,17 @@ describe('UsersService.getUsers', () => { const adb2cParam = makeDefaultAdB2cMockValue(); const module = await makeTestingModuleWithAdb2c(source, adb2cParam); - const { accountId } = await createAccount(source); - await createUser( - source, - accountId, - 'external_id1', - 'author', - 'AUTHOR_ID', - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: 'author', + author_id: 'AUTHOR_ID', + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const service = module.get(UsersService); await expect(service.getUsers('externalId_failed')).rejects.toEqual( @@ -1653,15 +1699,17 @@ describe('UsersService.getUsers', () => { adb2cParam.getUsers = new Error('ADB2C error'); const module = await makeTestingModuleWithAdb2c(source, adb2cParam); - const { accountId } = await createAccount(source); - const { externalId: externalId_author } = await createUser( - source, - accountId, - 'external_id1', - 'author', - 'AUTHOR_ID', - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: externalId_author } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: 'author', + author_id: 'AUTHOR_ID', + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const service = module.get(UsersService); await expect(service.getUsers(externalId_author)).rejects.toEqual( @@ -1890,23 +1938,27 @@ describe('UsersService.updateUser', () => { it('ユーザー情報を更新できる(None)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.NONE, - undefined, - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const service = module.get(UsersService); @@ -1942,23 +1994,27 @@ describe('UsersService.updateUser', () => { it('ユーザー情報を更新できる(Typist)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.TYPIST, - undefined, - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.TYPIST, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const service = module.get(UsersService); @@ -1994,26 +2050,27 @@ describe('UsersService.updateUser', () => { it('ユーザー情報を更新できる(Author)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.AUTHOR, - undefined, - true, - true, - 'password', - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.AUTHOR, + author_id: undefined, + auto_renew: true, + encryption: true, + encryption_password: 'password', + prompt: true, + }); const service = module.get(UsersService); @@ -2049,23 +2106,27 @@ describe('UsersService.updateUser', () => { it('ユーザーのRoleを更新できる(None⇒Typist)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.NONE, - undefined, - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const service = module.get(UsersService); @@ -2101,23 +2162,27 @@ describe('UsersService.updateUser', () => { it('ユーザーのRoleを更新できる(None⇒Author)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.NONE, - undefined, - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const service = module.get(UsersService); @@ -2153,23 +2218,27 @@ describe('UsersService.updateUser', () => { it('None以外からRoleを変更した場合、エラーとなる(Typist⇒None)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.TYPIST, - undefined, - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.TYPIST, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); const service = module.get(UsersService); @@ -2195,26 +2264,27 @@ describe('UsersService.updateUser', () => { it('Authorがパスワードundefinedで渡されたとき、元のパスワードを維持する(Encryptionがtrue)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.AUTHOR, - 'AUTHOR_ID', - true, - true, - 'password', - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.AUTHOR, + author_id: 'AUTHOR_ID', + auto_renew: true, + encryption: true, + encryption_password: 'password', + prompt: true, + }); const service = module.get(UsersService); @@ -2250,26 +2320,27 @@ describe('UsersService.updateUser', () => { it('Authorが暗号化なしで更新した場合、パスワードをNULLにする(Encryptionがfalse)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.AUTHOR, - 'AUTHOR_ID', - true, - false, - 'password', - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.AUTHOR, + author_id: 'AUTHOR_ID', + auto_renew: true, + encryption: false, + encryption_password: 'password', + prompt: true, + }); const service = module.get(UsersService); @@ -2305,26 +2376,27 @@ describe('UsersService.updateUser', () => { it('AuthorのDBにパスワードが設定されていない場合、パスワードundefinedでわたすとエラーとなる(Encryptionがtrue)', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.AUTHOR, - 'AUTHOR_ID', - true, - true, - undefined, - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.AUTHOR, + author_id: 'AUTHOR_ID', + auto_renew: true, + encryption: true, + encryption_password: undefined, + prompt: true, + }); const service = module.get(UsersService); @@ -2350,38 +2422,38 @@ describe('UsersService.updateUser', () => { it('AuthorIdが既存のユーザーと重複した場合、エラーとなる', async () => { const module = await makeTestingModule(source); - const { accountId } = await createAccount(source); - const { externalId: external_id } = await createUser( - source, - accountId, - 'external_id', - USER_ROLES.NONE, - undefined, - true, - ); - const { userId: user1 } = await createUser( - source, - accountId, - 'external_id1', - USER_ROLES.AUTHOR, - 'AUTHOR_ID1', - true, - true, - 'password', - true, - ); + const { id: accountId } = await makeTestSimpleAccount(source); + const { external_id: external_id } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id', + role: USER_ROLES.NONE, + author_id: undefined, + auto_renew: true, + encryption: false, + encryption_password: undefined, + prompt: false, + }); + const { id: user1 } = await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id1', + role: USER_ROLES.AUTHOR, + author_id: 'AUTHOR_ID1', + auto_renew: true, + encryption: true, + encryption_password: 'password', + prompt: true, + }); - await createUser( - source, - accountId, - 'external_id2', - USER_ROLES.AUTHOR, - 'AUTHOR_ID2', - true, - true, - 'password', - true, - ); + await makeTestUser(source, { + account_id: accountId, + external_id: 'external_id2', + role: USER_ROLES.AUTHOR, + author_id: 'AUTHOR_ID2', + auto_renew: true, + encryption: true, + encryption_password: 'password', + prompt: true, + }); const service = module.get(UsersService); diff --git a/dictation_server/src/features/users/users.service.ts b/dictation_server/src/features/users/users.service.ts index 6e9fa07..0fc460c 100644 --- a/dictation_server/src/features/users/users.service.ts +++ b/dictation_server/src/features/users/users.service.ts @@ -41,6 +41,7 @@ import { DateWithZeroTime } from '../licenses/types/types'; import { Context } from '../../common/log'; import { UserRoles } from '../../common/types/role'; import { + LicenseAlreadyDeallocatedError, LicenseExpiredError, LicenseUnavailableError, } from '../../repositories/licenses/errors/types'; @@ -886,7 +887,7 @@ export class UsersService { this.logger.log( `[IN] [${context.trackingId}] ${this.allocateLicense.name} | params: { ` + `userId: ${userId}, ` + - `newLicenseId: ${newLicenseId}, `, + `newLicenseId: ${newLicenseId}, };`, ); try { @@ -918,4 +919,40 @@ export class UsersService { ); } } + + /** + * ユーザーに割り当てられているライセンスを解除します + * @param context + * @param userId + */ + async deallocateLicense(context: Context, userId: number): Promise { + this.logger.log( + `[IN] [${context.trackingId}] ${this.deallocateLicense.name} | params: { ` + + `userId: ${userId}, };`, + ); + + try { + await this.licensesRepository.deallocateLicense(userId); + } catch (e) { + this.logger.error(`error=${e}`); + if (e instanceof Error) { + switch (e.constructor) { + case LicenseAlreadyDeallocatedError: + throw new HttpException( + makeErrorResponse('E010807'), + HttpStatus.BAD_REQUEST, + ); + default: + throw new HttpException( + makeErrorResponse('E009999'), + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } + } + } finally { + this.logger.log( + `[OUT] [${context.trackingId}] ${this.deallocateLicense.name}`, + ); + } + } } diff --git a/dictation_server/src/repositories/accounts/accounts.repository.service.ts b/dictation_server/src/repositories/accounts/accounts.repository.service.ts index e58669a..835c0db 100644 --- a/dictation_server/src/repositories/accounts/accounts.repository.service.ts +++ b/dictation_server/src/repositories/accounts/accounts.repository.service.ts @@ -20,7 +20,7 @@ import { } from '../../common/types/sort/util'; import { LICENSE_ALLOCATED_STATUS, - LICENSE_STATUS_ISSUE_REQUESTING, + LICENSE_ISSUE_STATUS, TIERS, } from '../../constants'; import { @@ -330,7 +330,7 @@ export class AccountsRepositoryService { const numberOfRequesting = await licenseOrder.count({ where: { from_account_id: id, - status: LICENSE_STATUS_ISSUE_REQUESTING, + status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING, }, }); @@ -340,7 +340,7 @@ export class AccountsRepositoryService { .select('SUM(license_orders.quantity)', 'sum') .where('license_orders.from_account_id = :id', { id }) .andWhere('license_orders.status = :status', { - status: LICENSE_STATUS_ISSUE_REQUESTING, + status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING, }) .getRawOne(); const issueRequesting = parseInt(result.sum, 10) || 0; @@ -415,7 +415,7 @@ export class AccountsRepositoryService { .select('SUM(license_orders.quantity)', 'sum') .where('license_orders.to_account_id = :id', { id }) .andWhere('license_orders.status = :status', { - status: LICENSE_STATUS_ISSUE_REQUESTING, + status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING, }) .getRawOne(); const issuedRequested = parseInt(issuedRequestedSqlResult.sum, 10) || 0; @@ -426,7 +426,7 @@ export class AccountsRepositoryService { .select('SUM(license_orders.quantity)', 'sum') .where('license_orders.from_account_id = :id', { id }) .andWhere('license_orders.status = :status', { - status: LICENSE_STATUS_ISSUE_REQUESTING, + status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING, }) .getRawOne(); const issuedRequesting = parseInt(issuedRequestingSqlResult.sum, 10) || 0; diff --git a/dictation_server/src/repositories/licenses/entity/license.entity.ts b/dictation_server/src/repositories/licenses/entity/license.entity.ts index 3d3df06..88363ab 100644 --- a/dictation_server/src/repositories/licenses/entity/license.entity.ts +++ b/dictation_server/src/repositories/licenses/entity/license.entity.ts @@ -97,26 +97,6 @@ export class License { @JoinColumn({ name: 'allocated_user_id' }) user?: User; } -@Entity({ name: 'licenses_history' }) -export class LicenseHistory { - @PrimaryGeneratedColumn() - id: number; - - @Column() - user_id: number; - - @Column() - license_id: number; - - @Column() - allocated: boolean; - - @Column() - executed_at: Date; - - @Column() - exchange_type: string; -} @Entity({ name: 'card_license_issue' }) export class CardLicenseIssue { diff --git a/dictation_server/src/repositories/licenses/errors/types.ts b/dictation_server/src/repositories/licenses/errors/types.ts index e0f9fbe..904bbfa 100644 --- a/dictation_server/src/repositories/licenses/errors/types.ts +++ b/dictation_server/src/repositories/licenses/errors/types.ts @@ -18,3 +18,9 @@ export class LicensesShortageError extends Error {} export class LicenseExpiredError extends Error {} // ライセンス割り当て不可エラー export class LicenseUnavailableError extends Error {} + +// ライセンス割り当て解除済みエラー +export class LicenseAlreadyDeallocatedError extends Error {} + +// 注文キャンセル失敗エラー +export class CancelOrderFailedError extends Error {} diff --git a/dictation_server/src/repositories/licenses/licenses.repository.service.ts b/dictation_server/src/repositories/licenses/licenses.repository.service.ts index 5bd59b9..a581dff 100644 --- a/dictation_server/src/repositories/licenses/licenses.repository.service.ts +++ b/dictation_server/src/repositories/licenses/licenses.repository.service.ts @@ -10,8 +10,7 @@ import { import { CARD_LICENSE_LENGTH, LICENSE_ALLOCATED_STATUS, - LICENSE_STATUS_ISSUE_REQUESTING, - LICENSE_STATUS_ISSUED, + LICENSE_ISSUE_STATUS, LICENSE_TYPE, SWITCH_FROM_TYPE, TIERS, @@ -25,6 +24,8 @@ import { OrderNotFoundError, LicenseExpiredError, LicenseUnavailableError, + LicenseAlreadyDeallocatedError, + CancelOrderFailedError, } from './errors/types'; import { AllocatableLicenseInfo, @@ -48,7 +49,7 @@ export class LicensesRepositoryService { licenseOrder.from_account_id = fromAccountId; licenseOrder.to_account_id = toAccountId; licenseOrder.quantity = quantity; - licenseOrder.status = LICENSE_STATUS_ISSUE_REQUESTING; + licenseOrder.status = LICENSE_ISSUE_STATUS.ISSUE_REQUESTING; // ライセンス注文テーブルに登録する const createdEntity = await this.dataSource.transaction( @@ -61,12 +62,12 @@ export class LicensesRepositoryService { { po_number: poNumber, from_account_id: fromAccountId, - status: LICENSE_STATUS_ISSUED, + status: LICENSE_ISSUE_STATUS.ISSUED, }, { po_number: poNumber, from_account_id: fromAccountId, - status: LICENSE_STATUS_ISSUE_REQUESTING, + status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING, }, ], }); @@ -102,8 +103,7 @@ export class LicensesRepositoryService { const cardLicenseIssueRepo = entityManager.getRepository(CardLicenseIssue); - const licenses = []; - //TODO タスク 2409: カードライセンスのレコード作成がbulkinsertになっていない + const licenses: License[] = []; // ライセンステーブルを作成する(BULK INSERT) for (let i = 0; i < count; i++) { const license = new License(); @@ -112,7 +112,12 @@ export class LicensesRepositoryService { license.type = LICENSE_TYPE.CARD; licenses.push(license); } - const savedLicenses = await licensesRepo.save(licenses); + const savedLicenses = await licensesRepo + .createQueryBuilder() + .insert() + .into(License) + .values(licenses) + .execute(); // カードライセンス発行テーブルを作成する const cardLicenseIssue = new CardLicenseIssue(); @@ -159,17 +164,21 @@ export class LicensesRepositoryService { isDuplicateKeysExist = false; } - const cardLicenses = []; - //TODO タスク 2409: カードライセンスのレコード作成がbulkinsertになっていない + const cardLicenses: CardLicense[] = []; // カードライセンステーブルを作成する(BULK INSERT) for (let i = 0; i < count; i++) { const cardLicense = new CardLicense(); - cardLicense.license_id = savedLicenses[i].id; // Licenseテーブルの自動採番されたIDを挿入 + cardLicense.license_id = savedLicenses.generatedMaps[i].id; // Licenseテーブルの自動採番されたIDを挿入 cardLicense.issue_id = savedCardLicensesIssue.id; // CardLicenseIssueテーブルの自動採番されたIDを挿入 cardLicense.card_license_key = licenseKeys[i]; cardLicenses.push(cardLicense); } - await cardLicenseRepo.save(cardLicenses); + await cardLicenseRepo + .createQueryBuilder() + .insert() + .into(CardLicense) + .values(cardLicenses) + .execute(); }); return licenseKeys; } @@ -342,7 +351,7 @@ export class LicensesRepositoryService { throw new OrderNotFoundError(`No order found for PONumber:${poNumber}`); } // 既に発行済みの注文の場合、エラー - if (issuingOrder.status !== LICENSE_STATUS_ISSUE_REQUESTING) { + if (issuingOrder.status !== LICENSE_ISSUE_STATUS.ISSUE_REQUESTING) { throw new AlreadyIssuedError( `An order for PONumber:${poNumber} has already been issued.`, ); @@ -362,11 +371,16 @@ export class LicensesRepositoryService { { id: issuingOrder.id }, { issued_at: nowDate, - status: LICENSE_STATUS_ISSUED, + status: LICENSE_ISSUE_STATUS.ISSUED, }, ); // ライセンステーブルを登録(注文元) - await licenseRepo.save(newLicenses); + await licenseRepo + .createQueryBuilder() + .insert() + .into(License) + .values(newLicenses) + .execute(); // 第一階層の場合はストックライセンスの概念が存在しないため、ストックライセンス変更処理は行わない if (tier !== TIERS.TIER1) { @@ -410,6 +424,7 @@ export class LicensesRepositoryService { ): Promise { const nowDate = new DateWithZeroTime(); const licenseRepo = this.dataSource.getRepository(License); + // EntityManagerではorderBy句で、expiry_dateに対して複数条件でソートを使用するため出来ない為、createQueryBuilderを使用する。 const queryBuilder = licenseRepo .createQueryBuilder('license') .where('license.account_id = :accountId', { accountId: myAccountId }) @@ -541,4 +556,77 @@ export class LicensesRepositoryService { await licenseAllocationHistoryRepo.save(allocationHistory); }); } + + /** + * ユーザーに割り当てられているライセンスを解除する + * @param userId + */ + async deallocateLicense(userId: number): Promise { + await this.dataSource.transaction(async (entityManager) => { + const licenseRepo = entityManager.getRepository(License); + const licenseAllocationHistoryRepo = entityManager.getRepository( + LicenseAllocationHistory, + ); + // 対象ユーザーのライセンス割り当て状態を取得 + const allocatedLicense = await licenseRepo.findOne({ + where: { + allocated_user_id: userId, + status: LICENSE_ALLOCATED_STATUS.ALLOCATED, + }, + }); + + // ライセンスが割り当てられていない場合はエラー + if (!allocatedLicense) { + throw new LicenseAlreadyDeallocatedError( + `License is already deallocated. userId: ${userId}`, + ); + } + + // ライセンスの割り当てを解除 + allocatedLicense.status = LICENSE_ALLOCATED_STATUS.REUSABLE; + allocatedLicense.allocated_user_id = null; + await licenseRepo.save(allocatedLicense); + + // ライセンス割り当て履歴テーブルへ登録 + const deallocationHistory = new LicenseAllocationHistory(); + deallocationHistory.user_id = userId; + deallocationHistory.license_id = allocatedLicense.id; + deallocationHistory.is_allocated = false; + deallocationHistory.executed_at = new Date(); + deallocationHistory.switch_from_type = SWITCH_FROM_TYPE.NONE; + await licenseAllocationHistoryRepo.save(deallocationHistory); + }); + } + + /** + * ライセンス注文をキャンセルする + * @param accountId + * @param poNumber + */ + async cancelOrder(accountId: number, poNumber: string): Promise { + await this.dataSource.transaction(async (entityManager) => { + const orderRepo = entityManager.getRepository(LicenseOrder); + + // キャンセル対象の注文を取得 + const targetOrder = await orderRepo.findOne({ + where: { + from_account_id: accountId, + po_number: poNumber, + status: LICENSE_ISSUE_STATUS.ISSUE_REQUESTING, + }, + }); + + // キャンセル対象の注文が存在しない場合エラー + if (!targetOrder) { + throw new CancelOrderFailedError( + `Cancel order is failed. accountId: ${accountId}, poNumber: ${poNumber}`, + ); + } + + // 注文キャンセル処理 + targetOrder.status = LICENSE_ISSUE_STATUS.CANCELED; + targetOrder.canceled_at = new Date(); + await orderRepo.save(targetOrder); + }); + } } diff --git a/dictation_server/src/repositories/user_groups/entity/user_group.entity.ts b/dictation_server/src/repositories/user_groups/entity/user_group.entity.ts index 2745334..42e14fa 100644 --- a/dictation_server/src/repositories/user_groups/entity/user_group.entity.ts +++ b/dictation_server/src/repositories/user_groups/entity/user_group.entity.ts @@ -1,4 +1,11 @@ -import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm'; +import { + Entity, + Column, + PrimaryGeneratedColumn, + OneToMany, + CreateDateColumn, + UpdateDateColumn, +} from 'typeorm'; import { UserGroupMember } from './user_group_member.entity'; @Entity({ name: 'user_group' }) @@ -15,16 +22,16 @@ export class UserGroup { @Column({ nullable: true }) deleted_at?: Date; - @Column() - created_by: string; - @Column({ nullable: true }) + created_by?: string; + + @CreateDateColumn({ default: () => "datetime('now', 'localtime')" }) // defaultはSQLite用設定値.本番用は別途migrationで設定 created_at?: Date; - @Column() - updated_by: string; - @Column({ nullable: true }) + updated_by?: string; + + @UpdateDateColumn({ default: () => "datetime('now', 'localtime')" }) // defaultはSQLite用設定値.本番用は別途migrationで設定 updated_at?: Date; @OneToMany( diff --git a/dictation_server/src/repositories/user_groups/entity/user_group_member.entity.ts b/dictation_server/src/repositories/user_groups/entity/user_group_member.entity.ts index 9256d0b..93f2484 100644 --- a/dictation_server/src/repositories/user_groups/entity/user_group_member.entity.ts +++ b/dictation_server/src/repositories/user_groups/entity/user_group_member.entity.ts @@ -5,6 +5,8 @@ import { PrimaryGeneratedColumn, JoinColumn, ManyToOne, + CreateDateColumn, + UpdateDateColumn, } from 'typeorm'; import { UserGroup } from './user_group.entity'; @@ -22,16 +24,16 @@ export class UserGroupMember { @Column({ nullable: true }) deleted_at?: Date; - @Column() - created_by: string; - @Column({ nullable: true }) + created_by?: string; + + @CreateDateColumn({ default: () => "datetime('now', 'localtime')" }) // defaultはSQLite用設定値.本番用は別途migrationで設定 created_at?: Date; - @Column() - updated_by: string; - @Column({ nullable: true }) + updated_by?: string; + + @UpdateDateColumn({ default: () => "datetime('now', 'localtime')" }) // defaultはSQLite用設定値.本番用は別途migrationで設定 updated_at?: Date; @ManyToOne(() => User, (user) => user.id) diff --git a/dictation_server/src/repositories/user_groups/errors/types.ts b/dictation_server/src/repositories/user_groups/errors/types.ts new file mode 100644 index 0000000..a41ff78 --- /dev/null +++ b/dictation_server/src/repositories/user_groups/errors/types.ts @@ -0,0 +1,4 @@ +// タイピストグループが存在しないエラー +export class TypistGroupNotExistError extends Error {} +// typistIdが不正な場合のエラー +export class TypistIdInvalidError extends Error {} diff --git a/dictation_server/src/repositories/user_groups/user_groups.repository.service.ts b/dictation_server/src/repositories/user_groups/user_groups.repository.service.ts index 770ecaa..2c15584 100644 --- a/dictation_server/src/repositories/user_groups/user_groups.repository.service.ts +++ b/dictation_server/src/repositories/user_groups/user_groups.repository.service.ts @@ -2,6 +2,9 @@ import { Injectable } from '@nestjs/common'; import { DataSource, In, IsNull } from 'typeorm'; import { UserGroup } from './entity/user_group.entity'; import { UserGroupMember } from './entity/user_group_member.entity'; +import { User } from '../users/entity/user.entity'; +import { TypistGroupNotExistError, TypistIdInvalidError } from './errors/types'; +import { USER_ROLES } from '../../constants'; @Injectable() export class UserGroupsRepositoryService { @@ -43,4 +46,155 @@ export class UserGroupsRepositoryService { return groupMembers; }); } + + /** + * タイピストグループと所属するメンバーのIDを取得します + * @param accountId + * @param typistGroupId + * @returns typist group + */ + async getTypistGroup( + accountId: number, + typistGroupId: number, + ): Promise { + return await this.dataSource.transaction(async (entityManager) => { + const userGroupRepo = entityManager.getRepository(UserGroup); + + const userGroup = await userGroupRepo.findOne({ + where: { + id: typistGroupId, + account_id: accountId, + deleted_at: IsNull(), + }, + relations: { + userGroupMembers: true, + }, + }); + + if (!userGroup) { + throw new TypistGroupNotExistError( + `Typist Group is not exist. typistGroupId: ${typistGroupId}`, + ); + } + return userGroup; + }); + } + + /** + * 指定したアカウントIDでタイピストグループを作成し、そのタイピストグループとtypistIdsのユーザーを紐付ける + * @param accountId + * @param name + * @param typistIds + * @returns createdTypistGroup + */ + async createTypistGroup( + name: string, + typistIds: number[], + accountId: number, + ): Promise { + return await this.dataSource.transaction(async (entityManager) => { + const userGroupRepo = entityManager.getRepository(UserGroup); + const userGroupMemberRepo = entityManager.getRepository(UserGroupMember); + // typistIdsのidを持つユーザーが、account_idのアカウントに所属していて、かつ、roleがtypistであることを確認する + const userRepo = entityManager.getRepository(User); + const userRecords = await userRepo.find({ + where: { + id: In(typistIds), + account_id: accountId, + role: USER_ROLES.TYPIST, + }, + }); + if (userRecords.length !== typistIds.length) { + throw new TypistIdInvalidError( + `Typist user not exists Error. typistIds:${typistIds}; typistIds(DB):${userRecords.map( + (x) => x.id, + )}`, + ); + } + // userGroupをDBに保存する + const userGroup = await userGroupRepo.save({ + account_id: accountId, + name, + }); + + const userGroupMembers = userRecords.map((user) => { + return { + user_group_id: userGroup.id, + user_id: user.id, + }; + }); + // userGroupMembersをDBに保存する + await userGroupMemberRepo.save(userGroupMembers); + + return userGroup; + }); + } + + /** + * 指定したIDのタイピストグループを更新し、そのタイピストグループとtypistIdsのユーザーを紐付ける + * @param accountId + * @param name + * @param typistIds + * @returns createdTypistGroup + */ + async updateTypistGroup( + accountId: number, + typistGroupId: number, + typistGroupName: string, + typistIds: number[], + ): Promise { + return await this.dataSource.transaction(async (entityManager) => { + const userGroupRepo = entityManager.getRepository(UserGroup); + const userGroupMemberRepo = entityManager.getRepository(UserGroupMember); + // typistIdsのidを持つユーザーが、account_idのアカウントに所属していて、かつ、roleがtypistであることを確認する + const userRepo = entityManager.getRepository(User); + const userRecords = await userRepo.find({ + where: { + id: In(typistIds), + account_id: accountId, + role: USER_ROLES.TYPIST, + }, + }); + if (userRecords.length !== typistIds.length) { + throw new TypistIdInvalidError( + `Typist user not exists Error. typistIds:${typistIds}; typistIds(DB):${userRecords.map( + (x) => x.id, + )}`, + ); + } + + // GroupIdが自アカウント内に存在するか確認する + const typistGroup = await userGroupRepo.findOne({ + where: { + id: typistGroupId, + account_id: accountId, + }, + }); + if (!typistGroup) { + throw new TypistGroupNotExistError( + `TypistGroup not exists Error. accountId: ${accountId}; typistGroupId: ${typistGroupId}`, + ); + } + + // 対象のタイピストグループを更新する + // ユーザーグループ名を更新する + typistGroup.name = typistGroupName; + await userGroupRepo.save(typistGroup); + + // user_group_membersテーブルから対象のタイピストグループのユーザーを削除する + await userGroupMemberRepo.delete({ + user_group_id: typistGroupId, + }); + + const typistGroupMembers = userRecords.map((typist) => { + return { + user_group_id: typistGroup.id, + user_id: typist.id, + }; + }); + await userGroupMemberRepo.save(typistGroupMembers); + + return typistGroup; + }); + } } diff --git a/dictation_server/src/repositories/users/users.repository.service.ts b/dictation_server/src/repositories/users/users.repository.service.ts index 7683de3..b4c388d 100644 --- a/dictation_server/src/repositories/users/users.repository.service.ts +++ b/dictation_server/src/repositories/users/users.repository.service.ts @@ -317,14 +317,7 @@ export class UsersRepositoryService { .createQueryBuilder() .insert() .into(License) - .values( - licenses.map((value) => ({ - expiry_date: value.expiry_date, - account_id: value.account_id, - type: value.type, - status: value.status, - })), - ) + .values(licenses) .execute(); }); } diff --git a/dictation_server/src/repositories/worktypes/entity/worktype.entity.ts b/dictation_server/src/repositories/worktypes/entity/worktype.entity.ts new file mode 100644 index 0000000..67d055a --- /dev/null +++ b/dictation_server/src/repositories/worktypes/entity/worktype.entity.ts @@ -0,0 +1,38 @@ +import { Account } from '../../accounts/entity/account.entity'; +import { + Entity, + Column, + PrimaryGeneratedColumn, + CreateDateColumn, + UpdateDateColumn, +} from 'typeorm'; + +@Entity({ name: 'worktypes' }) +export class Worktype { + @PrimaryGeneratedColumn() + id: number; + + @Column() + account_id: number; + + @Column() + custom_worktype_id: string; + + @Column({ nullable: true }) + description?: string; + + @Column({ nullable: true }) + deleted_at?: Date; + + @Column({ nullable: true }) + created_by: string; + + @CreateDateColumn({ default: () => "datetime('now', 'localtime')" }) // defaultはSQLite用設定値.本番用は別途migrationで設定 + created_at: Date; + + @Column({ nullable: true }) + updated_by?: string; + + @UpdateDateColumn({ default: () => "datetime('now', 'localtime')" }) // defaultはSQLite用設定値.本番用は別途migrationで設定 + updated_at: Date; +} diff --git a/dictation_server/src/repositories/worktypes/errors/types.ts b/dictation_server/src/repositories/worktypes/errors/types.ts new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/dictation_server/src/repositories/worktypes/errors/types.ts @@ -0,0 +1 @@ + diff --git a/dictation_server/src/repositories/worktypes/worktypes.repository.module.ts b/dictation_server/src/repositories/worktypes/worktypes.repository.module.ts new file mode 100644 index 0000000..df7a231 --- /dev/null +++ b/dictation_server/src/repositories/worktypes/worktypes.repository.module.ts @@ -0,0 +1,11 @@ +import { Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { Worktype } from './entity/worktype.entity'; +import { WorktypesRepositoryService } from './worktypes.repository.service'; + +@Module({ + imports: [TypeOrmModule.forFeature([Worktype])], + providers: [WorktypesRepositoryService], + exports: [WorktypesRepositoryService], +}) +export class WorktypesRepositoryModule {} diff --git a/dictation_server/src/repositories/worktypes/worktypes.repository.service.ts b/dictation_server/src/repositories/worktypes/worktypes.repository.service.ts new file mode 100644 index 0000000..f5fe450 --- /dev/null +++ b/dictation_server/src/repositories/worktypes/worktypes.repository.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@nestjs/common'; +import { DataSource } from 'typeorm'; +import { Worktype } from './entity/worktype.entity'; + +@Injectable() +export class WorktypesRepositoryService { + constructor(private dataSource: DataSource) {} + + /** + * ワークタイプ一覧を取得する + * @param accountId + * @returns worktypes + */ + async getWorktypes(accountId: number): Promise { + return await this.dataSource.transaction(async (entityManager) => { + const repo = entityManager.getRepository(Worktype); + + const worktypes = await repo.find({ where: { account_id: accountId } }); + return worktypes; + }); + } +}