diff --git a/dictation_server/src/api/odms/openapi.json b/dictation_server/src/api/odms/openapi.json index 7ecacde..ae10150 100644 --- a/dictation_server/src/api/odms/openapi.json +++ b/dictation_server/src/api/odms/openapi.json @@ -3015,7 +3015,33 @@ "required": ["worktypeId"] }, "UpdateWorktypeResponse": { "type": "object", "properties": {} }, - "WorktypeOptionItem": { + "GetWorktypeOptionItem": { + "type": "object", + "properties": { + "itemLabel": { "type": "string", "maxLength": 16 }, + "defaultValueType": { + "type": "string", + "maxLength": 20, + "description": "Default / Blank / LastInput" + }, + "initialValue": { "type": "string", "maxLength": 20 }, + "id": { "type": "number" } + }, + "required": ["itemLabel", "defaultValueType", "initialValue", "id"] + }, + "GetOptionItemsResponse": { + "type": "object", + "properties": { + "optionItems": { + "maxItems": 10, + "minItems": 10, + "type": "array", + "items": { "$ref": "#/components/schemas/GetWorktypeOptionItem" } + } + }, + "required": ["optionItems"] + }, + "PostWorktypeOptionItem": { "type": "object", "properties": { "itemLabel": { "type": "string", "maxLength": 16 }, @@ -3028,18 +3054,6 @@ }, "required": ["itemLabel", "defaultValueType", "initialValue"] }, - "GetOptionItemsResponse": { - "type": "object", - "properties": { - "optionItems": { - "maxItems": 10, - "minItems": 10, - "type": "array", - "items": { "$ref": "#/components/schemas/WorktypeOptionItem" } - } - }, - "required": ["optionItems"] - }, "UpdateOptionItemsRequest": { "type": "object", "properties": { @@ -3047,7 +3061,7 @@ "maxItems": 10, "minItems": 10, "type": "array", - "items": { "$ref": "#/components/schemas/WorktypeOptionItem" } + "items": { "$ref": "#/components/schemas/PostWorktypeOptionItem" } } }, "required": ["optionItems"] diff --git a/dictation_server/src/features/accounts/accounts.service.spec.ts b/dictation_server/src/features/accounts/accounts.service.spec.ts index c9c9cf3..369feab 100644 --- a/dictation_server/src/features/accounts/accounts.service.spec.ts +++ b/dictation_server/src/features/accounts/accounts.service.spec.ts @@ -3913,6 +3913,9 @@ describe('getOptionItems', () => { //実行結果を確認 { expect(resOptionItems.optionItems.length).toBe(10); + expect(resOptionItems.optionItems.map((x) => x.id)).toEqual( + optionItems.map((x) => x.id), + ); expect(resOptionItems.optionItems[0].itemLabel).toBe(''); expect(resOptionItems.optionItems[0].defaultValueType).toBe( OPTION_ITEM_VALUE_TYPE.DEFAULT, diff --git a/dictation_server/src/features/accounts/accounts.service.ts b/dictation_server/src/features/accounts/accounts.service.ts index 7e61ef1..8944b0d 100644 --- a/dictation_server/src/features/accounts/accounts.service.ts +++ b/dictation_server/src/features/accounts/accounts.service.ts @@ -1345,6 +1345,7 @@ export class AccountsService { return { optionItems: optionItems.map((x) => ({ + id: x.id, itemLabel: x.item_label, defaultValueType: x.default_value_type, initialValue: x.initial_value, diff --git a/dictation_server/src/features/accounts/types/types.ts b/dictation_server/src/features/accounts/types/types.ts index 216b3cb..d907538 100644 --- a/dictation_server/src/features/accounts/types/types.ts +++ b/dictation_server/src/features/accounts/types/types.ts @@ -380,7 +380,7 @@ export class UpdateWorktypesRequest { export class UpdateWorktypeResponse {} -export class WorktypeOptionItem { +export class PostWorktypeOptionItem { @ApiProperty({ maxLength: 16 }) @MaxLength(16) itemLabel: string; @@ -395,13 +395,18 @@ export class WorktypeOptionItem { @MaxLength(20) initialValue: string; } +export class GetWorktypeOptionItem extends PostWorktypeOptionItem { + @ApiProperty() + id: number; +} + export class GetOptionItemsResponse { @ApiProperty({ maxItems: 10, minItems: 10, - type: [WorktypeOptionItem], + type: [GetWorktypeOptionItem], }) - optionItems: WorktypeOptionItem[]; + optionItems: GetWorktypeOptionItem[]; } export class GetOptionItemsRequestParam { @@ -416,14 +421,14 @@ export class UpdateOptionItemsRequest { @ApiProperty({ maxItems: 10, minItems: 10, - type: [WorktypeOptionItem], + type: [PostWorktypeOptionItem], }) @IsArray() @ValidateNested({ each: true }) - @Type(() => WorktypeOptionItem) + @Type(() => PostWorktypeOptionItem) @ArrayMinSize(10) @ArrayMaxSize(10) - optionItems: WorktypeOptionItem[]; + optionItems: PostWorktypeOptionItem[]; } export class UpdateOptionItemsResponse {}