Files
egbim_qa_platform/apps/api/src/common/dtos/dynamic-feedback.dto.ts
T
root 33453ecc55
Deploy staging / deploy (push) Failing after 6s
Initial deployment setup
2026-08-31 16:45:24 +09:00

145 lines
4.4 KiB
TypeScript

/**
* Copyright 2025 LY Corporation
*
* LY Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
const dynamicFieldValueSchema = {
oneOf: [
{ type: 'string' },
{ type: 'number' },
{ type: 'array', items: { type: 'string' } },
{ type: 'null' },
],
description:
'The value type is determined by the channel field format. Select and date fields may be null.',
};
export const DYNAMIC_FEEDBACK_REQUEST_SCHEMA = {
type: 'object',
description:
'Dynamic feedback fields. Use GET /projects/{projectId}/channels/{channelId}/fields to discover the accepted keys, formats, and select options.',
additionalProperties: dynamicFieldValueSchema,
properties: {
title: { type: 'string', example: 'Feedback title' },
contents: { type: 'string', example: 'Feedback contents' },
Category: { type: 'string', example: 'ERROR_QNA' },
IP: { type: 'string', example: '192.168.0.10' },
MAC_address: { type: 'string', example: '00:1A:2B:3C:4D:5E' },
issueNames: {
type: 'array',
items: { type: 'string' },
description:
'Optional issue names to connect. This control field is used for issue linking and is not saved as a feedback field.',
example: ['Login error'],
},
},
example: {
title: 'Feedback title',
contents: 'Feedback contents',
Category: 'ERROR_QNA',
IP: '192.168.0.10',
MAC_address: '00:1A:2B:3C:4D:5E',
issueNames: ['Login error'],
},
};
export const DYNAMIC_FEEDBACK_MULTIPART_SCHEMA = {
type: 'object',
description:
'Multipart feedback input. Non-file parts use the channel field keys; the images field accepts repeated binary files of any type.',
additionalProperties: { type: 'string' },
properties: {
title: { type: 'string', example: 'Feedback title' },
contents: { type: 'string', example: 'Feedback contents' },
issueNames: {
type: 'string',
description: 'JSON array or repeated value depending on the client.',
example: '["Login error"]',
},
images: {
type: 'array',
items: { type: 'string', format: 'binary' },
description: 'Repeated file attachments. Any file type is accepted within the upload limits.',
},
},
};
export const DYNAMIC_FEEDBACK_ITEM_SCHEMA = {
type: 'object',
description:
'Feedback item. Channel field values are returned as top-level dynamic properties.',
additionalProperties: dynamicFieldValueSchema,
properties: {
id: { type: 'number', example: 34 },
createdAt: {
type: 'string',
format: 'date-time',
example: '2026-08-25T09:00:00.000Z',
},
updatedAt: {
type: 'string',
format: 'date-time',
example: '2026-08-25T09:30:00.000Z',
},
issues: {
type: 'array',
items: {
type: 'object',
properties: {
id: { type: 'number', example: 13 },
name: { type: 'string', example: 'Login error' },
status: { type: 'string', example: 'IN_PROGRESS' },
},
},
},
},
};
export const DYNAMIC_FEEDBACK_PAGINATION_SCHEMA = {
type: 'object',
properties: {
items: {
type: 'array',
items: DYNAMIC_FEEDBACK_ITEM_SCHEMA,
},
meta: {
type: 'object',
properties: {
itemCount: { type: 'number', example: 10 },
totalItems: { type: 'number', example: 35 },
itemsPerPage: { type: 'number', example: 10 },
currentPage: { type: 'number', example: 1 },
totalPages: { type: 'number', example: 4 },
},
},
},
};
export const DYNAMIC_FEEDBACK_QUERY_VALUE_SCHEMA = {
oneOf: [
{ type: 'string' },
{ type: 'number' },
{
type: 'array',
items: { oneOf: [{ type: 'string' }, { type: 'number' }] },
},
{
type: 'object',
properties: {
gte: { type: 'string', example: '2026-08-01' },
lt: { type: 'string', example: '2026-09-01' },
},
},
],
};