Browse Source

refactor: generic type for string or null

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5174/head
Pranav C 2 years ago
parent
commit
ca7f8dca08
  1. 75
      packages/nocodb-sdk/src/lib/Api.ts
  2. 2
      packages/nocodb/src/lib/meta/api/formViewApis.ts
  3. 234
      scripts/sdk/swagger.json

75
packages/nocodb-sdk/src/lib/Api.ts

@ -203,8 +203,8 @@ export interface FilterType {
project_id?: string;
base_id?: string;
fk_parent_id?: string;
fk_view_id?: string | null;
fk_hook_id?: string | null;
fk_view_id?: StringOrNullType;
fk_hook_id?: StringOrNullType;
}
export interface FilterReqType {
@ -219,8 +219,8 @@ export interface FilterReqType {
project_id?: string;
base_id?: string;
fk_parent_id?: string;
fk_view_id?: string | null;
fk_hook_id?: string | null;
fk_view_id?: StringOrNullType;
fk_hook_id?: StringOrNullType;
}
export interface FilterListType {
@ -454,7 +454,7 @@ export interface KanbanType {
alias?: string;
columns?: KanbanColumnType[];
fk_model_id?: string;
fk_grp_col_id?: string | null;
fk_grp_col_id?: StringOrNullType;
fk_cover_image_col_id?: string;
meta?: MetaType;
}
@ -473,7 +473,7 @@ export interface MapType {
initial_geo_position?: GeoLocationType;
fk_model_id?: string;
fk_view_id?: string;
fk_geo_data_col_id?: string | null;
fk_geo_data_col_id?: StringOrNullType;
columns?: MapColumnType[];
meta?: MetaType;
}
@ -492,11 +492,11 @@ export interface LicenseReqType {
export interface KanbanReqType {
title: string;
fk_grp_col_id?: string | null;
fk_grp_col_id?: StringOrNullType;
}
export interface KanbanUpdateReqType {
fk_grp_col_id?: string | null;
fk_grp_col_id?: StringOrNullType;
}
export interface FormType {
@ -505,11 +505,11 @@ export interface FormType {
heading?: string;
subheading?: string;
success_msg?: string;
redirect_url?: string;
redirect_after_secs?: string;
email?: string;
banner_image_url?: string;
logo_url?: string;
redirect_url?: StringOrNullType;
redirect_after_secs?: StringOrNullType;
email?: StringOrNullType;
banner_image_url?: StringOrNullType;
logo_url?: StringOrNullType;
submit_another_form?: BoolType;
show_blank_form?: BoolType;
columns?: FormColumnType[];
@ -519,22 +519,23 @@ export interface FormType {
}
export interface FormReqType {
title: string;
title?: string;
heading?: string;
subheading?: string;
success_msg?: string;
redirect_url?: string;
redirect_after_secs?: string;
email?: string;
banner_image_url?: string;
logo_url?: string;
redirect_url?: StringOrNullType;
redirect_after_secs?: StringOrNullType;
email?: StringOrNullType;
banner_image_url?: StringOrNullType;
logo_url?: StringOrNullType;
submit_another_form?: BoolType;
show_blank_form?: BoolType;
fk_model_id?: string;
lock_type?: 'collaborative' | 'locked' | 'personal';
meta?: MetaType;
}
export type FormCreateReqType = FormReqType;
export interface FormColumnType {
fk_column_id?: string;
id?: string;
@ -645,7 +646,7 @@ export interface HookReqType {
id?: string;
fk_model_id?: string;
title: string;
description?: string | null;
description?: StringOrNullType;
env?: string;
event: 'after' | 'before';
operation: 'insert' | 'delete' | 'update';
@ -686,7 +687,7 @@ export interface PasswordChangeReqType {
}
export interface ApiTokenReqType {
description?: string | null;
description?: StringOrNullType;
}
export interface PluginType {
@ -704,7 +705,7 @@ export interface PluginType {
tags?: string;
category?: string;
input_schema?: string;
input?: string | number | null;
input?: number | StringOrNullType;
creator?: string;
creator_website?: string;
price?: string;
@ -733,7 +734,7 @@ export interface HookLogType {
id?: string;
base_id?: string;
project_id?: string;
fk_hook_id?: string | null;
fk_hook_id?: StringOrNullType;
type?: string;
event?: string;
operation?: string;
@ -789,22 +790,22 @@ export interface NormalColumnRequestType {
fk_model_id?: string;
title?: string;
dt?: string;
np?: string | number | null;
ns?: string | number | null;
np?: number | StringOrNullType;
ns?: number | StringOrNullType;
pk?: BoolType;
pv?: BoolType;
rqd?: number | null | BoolType;
rqd?: BoolType;
column_name?: string;
un?: BoolType;
ct?: string;
ai?: BoolType;
unique?: BoolType;
cdf?: string | null;
cdf?: StringOrNullType;
cc?: string;
csn?: string;
dtx?: string;
dtxp?: string | number | null;
dtxs?: string | number | null;
dtxp?: number | StringOrNullType;
dtxs?: number | StringOrNullType;
au?: BoolType;
}
@ -881,6 +882,8 @@ export type VisibilityRuleReqType = {
export type BoolType = boolean | number | null;
export type StringOrNullType = string | null;
export type MetaType = object | string | null;
export interface CommentReqType {
@ -908,8 +911,8 @@ export interface ProjectUserReqType {
}
export interface SharedBaseReqType {
uuid?: string | null;
roles?: string | null;
uuid?: StringOrNullType;
roles?: StringOrNullType;
}
export interface PluginTestReqType {
@ -2652,7 +2655,7 @@ export class Api<
*/
formCreate: (
tableId: string,
data: FormReqType,
data: FormCreateReqType,
params: RequestParams = {}
) =>
this.request<FormType, any>({
@ -2672,7 +2675,11 @@ export class Api<
* @request PATCH:/api/v1/db/meta/forms/{formId}
* @response `200` `void` OK
*/
formUpdate: (formId: string, data: FormType, params: RequestParams = {}) =>
formUpdate: (
formId: string,
data: FormReqType,
params: RequestParams = {}
) =>
this.request<void, any>({
path: `/api/v1/db/meta/forms/${formId}`,
method: 'PATCH',

2
packages/nocodb/src/lib/meta/api/formViewApis.ts

@ -44,7 +44,7 @@ const router = Router({ mergeParams: true });
router.post(
'/api/v1/db/meta/tables/:tableId/forms',
metaApiMetrics,
getAjvValidatorMw('swagger.json#/components/schemas/FormReq'),
getAjvValidatorMw('swagger.json#/components/schemas/FormCreateReq'),
ncMetaAclMw(formViewCreate, 'formViewCreate')
);
router.get(

234
scripts/sdk/swagger.json

@ -2892,7 +2892,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FormReq"
"$ref": "#/components/schemas/FormCreateReq"
}
}
}
@ -2925,7 +2925,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Form"
"$ref": "#/components/schemas/FormReq"
}
}
}
@ -7538,7 +7538,7 @@
"type": "string"
},
"enabled": {
"$ref" : "#/components/schemas/Bool"
"$ref": "#/components/schemas/Bool"
},
"parent_id": {
"type": "string"
@ -7550,10 +7550,10 @@
"type": "string"
},
"pinned": {
"$ref" : "#/components/schemas/Bool"
"$ref": "#/components/schemas/Bool"
},
"deleted": {
"$ref" : "#/components/schemas/Bool"
"$ref": "#/components/schemas/Bool"
},
"order": {
"type": "number"
@ -7999,7 +7999,7 @@
"comparison_op": {
"type": "string"
},
"value": { },
"value": {},
"is_group": {
"oneOf": [
{
@ -8031,24 +8031,10 @@
"type": "string"
},
"fk_view_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
},
"fk_hook_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
}
},
"readOnly": true
@ -8072,7 +8058,7 @@
"comparison_op": {
"type": "string"
},
"value": { },
"value": {},
"is_group": {
"oneOf": [
{
@ -8104,24 +8090,10 @@
"type": "string"
},
"fk_view_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
},
"fk_hook_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
}
},
"readOnly": true
@ -8983,14 +8955,7 @@
"type": "string"
},
"fk_grp_col_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
},
"fk_cover_image_col_id": {
"type": "string"
@ -9040,14 +9005,7 @@
"minLength": 1
},
"fk_geo_data_col_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
},
"columns": {
"type": "array",
@ -9055,7 +9013,7 @@
"$ref": "#/components/schemas/MapColumn"
}
},
"meta":{
"meta": {
"$ref": "#/components/schemas/Meta"
}
}
@ -9101,14 +9059,7 @@
"type": "string"
},
"fk_grp_col_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
}
},
"required": [
@ -9121,14 +9072,7 @@
"description": "",
"properties": {
"fk_grp_col_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
}
}
},
@ -9153,19 +9097,19 @@
"type": "string"
},
"redirect_url": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"redirect_after_secs": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"email": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"banner_image_url": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"logo_url": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"submit_another_form": {
"$ref": "#/components/schemas/Bool"
@ -9212,20 +9156,21 @@
"success_msg": {
"type": "string"
},
"redirect_url": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"redirect_after_secs": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"email": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"banner_image_url": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"logo_url": {
"type": "string"
"$ref": "#/components/schemas/StringOrNull"
},
"submit_another_form": {
"$ref": "#/components/schemas/Bool"
@ -9233,9 +9178,6 @@
"show_blank_form": {
"$ref": "#/components/schemas/Bool"
},
"fk_model_id": {
"type": "string"
},
"lock_type": {
"type": "string",
"enum": [
@ -9247,9 +9189,18 @@
"meta": {
"$ref": "#/components/schemas/Meta"
}
},
"required": [
"title"
}
},
"FormCreateReq": {
"allOf": [
{
"$ref": "#/components/schemas/FormReq"
},
{
"required": [
"title"
]
}
]
},
"FormColumn": {
@ -9709,14 +9660,7 @@
"type": "string"
},
"description": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
},
"env": {
"type": "string"
@ -9910,14 +9854,11 @@
},
"input": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "null"
"$ref": "#/components/schemas/StringOrNull"
}
]
},
@ -9984,14 +9925,7 @@
"type": "object",
"properties": {
"description": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
}
}
},
@ -10009,14 +9943,7 @@
"type": "string"
},
"fk_hook_id": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
},
"type": {
"type": "string"
@ -10118,27 +10045,21 @@
},
"np": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "null"
"$ref": "#/components/schemas/StringOrNull"
}
]
},
"ns": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "null"
"$ref": "#/components/schemas/StringOrNull"
}
]
},
@ -10149,17 +10070,7 @@
"$ref": "#/components/schemas/Bool"
},
"rqd": {
"oneOf": [
{
"type": "integer"
},
{
"type": "null"
},
{
"$ref": "#/components/schemas/Bool"
}
]
"$ref": "#/components/schemas/Bool"
},
"column_name": {
"type": "string"
@ -10177,14 +10088,7 @@
"$ref": "#/components/schemas/Bool"
},
"cdf": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
},
"cc": {
"type": "string"
@ -10197,27 +10101,21 @@
},
"dtxp": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "null"
"$ref": "#/components/schemas/StringOrNull"
}
]
},
"dtxs": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "null"
"$ref": "#/components/schemas/StringOrNull"
}
]
},
@ -10436,6 +10334,16 @@
}
]
},
"StringOrNull": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"Meta": {
"oneOf": [
{
@ -10480,8 +10388,8 @@
"row_id": {
"type": "string"
},
"value": { },
"prev_value": { }
"value": {},
"prev_value": {}
}
},
"OrgUserReq": {
@ -10510,24 +10418,10 @@
"type": "object",
"properties": {
"uuid": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
},
"roles": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/StringOrNull"
}
}
},
@ -10555,7 +10449,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SignUpReq"
"$ref": "#/components/schemas/SignUpReq"
}
}
}

Loading…
Cancel
Save