Browse Source

fix(nocodb): FormView model type error

pull/7768/head
Ramesh Mane 6 months ago
parent
commit
b4d8434553
  1. 10
      packages/nc-gui/components/smartsheet/Form.vue
  2. 11
      packages/nocodb/src/models/FormView.ts
  3. 18
      packages/nocodb/src/schema/swagger-v2.json
  4. 18
      packages/nocodb/src/schema/swagger.json

10
packages/nc-gui/components/smartsheet/Form.vue

@ -373,8 +373,8 @@ function setFormData() {
systemFieldsIds.value = getSystemColumns(col).map((c) => c.fk_column_id)
formViewData.value = {
banner_image_url: '',
logo_url: '',
banner_image_url: null,
logo_url: null,
...formViewData.value,
submit_another_form: !!(formViewData.value?.submit_another_form ?? 0),
show_blank_form: !!(formViewData.value?.show_blank_form ?? 0),
@ -504,7 +504,7 @@ onChangeFile((files) => {
}
})
const handleOnUploadImage = (data: AttachmentResType = '') => {
const handleOnUploadImage = (data: AttachmentResType = null) => {
if (imageCropperData.value.cropFor === 'banner') {
formViewData.value!.banner_image_url = data
} else {
@ -725,7 +725,7 @@ useEventListener(
@click="
() => {
if (isEditable) {
formViewData!.banner_image_url = ''
formViewData!.banner_image_url = null
updateView()
}
}
@ -788,7 +788,7 @@ useEventListener(
@click="
() => {
if (isEditable) {
formViewData!.logo_url = ''
formViewData!.logo_url = null
updateView()
}
}

11
packages/nocodb/src/models/FormView.ts

@ -14,7 +14,12 @@ import { deserializeJSON, serializeJSON } from '~/utils/serialize';
import { CacheGetType, CacheScope, MetaTable } from '~/utils/globals';
import { prepareForDb, prepareForResponse } from '~/utils/modelUtils';
export default class FormView implements FormType {
type FormViewType = Omit<FormType, 'banner_image_url' | 'logo_url'> & {
banner_image_url?: AttachmentResType | string;
logo_url?: AttachmentResType | string;
};
export default class FormView implements FormViewType {
show: BoolType;
is_default: BoolType;
order: number;
@ -168,7 +173,7 @@ export default class FormView implements FormType {
return form;
}
static serializeAttachmentJSON(attachment: AttachmentResType) {
static serializeAttachmentJSON(attachment): string | null {
if (attachment) {
return serializeJSON(
extractProps(deserializeJSON(attachment), [
@ -193,7 +198,7 @@ export default class FormView implements FormType {
for (const key in formAttachments) {
if (
formAttachments[key]?.trim() &&
formAttachments[key] &&
typeof formAttachments[key] === 'string'
) {
formAttachments[key] = deserializeJSON(formAttachments[key]);

18
packages/nocodb/src/schema/swagger-v2.json

@ -13216,7 +13216,14 @@
"type": "object",
"properties": {
"banner_image_url": {
"$ref": "#/components/schemas/AttachmentReq",
"oneOf": [
{
"$ref": "#/components/schemas/AttachmentReq"
},
{
"type" : "null"
}
],
"description": "Banner Image URL"
},
"email": {
@ -13230,7 +13237,14 @@
"type": "string"
},
"logo_url": {
"$ref": "#/components/schemas/AttachmentReq",
"oneOf": [
{
"$ref": "#/components/schemas/AttachmentReq"
},
{
"type" : "null"
}
],
"description": "Logo URL."
},
"meta": {

18
packages/nocodb/src/schema/swagger.json

@ -18858,7 +18858,14 @@
"type": "object",
"properties": {
"banner_image_url": {
"$ref": "#/components/schemas/AttachmentReq",
"oneOf": [
{
"$ref": "#/components/schemas/AttachmentReq"
},
{
"type" : "null"
}
],
"description": "Banner Image URL"
},
"email": {
@ -18872,7 +18879,14 @@
"type": "string"
},
"logo_url": {
"$ref": "#/components/schemas/AttachmentReq",
"oneOf": [
{
"$ref": "#/components/schemas/AttachmentReq"
},
{
"type" : "null"
}
],
"description": "Logo URL"
},
"meta": {

Loading…
Cancel
Save