Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

remove model from webhook manager add tableId on v3 view response

Fendy Heryanto67f7be650125
diff --git a/packages/nocodb/src/schema/swagger-v3.json b/packages/nocodb/src/schema/swagger-v3.json
index 098bdf6201..d85954b45b 100644
--- a/packages/nocodb/src/schema/swagger-v3.json
+++ b/packages/nocodb/src/schema/swagger-v3.json
@@ -1658,6 +1658,7 @@
"list": [
{
"id": "vwpwk5v4urgbu85g",
+ "table_id": "mrc5unwjdov67vr",
"title": "Grid View",
"type": "grid",
"is_default": true,
@@ -1667,6 +1668,7 @@
},
{
"id": "vwfqa5qnmcaxt9yp",
+ "table_id": "mrc5unwjdov67vr",
"title": "Grid View 2",
"type": "grid",
"lock_type": "collaborative",
@@ -1677,6 +1679,7 @@
},
{
"id": "vwx2x5ietbis99xg",
+ "table_id": "mrc5unwjdov67vr",
"title": "Grid Group By",
"type": "grid",
"lock_type": "collaborative",
@@ -1686,6 +1689,7 @@
},
{
"id": "vwjctk8vdhbhxtd4",
+ "table_id": "mrc5unwjdov67vr",
"title": "Gallery View",
"type": "gallery",
"lock_type": "collaborative",
@@ -1695,6 +1699,7 @@
},
{
"id": "vwnyxj93jfswla29",
+ "table_id": "mrc5unwjdov67vr",
"title": "Kanban View",
"type": "kanban",
"lock_type": "collaborative",
@@ -1704,6 +1709,7 @@
},
{
"id": "vw7hwhx551tbr44z",
+ "table_id": "mrc5unwjdov67vr",
"title": "Calendar View",
"type": "calendar",
"lock_type": "collaborative",
@@ -1783,6 +1789,7 @@
"Example 1": {
"value": {
"id": "vw5rakj00x28vdht",
+ "table_id": "mrc5unwjdov67vr",
"title": "myFilterView2",
"type": "grid",
"lock_type": "collaborative",
@@ -2175,6 +2182,7 @@
"Example 1": {
"value": {
"id": "vw5rakj00x28vdht",
+ "table_id": "mrc5unwjdov67vr",
"title": "myFilterView2",
"type": "grid",
"lock_type": "collaborative",
@@ -2292,6 +2300,7 @@
"Example 1": {
"value": {
"id": "vw5rakj00x28vdht",
+ "table_id": "mrc5unwjdov67vr",
"title": "myFilterView2",
"type": "grid",
"lock_type": "collaborative",
@@ -5709,6 +5718,10 @@
"type": "string",
"description": "Unique identifier for the view."
},
+ "table_id": {
+ "type": "string",
+ "description": "Id of table associated with the view."
+ },
"title": {
"type": "string",
"description": "Title of the view."
@@ -6376,6 +6389,10 @@
"type": "string",
"description": "Unique identifier for the view."
},
+ "table_id": {
+ "type": "string",
+ "description": "Id of table associated with the view."
+ },
"is_default": {
"type": "boolean",
"description": "Indicates if this is the default view. Omitted if not the default view."
diff --git a/packages/nocodb/src/utils/view-webhook-manager.ts b/packages/nocodb/src/utils/view-webhook-manager.ts
index 43ba87938c..d6f1fa8ddb 100644
--- a/packages/nocodb/src/utils/view-webhook-manager.ts
+++ b/packages/nocodb/src/utils/view-webhook-manager.ts
@@ -7,8 +7,8 @@ import type { ModelWebhookManager } from '~/utils/model-webhook-manager';
import type { NcContext, NcRequest } from 'nocodb-sdk';
import type { IViewsV3Service } from '~/services/v3/views-v3.types';
import type { MetaService } from '~/meta/meta.service';
+import type { Model } from '~/models';
import Noco from '~/Noco';
-import { Model } from '~/models';
import { NcError } from '~/helpers/ncError';
import { HANDLE_WEBHOOK } from '~/services/hook-handler.service';
@@ -18,7 +18,6 @@ export class ViewWebhookManagerBuilder {
protected readonly ncMeta?: MetaService,
) {}
modelWebhookManager?: ModelWebhookManager;
- model?: Model;
modelId?: string;
oldView?: any;
withModelManager(modelWebhookManager: ModelWebhookManager) {
@@ -26,18 +25,10 @@ export class ViewWebhookManagerBuilder {
return this;
}
withModel(model: Model) {
- this.model = model;
this.modelId = model.id;
return this;
}
async withModelId(modelId: string) {
- this.model = await Model.getByIdOrName(
- this.context,
- {
- id: modelId,
- },
- this.ncMeta,
- );
this.modelId = modelId;
return this;
}
@@ -60,21 +51,20 @@ export class ViewWebhookManagerBuilder {
}
forCreate() {
- if (!this.model) {
+ if (!this.modelId) {
NcError.get(this.context).internalServerError(
`Need to call 'withModel' before running 'forCreate'`,
);
}
return new ViewWebhookManager(this.context, {
action: WebhookActions.INSERT,
- model: this.model!,
modelId: this.modelId!,
modelWebhookManager: this.modelWebhookManager,
});
}
forUpdate() {
- if (!this.model) {
+ if (!this.modelId) {
NcError.get(this.context).internalServerError(
`Need to call 'withModel' before running 'forUpdate'`,
);
@@ -86,7 +76,6 @@ export class ViewWebhookManagerBuilder {
}
return new ViewWebhookManager(this.context, {
action: WebhookActions.UPDATE,
- model: this.model!,
modelId: this.modelId!,
oldView: this.oldView,
modelWebhookManager: this.modelWebhookManager,
@@ -94,7 +83,7 @@ export class ViewWebhookManagerBuilder {
}
forDelete() {
- if (!this.model) {
+ if (!this.modelId) {
NcError.get(this.context).internalServerError(
`Need to call 'withModel' before running 'forDelete'`,
);
@@ -108,7 +97,6 @@ export class ViewWebhookManagerBuilder {
this.context,
{
action: WebhookActions.DELETE,
- model: this.model!,
modelId: this.modelId!,
oldView: this.oldView,
modelWebhookManager: this.modelWebhookManager,
@@ -124,7 +112,6 @@ export class ViewWebhookManager {
protected readonly params: {
action: WebhookActions;
modelId: string;
- model: Model;
oldView?: any;
newView?: any;
modelWebhookManager?: ModelWebhookManager;