Merged PR 463: API IF実装
## 概要 [Task2775: API IF実装](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2775) - ワークフロー編集APIのIFを実装し、OpenAPIを更新しました。 ## レビューポイント - パスは想定通りか - パラメータは適切か ## UIの変更 - なし ## 動作確認状況 - ローカルで確認
This commit is contained in:
parent
664e815ef9
commit
6baeb0b049
@ -1219,7 +1219,7 @@
|
||||
},
|
||||
"/accounts/delete": {
|
||||
"post": {
|
||||
"operationId": "deleteAccount",
|
||||
"operationId": "deleteAccountAndData",
|
||||
"summary": "",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
@ -2976,6 +2976,68 @@
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/workflows/{workflowId}": {
|
||||
"post": {
|
||||
"operationId": "updateWorkflow",
|
||||
"summary": "",
|
||||
"description": "アカウント内のワークフローを編集します",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "workflowId",
|
||||
"required": true,
|
||||
"in": "path",
|
||||
"description": "ワークフローの内部ID",
|
||||
"schema": { "type": "number" }
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/UpdateWorkflowRequest" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UpdateWorkflowResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": ["workflows"],
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/notification/register": {
|
||||
"post": {
|
||||
"operationId": "register",
|
||||
@ -4251,7 +4313,7 @@
|
||||
"CreateWorkflowsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"authorId": { "type": "number", "description": "Authornの内部ID" },
|
||||
"authorId": { "type": "number", "description": "Authorの内部ID" },
|
||||
"worktypeId": { "type": "number", "description": "Worktypeの内部ID" },
|
||||
"templateId": {
|
||||
"type": "number",
|
||||
@ -4267,6 +4329,25 @@
|
||||
"required": ["authorId", "typists"]
|
||||
},
|
||||
"CreateWorkflowsResponse": { "type": "object", "properties": {} },
|
||||
"UpdateWorkflowRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"authorId": { "type": "number", "description": "Authorの内部ID" },
|
||||
"worktypeId": { "type": "number", "description": "Worktypeの内部ID" },
|
||||
"templateId": {
|
||||
"type": "number",
|
||||
"description": "テンプレートの内部ID"
|
||||
},
|
||||
"typists": {
|
||||
"description": "ルーティング候補のタイピストユーザー/タイピストグループ",
|
||||
"minItems": 1,
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/components/schemas/WorkflowTypist" }
|
||||
}
|
||||
},
|
||||
"required": ["authorId", "typists"]
|
||||
},
|
||||
"UpdateWorkflowResponse": { "type": "object", "properties": {} },
|
||||
"RegisterRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -50,7 +50,7 @@ export class WorkflowTypist {
|
||||
}
|
||||
|
||||
export class CreateWorkflowsRequest {
|
||||
@ApiProperty({ description: 'Authornの内部ID' })
|
||||
@ApiProperty({ description: 'Authorの内部ID' })
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
@ -79,3 +79,42 @@ export class CreateWorkflowsRequest {
|
||||
}
|
||||
|
||||
export class CreateWorkflowsResponse {}
|
||||
|
||||
export class UpdateWorkflowRequestParam {
|
||||
@ApiProperty({ description: 'ワークフローの内部ID' })
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
workflowId: number;
|
||||
}
|
||||
|
||||
export class UpdateWorkflowRequest {
|
||||
@ApiProperty({ description: 'Authorの内部ID' })
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
authorId: number;
|
||||
@ApiProperty({ description: 'Worktypeの内部ID', required: false })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
worktypeId?: number | undefined;
|
||||
@ApiProperty({ description: 'テンプレートの内部ID', required: false })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
templateId?: number | undefined;
|
||||
@ApiProperty({
|
||||
description: 'ルーティング候補のタイピストユーザー/タイピストグループ',
|
||||
type: [WorkflowTypist],
|
||||
minItems: 1,
|
||||
})
|
||||
@Type(() => WorkflowTypist)
|
||||
@IsArray()
|
||||
@ArrayMinSize(1)
|
||||
typists: WorkflowTypist[];
|
||||
}
|
||||
|
||||
export class UpdateWorkflowResponse {}
|
||||
|
||||
@ -3,6 +3,7 @@ import {
|
||||
Controller,
|
||||
Get,
|
||||
HttpStatus,
|
||||
Param,
|
||||
Post,
|
||||
Req,
|
||||
UseGuards,
|
||||
@ -20,6 +21,9 @@ import {
|
||||
GetWorkflowsResponse,
|
||||
CreateWorkflowsRequest,
|
||||
CreateWorkflowsResponse,
|
||||
UpdateWorkflowResponse,
|
||||
UpdateWorkflowRequest,
|
||||
UpdateWorkflowRequestParam,
|
||||
} from './types/types';
|
||||
import { AuthGuard } from '../../common/guards/auth/authguards';
|
||||
import { RoleGuard } from '../../common/guards/role/roleguards';
|
||||
@ -110,4 +114,51 @@ export class WorkflowsController {
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: UpdateWorkflowResponse,
|
||||
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: 'updateWorkflow',
|
||||
description: 'アカウント内のワークフローを編集します',
|
||||
})
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(AuthGuard)
|
||||
@UseGuards(RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN] }))
|
||||
@Post('/:workflowId')
|
||||
async updateWorkflow(
|
||||
@Req() req: Request,
|
||||
@Param() param: UpdateWorkflowRequestParam,
|
||||
@Body() body: UpdateWorkflowRequest,
|
||||
): Promise<UpdateWorkflowResponse> {
|
||||
const { authorId } = body;
|
||||
const { workflowId } = param;
|
||||
const token = retrieveAuthorizationToken(req);
|
||||
const { userId } = jwt.decode(token, { json: true }) as AccessToken;
|
||||
console.log('updateWorkflow');
|
||||
|
||||
const context = makeContext(userId);
|
||||
console.log(context.trackingId);
|
||||
console.log(authorId);
|
||||
console.log(workflowId);
|
||||
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user