-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[ResponseOps][Cases] Add tags to template in configure api #183743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0e1e1ca
b043c4d
acbd8ef
ef89347
3806e8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,10 +10,12 @@ import { | |
| MAX_CUSTOM_FIELDS_PER_CASE, | ||
| MAX_CUSTOM_FIELD_KEY_LENGTH, | ||
| MAX_CUSTOM_FIELD_LABEL_LENGTH, | ||
| MAX_TAGS_PER_TEMPLATE, | ||
| MAX_TEMPLATES_LENGTH, | ||
| MAX_TEMPLATE_DESCRIPTION_LENGTH, | ||
| MAX_TEMPLATE_KEY_LENGTH, | ||
| MAX_TEMPLATE_NAME_LENGTH, | ||
| MAX_TEMPLATE_TAG_LENGTH, | ||
| } from '../../../constants'; | ||
| import { limitedArraySchema, limitedStringSchema, regexStringRt } from '../../../schema'; | ||
| import { CustomFieldTextTypeRt, CustomFieldToggleTypeRt } from '../../domain'; | ||
|
|
@@ -69,32 +71,51 @@ export const CustomFieldsConfigurationRt = limitedArraySchema({ | |
| fieldName: 'customFields', | ||
| }); | ||
|
|
||
| export const TemplateConfigurationRt = rt.strict({ | ||
| /** | ||
| * key of template | ||
| */ | ||
| key: regexStringRt({ | ||
| codec: limitedStringSchema({ fieldName: 'key', min: 1, max: MAX_TEMPLATE_KEY_LENGTH }), | ||
| pattern: '^[a-z0-9_-]+$', | ||
| message: `Key must be lower case, a-z, 0-9, '_', and '-' are allowed`, | ||
| }), | ||
| /** | ||
| * name of template | ||
| */ | ||
| name: limitedStringSchema({ fieldName: 'name', min: 1, max: MAX_TEMPLATE_NAME_LENGTH }), | ||
| /** | ||
| * description of templates | ||
| */ | ||
| description: limitedStringSchema({ | ||
| fieldName: 'description', | ||
| min: 1, | ||
| max: MAX_TEMPLATE_DESCRIPTION_LENGTH, | ||
| export const TemplateConfigurationRt = rt.intersection([ | ||
| rt.strict({ | ||
| /** | ||
| * key of template | ||
| */ | ||
| key: regexStringRt({ | ||
| codec: limitedStringSchema({ fieldName: 'key', min: 1, max: MAX_TEMPLATE_KEY_LENGTH }), | ||
| pattern: '^[a-z0-9_-]+$', | ||
| message: `Key must be lower case, a-z, 0-9, '_', and '-' are allowed`, | ||
| }), | ||
| /** | ||
| * name of template | ||
| */ | ||
| name: limitedStringSchema({ fieldName: 'name', min: 1, max: MAX_TEMPLATE_NAME_LENGTH }), | ||
| /** | ||
| * description of templates | ||
| */ | ||
| description: limitedStringSchema({ | ||
| fieldName: 'description', | ||
| min: 1, | ||
| max: MAX_TEMPLATE_DESCRIPTION_LENGTH, | ||
| }), | ||
| /** | ||
| * case fields | ||
| */ | ||
| caseFields: rt.union([rt.null, CaseBaseOptionalFieldsRequestRt]), | ||
| }), | ||
| /** | ||
| * case fields | ||
| */ | ||
| caseFields: rt.union([rt.null, CaseBaseOptionalFieldsRequestRt]), | ||
| }); | ||
| rt.exact( | ||
| rt.partial({ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. super nit: Do the tags need to be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yy I know, but I thought why not have |
||
| /** | ||
| * tags of templates | ||
| */ | ||
| tags: limitedArraySchema({ | ||
| codec: limitedStringSchema({ | ||
| fieldName: `template's tag`, | ||
| min: 0, | ||
| max: MAX_TEMPLATE_TAG_LENGTH, | ||
| }), | ||
| min: 0, | ||
| max: MAX_TAGS_PER_TEMPLATE, | ||
| fieldName: `template's tags`, | ||
| }), | ||
| }) | ||
| ), | ||
| ]); | ||
|
|
||
| export const TemplatesConfigurationRt = limitedArraySchema({ | ||
| codec: TemplateConfigurationRt, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.