Refactor Dashboard model to include DashboardViewConfig

This commit is contained in:
Simon Larsen 2024-10-23 12:18:15 +01:00
parent 4f03f448e8
commit 16fad55f9f
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
5 changed files with 35 additions and 3 deletions

View File

@ -41,7 +41,6 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
create: true,
delete: false,
update: false,
read: true,
})
@TableMetadata({
tableName: "CallLog",

View File

@ -21,6 +21,7 @@ import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import { Column, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne } from "typeorm";
import AccessControlColumn from "../../Types/Database/AccessControlColumn";
import Label from "./Label";
import DashboardViewConfig from "../../Types/Dashboard/DashboardViewConfig";
@AccessControlColumn("labels")
@EnableDocumentation()
@ -384,4 +385,35 @@ export default class Dashboard extends BaseModel {
})
public labels?: Array<Label> = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.CreateDashboard,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadDashboard,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.EditDashboard,
],
})
@TableColumn({
required: true,
type: TableColumnType.JSON,
title: "Dashboard View Config",
description: "Configuration of Dashboard View",
})
@Column({
nullable: false,
type: ColumnType.JSON,
})
public dashboardViewConfig?: DashboardViewConfig = undefined;
}

View File

@ -42,7 +42,6 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
create: true,
delete: false,
update: false,
read: true,
})
@TableMetadata({
tableName: "EmailLog",

View File

@ -41,7 +41,6 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
create: true,
delete: false,
update: false,
read: true,
})
@TableMetadata({
tableName: "SmsLog",

View File

@ -0,0 +1,3 @@
export default interface DashboardViewConfig {
_type: "DashboardViewConfig"
}