Merged PR 399: API IF修正

## 概要
[Task2631: API IF修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2631)

- OptionItem取得APIでidも返却するように修正

## レビューポイント
- OptionItem更新APIの引数で使用している型と分けたが問題ないか
  - 主に名前

## UIの変更
- Before/Afterのスクショなど
- スクショ置き場

## 動作確認状況
- ローカルで確認

## 補足
- 相談、参考資料などがあれば
This commit is contained in:
saito.k 2023-09-12 01:42:08 +00:00
parent 606ff6de9b
commit 7422ef38e1
4 changed files with 43 additions and 20 deletions

View File

@ -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"]

View File

@ -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,

View File

@ -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,

View File

@ -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 {}